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

test(compiler-tests): decide route module dangling names on the real production build (G8)

RULES-AUDIT §3 item 7 (R11(2)): router-plugin `expectValidModules` judged
G8 with the per-module approximation (the module bundled alone with every
export kept), which rejects a dangling read in an export the real graph
drops (§5.6, §5.9).

The module-alone check still runs first (no build for a correct
compiler); a module with a free name is checked again against a
`vite build` of the same app (the generated route tree as input, as the
app's router reads it), and the name counts only if the production client
chunks still read it free. A route compiled with route HMR keeps the
module-alone check: its HMR code runs in dev on an update, and production
drops it.

ctu `ShippedModule.module` is optional: without it a free name counts
wherever the build still ships it, so generated code without mappings
(§5.14) cannot hide a dangling read; control added.

Checked with temporary compiler patches (reverted): an unread export with
a dangling read (G8-legal) failed at least 20 of 28 rows of
code-splitter-route-options before and passes now; a shipped, unmapped
dangling read (`Route.options.x = () => undeclared`) is still caught.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sheraff 2026-10-22 05:57:10 +02:00
commit 88720e56a0
No known key found for this signature in database
3 changed files with 127 additions and 7 deletions