0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00

refactor(compiler): the core cleans up function-scope orphans once

Function-local declarators and destructuring leaves only erased code read
were cleaned by each planner that erased code (start-env, Hydrate's
server fallbacks, route-split's `deleteNodes`), each with its own scope:
a new erasing planner had to remember the call, and a compile with three
of them walked the bindings three times. `AnalysisPlan.resolve()` now
runs `cleanOrphanedDeclarations` once, after every planner, when the env
module erases anything.

The scope of each removal follows from what orphaned it: every output
when edits addressed to every output alone erased its readers (and what
its run encloses that went before), else the env module, whose liveness
decides every orphan. That is the planners' choice in each case (start-env
with a separate provider and route-split erase in the env module only;
start-env without one and Hydrate's fallbacks everywhere), decided per
removal instead of per planner.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sheraff 2026-10-29 19:36:44 +01:00
commit b853bc112c
No known key found for this signature in database
3 changed files with 111 additions and 73 deletions