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

feat(router-generator): link route modules in both directions

`uses` is a contract relation: generation reads only the used package's
package.json (dependencies, devDependencies or peerDependencies), never its
manifest, so two modules can use each other and a module can use the module
that includes it. The declaration build compiles against generated stand-ins
for the used contracts (`.tanstack/route-types-stubs.d.ts`); the contract
(`routeContract.gen.ts`) now declares the module's register and router and
reaches only the module's own files, the framework and the contracts of
included modules. Include cycles are rejected with a diagnostic.

Generated files are kept in sync: files that are not generated anymore are
removed, also when a package stops being a route module, and a generated
file deleted or edited in watch mode is regenerated. Every generated file is
written atomically through the generator's file system. Generated namespaces
and contracts import only what they use, so `noUnusedLocals` passes on them.
Diagnostics name a single named installation instead of "several times".

The route-module context no longer carries derivable state (installations,
manifests, watch-file lists); mount placement is resolved once per build.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
Manuel Schiller 2026-11-07 19:48:18 +01:00
commit ec679c132d
18 changed files with 1325 additions and 672 deletions