diff --git a/.changeset/compiler-core-yuku.md b/.changeset/compiler-core-yuku.md
new file mode 100644
index 0000000000..d013d83c9c
--- /dev/null
+++ b/.changeset/compiler-core-yuku.md
@@ -0,0 +1,11 @@
+---
+'@tanstack/router-utils': minor
+---
+
+Add the compiler core shared by the router plugin and TanStack Start, built on Yuku (`@tanstack/router-utils/compiler`): one parse and one plan per module and environment, with every output (the module, its split chunks, Hydrate chunks, server function providers) emitted from the original source with exact source maps.
+
+The dev caches stay bounded by the live modules: deleted, renamed or no longer imported files leave no plans, raw facts or dependency-index rows behind, and publishing a plan updates only that plan's dependency rows. Resolutions and emitted outputs are not cached: each compile records its resolutions in its dependency ledger, validation asks the bundler's resolver again once a file appeared or disappeared, and outputs are emitted from the frozen plan on request. `TSR_COMPILER_STATS=1` exposes the cache sizes (`compilerStats()`) of the compiler core, the router plugin and the route generator, and `TSR_COMPILER_NO_CACHE` (`plans`, `facts`, `targets`, `all`) disables caches for measurements.
+
+Removed the Babel helpers (`parseAst`, `generateFromAst`, `deadCodeElimination`, `findReferencedIdentifiers`, `stripTypeExports` and the binding helpers of `compiler-helpers`) and the `@babel/*` and `babel-dead-code-elimination` dependencies. Also removed the unused `logDiff`, `createIdentifier` and `decodeIdentifier` exports and the `ansis` and `diff` dependencies.
+
+The package requires Node `^20.19.0 || >=22.12.0`: its CommonJS build loads the ESM-only parser through `require(esm)`.
diff --git a/.changeset/react-start-rsc-compiler.md b/.changeset/react-start-rsc-compiler.md
new file mode 100644
index 0000000000..81b4cb6b40
--- /dev/null
+++ b/.changeset/react-start-rsc-compiler.md
@@ -0,0 +1,7 @@
+---
+'@tanstack/react-start-rsc': minor
+---
+
+RSC CSS injection runs in Start's compiler. Server functions that only a `'use client'` component imports are in the production manifest (#7943). With RSC, server function provider modules load only what their handlers reach, so a route module's client-only code no longer runs under `react-server`.
+
+Removed `@tanstack/react-start-rsc/plugin/rscCssTransform` (the Babel transform).
diff --git a/.changeset/route-generator-yuku.md b/.changeset/route-generator-yuku.md
new file mode 100644
index 0000000000..c235d63b99
--- /dev/null
+++ b/.changeset/route-generator-yuku.md
@@ -0,0 +1,17 @@
+---
+'@tanstack/router-generator': minor
+'@tanstack/router-cli': patch
+---
+
+Rebuild the route generator without Babel.
+
+**`routeTree.gen.ts` formatting changes once.** The route tree is printed directly in your `quoteStyle` and `semicolons`, and `enableRouteTreeFormatting` now defaults to `false`: Prettier is loaded only when you set it to `true`. A committed `routeTree.gen.ts` shows a one-time formatting diff after upgrading. Custom scaffolding templates are inserted as written.
+
+- Route files are recognised by binding: an aliased `createFileRoute` import gets its id fixed; a `createFileRoute` the app declares itself is left alone; a plain template literal path is reported, not rewritten (#7216).
+- The tree is rebuilt from the files on every change: deleting a layout keeps its children, a deleted `routeTree.gen.ts` is written again, edits of the virtual route config and of `__virtual.ts` files are picked up, and a moved route gets its new id without a content change.
+- Empty `.ts` route files get a scaffold without JSX (#8480); `.lazy.vue` files and `route.component.vue` pieces belong to their route; `importRoutesUsingAbsolutePaths` applies to lazy imports; unusual file names give valid trees.
+- A route file used for two routes, and two routes with one id, are errors naming the files.
+- Writes are atomic per write (also when `tmpDir` is on another filesystem); the generator's own writes no longer regenerate.
+- `tsr watch` and the Rspack/webpack plugins watch every route root, including `physical()` mounts.
+- `GeneratorPlugin.onRouteTreeChanged` receives the tree model (`{ model }`). The internal helpers `format`, `inferFullPath`, `checkRouteFullPathUniqueness` and `writeIfDifferent` are no longer exported.
+- `@tanstack/router-generator` and `@tanstack/router-cli` require Node `^20.19.0 || >=22.12.0`: the CommonJS build and the `tsr` binary load the ESM-only parser through `require(esm)`.
diff --git a/.changeset/route-hmr-runtime.md b/.changeset/route-hmr-runtime.md
new file mode 100644
index 0000000000..8ad5149152
--- /dev/null
+++ b/.changeset/route-hmr-runtime.md
@@ -0,0 +1,8 @@
+---
+'@tanstack/router-core': patch
+'@tanstack/react-router': patch
+'@tanstack/solid-router': patch
+'@tanstack/vue-router': patch
+---
+
+Add the development-only route HMR runtime used by the router plugin's output, on new `/hmr` subpaths (`@tanstack/router-core/hmr`, `@tanstack/{react,solid,vue}-router/hmr`). It updates the live route in place, keeps each split component's lazy wrapper across updates, and with Vite's bundled dev falls back to the original importer when Rolldown throws `MissingFactoryError`. An update patches only the route its module exported, so another router in the same window (module federation) is left alone (#7921). After the route tree is regenerated (a route added or renamed), updates keep reaching the route the rebuilt tree holds. Nothing of it reaches production bundles.
diff --git a/.changeset/router-plugin-library-build-externals.md b/.changeset/router-plugin-library-build-externals.md
new file mode 100644
index 0000000000..0945a25576
--- /dev/null
+++ b/.changeset/router-plugin-library-build-externals.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/router-plugin': patch
+---
+
+Fix the Vite plugin failing a library build (`build.lib` with `external` dependencies) at the end of the build: the report of split exports that an entry chunk still holds walked the entry's imports, which also name the external packages, and read a chunk that does not exist (`Cannot read properties of undefined (reading 'modules')`).
diff --git a/.changeset/router-plugin-order-check-splitting-only.md b/.changeset/router-plugin-order-check-splitting-only.md
new file mode 100644
index 0000000000..42f42e205e
--- /dev/null
+++ b/.changeset/router-plugin-order-check-splitting-only.md
@@ -0,0 +1,5 @@
+---
+'@tanstack/router-plugin': patch
+---
+
+Check the Vite plugin order (the router plugin before the framework's JSX plugin) only when `autoCodeSplitting` is on, as before: without splitting, route HMR works whatever the order, so a config listing `react()` or `solid()` first is not an error.
diff --git a/.changeset/router-plugin-yuku.md b/.changeset/router-plugin-yuku.md
new file mode 100644
index 0000000000..41052d98cb
--- /dev/null
+++ b/.changeset/router-plugin-yuku.md
@@ -0,0 +1,23 @@
+---
+'@tanstack/router-plugin': minor
+---
+
+Route code splitting and route HMR run on the new compiler core instead of Babel: faster dev startup, HMR and builds, with the same production output shape.
+
+**What changes for your app when you upgrade:**
+
+- **Vite 6 or later is required** (the `vite` peer range is now `>=6`): the plugin is tested on Vite 6, 7 and 8; Vite 5 is no longer supported.
+- **esbuild refuses `autoCodeSplitting: true`** with a clear error (route generation still works there); use Vite, Rspack or webpack for code splitting.
+- **CommonJS consumers need Node 20.19+ or 22.12+** (`engines`): a `webpack.config.js` / `rspack.config.js` that `require()`s the plugin loads the ESM-only parser through `require(esm)`, which Node 22.0–22.11 and 21 do not support.
+- **Routes the compiler cannot read statically stay unsplit with one warning per file per build** naming the file: route options built by a helper call (`createFileRoute('/x')(makeOptions())`), options that spread or compute, methods that read `this`, and route modules the compiler cannot parse. Main split some of these silently or crashed.
+- **`routeTree.gen.ts` formatting changes once** (`enableRouteTreeFormatting` now defaults to `false`; see the route generator's changeset).
+- **Removed:** `codeSplittingOptions.compilerPlugins` (the experimental Babel hook).
+
+- Any route option value splits: identifiers, inline functions, method shorthands (#8623), object-form loaders (#8753), casts, `satisfies`, calls such as `memo(Page)`, and options held in a module-level constant. Module state the route module and its chunks share exists once (#8754, #8505). Root routes split their `errorComponent` and `notFoundComponent`.
+- `createFileRoute` & co. are recognised by their import binding. Routes whose options cannot be read statically, and methods or function expressions that read `this` (#8688), stay in the route module with one warning naming the file.
+- A route's CSS import loads with its split component chunks when every component option the route defines is split; otherwise it stays in the route module.
+- Route HMR keeps split components' lazy wrappers across updates in React, Solid and Vue, refreshes edits of split loaders and other non-component options on Rspack and webpack, and needs no framework plugin for `.ts` route modules.
+- Production output is decided by the bundler's mode and is identical with `addHmr: false`.
+- Rspack and webpack use the plugin's own loader: source maps compose with earlier loaders and name the route file (#6667, #3828); project paths with `'`, `#` or spaces work (#7754). Rspack/webpack no longer rebuild every environment once after the first watch build.
+- esbuild refuses `autoCodeSplitting` with a clear error; the route generator keeps working there.
+- Removed: `codeSplittingOptions.compilerPlugins` (the experimental Babel hook), the `@babel/*` dependencies and the direct `chokidar` dependency (the route generator's watcher brings it). New entry `@tanstack/router-plugin/planners` exposes the route planners to TanStack Start.
diff --git a/.changeset/rsbuild-manifest-module-chunks-once.md b/.changeset/rsbuild-manifest-module-chunks-once.md
deleted file mode 100644
index 02febd9d84..0000000000
--- a/.changeset/rsbuild-manifest-module-chunks-once.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/start-plugin-core': patch
----
-
-Rsbuild: the Start manifest pass that runs after every client compilation (builds and each dev update) reads an imported module's chunks once per compilation and counts the module once per importing chunk, instead of once per import connection. The manifest is unchanged; the pass takes about 40 % less time (on a 333-route app, tens of milliseconds less per HMR update).
diff --git a/.changeset/rsbuild-manifest-own-chunks.md b/.changeset/rsbuild-manifest-own-chunks.md
deleted file mode 100644
index 04e8e29928..0000000000
--- a/.changeset/rsbuild-manifest-own-chunks.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/start-plugin-core': patch
----
-
-Rsbuild: a route's client manifest entry lists only its own chunks and CSS. When two routes shared a module in a chunk of its own, each route's entry also listed the other route's chunk as a preload and its stylesheet.
diff --git a/.changeset/rsbuild-rule-use-falsy-loaders.md b/.changeset/rsbuild-rule-use-falsy-loaders.md
deleted file mode 100644
index a84a054fbd..0000000000
--- a/.changeset/rsbuild-rule-use-falsy-loaders.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/start-plugin-core': patch
----
-
-fix: the Rsbuild RSC integration skips falsy entries in a rule's `use` array (Rspack's conditionally disabled loaders) instead of treating them as loaders.
diff --git a/.changeset/rsbuild-virtual-modules-build.md b/.changeset/rsbuild-virtual-modules-build.md
deleted file mode 100644
index 01a0c5ee6e..0000000000
--- a/.changeset/rsbuild-virtual-modules-build.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/start-plugin-core': patch
----
-
-Rsbuild: fix the Rsbuild plugin build after two changes to its virtual modules crossed. Without this fix the package does not build, so no release could ship it. The Rsbuild dev manifest is written to its virtual module under the app's root.
diff --git a/.changeset/rsbuild-virtual-modules-root.md b/.changeset/rsbuild-virtual-modules-root.md
deleted file mode 100644
index 427043a712..0000000000
--- a/.changeset/rsbuild-virtual-modules-root.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/start-plugin-core': patch
----
-
-Rsbuild: Start writes its virtual modules under the app's root, not the working directory. An app built or served from another directory (`rsbuild build --root ` from a monorepo root) no longer fails with "Module not found" on the packages they import, such as RSC's serialization adapters.
diff --git a/.changeset/rsc-security-floor.md b/.changeset/rsc-security-floor.md
deleted file mode 100644
index 9c828f13b3..0000000000
--- a/.changeset/rsc-security-floor.md
+++ /dev/null
@@ -1,8 +0,0 @@
----
-'@tanstack/react-start-rsc': patch
----
-
-Raise the minimum RSC bundler peer dependencies to versions with the React Server Components fixes for GHSA-xqc2-xf4c-x3h3 (CVE-2026-126187, unauthenticated RCE) and GHSA-h3gv-c5rc-p453 (server function DoS):
-
-- `@vitejs/plugin-rsc` to `>=0.5.38` (GHSA-59pf-q495-3c99), which vendors a fixed `react-server-dom-webpack`.
-- `react-server-dom-rspack` to `>=0.1.1`, the first release built from React sources that include the fix.
diff --git a/.changeset/start-compiler-yuku.md b/.changeset/start-compiler-yuku.md
new file mode 100644
index 0000000000..89e30a5585
--- /dev/null
+++ b/.changeset/start-compiler-yuku.md
@@ -0,0 +1,52 @@
+---
+'@tanstack/start-plugin-core': minor
+'@tanstack/router-core': minor
+'@tanstack/start-client-core': patch
+'@tanstack/react-start': patch
+'@tanstack/solid-start': patch
+'@tanstack/vue-start': patch
+---
+
+Start's Vite and Rsbuild plugins run on the new compiler core instead of Babel: each module compiles once per environment, with server functions, environment separation, ``, RSC CSS, route code splitting and HMR, and import protection in one pass. Builds and dev startup are 2–4× faster on a 340-route benchmark app.
+
+**What changes for your app when you upgrade:**
+
+- **Every server function id changes** (a shorter hash of the file and the function's name). Update CDN rules, WAF allowlists, analytics keyed by id and native clients that call `/_serverFn/` directly. Browser tabs loaded before a deploy fail their next server-function call after it: plan a reload or a blue/green window.
+- **`serverFns.generateFunctionId` receives the function's stable name** (`greetUser`) as `functionName`, not the generated handler name (`greetUser_createServerFn_handler`). Custom generators keyed on the old names must be updated.
+- **Production builds answer HTTP calls only for server functions that some client module imports.** A function only server code calls, or one returned to the client as data, gets a 404 over HTTP. The dev server still answers and warns once per function, so this shows up only after deploying: check the dev warnings before you ship.
+- **A module the compiler cannot parse fails the client build** with an error naming the file, instead of shipping untransformed (its server code included).
+- **`routeTree.gen.ts` formatting changes once**: `enableRouteTreeFormatting` now defaults to `false` and the tree is printed in your `quoteStyle` and `semicolons`; commit the one-time diff.
+- **Removed (experimental, Babel-typed):** the `compilerTransforms` and `serverFnProviderModuleDirectives` options and the `StartCompilerPlugin`, `StartCompilerImportTransform`, `StartCompilerTransformContext` and `StartCompilerTransformCandidate` types. RSC integrations pass `rsc: { loadCssExpression, providerDirective }` instead.
+
+**Server functions**
+
+- **Production builds answer HTTP calls only for server functions that client code imports.** A function only server code calls (another server function, a server route), or one returned to the client as data, is refused when called over HTTP. The dev server still answers such a call and warns once per function.
+- `serverFns.generateFunctionId` receives the server function's stable key (its export or variable name, e.g. `greetUser`) as `functionName`, instead of the generated handler name (`greetUser_createServerFn_handler`). Custom generators keyed on the old names must be updated.
+- Default production ids are shorter (22 characters).
+- Server functions are recognised by binding through re-exports, namespaces, aliases, user factories and stored builders, whatever the code formatting (#7280). With SSR as the provider the handler stays in its module (one instance) and server-side callers call it directly (#7213, #8731). `createServerOnlyFn(...)` passed to `.handler()` works (#8446). Nested server functions are hoisted on the server when safe.
+- Client middleware sees only the server function's id during SSR, as in the browser.
+- Vite `bundledDev`: lazy dependencies load, edits no longer crash the hot update, and SSR reflects edits (#8407, #8062, #7535).
+
+**Import protection**
+
+- A denied import is replaced by a mock module of its own that exports the target's names. Build violations are decided after tree-shaking; when `onViolation` returns `false` the import gets the real module and the build reruns until no new import is allowed.
+- Exempt importers (`ignoreImporters`, `exclude`, `include`) get the real module; dependencies that mark themselves server-only follow `excludeFiles`; `.vue` and `.mdx` importers are checked on their compiled output; a client entry marked server-only fails the build.
+- Reports show the import in the original source with a code frame, and traces follow the bundler graph. In dev, a denied import added by an edit is reported.
+- Rsbuild: works with Rspack's persistent cache (`performance.buildCache`).
+
+**Rsbuild**
+
+- Server-only routes are pruned from the client route tree (#8545); the client manifest lists only the chunks a route loads (#8780).
+- Dev answers the SPA shell with `spa.enabled` (#8543) and no longer forces `server.compress: false` (#8544).
+- The server environment shares async chunks instead of duplicating the route modules the server function resolver imports.
+
+**Other**
+
+- Dev compiler state stays bounded by the live modules (Vite and Rsbuild): deleted, renamed or no longer imported files leave no plans, raw facts or import-protection records behind.
+- Editing the imports of a route module no longer fully reloads the page.
+- Generator plugins given as `router.plugins` run next to Start's (#7768); Start's route tree footer follows `quoteStyle` and `semicolons`.
+- Solid Start server environments split route components like the client, so hydration keys agree.
+- Require `exsolve` `^1.1.3`, so memory no longer grows across builds in one process. Entry lookups bypass its process-wide cache, so an entry file created after a dev server restart is found.
+- The plugins load the router-core helpers they need from the new `@tanstack/router-core/tooling` entry instead of the router runtime.
+
+**Removed (experimental, Babel-typed):** the `compilerTransforms` and `serverFnProviderModuleDirectives` options and the `StartCompilerPlugin`, `StartCompilerImportTransform`, `StartCompilerTransformContext` and `StartCompilerTransformCandidate` types. RSC integrations pass `rsc: { loadCssExpression, providerDirective }` instead.
diff --git a/.changeset/start-server-fn-custom-id-check.md b/.changeset/start-server-fn-custom-id-check.md
deleted file mode 100644
index 384f0ade06..0000000000
--- a/.changeset/start-server-fn-custom-id-check.md
+++ /dev/null
@@ -1,7 +0,0 @@
----
-'@tanstack/start-plugin-core': minor
----
-
-A server function id that a custom `serverFns.generateFunctionId` returns and that never worked over HTTP now fails the build, with an error naming the file, the function and the id: whitespace, a control or non-ASCII character, any of `"`, `#`, `/`, `<`, `>`, `?`, `\`, `^`, `` ` ``, `{`, `}`, the ids `.` and `..`, and a percent-encoding the server reads as another id (`%41`, lowercase hex, `%2E`) or rejects. The client puts the id in the URL unencoded, so a `#` or `?` ended the path and a `/` cut the id short (the call silently ran another server function of the file or none), and the other characters reached the server percent-encoded and matched no function. An id embedding a non-ASCII `functionName` is one of these. One case did work and now fails the build: such an id on a server function only SSR code called.
-
-Ids with `%` or the other characters URLs allow (such as `:`, `@`, `+`, `=`, `,`, `;`, `!`, `*`, `(`, `)`, `&`, `'`, `|`, `[`, `]`) still build and reach their handler, with a deprecation warning (from the Vite plugin; the Rsbuild plugin does not print compiler warnings yet): the next major version rejects them, since proxies and servers may decode or rewrite them (hash the inputs instead, as the documented example does). An id with `'` no longer breaks the server bundle.
diff --git a/.changeset/start-vite-root-library-discovery.md b/.changeset/start-vite-root-library-discovery.md
deleted file mode 100644
index d4e8221c59..0000000000
--- a/.changeset/start-vite-root-library-discovery.md
+++ /dev/null
@@ -1,5 +0,0 @@
----
-'@tanstack/start-plugin-core': patch
----
-
-Vite: Start finds the Start libraries it bundles in the SSR build from Vite's root, not the working directory. A `vite build ` run from another directory (a monorepo root, a script) no longer leaves them external and uncompiled, where their server fns returned `undefined`.
diff --git a/.github/workflows/compiler-platforms.yml b/.github/workflows/compiler-platforms.yml
index ad70e39bb6..349bbce3f8 100644
--- a/.github/workflows/compiler-platforms.yml
+++ b/.github/workflows/compiler-platforms.yml
@@ -2,8 +2,17 @@ name: Compiler Platforms
# The main PR workflow only runs on Linux x64 (glibc). The compilers load a
# native Yuku binary per platform and handle platform-specific paths, so run
-# their unit tests and a Vite and Rsbuild production build on the other
-# platforms we ship to.
+# their fast test tier (test:unit, the compiler core's included; its client
+# checks run in pages of a headless Chromium), a small integration smoke set
+# (test:integration:smoke: real Vite, Rspack, webpack and Rsbuild builds,
+# including apps under paths with `#`, `%`, spaces and non-ASCII characters,
+# and modules the compiler cannot parse) and a Vite and Rsbuild production
+# build on the other platforms we ship to. The rest of the slow tier
+# (test:integration) runs on Linux x64 in the main PR workflow.
+#
+# Chromium: Playwright's own build on the glibc platforms; Alpine (musl) has
+# no Playwright build, so the job installs the distribution's Chromium and
+# names it to the test browser helper (TANSTACK_COMPILER_TESTS_CHROMIUM).
on:
pull_request:
@@ -12,6 +21,8 @@ on:
- 'packages/router-generator/**'
- 'packages/router-plugin/**'
- 'packages/start-plugin-core/**'
+ - 'packages/compiler-test-utils/**'
+ - 'packages/react-start-rsc/**'
- 'pnpm-lock.yaml'
- '.github/workflows/compiler-platforms.yml'
schedule:
@@ -57,7 +68,9 @@ jobs:
- name: Install system packages
if: ${{ matrix.container }}
shell: sh
- run: apk add --no-cache bash git
+ # Chromium and its fonts for the browser-backed tests (Playwright has
+ # no musl build; the helper launches this executable instead)
+ run: apk add --no-cache bash git chromium font-noto
- name: Keep LF line endings
# Snapshots are stored with LF. Windows runners check out CRLF by default,
# and with `* text=auto` disabling autocrlf alone still uses the native eol
@@ -70,7 +83,7 @@ jobs:
persist-credentials: false
- name: Setup pnpm
if: ${{ !matrix.container }}
- uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
+ uses: pnpm/action-setup@739bfe42ca9233c5e6aca07c1a25a9d34aca49b0 # v6.0.7
- name: Setup Node
if: ${{ !matrix.container }}
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
@@ -81,6 +94,8 @@ jobs:
if: ${{ matrix.container }}
run: npm install --global "$(node -p "require('./package.json').packageManager")"
- name: Install dependencies
+ # The compiler packages, what their tests build (the start-plugin-core
+ # tiers depend on the React, Solid and Vue Start builds) and the e2e app
run: >-
pnpm install --frozen-lockfile
--filter .
@@ -88,12 +103,39 @@ jobs:
--filter "@tanstack/router-generator..."
--filter "@tanstack/router-plugin..."
--filter "@tanstack/start-plugin-core..."
+ --filter "@tanstack/react-start-rsc..."
+ --filter "@tanstack/react-start..."
+ --filter "@tanstack/solid-start..."
+ --filter "@tanstack/vue-start..."
--filter "tanstack-react-start-e2e-basic..."
- - name: Unit tests
+ - name: Install Chromium (Playwright)
+ if: ${{ !matrix.container }}
+ # `--with-deps` installs the shared libraries Chromium needs on Linux
+ # (a no-op where they are present); the macOS and Windows images need none
+ run: |
+ if [ "$RUNNER_OS" = Linux ]; then
+ pnpm exec playwright install --with-deps chromium
+ else
+ pnpm exec playwright install chromium
+ fi
+ - name: Use the system Chromium (container)
+ if: ${{ matrix.container }}
+ run: echo "TANSTACK_COMPILER_TESTS_CHROMIUM=$(command -v chromium-browser || command -v chromium)" >> "$GITHUB_ENV"
+ - name: Unit tests (fast tier)
run: >-
pnpm nx run-many --targets=test:unit
--projects=@tanstack/router-utils,@tanstack/router-generator,@tanstack/router-plugin,@tanstack/start-plugin-core
--skip-nx-cache --outputStyle=static
+ - name: Noncompiler tests (runtime and build plumbing)
+ run: >-
+ pnpm nx run-many --targets=test:noncompiler
+ --projects=@tanstack/start-plugin-core,@tanstack/react-start-rsc
+ --skip-nx-cache --outputStyle=static
+ - name: Integration smoke (no browser)
+ run: >-
+ pnpm nx run-many --targets=test:integration:smoke
+ --projects=@tanstack/router-plugin,@tanstack/start-plugin-core
+ --skip-nx-cache --outputStyle=static
- name: Production builds
run: >-
pnpm nx run-many --targets=build:vite:ssr,build:rsbuild:ssr
diff --git a/AGENTS.md b/AGENTS.md
index f47b5103e1..eb0757cacd 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -24,7 +24,7 @@ CI=1 NX_DAEMON=false pnpm nx run-many -p -t --skipRemoteCache
```
- Run one Nx command at a time. For a ~20-second startup/graph stall, stop, run `pnpm nx reset`, and retry once, then escalate. Do not apply that timeout to running tests.
-- For code changes, run affected packages' `test:unit`, `test:types`, and `test:eslint` where available, including affected consumers; use `test:e2e` for browser/app behavior and `test:build` for exports/build changes. Root `pnpm test` includes the full e2e suite. Published-code changes require `pnpm changeset`.
+- For code changes, run affected packages' `test:unit`, `test:integration`, `test:noncompiler`, `test:types`, and `test:eslint` where available, including affected consumers; use `test:e2e` for browser/app behavior and `test:build` for exports/build changes. Root `pnpm test` includes the full e2e suite. Published-code changes require `pnpm changeset`.
## Runtime rules
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 4b6e808af1..12ba6656d1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -65,6 +65,7 @@ Run the checks relevant to your changes while developing:
- `pnpm test:eslint` checks linting for affected packages.
- `pnpm test:types` checks types for affected packages.
- `pnpm test:unit` runs unit tests for affected packages.
+- `pnpm test:integration` runs the slow tier of the compiler packages (`router-plugin`, `start-plugin-core`, `compiler-test-utils`): tests that start real builds, dev servers or browsers.
- `pnpm test:build` checks builds for affected packages.
- `pnpm test:e2e` runs end-to-end tests and requires the Playwright browsers.
diff --git a/benchmarks/AGENTS.md b/benchmarks/AGENTS.md
index 9d56a2411a..c8af3dba2e 100644
--- a/benchmarks/AGENTS.md
+++ b/benchmarks/AGENTS.md
@@ -2,11 +2,12 @@
Read the relevant README before running benchmarks. Compare baseline and candidate with the same workload and production builds; add a focused case when existing scenarios miss the changed mechanism. Keep workloads and benchmark names stable for historical comparisons.
-| Changed behavior | Guide | Nx project |
-| ------------------------------------------ | ---------------------------------- | -------------------------------------------------------- |
-| Standalone Router navigation/rendering CPU | [client-nav](client-nav/README.md) | `@benchmarks/client-nav` |
-| Start request/SSR CPU | [ssr](ssr/README.md) | `@benchmarks/ssr` |
-| Client/server retention and allocations | [memory](memory/README.md) | `@benchmarks/memory-client`, `@benchmarks/memory-server` |
+| Changed behavior | Guide | Nx project |
+| ------------------------------------------ | ---------------------------------------- | ------------------------------------------------------------ |
+| Standalone Router navigation/rendering CPU | [client-nav](client-nav/README.md) | `@benchmarks/client-nav` |
+| Start request/SSR CPU | [ssr](ssr/README.md) | `@benchmarks/ssr` |
+| Client/server retention and allocations | [memory](memory/README.md) | `@benchmarks/memory-client`, `@benchmarks/memory-server` |
+| Compiler/plugin dev, HMR and build time | [compiler-perf](compiler-perf/README.md) | `@benchmarks/compiler-perf` (run `scripts/run.mjs` directly) |
Use `test:perf:` through Nx. Plain memory runs only smoke-test; memory metrics require CodSpeed. Client navigation benchmarks do not cover Start hydration or client server-function calls.
diff --git a/benchmarks/bundle-size/.gitignore b/benchmarks/bundle-size/.gitignore
index bd05a98cee..57d925bd7c 100644
--- a/benchmarks/bundle-size/.gitignore
+++ b/benchmarks/bundle-size/.gitignore
@@ -9,3 +9,5 @@ results/*.js
results/*.log
results/runs/
!results/.gitkeep
+dist-server
+dist-server-maps
diff --git a/benchmarks/bundle-size/README.md b/benchmarks/bundle-size/README.md
index 2185d6b43f..8d0b8dbb9f 100644
--- a/benchmarks/bundle-size/README.md
+++ b/benchmarks/bundle-size/README.md
@@ -170,3 +170,20 @@ The measurement script supports optional interfaces for historical backfilling:
These are intended for one-off scripts that replay historical commits and append results to the same history dataset shape used for chart generation.
If `--append-history` points at a `data.js` file, output is written as `window.BENCHMARK_DATA = ...` for direct GitHub Pages compatibility.
+
+## Server Output
+
+`scripts/benchmarks/bundle-size/server.mjs` builds the Start scenarios with
+their server environment (`measure.mjs` builds the client only) and reports
+server bytes (total, entry chunk), the chunks and modules loaded for a first
+request to `/`, and cold start time (process spawn → first SSR response):
+
+```bash
+node scripts/benchmarks/bundle-size/server.mjs --repo-root . \
+ --dist-dir benchmarks/bundle-size/dist-server --build \
+ --maps-dist-dir benchmarks/bundle-size/dist-server-maps --build-maps \
+ --out server.json [--baseline ]
+```
+
+To compare checkouts, run it with `--repo-root ` and dist
+directories inside that checkout (chunks resolve their externals from there).
diff --git a/benchmarks/bundle-size/package.json b/benchmarks/bundle-size/package.json
index ca34cd6cd7..ed1e7410f7 100644
--- a/benchmarks/bundle-size/package.json
+++ b/benchmarks/bundle-size/package.json
@@ -68,7 +68,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-plugin": "workspace:^",
"@types/react": "^19.0.8",
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts
index 27b9498b11..7c15baf4e9 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts
@@ -9,25 +9,25 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
import { Route as NestedRouteImport } from './routes/nested'
-import { Route as CtxIdRouteImport } from './routes/ctx.$id'
-import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as SlowIdRouteImport } from './routes/slow.$id'
+import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as CtxIdRouteImport } from './routes/ctx.$id'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
const NestedRoute = NestedRouteImport.update({
id: '/nested',
path: '/nested',
getParentRoute: () => rootRouteImport,
} as any)
-const CtxIdRoute = CtxIdRouteImport.update({
- id: '/ctx/$id',
- path: '/ctx/$id',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const SlowIdRoute = SlowIdRouteImport.update({
+ id: '/slow/$id',
+ path: '/slow/$id',
getParentRoute: () => rootRouteImport,
} as any)
const NestedIdRoute = NestedIdRouteImport.update({
@@ -35,9 +35,9 @@ const NestedIdRoute = NestedIdRouteImport.update({
path: '/$id',
getParentRoute: () => NestedRoute,
} as any)
-const SlowIdRoute = SlowIdRouteImport.update({
- id: '/slow/$id',
- path: '/slow/$id',
+const CtxIdRoute = CtxIdRouteImport.update({
+ id: '/ctx/$id',
+ path: '/ctx/$id',
getParentRoute: () => rootRouteImport,
} as any)
@@ -80,13 +80,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
'/nested': {
id: '/nested'
path: '/nested'
@@ -94,11 +87,18 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof NestedRouteImport
parentRoute: typeof rootRouteImport
}
- '/ctx/$id': {
- id: '/ctx/$id'
- path: '/ctx/$id'
- fullPath: '/ctx/$id'
- preLoaderRoute: typeof CtxIdRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/slow/$id': {
+ id: '/slow/$id'
+ path: '/slow/$id'
+ fullPath: '/slow/$id'
+ preLoaderRoute: typeof SlowIdRouteImport
parentRoute: typeof rootRouteImport
}
'/nested/$id': {
@@ -108,11 +108,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof NestedIdRouteImport
parentRoute: typeof NestedRoute
}
- '/slow/$id': {
- id: '/slow/$id'
- path: '/slow/$id'
- fullPath: '/slow/$id'
- preLoaderRoute: typeof SlowIdRouteImport
+ '/ctx/$id': {
+ id: '/ctx/$id'
+ path: '/ctx/$id'
+ fullPath: '/ctx/$id'
+ preLoaderRoute: typeof CtxIdRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts
index cd84f99d5d..44d88e9f8d 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts
@@ -9,26 +9,16 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
-import { Route as BrokenRouteImport } from './routes/broken'
-import { Route as Hop1RouteImport } from './routes/hop1'
-import { Route as Hop2RouteImport } from './routes/hop2'
import { Route as TargetRouteImport } from './routes/target'
+import { Route as Hop2RouteImport } from './routes/hop2'
+import { Route as Hop1RouteImport } from './routes/hop1'
+import { Route as BrokenRouteImport } from './routes/broken'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as MissingIdRouteImport } from './routes/missing.$id'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
-const BrokenRoute = BrokenRouteImport.update({
- id: '/broken',
- path: '/broken',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop1Route = Hop1RouteImport.update({
- id: '/hop1',
- path: '/hop1',
+const TargetRoute = TargetRouteImport.update({
+ id: '/target',
+ path: '/target',
getParentRoute: () => rootRouteImport,
} as any)
const Hop2Route = Hop2RouteImport.update({
@@ -36,9 +26,19 @@ const Hop2Route = Hop2RouteImport.update({
path: '/hop2',
getParentRoute: () => rootRouteImport,
} as any)
-const TargetRoute = TargetRouteImport.update({
- id: '/target',
- path: '/target',
+const Hop1Route = Hop1RouteImport.update({
+ id: '/hop1',
+ path: '/hop1',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const BrokenRoute = BrokenRouteImport.update({
+ id: '/broken',
+ path: '/broken',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const MissingIdRoute = MissingIdRouteImport.update({
@@ -98,25 +98,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/broken': {
- id: '/broken'
- path: '/broken'
- fullPath: '/broken'
- preLoaderRoute: typeof BrokenRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop1': {
- id: '/hop1'
- path: '/hop1'
- fullPath: '/hop1'
- preLoaderRoute: typeof Hop1RouteImport
+ '/target': {
+ id: '/target'
+ path: '/target'
+ fullPath: '/target'
+ preLoaderRoute: typeof TargetRouteImport
parentRoute: typeof rootRouteImport
}
'/hop2': {
@@ -126,11 +112,25 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof Hop2RouteImport
parentRoute: typeof rootRouteImport
}
- '/target': {
- id: '/target'
- path: '/target'
- fullPath: '/target'
- preLoaderRoute: typeof TargetRouteImport
+ '/hop1': {
+ id: '/hop1'
+ path: '/hop1'
+ fullPath: '/hop1'
+ preLoaderRoute: typeof Hop1RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/broken': {
+ id: '/broken'
+ path: '/broken'
+ fullPath: '/broken'
+ preLoaderRoute: typeof BrokenRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/missing/$id': {
diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts
index b6f217e527..ead6a4436a 100644
--- a/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts
@@ -9,15 +9,15 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
-import { Route as DocsRouteImport } from './routes/docs'
import { Route as SettingsRouteImport } from './routes/settings'
-import { Route as ArticlesIdRouteImport } from './routes/articles.$id'
+import { Route as DocsRouteImport } from './routes/docs'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as DocsSectionRouteImport } from './routes/docs.$section'
+import { Route as ArticlesIdRouteImport } from './routes/articles.$id'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
getParentRoute: () => rootRouteImport,
} as any)
const DocsRoute = DocsRouteImport.update({
@@ -25,14 +25,9 @@ const DocsRoute = DocsRouteImport.update({
path: '/docs',
getParentRoute: () => rootRouteImport,
} as any)
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => rootRouteImport,
-} as any)
-const ArticlesIdRoute = ArticlesIdRouteImport.update({
- id: '/articles/$id',
- path: '/articles/$id',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const DocsSectionRoute = DocsSectionRouteImport.update({
@@ -40,6 +35,11 @@ const DocsSectionRoute = DocsSectionRouteImport.update({
path: '/$section',
getParentRoute: () => DocsRoute,
} as any)
+const ArticlesIdRoute = ArticlesIdRouteImport.update({
+ id: '/articles/$id',
+ path: '/articles/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -86,11 +86,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/settings': {
+ id: '/settings'
+ path: '/settings'
+ fullPath: '/settings'
+ preLoaderRoute: typeof SettingsRouteImport
parentRoute: typeof rootRouteImport
}
'/docs': {
@@ -100,18 +100,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DocsRouteImport
parentRoute: typeof rootRouteImport
}
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/articles/$id': {
- id: '/articles/$id'
- path: '/articles/$id'
- fullPath: '/articles/$id'
- preLoaderRoute: typeof ArticlesIdRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/docs/$section': {
@@ -121,6 +114,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DocsSectionRouteImport
parentRoute: typeof DocsRoute
}
+ '/articles/$id': {
+ id: '/articles/$id'
+ path: '/articles/$id'
+ fullPath: '/articles/$id'
+ preLoaderRoute: typeof ArticlesIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts
index af253f4a15..a6ab2a4fc8 100644
--- a/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts
@@ -9,24 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
import { Route as GalleryRouteImport } from './routes/gallery'
-import { Route as PagesNRouteImport } from './routes/pages.$n'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
+import { Route as PagesNRouteImport } from './routes/pages.$n'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
const GalleryRoute = GalleryRouteImport.update({
id: '/gallery',
path: '/gallery',
getParentRoute: () => rootRouteImport,
} as any)
-const PagesNRoute = PagesNRouteImport.update({
- id: '/pages/$n',
- path: '/pages/$n',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
@@ -34,6 +29,11 @@ const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
path: '/photos/$photoId',
getParentRoute: () => rootRouteImport,
} as any)
+const PagesNRoute = PagesNRouteImport.update({
+ id: '/pages/$n',
+ path: '/pages/$n',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
'/gallery': {
id: '/gallery'
path: '/gallery'
@@ -85,11 +78,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof GalleryRouteImport
parentRoute: typeof rootRouteImport
}
- '/pages/$n': {
- id: '/pages/$n'
- path: '/pages/$n'
- fullPath: '/pages/$n'
- preLoaderRoute: typeof PagesNRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/photos/$photoId': {
@@ -99,6 +92,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof PhotosPhotoIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/pages/$n': {
+ id: '/pages/$n'
+ path: '/pages/$n'
+ fullPath: '/pages/$n'
+ preLoaderRoute: typeof PagesNRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts
index 0da70513e8..b61431e40d 100644
--- a/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts
@@ -9,20 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
import { Route as AboutRouteImport } from './routes/about'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as ItemsIdRouteImport } from './routes/items.$id'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
const AboutRoute = AboutRouteImport.update({
id: '/about',
path: '/about',
getParentRoute: () => rootRouteImport,
} as any)
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ItemsIdRoute = ItemsIdRouteImport.update({
id: '/items/$id',
path: '/items/$id',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
'/about': {
id: '/about'
path: '/about'
@@ -75,6 +68,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof AboutRouteImport
parentRoute: typeof rootRouteImport
}
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/items/$id': {
id: '/items/$id'
path: '/items/$id'
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts
index fa5d032141..bdec400237 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts
@@ -9,24 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
import { Route as DepsRouteImport } from './routes/deps'
-import { Route as CachedIdRouteImport } from './routes/cached.$id'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as FreshIdRouteImport } from './routes/fresh.$id'
+import { Route as CachedIdRouteImport } from './routes/cached.$id'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
const DepsRoute = DepsRouteImport.update({
id: '/deps',
path: '/deps',
getParentRoute: () => rootRouteImport,
} as any)
-const CachedIdRoute = CachedIdRouteImport.update({
- id: '/cached/$id',
- path: '/cached/$id',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const FreshIdRoute = FreshIdRouteImport.update({
@@ -34,6 +29,11 @@ const FreshIdRoute = FreshIdRouteImport.update({
path: '/fresh/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const CachedIdRoute = CachedIdRouteImport.update({
+ id: '/cached/$id',
+ path: '/cached/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
'/deps': {
id: '/deps'
path: '/deps'
@@ -85,11 +78,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DepsRouteImport
parentRoute: typeof rootRouteImport
}
- '/cached/$id': {
- id: '/cached/$id'
- path: '/cached/$id'
- fullPath: '/cached/$id'
- preLoaderRoute: typeof CachedIdRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/fresh/$id': {
@@ -99,6 +92,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof FreshIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/cached/$id': {
+ id: '/cached/$id'
+ path: '/cached/$id'
+ fullPath: '/cached/$id'
+ preLoaderRoute: typeof CachedIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts
index 30247636dd..dc0acc183d 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts
@@ -9,35 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
-import { Route as AboutRouteImport } from './routes/about'
-import { Route as BlogRouteImport } from './routes/blog'
-import { Route as SearchRouteImport } from './routes/search'
-import { Route as SettingsRouteImport } from './routes/settings'
import { Route as ShopRouteImport } from './routes/shop'
-import { Route as BlogIndexRouteImport } from './routes/blog.index'
-import { Route as BlogSlugRouteImport } from './routes/blog.$slug'
+import { Route as SettingsRouteImport } from './routes/settings'
+import { Route as SearchRouteImport } from './routes/search'
+import { Route as BlogRouteImport } from './routes/blog'
+import { Route as AboutRouteImport } from './routes/about'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as ShopIndexRouteImport } from './routes/shop.index'
+import { Route as BlogIndexRouteImport } from './routes/blog.index'
import { Route as ShopProductIdRouteImport } from './routes/shop.$productId'
+import { Route as BlogSlugRouteImport } from './routes/blog.$slug'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
-const AboutRoute = AboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => rootRouteImport,
-} as any)
-const BlogRoute = BlogRouteImport.update({
- id: '/blog',
- path: '/blog',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SearchRoute = SearchRouteImport.update({
- id: '/search',
- path: '/search',
+const ShopRoute = ShopRouteImport.update({
+ id: '/shop',
+ path: '/shop',
getParentRoute: () => rootRouteImport,
} as any)
const SettingsRoute = SettingsRouteImport.update({
@@ -45,31 +30,46 @@ const SettingsRoute = SettingsRouteImport.update({
path: '/settings',
getParentRoute: () => rootRouteImport,
} as any)
-const ShopRoute = ShopRouteImport.update({
- id: '/shop',
- path: '/shop',
+const SearchRoute = SearchRouteImport.update({
+ id: '/search',
+ path: '/search',
getParentRoute: () => rootRouteImport,
} as any)
-const BlogIndexRoute = BlogIndexRouteImport.update({
+const BlogRoute = BlogRouteImport.update({
+ id: '/blog',
+ path: '/blog',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const AboutRoute = AboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
- getParentRoute: () => BlogRoute,
-} as any)
-const BlogSlugRoute = BlogSlugRouteImport.update({
- id: '/$slug',
- path: '/$slug',
- getParentRoute: () => BlogRoute,
+ getParentRoute: () => rootRouteImport,
} as any)
const ShopIndexRoute = ShopIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => ShopRoute,
} as any)
+const BlogIndexRoute = BlogIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => BlogRoute,
+} as any)
const ShopProductIdRoute = ShopProductIdRouteImport.update({
id: '/$productId',
path: '/$productId',
getParentRoute: () => ShopRoute,
} as any)
+const BlogSlugRoute = BlogSlugRouteImport.update({
+ id: '/$slug',
+ path: '/$slug',
+ getParentRoute: () => BlogRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -154,32 +154,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/about': {
- id: '/about'
- path: '/about'
- fullPath: '/about'
- preLoaderRoute: typeof AboutRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/blog': {
- id: '/blog'
- path: '/blog'
- fullPath: '/blog'
- preLoaderRoute: typeof BlogRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/search': {
- id: '/search'
- path: '/search'
- fullPath: '/search'
- preLoaderRoute: typeof SearchRouteImport
+ '/shop': {
+ id: '/shop'
+ path: '/shop'
+ fullPath: '/shop'
+ preLoaderRoute: typeof ShopRouteImport
parentRoute: typeof rootRouteImport
}
'/settings': {
@@ -189,26 +168,33 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SettingsRouteImport
parentRoute: typeof rootRouteImport
}
- '/shop': {
- id: '/shop'
- path: '/shop'
- fullPath: '/shop'
- preLoaderRoute: typeof ShopRouteImport
+ '/search': {
+ id: '/search'
+ path: '/search'
+ fullPath: '/search'
+ preLoaderRoute: typeof SearchRouteImport
parentRoute: typeof rootRouteImport
}
- '/blog/': {
- id: '/blog/'
- path: '/'
- fullPath: '/blog/'
- preLoaderRoute: typeof BlogIndexRouteImport
- parentRoute: typeof BlogRoute
+ '/blog': {
+ id: '/blog'
+ path: '/blog'
+ fullPath: '/blog'
+ preLoaderRoute: typeof BlogRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/blog/$slug': {
- id: '/blog/$slug'
- path: '/$slug'
- fullPath: '/blog/$slug'
- preLoaderRoute: typeof BlogSlugRouteImport
- parentRoute: typeof BlogRoute
+ '/about': {
+ id: '/about'
+ path: '/about'
+ fullPath: '/about'
+ preLoaderRoute: typeof AboutRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
}
'/shop/': {
id: '/shop/'
@@ -217,6 +203,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof ShopIndexRouteImport
parentRoute: typeof ShopRoute
}
+ '/blog/': {
+ id: '/blog/'
+ path: '/'
+ fullPath: '/blog/'
+ preLoaderRoute: typeof BlogIndexRouteImport
+ parentRoute: typeof BlogRoute
+ }
'/shop/$productId': {
id: '/shop/$productId'
path: '/$productId'
@@ -224,6 +217,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof ShopProductIdRouteImport
parentRoute: typeof ShopRoute
}
+ '/blog/$slug': {
+ id: '/blog/$slug'
+ path: '/$slug'
+ fullPath: '/blog/$slug'
+ preLoaderRoute: typeof BlogSlugRouteImport
+ parentRoute: typeof BlogRoute
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts
index 97e215b6da..645d925238 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts
@@ -9,20 +9,20 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
import { Route as DocsRouteImport } from './routes/docs'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as SectionsSectionRouteImport } from './routes/sections.$section'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
const DocsRoute = DocsRouteImport.update({
id: '/docs',
path: '/docs',
getParentRoute: () => rootRouteImport,
} as any)
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => rootRouteImport,
+} as any)
const SectionsSectionRoute = SectionsSectionRouteImport.update({
id: '/sections/$section',
path: '/sections/$section',
@@ -61,13 +61,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
'/docs': {
id: '/docs'
path: '/docs'
@@ -75,6 +68,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DocsRouteImport
parentRoute: typeof rootRouteImport
}
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/sections/$section': {
id: '/sections/$section'
path: '/sections/$section'
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts
index e6f3596562..20b4af6146 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts
@@ -9,72 +9,48 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
-import { Route as LayoutRouteImport } from './routes/_layout'
-import { Route as SecARouteImport } from './routes/sec-a'
-import { Route as SecBRouteImport } from './routes/sec-b'
-import { Route as SecCRouteImport } from './routes/sec-c'
-import { Route as SecDRouteImport } from './routes/sec-d'
-import { Route as SecERouteImport } from './routes/sec-e'
import { Route as SecFRouteImport } from './routes/sec-f'
-import { Route as marketingPricingRouteImport } from './routes/(marketing)/pricing'
-import { Route as marketingPromoRouteImport } from './routes/(marketing)/promo'
-import { Route as LayoutAlphaRouteImport } from './routes/_layout.alpha'
-import { Route as LayoutBetaRouteImport } from './routes/_layout.beta'
-import { Route as FilesSplatRouteImport } from './routes/files.$'
-import { Route as ReleaseVChar123versionChar125RouteImport } from './routes/release.v{$version}'
-import { Route as SecAIndexRouteImport } from './routes/sec-a.index'
-import { Route as SecAIdRouteImport } from './routes/sec-a.$id'
-import { Route as SecAAboutRouteImport } from './routes/sec-a.about'
-import { Route as SecASettingsRouteImport } from './routes/sec-a.settings'
-import { Route as SecBIndexRouteImport } from './routes/sec-b.index'
-import { Route as SecBIdRouteImport } from './routes/sec-b.$id'
-import { Route as SecBAboutRouteImport } from './routes/sec-b.about'
-import { Route as SecBSettingsRouteImport } from './routes/sec-b.settings'
-import { Route as SecCIndexRouteImport } from './routes/sec-c.index'
-import { Route as SecCIdRouteImport } from './routes/sec-c.$id'
-import { Route as SecCAboutRouteImport } from './routes/sec-c.about'
-import { Route as SecCSettingsRouteImport } from './routes/sec-c.settings'
-import { Route as SecDIndexRouteImport } from './routes/sec-d.index'
-import { Route as SecDIdRouteImport } from './routes/sec-d.$id'
-import { Route as SecDAboutRouteImport } from './routes/sec-d.about'
-import { Route as SecDSettingsRouteImport } from './routes/sec-d.settings'
-import { Route as SecEIndexRouteImport } from './routes/sec-e.index'
-import { Route as SecEIdRouteImport } from './routes/sec-e.$id'
-import { Route as SecEAboutRouteImport } from './routes/sec-e.about'
-import { Route as SecESettingsRouteImport } from './routes/sec-e.settings'
+import { Route as SecERouteImport } from './routes/sec-e'
+import { Route as SecDRouteImport } from './routes/sec-d'
+import { Route as SecCRouteImport } from './routes/sec-c'
+import { Route as SecBRouteImport } from './routes/sec-b'
+import { Route as SecARouteImport } from './routes/sec-a'
+import { Route as LayoutRouteImport } from './routes/_layout'
+import { Route as IndexRouteImport } from './routes/index'
import { Route as SecFIndexRouteImport } from './routes/sec-f.index'
-import { Route as SecFIdRouteImport } from './routes/sec-f.$id'
-import { Route as SecFAboutRouteImport } from './routes/sec-f.about'
+import { Route as SecEIndexRouteImport } from './routes/sec-e.index'
+import { Route as SecDIndexRouteImport } from './routes/sec-d.index'
+import { Route as SecCIndexRouteImport } from './routes/sec-c.index'
+import { Route as SecBIndexRouteImport } from './routes/sec-b.index'
+import { Route as SecAIndexRouteImport } from './routes/sec-a.index'
import { Route as SecFSettingsRouteImport } from './routes/sec-f.settings'
+import { Route as SecFAboutRouteImport } from './routes/sec-f.about'
+import { Route as SecFIdRouteImport } from './routes/sec-f.$id'
+import { Route as SecESettingsRouteImport } from './routes/sec-e.settings'
+import { Route as SecEAboutRouteImport } from './routes/sec-e.about'
+import { Route as SecEIdRouteImport } from './routes/sec-e.$id'
+import { Route as SecDSettingsRouteImport } from './routes/sec-d.settings'
+import { Route as SecDAboutRouteImport } from './routes/sec-d.about'
+import { Route as SecDIdRouteImport } from './routes/sec-d.$id'
+import { Route as SecCSettingsRouteImport } from './routes/sec-c.settings'
+import { Route as SecCAboutRouteImport } from './routes/sec-c.about'
+import { Route as SecCIdRouteImport } from './routes/sec-c.$id'
+import { Route as SecBSettingsRouteImport } from './routes/sec-b.settings'
+import { Route as SecBAboutRouteImport } from './routes/sec-b.about'
+import { Route as SecBIdRouteImport } from './routes/sec-b.$id'
+import { Route as SecASettingsRouteImport } from './routes/sec-a.settings'
+import { Route as SecAAboutRouteImport } from './routes/sec-a.about'
+import { Route as SecAIdRouteImport } from './routes/sec-a.$id'
+import { Route as ReleaseVChar123versionChar125RouteImport } from './routes/release.v{$version}'
+import { Route as FilesSplatRouteImport } from './routes/files.$'
+import { Route as LayoutBetaRouteImport } from './routes/_layout.beta'
+import { Route as LayoutAlphaRouteImport } from './routes/_layout.alpha'
+import { Route as marketingPromoRouteImport } from './routes/(marketing)/promo'
+import { Route as marketingPricingRouteImport } from './routes/(marketing)/pricing'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => rootRouteImport,
-} as any)
-const LayoutRoute = LayoutRouteImport.update({
- id: '/_layout',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecARoute = SecARouteImport.update({
- id: '/sec-a',
- path: '/sec-a',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecBRoute = SecBRouteImport.update({
- id: '/sec-b',
- path: '/sec-b',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecCRoute = SecCRouteImport.update({
- id: '/sec-c',
- path: '/sec-c',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecDRoute = SecDRouteImport.update({
- id: '/sec-d',
- path: '/sec-d',
+const SecFRoute = SecFRouteImport.update({
+ id: '/sec-f',
+ path: '/sec-f',
getParentRoute: () => rootRouteImport,
} as any)
const SecERoute = SecERouteImport.update({
@@ -82,150 +58,68 @@ const SecERoute = SecERouteImport.update({
path: '/sec-e',
getParentRoute: () => rootRouteImport,
} as any)
-const SecFRoute = SecFRouteImport.update({
- id: '/sec-f',
- path: '/sec-f',
+const SecDRoute = SecDRouteImport.update({
+ id: '/sec-d',
+ path: '/sec-d',
getParentRoute: () => rootRouteImport,
} as any)
-const marketingPricingRoute = marketingPricingRouteImport.update({
- id: '/(marketing)/pricing',
- path: '/pricing',
+const SecCRoute = SecCRouteImport.update({
+ id: '/sec-c',
+ path: '/sec-c',
getParentRoute: () => rootRouteImport,
} as any)
-const marketingPromoRoute = marketingPromoRouteImport.update({
- id: '/(marketing)/promo',
- path: '/promo',
+const SecBRoute = SecBRouteImport.update({
+ id: '/sec-b',
+ path: '/sec-b',
getParentRoute: () => rootRouteImport,
} as any)
-const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
- id: '/alpha',
- path: '/alpha',
- getParentRoute: () => LayoutRoute,
-} as any)
-const LayoutBetaRoute = LayoutBetaRouteImport.update({
- id: '/beta',
- path: '/beta',
- getParentRoute: () => LayoutRoute,
-} as any)
-const FilesSplatRoute = FilesSplatRouteImport.update({
- id: '/files/$',
- path: '/files/$',
+const SecARoute = SecARouteImport.update({
+ id: '/sec-a',
+ path: '/sec-a',
getParentRoute: () => rootRouteImport,
} as any)
-const ReleaseVChar123versionChar125Route =
- ReleaseVChar123versionChar125RouteImport.update({
- id: '/release/v{$version}',
- path: '/release/v{$version}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const SecAIndexRoute = SecAIndexRouteImport.update({
+const LayoutRoute = LayoutRouteImport.update({
+ id: '/_layout',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
- getParentRoute: () => SecARoute,
-} as any)
-const SecAIdRoute = SecAIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecARoute,
-} as any)
-const SecAAboutRoute = SecAAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecARoute,
-} as any)
-const SecASettingsRoute = SecASettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecARoute,
-} as any)
-const SecBIndexRoute = SecBIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBIdRoute = SecBIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBAboutRoute = SecBAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecBSettingsRoute = SecBSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecBRoute,
-} as any)
-const SecCIndexRoute = SecCIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCIdRoute = SecCIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCAboutRoute = SecCAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecCSettingsRoute = SecCSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecCRoute,
-} as any)
-const SecDIndexRoute = SecDIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDIdRoute = SecDIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDAboutRoute = SecDAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecDSettingsRoute = SecDSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecDRoute,
-} as any)
-const SecEIndexRoute = SecEIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecERoute,
-} as any)
-const SecEIdRoute = SecEIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecERoute,
-} as any)
-const SecEAboutRoute = SecEAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecERoute,
-} as any)
-const SecESettingsRoute = SecESettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecERoute,
+ getParentRoute: () => rootRouteImport,
} as any)
const SecFIndexRoute = SecFIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => SecFRoute,
} as any)
-const SecFIdRoute = SecFIdRouteImport.update({
- id: '/$id',
- path: '/$id',
+const SecEIndexRoute = SecEIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecDIndexRoute = SecDIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecCIndexRoute = SecCIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecBIndexRoute = SecBIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecAIndexRoute = SecAIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecARoute,
+} as any)
+const SecFSettingsRoute = SecFSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
getParentRoute: () => SecFRoute,
} as any)
const SecFAboutRoute = SecFAboutRouteImport.update({
@@ -233,10 +127,116 @@ const SecFAboutRoute = SecFAboutRouteImport.update({
path: '/about',
getParentRoute: () => SecFRoute,
} as any)
-const SecFSettingsRoute = SecFSettingsRouteImport.update({
+const SecFIdRoute = SecFIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecESettingsRoute = SecESettingsRouteImport.update({
id: '/settings',
path: '/settings',
- getParentRoute: () => SecFRoute,
+ getParentRoute: () => SecERoute,
+} as any)
+const SecEAboutRoute = SecEAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecEIdRoute = SecEIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecERoute,
+} as any)
+const SecDSettingsRoute = SecDSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDAboutRoute = SecDAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecDIdRoute = SecDIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecDRoute,
+} as any)
+const SecCSettingsRoute = SecCSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCAboutRoute = SecCAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecCIdRoute = SecCIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecCRoute,
+} as any)
+const SecBSettingsRoute = SecBSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBAboutRoute = SecBAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecBIdRoute = SecBIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecBRoute,
+} as any)
+const SecASettingsRoute = SecASettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecARoute,
+} as any)
+const SecAAboutRoute = SecAAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecARoute,
+} as any)
+const SecAIdRoute = SecAIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecARoute,
+} as any)
+const ReleaseVChar123versionChar125Route =
+ ReleaseVChar123versionChar125RouteImport.update({
+ id: '/release/v{$version}',
+ path: '/release/v{$version}',
+ getParentRoute: () => rootRouteImport,
+ } as any)
+const FilesSplatRoute = FilesSplatRouteImport.update({
+ id: '/files/$',
+ path: '/files/$',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const LayoutBetaRoute = LayoutBetaRouteImport.update({
+ id: '/beta',
+ path: '/beta',
+ getParentRoute: () => LayoutRoute,
+} as any)
+const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
+ id: '/alpha',
+ path: '/alpha',
+ getParentRoute: () => LayoutRoute,
+} as any)
+const marketingPromoRoute = marketingPromoRouteImport.update({
+ id: '/(marketing)/promo',
+ path: '/promo',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const marketingPricingRoute = marketingPricingRouteImport.update({
+ id: '/(marketing)/pricing',
+ path: '/pricing',
+ getParentRoute: () => rootRouteImport,
} as any)
export interface FileRoutesByFullPath {
@@ -484,46 +484,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/_layout': {
- id: '/_layout'
- path: ''
- fullPath: '/'
- preLoaderRoute: typeof LayoutRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-a': {
- id: '/sec-a'
- path: '/sec-a'
- fullPath: '/sec-a'
- preLoaderRoute: typeof SecARouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-b': {
- id: '/sec-b'
- path: '/sec-b'
- fullPath: '/sec-b'
- preLoaderRoute: typeof SecBRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-c': {
- id: '/sec-c'
- path: '/sec-c'
- fullPath: '/sec-c'
- preLoaderRoute: typeof SecCRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-d': {
- id: '/sec-d'
- path: '/sec-d'
- fullPath: '/sec-d'
- preLoaderRoute: typeof SecDRouteImport
+ '/sec-f': {
+ id: '/sec-f'
+ path: '/sec-f'
+ fullPath: '/sec-f'
+ preLoaderRoute: typeof SecFRouteImport
parentRoute: typeof rootRouteImport
}
'/sec-e': {
@@ -533,194 +498,47 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SecERouteImport
parentRoute: typeof rootRouteImport
}
- '/sec-f': {
- id: '/sec-f'
- path: '/sec-f'
- fullPath: '/sec-f'
- preLoaderRoute: typeof SecFRouteImport
+ '/sec-d': {
+ id: '/sec-d'
+ path: '/sec-d'
+ fullPath: '/sec-d'
+ preLoaderRoute: typeof SecDRouteImport
parentRoute: typeof rootRouteImport
}
- '/(marketing)/pricing': {
- id: '/(marketing)/pricing'
- path: '/pricing'
- fullPath: '/pricing'
- preLoaderRoute: typeof marketingPricingRouteImport
+ '/sec-c': {
+ id: '/sec-c'
+ path: '/sec-c'
+ fullPath: '/sec-c'
+ preLoaderRoute: typeof SecCRouteImport
parentRoute: typeof rootRouteImport
}
- '/(marketing)/promo': {
- id: '/(marketing)/promo'
- path: '/promo'
- fullPath: '/promo'
- preLoaderRoute: typeof marketingPromoRouteImport
+ '/sec-b': {
+ id: '/sec-b'
+ path: '/sec-b'
+ fullPath: '/sec-b'
+ preLoaderRoute: typeof SecBRouteImport
parentRoute: typeof rootRouteImport
}
- '/_layout/alpha': {
- id: '/_layout/alpha'
- path: '/alpha'
- fullPath: '/alpha'
- preLoaderRoute: typeof LayoutAlphaRouteImport
- parentRoute: typeof LayoutRoute
- }
- '/_layout/beta': {
- id: '/_layout/beta'
- path: '/beta'
- fullPath: '/beta'
- preLoaderRoute: typeof LayoutBetaRouteImport
- parentRoute: typeof LayoutRoute
- }
- '/files/$': {
- id: '/files/$'
- path: '/files/$'
- fullPath: '/files/$'
- preLoaderRoute: typeof FilesSplatRouteImport
+ '/sec-a': {
+ id: '/sec-a'
+ path: '/sec-a'
+ fullPath: '/sec-a'
+ preLoaderRoute: typeof SecARouteImport
parentRoute: typeof rootRouteImport
}
- '/release/v{$version}': {
- id: '/release/v{$version}'
- path: '/release/v{$version}'
- fullPath: '/release/v{$version}'
- preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
+ '/_layout': {
+ id: '/_layout'
+ path: ''
+ fullPath: '/'
+ preLoaderRoute: typeof LayoutRouteImport
parentRoute: typeof rootRouteImport
}
- '/sec-a/': {
- id: '/sec-a/'
+ '/': {
+ id: '/'
path: '/'
- fullPath: '/sec-a/'
- preLoaderRoute: typeof SecAIndexRouteImport
- parentRoute: typeof SecARoute
- }
- '/sec-a/$id': {
- id: '/sec-a/$id'
- path: '/$id'
- fullPath: '/sec-a/$id'
- preLoaderRoute: typeof SecAIdRouteImport
- parentRoute: typeof SecARoute
- }
- '/sec-a/about': {
- id: '/sec-a/about'
- path: '/about'
- fullPath: '/sec-a/about'
- preLoaderRoute: typeof SecAAboutRouteImport
- parentRoute: typeof SecARoute
- }
- '/sec-a/settings': {
- id: '/sec-a/settings'
- path: '/settings'
- fullPath: '/sec-a/settings'
- preLoaderRoute: typeof SecASettingsRouteImport
- parentRoute: typeof SecARoute
- }
- '/sec-b/': {
- id: '/sec-b/'
- path: '/'
- fullPath: '/sec-b/'
- preLoaderRoute: typeof SecBIndexRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/$id': {
- id: '/sec-b/$id'
- path: '/$id'
- fullPath: '/sec-b/$id'
- preLoaderRoute: typeof SecBIdRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/about': {
- id: '/sec-b/about'
- path: '/about'
- fullPath: '/sec-b/about'
- preLoaderRoute: typeof SecBAboutRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-b/settings': {
- id: '/sec-b/settings'
- path: '/settings'
- fullPath: '/sec-b/settings'
- preLoaderRoute: typeof SecBSettingsRouteImport
- parentRoute: typeof SecBRoute
- }
- '/sec-c/': {
- id: '/sec-c/'
- path: '/'
- fullPath: '/sec-c/'
- preLoaderRoute: typeof SecCIndexRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/$id': {
- id: '/sec-c/$id'
- path: '/$id'
- fullPath: '/sec-c/$id'
- preLoaderRoute: typeof SecCIdRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/about': {
- id: '/sec-c/about'
- path: '/about'
- fullPath: '/sec-c/about'
- preLoaderRoute: typeof SecCAboutRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-c/settings': {
- id: '/sec-c/settings'
- path: '/settings'
- fullPath: '/sec-c/settings'
- preLoaderRoute: typeof SecCSettingsRouteImport
- parentRoute: typeof SecCRoute
- }
- '/sec-d/': {
- id: '/sec-d/'
- path: '/'
- fullPath: '/sec-d/'
- preLoaderRoute: typeof SecDIndexRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/$id': {
- id: '/sec-d/$id'
- path: '/$id'
- fullPath: '/sec-d/$id'
- preLoaderRoute: typeof SecDIdRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/about': {
- id: '/sec-d/about'
- path: '/about'
- fullPath: '/sec-d/about'
- preLoaderRoute: typeof SecDAboutRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-d/settings': {
- id: '/sec-d/settings'
- path: '/settings'
- fullPath: '/sec-d/settings'
- preLoaderRoute: typeof SecDSettingsRouteImport
- parentRoute: typeof SecDRoute
- }
- '/sec-e/': {
- id: '/sec-e/'
- path: '/'
- fullPath: '/sec-e/'
- preLoaderRoute: typeof SecEIndexRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/$id': {
- id: '/sec-e/$id'
- path: '/$id'
- fullPath: '/sec-e/$id'
- preLoaderRoute: typeof SecEIdRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/about': {
- id: '/sec-e/about'
- path: '/about'
- fullPath: '/sec-e/about'
- preLoaderRoute: typeof SecEAboutRouteImport
- parentRoute: typeof SecERoute
- }
- '/sec-e/settings': {
- id: '/sec-e/settings'
- path: '/settings'
- fullPath: '/sec-e/settings'
- preLoaderRoute: typeof SecESettingsRouteImport
- parentRoute: typeof SecERoute
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
}
'/sec-f/': {
id: '/sec-f/'
@@ -729,11 +547,46 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SecFIndexRouteImport
parentRoute: typeof SecFRoute
}
- '/sec-f/$id': {
- id: '/sec-f/$id'
- path: '/$id'
- fullPath: '/sec-f/$id'
- preLoaderRoute: typeof SecFIdRouteImport
+ '/sec-e/': {
+ id: '/sec-e/'
+ path: '/'
+ fullPath: '/sec-e/'
+ preLoaderRoute: typeof SecEIndexRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-d/': {
+ id: '/sec-d/'
+ path: '/'
+ fullPath: '/sec-d/'
+ preLoaderRoute: typeof SecDIndexRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-c/': {
+ id: '/sec-c/'
+ path: '/'
+ fullPath: '/sec-c/'
+ preLoaderRoute: typeof SecCIndexRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-b/': {
+ id: '/sec-b/'
+ path: '/'
+ fullPath: '/sec-b/'
+ preLoaderRoute: typeof SecBIndexRouteImport
+ parentRoute: typeof SecBRoute
+ }
+ '/sec-a/': {
+ id: '/sec-a/'
+ path: '/'
+ fullPath: '/sec-a/'
+ preLoaderRoute: typeof SecAIndexRouteImport
+ parentRoute: typeof SecARoute
+ }
+ '/sec-f/settings': {
+ id: '/sec-f/settings'
+ path: '/settings'
+ fullPath: '/sec-f/settings'
+ preLoaderRoute: typeof SecFSettingsRouteImport
parentRoute: typeof SecFRoute
}
'/sec-f/about': {
@@ -743,13 +596,160 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SecFAboutRouteImport
parentRoute: typeof SecFRoute
}
- '/sec-f/settings': {
- id: '/sec-f/settings'
- path: '/settings'
- fullPath: '/sec-f/settings'
- preLoaderRoute: typeof SecFSettingsRouteImport
+ '/sec-f/$id': {
+ id: '/sec-f/$id'
+ path: '/$id'
+ fullPath: '/sec-f/$id'
+ preLoaderRoute: typeof SecFIdRouteImport
parentRoute: typeof SecFRoute
}
+ '/sec-e/settings': {
+ id: '/sec-e/settings'
+ path: '/settings'
+ fullPath: '/sec-e/settings'
+ preLoaderRoute: typeof SecESettingsRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/about': {
+ id: '/sec-e/about'
+ path: '/about'
+ fullPath: '/sec-e/about'
+ preLoaderRoute: typeof SecEAboutRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-e/$id': {
+ id: '/sec-e/$id'
+ path: '/$id'
+ fullPath: '/sec-e/$id'
+ preLoaderRoute: typeof SecEIdRouteImport
+ parentRoute: typeof SecERoute
+ }
+ '/sec-d/settings': {
+ id: '/sec-d/settings'
+ path: '/settings'
+ fullPath: '/sec-d/settings'
+ preLoaderRoute: typeof SecDSettingsRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/about': {
+ id: '/sec-d/about'
+ path: '/about'
+ fullPath: '/sec-d/about'
+ preLoaderRoute: typeof SecDAboutRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-d/$id': {
+ id: '/sec-d/$id'
+ path: '/$id'
+ fullPath: '/sec-d/$id'
+ preLoaderRoute: typeof SecDIdRouteImport
+ parentRoute: typeof SecDRoute
+ }
+ '/sec-c/settings': {
+ id: '/sec-c/settings'
+ path: '/settings'
+ fullPath: '/sec-c/settings'
+ preLoaderRoute: typeof SecCSettingsRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/about': {
+ id: '/sec-c/about'
+ path: '/about'
+ fullPath: '/sec-c/about'
+ preLoaderRoute: typeof SecCAboutRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-c/$id': {
+ id: '/sec-c/$id'
+ path: '/$id'
+ fullPath: '/sec-c/$id'
+ preLoaderRoute: typeof SecCIdRouteImport
+ parentRoute: typeof SecCRoute
+ }
+ '/sec-b/settings': {
+ id: '/sec-b/settings'
+ path: '/settings'
+ fullPath: '/sec-b/settings'
+ preLoaderRoute: typeof SecBSettingsRouteImport
+ parentRoute: typeof SecBRoute
+ }
+ '/sec-b/about': {
+ id: '/sec-b/about'
+ path: '/about'
+ fullPath: '/sec-b/about'
+ preLoaderRoute: typeof SecBAboutRouteImport
+ parentRoute: typeof SecBRoute
+ }
+ '/sec-b/$id': {
+ id: '/sec-b/$id'
+ path: '/$id'
+ fullPath: '/sec-b/$id'
+ preLoaderRoute: typeof SecBIdRouteImport
+ parentRoute: typeof SecBRoute
+ }
+ '/sec-a/settings': {
+ id: '/sec-a/settings'
+ path: '/settings'
+ fullPath: '/sec-a/settings'
+ preLoaderRoute: typeof SecASettingsRouteImport
+ parentRoute: typeof SecARoute
+ }
+ '/sec-a/about': {
+ id: '/sec-a/about'
+ path: '/about'
+ fullPath: '/sec-a/about'
+ preLoaderRoute: typeof SecAAboutRouteImport
+ parentRoute: typeof SecARoute
+ }
+ '/sec-a/$id': {
+ id: '/sec-a/$id'
+ path: '/$id'
+ fullPath: '/sec-a/$id'
+ preLoaderRoute: typeof SecAIdRouteImport
+ parentRoute: typeof SecARoute
+ }
+ '/release/v{$version}': {
+ id: '/release/v{$version}'
+ path: '/release/v{$version}'
+ fullPath: '/release/v{$version}'
+ preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/files/$': {
+ id: '/files/$'
+ path: '/files/$'
+ fullPath: '/files/$'
+ preLoaderRoute: typeof FilesSplatRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/_layout/beta': {
+ id: '/_layout/beta'
+ path: '/beta'
+ fullPath: '/beta'
+ preLoaderRoute: typeof LayoutBetaRouteImport
+ parentRoute: typeof LayoutRoute
+ }
+ '/_layout/alpha': {
+ id: '/_layout/alpha'
+ path: '/alpha'
+ fullPath: '/alpha'
+ preLoaderRoute: typeof LayoutAlphaRouteImport
+ parentRoute: typeof LayoutRoute
+ }
+ '/(marketing)/promo': {
+ id: '/(marketing)/promo'
+ path: '/promo'
+ fullPath: '/promo'
+ preLoaderRoute: typeof marketingPromoRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/pricing': {
+ id: '/(marketing)/pricing'
+ path: '/pricing'
+ fullPath: '/pricing'
+ preLoaderRoute: typeof marketingPricingRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts
index b15beed09b..96d211d64c 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts
+++ b/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts
@@ -9,13 +9,13 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as IndexRouteImport } from './routes/index'
-import { Route as CatalogRouteImport } from './routes/catalog'
import { Route as ProductsRouteImport } from './routes/products'
+import { Route as CatalogRouteImport } from './routes/catalog'
+import { Route as IndexRouteImport } from './routes/index'
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const ProductsRoute = ProductsRouteImport.update({
+ id: '/products',
+ path: '/products',
getParentRoute: () => rootRouteImport,
} as any)
const CatalogRoute = CatalogRouteImport.update({
@@ -23,9 +23,9 @@ const CatalogRoute = CatalogRouteImport.update({
path: '/catalog',
getParentRoute: () => rootRouteImport,
} as any)
-const ProductsRoute = ProductsRouteImport.update({
- id: '/products',
- path: '/products',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
@@ -61,11 +61,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/products': {
+ id: '/products'
+ path: '/products'
+ fullPath: '/products'
+ preLoaderRoute: typeof ProductsRouteImport
parentRoute: typeof rootRouteImport
}
'/catalog': {
@@ -75,11 +75,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof CatalogRouteImport
parentRoute: typeof rootRouteImport
}
- '/products': {
- id: '/products'
- path: '/products'
- fullPath: '/products'
- preLoaderRoute: typeof ProductsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/compiler-perf/.gitignore b/benchmarks/compiler-perf/.gitignore
new file mode 100644
index 0000000000..4cd272dd4f
--- /dev/null
+++ b/benchmarks/compiler-perf/.gitignore
@@ -0,0 +1,2 @@
+apps/
+results/
diff --git a/benchmarks/compiler-perf/README.md b/benchmarks/compiler-perf/README.md
new file mode 100644
index 0000000000..64835d8869
--- /dev/null
+++ b/benchmarks/compiler-perf/README.md
@@ -0,0 +1,267 @@
+# Compiler performance harness
+
+Measures, on large generated apps, how the TanStack compiler (route generator,
+code splitting, HMR injection, Start server-function and environment
+transforms, `` handling, import protection) affects what users wait for:
+
+1. **Dev startup**: process start → server listening → first page hydrated in
+ Chromium, plus a "compile everything" variant that isolates transform
+ throughput.
+2. **HMR**: file save → updated DOM, per kind of edit.
+3. **Production build**: wall-clock of `vite build` (client + SSR) and
+ `rsbuild build`.
+
+and attributes main-thread time to our plugins (CPU profiles plus per-plugin
+hook timing). Optional scenarios measure the **floor** (the same scenarios
+with the compiler's outputs replayed, i.e. what they would cost with a
+zero-cost compiler) and **memory** (peak RSS, heap after GC, HMR leak check).
+
+## Workloads
+
+`scripts/generate.mjs` writes deterministic (seeded) apps into `apps/` (git-ignored):
+
+| variant | contents |
+| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| `react-start` | TanStack Start (Vite and Rsbuild configs): 338 route files (10 sections × 3 groups, nested layouts, pathless/group/splat/param routes, 5 server routes), loaders, `validateSearch`/`loaderDeps`, `beforeLoad`, pending/error/notFound components, 106 server functions (20 files + inline, validators, middleware), `createIsomorphicFn`/`createServerOnlyFn`/`createClientOnlyFn`, `ClientOnly`, 10 `` boundaries, `*.server.ts` modules, 40 shared components |
+| `react-router` | the same route tree as a client-only Router app with `autoCodeSplitting`, no Start features |
+| `solid-start` | `react-start` written for Solid (signals, ``/``, `class`, accessor router hooks); Vite only (`vite-plugin-solid`; no Rsbuild config, which would need `@rsbuild/plugin-babel` + `@rsbuild/plugin-solid`). Same route tree, server functions and probes |
+| `solid-router` | `react-router` written for Solid |
+
+Every result records a hash of the generated sources (`workloads..hash`);
+`compare.mjs` warns when baseline and candidate inputs differ. Apps resolve
+dependencies through this package, which links the built workspace packages.
+
+## Running
+
+From the repository root of any checkout that contains this directory:
+
+```sh
+CI=1 pnpm install --frozen-lockfile
+# Builds @tanstack/react-start, router-plugin, react-router through Nx, then runs everything.
+node benchmarks/compiler-perf/scripts/run.mjs --label --out
+```
+
+Results: `/results.json` (all samples + stats), `/summary.md`,
+`/run.log`, and `/profiles/` (CPU profiles + hook timings).
+Without `--out`, results go to `benchmarks/compiler-perf/results//`.
+
+Useful options (`--help` lists all):
+
+- `--variants react-start,react-router` (default); the Solid variants run with
+ `--variants solid-start,solid-router`. The Solid apps keep the React apps'
+ structure (same seeded choices), so React and Solid numbers are comparable
+ per scenario, but Solid's own JSX transform runs Babel in every variant.
+- `--scenarios build,dev-compile,dev-cold,dev-warm,hmr,rsbuild,profile` (the
+ default set); also `rsbuild-build`/`rsbuild-dev` (the halves of `rsbuild`),
+ `floor`, `memory`, `leak` (see below)
+- `--runs 5 --warmup 1` (startup/build), `--hmr-iterations 20 --hmr-warmup 3`
+- `--skip-package-builds` when the packages are already built
+- `--max-busy 1.5`: before every run (and every HMR edit) the harness samples
+ `/proc/stat` and waits while other processes keep more than 1.5 cores busy
+ (up to `--quiet-timeout` seconds; runs that time out are recorded with
+ `flagged: true`). Each run records `busyCores` and the 1-minute load.
+ A pre-run sample is not enough (bursty neighbours slowed one series by
+ ~10% while every pre-run sample was below 4), so each run also records
+ `othersBusyDuring`: system-wide busy time during the run minus the
+ harness's own process tree (dev server, build, Chromium). Runs above
+ `--max-busy` are flagged and repeated, up to `--retries` (default 5) per
+ scenario and 3× that many HMR edits per kind; remaining flagged runs are
+ kept, counted in `summary.md` and reported by `compare.mjs`. The default
+ is strict on purpose: on a 32-core machine, 2–4 cores of unrelated load
+ slowed the browser startup scenarios by 5–15% (likely lower boost clocks),
+ far more than the number of busy cores suggests.
+
+Compare two runs:
+
+```sh
+node benchmarks/compiler-perf/scripts/compare.mjs /results.json /results.json --md compare.md
+```
+
+### Running against a checkout without this directory
+
+Copy the directory into the other checkout, add its lockfile importer, build and
+run (nothing else in the lockfile changes, all dependencies are already
+resolved there):
+
+```sh
+rsync -a --exclude apps --exclude results --exclude node_modules \
+ benchmarks/compiler-perf/ /benchmarks/compiler-perf/
+cd
+CI=1 pnpm install --frozen-lockfile || pnpm install --no-frozen-lockfile
+node benchmarks/compiler-perf/scripts/run.mjs --label --out
+```
+
+Use the same Node binary for baseline and candidate (`compare.mjs` warns
+otherwise). pnpm may select a different Node per checkout from its `.nvmrc`,
+so pass an absolute path, e.g.
+`NODE=$(cd && node -p process.execPath); $NODE benchmarks/compiler-perf/scripts/run.mjs ...`.
+
+Each generated app links `vite` and `@rsbuild/core` (`apps//node_modules/`)
+to the instance the TanStack plugin packages resolve (`meta.shared` in the
+results). A workspace can contain several peer-dependency variants of the same
+Vite version, and a second instance breaks Start's dev server detection
+(`instanceof RunnableDevEnvironment`).
+
+## Scenarios and metrics
+
+All times are milliseconds, wall-clock unless stated.
+
+| scenario | metrics |
+| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `/build` | `buildMs`: `vite build` process wall time (client + SSR environments for Start), output and cache dirs removed first |
+| `/dev-compile` | `listenMs`; `compileAllMs`: after listening, `environment.transformRequest` on every route file, the router entry and the route tree, crawling their imported app modules (split chunks, server-function modules, virtual modules) per environment (`clientMs`, `ssrMs`, module counts). Cold dependency cache |
+| `/dev-cold` | `listenMs`: process spawn → `server.listen()` resolved; `hydratedMs`: spawn → root component's first effect in Chromium on `/` (`listenToHydratedMs` from navigation start). Dependency cache removed; a dependency-optimizer reload counts towards the time (`reloads`) |
+| `/dev-warm` | the same with the dependency cache from the previous run kept |
+| `/hmr/` | `updateMs`: file write → the edited text appears in the page (MutationObserver timestamp in the page); `fullReloads` per edit |
+| `react-start/rsbuild-*` | `rsbuild build` wall time; `rsbuild dev` spawn → port open → hydrated |
+| attribution (`profile`) | one extra run each of dev-compile, dev-cold and build (and rsbuild build) under `node --cpu-prof` with hook timing on |
+
+HMR kinds (`react-router` has the first three):
+
+- `route-component`: text in a route component (`src/routes/s00/g0/i0.tsx`)
+- `route-loader`: value returned by a route loader and rendered (`i1.tsx`)
+- `shared-component`: a non-route component used by a route (`src/components/ProbeWidget.tsx`)
+- `server-fn`: the return value of a server function handler (`src/server/probe.ts`); measured as save → the first call from the page that returns the new value (the page calls it in a loop)
+- `hydrate`: text inside a `` boundary (`i4.tsx`), after the boundary has hydrated
+
+Dev servers run through `scripts/dev-driver.mjs` (`vite.createServer` + `listen`,
+with Node's compile cache enabled like the Vite CLI). The Node compile cache and
+the OS file cache stay warm between runs; "cold" means no Vite dependency cache
+and no build output.
+
+### Floor (`--scenarios floor`)
+
+How fast each scenario would be if the TanStack compiler cost nothing while
+producing exactly the same output. `scripts/replay.mjs`:
+
+- **record** (one unmeasured run per scenario): every hook of a plugin whose
+ name matches `tanstack` (`COMPILER_PERF_REPLAY_PLUGINS` overrides the regex)
+ that returns code (`transform`, `load`, `renderChunk`; Rsbuild
+ `api.transform` handlers; unplugin `transform`/`load` hooks under Rspack;
+ Rspack loaders shipped by `@tanstack/*` packages, wrapped in Node's require
+ cache so module ids do not change; Rspack `VirtualModulesPlugin` writes) runs
+ for real and its result is stored by (environment, plugin, hook, id with
+ `v=`/`t=` queries stripped, hash of the input code), plus the call's
+ occurrence index.
+- **replay** (the measured `/floor-` runs): the store is
+ deserialized when the config loads, and those hooks return the stored
+ result without running. A miss runs the real hook (`misses`; should be 0).
+ The load time (`replayLoadMs`) is subtracted from the times (`raw*` keeps
+ the unadjusted values).
+
+It works on any compiler implementation because it keys on plugin names, hook
+identity and loader packages, not on compiler internals. `--floor` selects the
+scenarios (default `build,dev-compile,dev-cold,hmr,rsbuild-build`); run the
+real scenarios in the same invocation so `summary.md` can put real and floor
+side by side.
+
+Checks and limits:
+
+- Build output is hashed (`outputHash`); dev compile-all hashes every served
+ module per environment (`clientOutputHash`, `ssrOutputHash`, with
+ per-session queries and Vite's run-dependent CJS interop order
+ normalized). `outputMismatch` counts hashes that differ from the record
+ run; `results.floor..realMatches` compares the record run with
+ the real run.
+- The other hooks of the same plugins still run (`otherTanstackHookSyncMs`):
+ `resolveId`, `hotUpdate`, `generateBundle`, and the **route generator**
+ (Vite `configResolved`, Rspack `beforeRun`), reported as `generatorMs`
+ (settled time; on the startup critical path, so `floor − generatorMs`
+ estimates a floor without the generator). `routeTree.gen.ts` is kept
+ between runs, so the generator only checks and does not rewrite it.
+- Side effects of replayed hooks do not happen (`this.addWatchFile`, extra
+ `this.load` calls of the server-fn lookup, compiler caches). The output
+ checks catch side effects that change output.
+- Floor HMR uses deterministic edit tokens; the record run makes extra edits
+ to cover the replay run's retries.
+
+### Memory (`--scenarios memory,leak`)
+
+`scripts/memory.mjs` takes snapshots with `--expose-gc` (two full GCs first):
+V8 `heapUsedMb`, `externalMb`, `arrayBuffersMb`, `rssMb`, `peakRssMb` (VmHWM)
+and the RSS of descendant processes (`childPeakRssMb`, sampled every 200 ms).
+Memory runs are separate from timed runs (`--memory-runs`, default 3).
+
+- `mem-build`, `mem-rsbuild-build`: CLI build preloaded with
+ `--import memory.mjs`; the snapshot is taken at process exit.
+- `mem-dev-cold`: dev server after `/` hydrated; `mem-dev-compile`: after
+ compile-all.
+- `leak`: dev server after a cold start with `/` and one page per probe open,
+ snapshot, then `--leak-cycles` (default 50) edit + revert cycles rotating
+ over route component, route loader, server function handler and shared
+ module, each waiting for the edit and for the revert to show up; a
+ snapshot every 10 cycles (`series`) and at the end. `heapGrowthMb` /
+ `rssGrowthMb` are end − start.
+
+### Soak (`--scenarios soak`)
+
+`soakRun` in `scripts/run.mjs`: one dev server (`--soak-bundlers vite,rsbuild`;
+Rsbuild for `react-start` only), `--soak-cycles` (default 500) edit + revert
+cycles rotating over the kinds of `scripts/soak-files.mjs`: the HMR probes
+(route component, loader, shared module, server-fn handler, ``),
+module adds and deletes (a new module imported by a soak route, then
+dropped and deleted), route adds and deletes (route tree regenerated), route
+renames, adding/removing a `*.server.ts` import (alternately read by a
+server-fn handler and by client code, an import-protection violation), and
+dependency-only factory flips (`src/soak/factory.ts` stops/starts exporting a
+server-fn builder; only its importer's output changes). Every name is a
+function of the cycle index (record/replay sees the same files).
+
+Every `--soak-every` cycles (default 25): forced GC, `heapUsed`, `external`,
+`arrayBuffers`, RSS, and the compiler's cache sizes (`TSR_COMPILER_STATS=1`,
+below); heap snapshots after the `--soak-snapshots` cycles (default
+`0,100,500`; the cycle-0 snapshot absorbs V8's one-time snapshot overhead).
+`--soak-modes`: `real`, `replay` (record run, then a run with our transform
+hooks replaced by the recorded outputs, see Floor), `transform-off` (Router
+app with splitting and HMR off: nothing reaches the compiler).
+
+- `scripts/soak-analyze.mjs `: OLS slope of each GC'd metric
+ (KB/edit, 95% CI) over the last 75% of the samples, and per cache counter
+ its values, slope per 100 cycles and whether it grows.
+- `scripts/heap-diff.mjs A.heapsnapshot B.heapsnapshot`: per-constructor
+ growth, new survivors, and retained self size by _owner_ (the first
+ function or class instance on the shortest retaining path whose script
+ belongs to a package), A → B (`--owner-detail ` lists one owner's
+ largest objects with their paths).
+
+### Compiler introspection and cache knobs (dev-only measurement aids)
+
+Environment variables read by `@tanstack/router-utils/compiler` (inert unless
+set; Node-side only, never in a bundle):
+
+- `TSR_COMPILER_STATS=1`: the compiler caches (`PlanCache`, dependents index,
+ `RawFactsCache`, resolution caches, with approximate bytes and hit/miss
+ counters), the hosts' sessions (import protection, server-fn registries,
+ Rsbuild per-resource records) and the route generator register size
+ readers in a process-global registry (`compilerStats()`; the dev driver
+ and `scripts/ipc-agent.mjs` answer `{ type: 'stats' }`).
+ `TSR_COMPILER_STATS_BYTES=0` skips the byte estimates.
+- `TSR_COMPILER_NO_CACHE=`: disables caches for on/off measurements:
+ `plans` (no plan is published: every request, derived ids included,
+ plans again), `facts` (summaries and target facts re-read and re-parsed
+ on every request), `targets` (target facts only), `all`. Outputs are
+ identical with any knob (`stats.test.ts`). Resolutions and emitted
+ outputs are not cached (R54): nothing to switch off.
+- `scripts/cache-knobs.mjs --out `: runs the harness per (round, knob),
+ interleaved, and tabulates medians per knob against "all on".
+
+### Attribution
+
+- **CPU profile** (`attribution..cpu.main`): `compilerInclusiveMs` is the
+ main-thread time of samples with a TanStack compiler frame on the stack
+ (`router-plugin`, `router-generator`, `router-utils`, `start-plugin-core`,
+ `*-start/dist/esm/plugin`, `react-start-rsc`, `virtual-file-routes`, any
+ `packages/*compiler*` or `yuku` package); this includes the Babel/Prettier
+ work they call. `compilerShareOfBusy` divides it by the non-idle main-thread
+ time. `byCategory` is self time by owner (babel, vite, rolldown JS glue,
+ gc, ...). Native frames inherit their caller's owner. Extend the compiler
+ package list with `COMPILER_PERF_COMPILER_RE=`.
+- **Hook timing** (`attribution..hooks`, Vite only): every JS plugin hook
+ is wrapped (`scripts/hook-timing.mjs`, inert unless
+ `COMPILER_PERF_HOOKS_OUT` is set). `syncMs` is main-thread time until the
+ hook returned, so it misses work after an `await`; `settledMs` overlaps
+ between concurrent modules and is not additive. Rolldown builtin plugins are
+ native in builds and are not wrapped.
+
+Profiled runs are slower than unprofiled ones; use them for shares, not for
+absolute times.
diff --git a/benchmarks/compiler-perf/package.json b/benchmarks/compiler-perf/package.json
new file mode 100644
index 0000000000..144b1bb79a
--- /dev/null
+++ b/benchmarks/compiler-perf/package.json
@@ -0,0 +1,30 @@
+{
+ "name": "@benchmarks/compiler-perf",
+ "private": true,
+ "type": "module",
+ "scripts": {
+ "generate": "node scripts/generate.mjs",
+ "perf": "node scripts/run.mjs",
+ "compare": "node scripts/compare.mjs"
+ },
+ "dependencies": {
+ "@tanstack/react-router": "workspace:^",
+ "@tanstack/react-start": "workspace:^",
+ "@tanstack/solid-router": "workspace:^",
+ "@tanstack/solid-start": "workspace:^",
+ "react": "^19.0.0",
+ "react-dom": "^19.0.0",
+ "solid-js": "^1.9.10"
+ },
+ "devDependencies": {
+ "@playwright/test": "catalog:",
+ "@rsbuild/core": "^2.1.0",
+ "@rsbuild/plugin-react": "^2.0.0",
+ "@tanstack/router-plugin": "workspace:^",
+ "@types/react": "^19.0.8",
+ "@types/react-dom": "^19.0.3",
+ "@vitejs/plugin-react": "^6.0.1",
+ "vite": "^8.0.14",
+ "vite-plugin-solid": "^2.11.11"
+ }
+}
diff --git a/benchmarks/compiler-perf/scripts/cache-knobs.mjs b/benchmarks/compiler-perf/scripts/cache-knobs.mjs
new file mode 100644
index 0000000000..c8346fa65d
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/cache-knobs.mjs
@@ -0,0 +1,168 @@
+#!/usr/bin/env node
+// Cache on/off comparison: runs the harness once per (round, knob) with
+// TSR_COMPILER_NO_CACHE= ('' = every cache on), interleaved so every
+// configuration sees the same machine conditions, then reports the median of
+// each metric per knob and its change against "on".
+//
+// Usage: node cache-knobs.mjs --out [--rounds 3] [--knobs on,plans,facts,targets]
+// [--variants react-start,react-router] [--scenarios build,dev-compile,dev-cold,hmr]
+// [--runs 2] [--hmr-iterations 6] [--max-busy 8] [--port 4810] [--report-only]
+
+import { execFileSync } from 'node:child_process'
+import fs from 'node:fs'
+import path from 'node:path'
+import { parseArgs } from 'node:util'
+import { fileURLToPath } from 'node:url'
+
+const here = path.dirname(fileURLToPath(import.meta.url))
+const { values: opts } = parseArgs({
+ options: {
+ out: { type: 'string' },
+ rounds: { type: 'string', default: '3' },
+ knobs: { type: 'string', default: 'on,plans,facts,targets' },
+ variants: { type: 'string', default: 'react-start,react-router' },
+ scenarios: { type: 'string', default: 'build,dev-compile,dev-cold,hmr' },
+ runs: { type: 'string', default: '2' },
+ 'hmr-iterations': { type: 'string', default: '6' },
+ 'max-busy': { type: 'string', default: '8' },
+ port: { type: 'string', default: '4810' },
+ 'report-only': { type: 'boolean', default: false },
+ },
+})
+const out = path.resolve(opts.out)
+const knobs = opts.knobs.split(',')
+const rounds = Number(opts.rounds)
+
+if (!opts['report-only']) {
+ for (let round = 1; round <= rounds; round++) {
+ for (const knob of knobs) {
+ const dir = path.join(out, `${knob}-r${round}`)
+ if (fs.existsSync(path.join(dir, 'results.json'))) {
+ continue
+ }
+ console.log(`round ${round} knob ${knob}`)
+ // a run that dies (a crashed browser) is retried once from scratch
+ for (let attempt = 1; ; attempt++) {
+ try {
+ runOnce(knob, round, dir)
+ break
+ } catch (error) {
+ console.log(
+ `round ${round} knob ${knob} failed (attempt ${attempt}): ${error.message.split('\n')[0]}`,
+ )
+ if (attempt === 2) {
+ break
+ }
+ fs.rmSync(dir, { recursive: true, force: true })
+ }
+ }
+ }
+ }
+}
+
+function runOnce(knob, round, dir) {
+ execFileSync(
+ process.execPath,
+ [
+ path.join(here, 'run.mjs'),
+ '--label',
+ `cache-${knob}-r${round}`,
+ '--out',
+ dir,
+ '--variants',
+ opts.variants,
+ '--scenarios',
+ opts.scenarios,
+ '--runs',
+ opts.runs,
+ '--warmup',
+ round === 1 ? '1' : '0',
+ '--hmr-iterations',
+ opts['hmr-iterations'],
+ '--hmr-warmup',
+ '2',
+ '--max-busy',
+ opts['max-busy'],
+ '--skip-package-builds',
+ '--port',
+ opts.port,
+ ],
+ {
+ stdio: 'inherit',
+ env: {
+ ...process.env,
+ TSR_COMPILER_NO_CACHE: knob === 'on' ? '' : knob,
+ },
+ },
+ )
+}
+
+// ---------------------------------------------------------------------------
+
+const METRICS = {
+ build: ['buildMs'],
+ 'dev-compile': ['compileAllMs', 'listenMs'],
+ 'dev-cold': ['hydratedMs'],
+ 'rsbuild-build': ['buildMs'],
+ 'rsbuild-dev-cold': ['hydratedMs'],
+}
+const median = (xs) => {
+ const s = [...xs].sort((a, b) => a - b)
+ const n = s.length
+ return n ? (n % 2 ? s[(n - 1) / 2] : (s[n / 2 - 1] + s[n / 2]) / 2) : NaN
+}
+const samples = {}
+let load = []
+for (const knob of knobs) {
+ for (let round = 1; round <= rounds; round++) {
+ const file = path.join(out, `${knob}-r${round}`, 'results.json')
+ if (!fs.existsSync(file)) {
+ continue
+ }
+ const res = JSON.parse(fs.readFileSync(file, 'utf8'))
+ for (const [name, entry] of Object.entries(res.scenarios)) {
+ const [, scenario, kind] = name.split('/')
+ const keys = scenario === 'hmr' ? ['updateMs'] : (METRICS[scenario] ?? [])
+ for (const key of keys) {
+ const values = entry.metrics[key]?.samples ?? []
+ const id = `${name}:${key}`
+ ;((samples[id] ??= {})[knob] ??= []).push(...values)
+ }
+ for (const run of entry.runs) {
+ if (typeof run.othersBusyDuring === 'number') {
+ load.push(run.othersBusyDuring)
+ }
+ }
+ void kind
+ }
+ }
+}
+const lines = [
+ `| metric | ${knobs.map((k) => (k === 'on' ? 'all on' : `${k} off`)).join(' | ')} |`,
+ `|---|${knobs.map(() => '---:').join('|')}|`,
+]
+for (const [id, byKnob] of Object.entries(samples).sort()) {
+ const base = median(byKnob.on ?? [])
+ lines.push(
+ `| ${id} | ${knobs
+ .map((k) => {
+ const m = median(byKnob[k] ?? [])
+ if (!Number.isFinite(m)) {
+ return 'n/a'
+ }
+ const d =
+ k === 'on' || !base
+ ? ''
+ : ` (${m >= base ? '+' : ''}${(((m - base) / base) * 100).toFixed(1)}%)`
+ return `${Math.round(m)}${d} n=${byKnob[k].length}`
+ })
+ .join(' | ')} |`,
+ )
+}
+load = load.sort((a, b) => a - b)
+lines.push(
+ '',
+ `Other processes' load during the runs: median ${median(load).toFixed(1)} cores, max ${load.at(-1)?.toFixed(1)}.`,
+)
+fs.writeFileSync(path.join(out, 'cache-knobs.md'), lines.join('\n') + '\n')
+console.log(lines.join('\n'))
diff --git a/benchmarks/compiler-perf/scripts/compare.mjs b/benchmarks/compiler-perf/scripts/compare.mjs
new file mode 100644
index 0000000000..e0f5eebabc
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/compare.mjs
@@ -0,0 +1,130 @@
+#!/usr/bin/env node
+// Compares two harness result files.
+// Usage: node scripts/compare.mjs [--md out.md]
+
+import fs from 'node:fs'
+import { parseArgs } from 'node:util'
+import { primaryMetrics } from './report.mjs'
+
+const { values, positionals } = parseArgs({
+ allowPositionals: true,
+ options: { md: { type: 'string' } },
+})
+if (positionals.length !== 2) {
+ console.error(
+ 'Usage: node scripts/compare.mjs [--md out.md]',
+ )
+ process.exit(1)
+}
+const [base, cand] = positionals.map((f) =>
+ JSON.parse(fs.readFileSync(f, 'utf8')),
+)
+
+const lines = []
+lines.push(`# Compiler perf: ${cand.label} vs ${base.label}`)
+lines.push('')
+lines.push(
+ `- baseline: \`${base.meta.commit?.slice(0, 10)}\` (${base.meta.branch}), node ${base.meta.node}`,
+)
+lines.push(
+ `- candidate: \`${cand.meta.commit?.slice(0, 10)}\` (${cand.meta.branch}), node ${cand.meta.node}`,
+)
+
+const warnings = []
+for (const [variant, w] of Object.entries(cand.workloads)) {
+ const b = base.workloads[variant]
+ if (b && b.hash !== w.hash) {
+ warnings.push(
+ `workload ${variant} differs (hash ${b.hash} vs ${w.hash}): inputs are not identical`,
+ )
+ }
+}
+if (base.meta.node !== cand.meta.node) {
+ warnings.push(
+ `different Node versions (${base.meta.node} vs ${cand.meta.node})`,
+ )
+}
+for (const [name, v] of Object.entries(cand.meta.versions ?? {})) {
+ if (base.meta.versions?.[name] !== v) {
+ warnings.push(`different ${name} (${base.meta.versions?.[name]} vs ${v})`)
+ }
+}
+if (base.meta.cpu !== cand.meta.cpu) {
+ warnings.push(`different machines (${base.meta.cpu} vs ${cand.meta.cpu})`)
+}
+for (const [name, entry] of Object.entries(cand.scenarios)) {
+ const flagged =
+ (entry.flaggedRuns ?? 0) + (base.scenarios[name]?.flaggedRuns ?? 0)
+ if (flagged) {
+ warnings.push(`${name}: ${flagged} runs flagged for machine load`)
+ }
+}
+for (const w of warnings) {
+ lines.push(`- **warning:** ${w}`)
+}
+lines.push('')
+lines.push(
+ 'Verdict: `faster`/`slower` when the sample ranges do not overlap, `~faster`/`~slower` when the medians differ by more than twice the larger cv, `~` otherwise.',
+)
+lines.push('')
+lines.push(
+ '| scenario | metric | base median | cand median | Δ | Δ% | base p90 | cand p90 | verdict |',
+)
+lines.push('|---|---|---:|---:|---:|---:|---:|---:|---|')
+
+const r = (v) => (v >= 100 ? Math.round(v) : Math.round(v * 10) / 10)
+for (const [name, entry] of Object.entries(cand.scenarios)) {
+ const baseEntry = base.scenarios[name]
+ if (!baseEntry) {
+ continue
+ }
+ for (const key of primaryMetrics(name, entry.metrics)) {
+ const c = entry.metrics[key]
+ const b = baseEntry.metrics[key]
+ if (!b?.n || !c?.n) {
+ continue
+ }
+ const delta = c.median - b.median
+ const pct = b.median ? (delta / b.median) * 100 : 0
+ let verdict = '~'
+ if (c.max < b.min) {
+ verdict = 'faster'
+ } else if (c.min > b.max) {
+ verdict = 'slower'
+ } else if (Math.abs(pct) > 200 * Math.max(b.cv, c.cv)) {
+ verdict = pct < 0 ? '~faster' : '~slower'
+ }
+ lines.push(
+ `| ${name} | ${key} | ${r(b.median)} | ${r(c.median)} | ${delta > 0 ? '+' : ''}${r(delta)} | ${pct > 0 ? '+' : ''}${pct.toFixed(1)}% | ${r(b.p90)} | ${r(c.p90)} | ${verdict} |`,
+ )
+ }
+}
+
+const attrNames = Object.keys(cand.attribution ?? {}).filter(
+ (n) => base.attribution?.[n]?.cpu?.main,
+)
+if (attrNames.length) {
+ lines.push('')
+ lines.push('## Compiler attribution (profiled runs)')
+ lines.push('')
+ lines.push(
+ '| run | base compiler ms | cand compiler ms | base share | cand share | base busy ms | cand busy ms |',
+ )
+ lines.push('|---|---:|---:|---:|---:|---:|---:|')
+ for (const name of attrNames) {
+ const b = base.attribution[name].cpu.main
+ const c = cand.attribution[name].cpu.main
+ if (!c) {
+ continue
+ }
+ lines.push(
+ `| ${name} | ${r(b.compilerInclusiveMs)} | ${r(c.compilerInclusiveMs)} | ${(b.compilerShareOfBusy * 100).toFixed(1)}% | ${(c.compilerShareOfBusy * 100).toFixed(1)}% | ${r(b.busyMs)} | ${r(c.busyMs)} |`,
+ )
+ }
+}
+
+const out = lines.join('\n') + '\n'
+if (values.md) {
+ fs.writeFileSync(values.md, out)
+}
+console.log(out)
diff --git a/benchmarks/compiler-perf/scripts/cpuprofile.mjs b/benchmarks/compiler-perf/scripts/cpuprofile.mjs
new file mode 100644
index 0000000000..a3cc76c5b8
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/cpuprofile.mjs
@@ -0,0 +1,176 @@
+// Attributes a V8 .cpuprofile (from `node --cpu-prof`) to code owners.
+//
+// - byCategory: self time per owner (TanStack compiler packages, Babel, Vite,
+// Rolldown JS glue, ...). Native frames without a URL inherit the category of
+// their nearest JS ancestor, so native parsers called from JS stay with
+// their caller.
+// - compilerInclusiveMs: samples whose stack contains a TanStack compiler
+// frame (includes Babel/Prettier/fs work the compiler calls synchronously).
+//
+// The compiler package list can be extended with COMPILER_PERF_COMPILER_RE (a
+// regular expression matched against frame URLs), e.g. for new packages that
+// a rewrite introduces.
+
+import fs from 'node:fs'
+
+const DEFAULT_COMPILER_RE =
+ /\/(?:packages|node_modules\/@tanstack)\/(?:router-plugin|router-generator|router-utils|start-plugin-core|react-start-rsc|solid-start-rsc|virtual-file-routes|[a-z-]*compiler[a-z-]*)\/(?!node_modules)|\/(?:packages|node_modules\/@tanstack)\/(?:react|solid|vue)-start\/dist\/esm\/plugin\/|\/node_modules\/(?:@yuku|yuku)[^/]*\//
+
+function compilerRe() {
+ const extra = process.env.COMPILER_PERF_COMPILER_RE
+ return extra
+ ? new RegExp(`${DEFAULT_COMPILER_RE.source}|${extra}`)
+ : DEFAULT_COMPILER_RE
+}
+
+const CATEGORY_RULES = [
+ [
+ 'babel',
+ /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:@babel\/|babel-dead-code-elimination\/|recast\/|ast-types\/)/,
+ ],
+ ['prettier', /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?prettier\//],
+ ['vite', /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?vite\//],
+ [
+ 'rolldown',
+ /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:rolldown|@rolldown\/)/,
+ ],
+ [
+ 'rsbuild/rspack',
+ /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:@rsbuild\/|@rspack\/)/,
+ ],
+ [
+ 'plugin-react',
+ /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?@vitejs\//,
+ ],
+ [
+ 'plugin-solid',
+ /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:vite-plugin-solid|babel-preset-solid|babel-plugin-jsx-dom-expressions|solid-refresh|@rsbuild\/plugin-solid)\//,
+ ],
+ [
+ 'react-runtime',
+ /\/node_modules\/(?:\.pnpm\/[^/]+\/node_modules\/)?(?:react|react-dom|scheduler)\//,
+ ],
+ [
+ 'tanstack-runtime',
+ /\/packages\/[^/]+\/(?:dist|src)\/|\/node_modules\/@tanstack\//,
+ ],
+ ['app', /\/benchmarks\/compiler-perf\/apps\//],
+ ['other-deps', /\/node_modules\//],
+ ['node', /^node:|^internal\/|^(?![a-z]+:)[^/]/],
+]
+
+export function analyzeCpuProfile(file) {
+ const profile = JSON.parse(fs.readFileSync(file, 'utf8'))
+ const re = compilerRe()
+ const nodes = new Map()
+ const parent = new Map()
+ for (const node of profile.nodes) {
+ nodes.set(node.id, node)
+ for (const child of node.children ?? []) {
+ parent.set(child, node.id)
+ }
+ }
+ const categoryOf = new Map()
+ const inCompiler = new Map()
+ const resolve = (id) => {
+ if (categoryOf.has(id)) {
+ return
+ }
+ const node = nodes.get(id)
+ const { url, functionName } = node.callFrame
+ const parentId = parent.get(id)
+ if (parentId !== undefined) {
+ resolve(parentId)
+ }
+ let category
+ if (functionName === '(garbage collector)') {
+ category = '(gc)'
+ } else if (functionName === '(idle)') {
+ category = '(idle)'
+ } else if (functionName === '(program)') {
+ category = '(program)'
+ } else if (functionName === '(root)') {
+ category = '(root)'
+ } else if (!url) {
+ category = parentId !== undefined ? categoryOf.get(parentId) : 'native'
+ if (category === '(root)') {
+ category = 'native'
+ }
+ } else if (re.test(url)) {
+ category = 'tanstack-compiler'
+ } else {
+ category =
+ CATEGORY_RULES.find(([, rule]) => rule.test(url))?.[0] ?? 'other'
+ }
+ categoryOf.set(id, category)
+ inCompiler.set(
+ id,
+ category === 'tanstack-compiler' ||
+ (parentId !== undefined && inCompiler.get(parentId)),
+ )
+ }
+
+ const byCategory = {}
+ let compilerInclusiveUs = 0
+ let totalUs = 0
+ const { samples, timeDeltas } = profile
+ for (let i = 0; i < samples.length; i++) {
+ // timeDeltas[i] is the time elapsed before sample i; attribute the next
+ // delta to the sampled frame.
+ const dt = timeDeltas[i + 1] ?? 0
+ const id = samples[i]
+ resolve(id)
+ const category = categoryOf.get(id)
+ byCategory[category] = (byCategory[category] ?? 0) + dt
+ if (inCompiler.get(id)) {
+ compilerInclusiveUs += dt
+ }
+ totalUs += dt
+ }
+ const busyUs = totalUs - (byCategory['(idle)'] ?? 0)
+ const ms = (us) => Math.round(us / 100) / 10
+ return {
+ profileMs: ms(profile.endTime - profile.startTime),
+ busyMs: ms(busyUs),
+ compilerInclusiveMs: ms(compilerInclusiveUs),
+ compilerShareOfBusy: busyUs
+ ? Math.round((compilerInclusiveUs / busyUs) * 1000) / 1000
+ : 0,
+ byCategory: Object.fromEntries(
+ Object.entries(byCategory)
+ .sort((a, b) => b[1] - a[1])
+ .map(([k, v]) => [k, ms(v)]),
+ ),
+ }
+}
+
+/** Merges the analyses of several profiles written by one process tree. */
+export function analyzeCpuProfileDir(dir) {
+ const files = fs.existsSync(dir)
+ ? fs.readdirSync(dir).filter((f) => f.endsWith('.cpuprofile'))
+ : []
+ const analyses = files.map((f) => ({
+ file: f,
+ ...analyzeCpuProfile(`${dir}/${f}`),
+ }))
+ // Report the busiest profile (the main thread of the process under test)
+ // and keep the others for reference.
+ analyses.sort((a, b) => b.busyMs - a.busyMs)
+ return {
+ main: analyses[0],
+ others: analyses.slice(1).map(({ file, busyMs, compilerInclusiveMs }) => ({
+ file,
+ busyMs,
+ compilerInclusiveMs,
+ })),
+ }
+}
+
+if (
+ process.argv[1] &&
+ import.meta.url.endsWith(process.argv[1].split('/').pop())
+) {
+ for (const file of process.argv.slice(2)) {
+ console.log(file, JSON.stringify(analyzeCpuProfile(file), null, 2))
+ }
+}
diff --git a/benchmarks/compiler-perf/scripts/dev-driver.mjs b/benchmarks/compiler-perf/scripts/dev-driver.mjs
new file mode 100644
index 0000000000..875bb22224
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/dev-driver.mjs
@@ -0,0 +1,185 @@
+// Child process that runs a Vite dev server for the harness.
+//
+// Usage: node dev-driver.mjs
+// Talks to the parent over IPC:
+// -> { type: 'listening', ... } once the server listens
+// <- { type: 'compile-all' } transform every app module
+// -> { type: 'compile-all', result }
+// <- { type: 'mem' } GC (with --expose-gc), then
+// -> { type: 'mem', result } heap/RSS snapshot (memory.mjs)
+// <- { type: 'stats' | 'heap-snapshot' } see ipc-agent.mjs
+// <- { type: 'stop' } close the server and exit
+
+import crypto from 'node:crypto'
+import fs from 'node:fs'
+import module from 'node:module'
+import path from 'node:path'
+import { performance } from 'node:perf_hooks'
+import { pathToFileURL } from 'node:url'
+import { installIpcAgent } from './ipc-agent.mjs'
+
+const [appDir, portArg] = process.argv.slice(2)
+const send = (msg) => process.send?.(msg)
+// performance.now() in a fresh process is measured from process start.
+const marks = { processStart: 0 }
+
+// Like Vite's CLI: cache compiled JS of Vite and the plugins across runs.
+module.enableCompileCache?.()
+setTimeout(() => module.flushCompileCache?.(), 10_000).unref()
+
+// The app links the vite instance the TanStack plugins use (see
+// resolveSharedPackages in generate.mjs).
+const vite = await import(
+ pathToFileURL(path.join(appDir, 'node_modules/vite/dist/node/index.js')).href
+)
+marks.viteImported = performance.now()
+
+const server = await vite.createServer({
+ root: appDir,
+ configFile: path.join(appDir, 'vite.config.ts'),
+ server: { port: Number(portArg), strictPort: true, host: '127.0.0.1' },
+})
+marks.serverCreated = performance.now()
+await server.listen()
+marks.listening = performance.now()
+send({
+ type: 'listening',
+ marks,
+ epochMs: performance.timeOrigin + marks.listening,
+})
+
+function walk(dir, out = []) {
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
+ const full = path.join(dir, entry.name)
+ if (entry.isDirectory()) {
+ walk(full, out)
+ } else if (/\.(tsx?|jsx?)$/.test(entry.name)) {
+ out.push(full)
+ }
+ }
+ return out
+}
+
+function seedUrls() {
+ const src = path.join(appDir, 'src')
+ const seeds = [
+ ...['router.tsx', 'main.tsx', 'routeTree.gen.ts']
+ .map((f) => path.join(src, f))
+ .filter((f) => fs.existsSync(f)),
+ ...walk(path.join(src, 'routes')),
+ ]
+ return seeds.map(
+ (file) => '/' + path.relative(appDir, file).split(path.sep).join('/'),
+ )
+}
+
+function shouldCrawl(mod) {
+ const id = mod.id ?? mod.url
+ if (!id) {
+ return false
+ }
+ if (
+ id.includes('/node_modules/') ||
+ id.includes('/.vite-cache/') ||
+ id.startsWith('/@vite/')
+ ) {
+ return false
+ }
+ if (
+ id.startsWith('\0') ||
+ id.startsWith('virtual:') ||
+ id.startsWith('/@id/')
+ ) {
+ return true
+ }
+ return id.startsWith(appDir)
+}
+
+// Strips the per-session parts of served code (dependency optimizer and HMR
+// timestamps) so record/replay runs can be compared. Vite emits its CommonJS
+// interop bindings in resolve-completion order, which varies between runs.
+const CJS_INTEROP_RE = /const [\w$]+ = __vite__cjsImport\d+_[\w$]+\["[^"]+"\];/g
+const normalizeServed = (code) => {
+ code = code.replace(/([?&])(v|t)=[\w-]+/g, '$1$2=*')
+ const interop = code.match(CJS_INTEROP_RE)
+ return interop
+ ? code.replace(CJS_INTEROP_RE, '') + '\n' + interop.sort().join('')
+ : code
+}
+
+async function compileEnvironment(env) {
+ const seen = new Set()
+ const errors = []
+ const outputs = new Map()
+ let wave = seedUrls()
+ const t0 = performance.now()
+ while (wave.length) {
+ const next = []
+ await Promise.all(
+ wave.map(async (url) => {
+ if (seen.has(url)) {
+ return
+ }
+ seen.add(url)
+ try {
+ const result = await env.transformRequest(url)
+ outputs.set(url, result?.code ?? '')
+ } catch (error) {
+ errors.push({
+ url,
+ message: String(error?.message ?? error).slice(0, 300),
+ })
+ return
+ }
+ const mod = await env.moduleGraph.getModuleByUrl(url)
+ for (const dep of mod?.importedModules ?? []) {
+ if (shouldCrawl(dep) && !seen.has(dep.url)) {
+ next.push(dep.url)
+ }
+ }
+ }),
+ )
+ wave = [...new Set(next)].filter((url) => !seen.has(url))
+ }
+ const ms = performance.now() - t0
+ // Debugging aid for output mismatches between runs.
+ if (process.env.COMPILER_PERF_DUMP_OUTPUTS) {
+ fs.writeFileSync(
+ `${process.env.COMPILER_PERF_DUMP_OUTPUTS}.${env.name}.json`,
+ JSON.stringify(
+ Object.fromEntries(
+ [...outputs].map(([url, code]) => [url, normalizeServed(code)]),
+ ),
+ ),
+ )
+ }
+ const hash = crypto.createHash('sha256')
+ for (const url of [...outputs.keys()].sort()) {
+ hash.update(url + '\0' + normalizeServed(outputs.get(url)) + '\0')
+ }
+ return {
+ ms,
+ modules: seen.size,
+ errors,
+ outputHash: hash.digest('hex').slice(0, 16),
+ }
+}
+
+installIpcAgent()
+process.on('message', async (msg) => {
+ if (msg?.type === 'compile-all') {
+ const result = { envs: {} }
+ const t0 = performance.now()
+ const names = Object.keys(server.environments).sort((a, b) =>
+ a === 'client' ? -1 : b === 'client' ? 1 : a.localeCompare(b),
+ )
+ for (const name of names) {
+ result.envs[name] = await compileEnvironment(server.environments[name])
+ }
+ result.totalMs = performance.now() - t0
+ send({ type: 'compile-all', result })
+ } else if (msg?.type === 'stop') {
+ await server.close()
+ process.exit(0)
+ }
+})
diff --git a/benchmarks/compiler-perf/scripts/generate.mjs b/benchmarks/compiler-perf/scripts/generate.mjs
new file mode 100644
index 0000000000..d1bf09e080
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/generate.mjs
@@ -0,0 +1,1359 @@
+// Deterministic generator for the compiler performance workloads.
+//
+// Writes a large file-based app (React or Solid) into `apps//`. The output only
+// depends on the variant name and SEED, so baseline and candidate checkouts get
+// byte-identical inputs. `workloadHash()` hashes the generated sources so the
+// results can prove that.
+//
+// Variants:
+// - react-start: TanStack Start (Vite + Rsbuild configs) with ~340 routes,
+// ~105 server functions, middleware, isomorphic/server-only/
+// client-only fns, ClientOnly, boundaries, server
+// routes and `*.server.ts` modules.
+// - react-router: the same route tree as a plain Router SPA with
+// autoCodeSplitting, without any Start feature.
+// - solid-start, solid-router: the same apps written for Solid (signals,
+// /, `class`, accessors for router hooks).
+
+import crypto from 'node:crypto'
+import fs from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+
+const here = path.dirname(fileURLToPath(import.meta.url))
+export const benchRoot = path.resolve(here, '..')
+export const appsRoot = path.join(benchRoot, 'apps')
+
+export const SEED = 20261024
+// Default variants. `ALL_VARIANTS` adds the Solid ones (`--variants`).
+export const VARIANTS = ['react-start', 'react-router']
+export const ALL_VARIANTS = [...VARIANTS, 'solid-start', 'solid-router']
+
+export const isStart = (variant) => variant.endsWith('-start')
+export const hasRsbuild = (variant) => variant === 'react-start'
+export const frameworkOf = (variant) => variant.split('-')[0]
+
+const SECTIONS = 10
+const GROUPS = 3
+const ITEMS = 6
+const WIDGETS = 40
+const SERVER_FN_FILES = 20
+
+// Files that the HMR scenarios edit. Each one contains the literal token
+// `-v0`, which the harness swaps for a fresh token on every iteration.
+export const PROBES = {
+ 'react-start': {
+ 'route-component': {
+ file: 'src/routes/s00/g0/i0.tsx',
+ url: '/s00/g0/i0',
+ token: 'probe-component-v0',
+ },
+ 'route-loader': {
+ file: 'src/routes/s00/g0/i1.tsx',
+ url: '/s00/g0/i1',
+ token: 'probe-loader-v0',
+ },
+ 'shared-component': {
+ file: 'src/components/ProbeWidget.tsx',
+ url: '/s00/g0/i2',
+ token: 'probe-widget-v0',
+ },
+ 'server-fn': {
+ file: 'src/server/probe.ts',
+ url: '/s00/g0/i3',
+ token: 'probe-serverfn-v0',
+ poll: true,
+ },
+ hydrate: {
+ file: 'src/routes/s00/g0/i4.tsx',
+ url: '/s00/g0/i4',
+ token: 'probe-hydrate-v0',
+ },
+ },
+ 'react-router': {
+ 'route-component': {
+ file: 'src/routes/s00/g0/i0.tsx',
+ url: '/s00/g0/i0',
+ token: 'probe-component-v0',
+ },
+ 'route-loader': {
+ file: 'src/routes/s00/g0/i1.tsx',
+ url: '/s00/g0/i1',
+ token: 'probe-loader-v0',
+ },
+ 'shared-component': {
+ file: 'src/components/ProbeWidget.tsx',
+ url: '/s00/g0/i2',
+ token: 'probe-widget-v0',
+ },
+ },
+}
+
+PROBES['solid-start'] = PROBES['react-start']
+PROBES['solid-router'] = PROBES['react-router']
+
+function mulberry32(seed) {
+ let a = seed >>> 0
+ return () => {
+ a = (a + 0x6d2b79f5) >>> 0
+ let t = a
+ t = Math.imul(t ^ (t >>> 15), t | 1)
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61)
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296
+ }
+}
+
+const pad = (n) => String(n).padStart(2, '0')
+const WORDS = [
+ 'alpha',
+ 'bravo',
+ 'canyon',
+ 'delta',
+ 'ember',
+ 'fjord',
+ 'granite',
+ 'harbor',
+ 'indigo',
+ 'juniper',
+ 'kestrel',
+ 'lumen',
+ 'meadow',
+ 'nectar',
+ 'onyx',
+ 'prairie',
+ 'quartz',
+ 'raven',
+ 'sierra',
+ 'tundra',
+]
+
+function createRng(seed) {
+ const next = mulberry32(seed)
+ return {
+ chance: (p) => next() < p,
+ int: (lo, hi) => lo + Math.floor(next() * (hi - lo + 1)),
+ pick: (arr) => arr[Math.floor(next() * arr.length)],
+ word: () => WORDS[Math.floor(next() * WORDS.length)],
+ }
+}
+
+function relImport(fromFile, toFile) {
+ let rel = path.posix.relative(path.posix.dirname(fromFile), toFile)
+ if (!rel.startsWith('.')) {
+ rel = './' + rel
+ }
+ return rel.replace(/\.(tsx?|jsx?)$/, '')
+}
+
+function componentName(routePath) {
+ if (routePath === '/') {
+ return 'Home'
+ }
+ const segments = routePath
+ .replace(/\/$/, '/index')
+ .replace(/\/\$$/, '/splat')
+ .split(/[^a-zA-Z0-9]+/)
+ .filter(Boolean)
+ return segments.map((s) => s.charAt(0).toUpperCase() + s.slice(1)).join('')
+}
+
+// ---------------------------------------------------------------------------
+// Route tree description (shared by both variants)
+// ---------------------------------------------------------------------------
+
+function routeList(variant) {
+ const routes = []
+ const add = (file, routePath, kind, extra = {}) =>
+ routes.push({ file: `src/routes/${file}`, routePath, kind, ...extra })
+
+ add('index.tsx', '/', 'home')
+ add('about.tsx', '/about', 'leaf')
+ add('_auth.tsx', '/_auth', 'pathless')
+ for (const name of ['settings', 'profile', 'billing', 'team']) {
+ add(`_auth/${name}.tsx`, `/_auth/${name}`, 'leaf')
+ }
+ for (const name of ['pricing', 'features', 'contact']) {
+ add(`(marketing)/${name}.tsx`, `/(marketing)/${name}`, 'leaf')
+ }
+ add('docs/index.tsx', '/docs/', 'leaf')
+ add('docs/$.tsx', '/docs/$', 'splat')
+
+ for (let s = 0; s < SECTIONS; s++) {
+ const sec = `s${pad(s)}`
+ add(`${sec}/route.tsx`, `/${sec}`, 'layout', { depth: 1 })
+ add(`${sec}/index.tsx`, `/${sec}/`, 'leaf')
+ for (let g = 0; g < GROUPS; g++) {
+ const grp = `${sec}/g${g}`
+ add(`${grp}/route.tsx`, `/${grp}`, 'layout', { depth: 2 })
+ add(`${grp}/index.tsx`, `/${grp}/`, 'leaf')
+ for (let i = 0; i < ITEMS; i++) {
+ add(`${grp}/i${i}.tsx`, `/${grp}/i${i}`, 'leaf', {
+ probe: s === 0 && g === 0 ? i : undefined,
+ })
+ }
+ add(`${grp}/$itemId.tsx`, `/${grp}/$itemId`, 'param')
+ add(`${grp}/$itemId.edit.tsx`, `/${grp}/$itemId/edit`, 'param')
+ }
+ }
+
+ if (isStart(variant)) {
+ for (const name of ['health', 'items', 'search', 'session', 'webhook']) {
+ add(`api/${name}.ts`, `/api/${name}`, 'api')
+ }
+ }
+ return routes
+}
+
+// ---------------------------------------------------------------------------
+// Shared modules
+// ---------------------------------------------------------------------------
+
+function widgetSource(n, rng, fw) {
+ const rows = rng.int(3, 7)
+ const tone = rng.pick(['info', 'warn', 'ok', 'muted'])
+ if (fw === 'solid') {
+ return `import { For, Show, createMemo, createSignal } from 'solid-js'
+import { formatLabel, sumBy } from '../lib/format'
+
+export interface Widget${pad(n)}Props {
+ label: string
+ items?: Array<{ id: string; value: number }>
+ compact?: boolean
+}
+
+const TONE = '${tone}'
+
+export function Widget${pad(n)}(props: Widget${pad(n)}Props) {
+ const [open, setOpen] = createSignal(${rng.chance(0.5)})
+ const items = () => props.items ?? []
+ const total = createMemo(() => sumBy(items(), (item) => item.value))
+ const visible = () => (props.compact ? items().slice(0, ${rows}) : items())
+
+ return (
+
+ )
+}
+`
+ }
+ return `import { useMemo, useState } from 'react'
+import { formatLabel, sumBy } from '../lib/format'
+
+export interface Widget${pad(n)}Props {
+ label: string
+ items?: Array<{ id: string; value: number }>
+ compact?: boolean
+}
+
+const TONE = '${tone}'
+
+export function Widget${pad(n)}({ label, items = [], compact }: Widget${pad(n)}Props) {
+ const [open, setOpen] = useState(${rng.chance(0.5)})
+ const total = useMemo(() => sumBy(items, (item) => item.value), [items])
+ const visible = compact ? items.slice(0, ${rows}) : items
+
+ return (
+
+
+ {formatLabel(label)}
+ setOpen((value) => !value)}>
+ {open ? 'Hide' : 'Show'} ({total})
+
+
+ {open ? (
+
+ {visible.map((item) => (
+
+ {item.id}
+ {item.value.toFixed(${rng.int(0, 2)})}
+
+ ))}
+
+ ) : null}
+
+ )
+}
+`
+}
+
+const formatSource = `export function formatLabel(label: string) {
+ return label
+ .split(/[-_\\s]+/)
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
+ .join(' ')
+}
+
+export function sumBy(items: Array, pick: (item: T) => number) {
+ let total = 0
+ for (const item of items) {
+ total += pick(item)
+ }
+ return total
+}
+
+export function formatPrice(cents: number) {
+ return '$' + (cents / 100).toFixed(2)
+}
+
+export function makeItems(prefix: string, count: number) {
+ return Array.from({ length: count }, (_, index) => ({
+ id: prefix + '-' + index,
+ value: (index * 37) % 101,
+ }))
+}
+`
+
+const probeWidgetSource = (fw) => `export function ProbeWidget() {
+ return (
+
+ )
+}
+`
+
+const dataApiSource = `import { makeItems } from '../lib/format'
+
+const wait = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
+
+export async function fetchSection(section: string) {
+ await wait(0)
+ return { section, items: makeItems(section, 8) }
+}
+
+export async function fetchItem(id: string, page = 1) {
+ await wait(0)
+ return { id, page, title: 'Item ' + id, items: makeItems(id, 5) }
+}
+
+export async function fetchList(prefix: string) {
+ await wait(0)
+ return makeItems(prefix, 12)
+}
+`
+
+function dbServerSource() {
+ return `// Server-only data access. Only server function handlers import this module.
+import { makeItems } from '../lib/format'
+
+const tables = new Map>()
+
+function table(name: string) {
+ let rows = tables.get(name)
+ if (!rows) {
+ rows = makeItems(name, 20)
+ tables.set(name, rows)
+ }
+ return rows
+}
+
+export const db = {
+ async find(name: string, id: string) {
+ return table(name).find((row) => row.id === id) ?? { id, value: 0 }
+ },
+ async list(name: string, page = 1) {
+ return table(name).slice((page - 1) * 5, page * 5)
+ },
+ async update(name: string, id: string, value: number) {
+ const rows = table(name)
+ const row = rows.find((entry) => entry.id === id)
+ if (row) {
+ row.value = value
+ }
+ return row ?? null
+ },
+ secret: process.env.DATABASE_URL ?? 'memory://local',
+}
+`
+}
+
+const secretsServerSource = `export function readSecret(name: string) {
+ return process.env[name] ?? 'dev-' + name.toLowerCase()
+}
+`
+
+const middlewareSource = (
+ fw,
+) => `import { createMiddleware } from '@tanstack/${fw}-start'
+import { readSecret } from './secrets.server'
+
+export const loggingMiddleware = createMiddleware({ type: 'function' }).server(
+ async ({ next }) => {
+ const result = await next()
+ return result
+ },
+)
+
+export const authMiddleware = createMiddleware({ type: 'function' })
+ .client(async ({ next }) => {
+ return next({ sendContext: { clientTime: Date.now() } })
+ })
+ .server(async ({ next }) => {
+ return next({ context: { user: { id: 'u1', token: readSecret('AUTH_TOKEN') } } })
+ })
+
+export const timingMiddleware = createMiddleware({ type: 'function' })
+ .middleware([loggingMiddleware])
+ .server(async ({ next }) => {
+ const start = Date.now()
+ const result = await next()
+ void (Date.now() - start)
+ return result
+ })
+`
+
+function serverFnFileSource(n, rng, fw) {
+ const id = pad(n)
+ const mw = () =>
+ rng.pick([
+ '[loggingMiddleware]',
+ '[authMiddleware]',
+ '[timingMiddleware]',
+ '[authMiddleware, loggingMiddleware]',
+ ])
+ return `import { createServerFn } from '@tanstack/${fw}-start'
+import { db } from './db.server'
+import { authMiddleware, loggingMiddleware, timingMiddleware } from './middleware'
+
+export const getItem${id} = createServerFn({ method: 'GET' })
+ .middleware(${mw()})
+ .validator((input: { id: string; page?: number }) => input)
+ .handler(async ({ data }) => {
+ const row = await db.find('t${id}', data.id)
+ return { id: data.id, page: data.page ?? 1, value: row.value, title: 'Item ' + data.id }
+ })
+
+export const listItems${id} = createServerFn({ method: 'GET' })
+ .validator((input: { page: number }) => {
+ if (input.page < 1) {
+ throw new Error('page must be positive')
+ }
+ return input
+ })
+ .handler(async ({ data }) => {
+ return db.list('t${id}', data.page)
+ })
+
+export const updateItem${id} = createServerFn({ method: 'POST' })
+ .middleware(${mw()})
+ .validator((input: { id: string; value: number }) => input)
+ .handler(async ({ data, context }) => {
+ void context
+ return db.update('t${id}', data.id, data.value)
+ })
+
+export const stats${id} = createServerFn().handler(async () => {
+ const rows = await db.list('t${id}')
+ return { count: rows.length, connection: db.secret.length > 0 ? 'ok' : 'none' }
+})
+`
+}
+
+const probeServerFnSource = (
+ fw,
+) => `import { createServerFn } from '@tanstack/${fw}-start'
+import { db } from './db.server'
+
+export const getProbe = createServerFn({ method: 'GET' }).handler(async () => {
+ void db
+ return 'probe-serverfn-v0'
+})
+`
+
+function isoSource(n, fw) {
+ return `import {
+ createClientOnlyFn,
+ createIsomorphicFn,
+ createServerOnlyFn,
+} from '@tanstack/${fw}-start'
+
+export const runtimeLabel${n} = createIsomorphicFn()
+ .server(() => 'server-${n}')
+ .client(() => 'client-${n}')
+
+export const readServerConfig${n} = createServerOnlyFn(() => ({
+ region: process.env.REGION ?? 'local',
+ slot: ${n},
+}))
+
+export const readViewport${n} = createClientOnlyFn(() => window.innerWidth + ${n})
+`
+}
+
+// ---------------------------------------------------------------------------
+// Route sources
+// ---------------------------------------------------------------------------
+
+function routeSource(route, variant, rng, ctx) {
+ const start = isStart(variant)
+ const fw = frameworkOf(variant)
+ const solid = fw === 'solid'
+ // Solid: router hooks return accessors, JSX uses `class`.
+ const call = solid ? '()' : ''
+ const cls = solid ? 'class' : 'className'
+ if (route.kind === 'api') {
+ return apiRouteSource(route, fw)
+ }
+ const file = route.file
+ const imp = (to) => relImport(file, to)
+ const name = componentName(route.routePath)
+ const lines = []
+ const reactImports = new Set([solid ? 'createSignal' : 'useState'])
+ const routerImports = new Set(['createFileRoute', 'Link'])
+ const startImports = new Set()
+ const extraImports = []
+ const options = []
+ const body = []
+ const helpers = []
+
+ const probeKind = Object.keys(PROBES[variant]).find(
+ (kind) => PROBES[variant][kind].url === route.routePath,
+ )
+
+ const widgets = Array.from({ length: rng.int(1, 3) }, () =>
+ rng.int(0, WIDGETS - 1),
+ )
+ for (const w of new Set(widgets)) {
+ extraImports.push(
+ `import { Widget${pad(w)} } from '${imp(`src/components/Widget${pad(w)}.tsx`)}'`,
+ )
+ }
+ extraImports.push(
+ `import { formatLabel, makeItems } from '${imp('src/lib/format.ts')}'`,
+ )
+
+ // --- loader -------------------------------------------------------------
+ const hasSearch = route.kind === 'leaf' && rng.chance(0.2)
+ const hasLoader =
+ probeKind === 'route-loader' ||
+ (probeKind === undefined && route.kind !== 'pathless' && rng.chance(0.7))
+ const fnFile = rng.int(0, SERVER_FN_FILES - 1)
+
+ if (hasSearch) {
+ options.push(` validateSearch: (search: Record) => ({
+ page: Number(search.page ?? 1),
+ sort: search.sort === 'desc' ? ('desc' as const) : ('asc' as const),
+ }),`)
+ }
+ if (route.kind === 'pathless' || rng.chance(0.15)) {
+ options.push(` beforeLoad: ({ location }) => {
+ return { visitedAt: location.pathname.length }
+ },`)
+ }
+ if (hasLoader) {
+ if (hasSearch) {
+ options.push(` loaderDeps: ({ search }) => ({ page: search.page }),`)
+ }
+ const pageExpr = hasSearch ? 'deps.page' : '1'
+ const loaderArgs = hasSearch ? '{ deps, params }' : '{ params }'
+ const idExpr =
+ route.kind === 'param' ? 'params.itemId' : `'${route.routePath}'`
+ if (probeKind === 'route-loader') {
+ options.push(` loader: async () => {
+ return { probe: 'probe-loader-v0', items: makeItems('probe', 3) }
+ },`)
+ } else if (start) {
+ extraImports.push(
+ `import { getItem${pad(fnFile)}, stats${pad(fnFile)} } from '${imp(`src/server/fns-${pad(fnFile)}.ts`)}'`,
+ )
+ options.push(` loader: async (${loaderArgs}) => {
+ void params
+ const [item, stats] = await Promise.all([
+ getItem${pad(fnFile)}({ data: { id: String(${idExpr}), page: ${pageExpr} } }),
+ stats${pad(fnFile)}(),
+ ])
+ return { item, stats, items: makeItems(item.id, 4) }
+ },`)
+ } else {
+ extraImports.push(`import { fetchItem } from '${imp('src/data/api.ts')}'`)
+ options.push(` loader: async (${loaderArgs}) => {
+ void params
+ const item = await fetchItem(String(${idExpr}), ${pageExpr})
+ return { item, items: item.items }
+ },`)
+ }
+ }
+ if (rng.chance(0.4)) {
+ options.push(` head: () => ({
+ meta: [{ title: '${name} | Perf App' }, { name: 'description', content: '${rng.word()} ${rng.word()}' }],
+ }),`)
+ }
+ const hasPending = rng.chance(0.3)
+ const hasError = rng.chance(0.3)
+ const hasNotFound = rng.chance(0.1)
+ if (hasPending) {
+ options.push(` pendingComponent: PendingView,`)
+ helpers.push(`function PendingView() {
+ return Loading ${name}…
+}`)
+ }
+ if (hasError) {
+ routerImports.add('ErrorComponentProps')
+ options.push(` errorComponent: ErrorView,`)
+ helpers.push(`function ErrorView({ error, reset }: ErrorComponentProps) {
+ return (
+
+
${name} failed: {error.message}
+
+ Retry
+
+
+ )
+}`)
+ }
+ if (hasNotFound) {
+ options.push(` notFoundComponent: () => Nothing in ${name}
,`)
+ }
+ options.push(` component: ${name}Component,`)
+
+ // --- start-only features --------------------------------------------------
+ const inlineServerFn =
+ start && probeKind === undefined && ctx.inlineFns < 25 && rng.chance(0.09)
+ if (inlineServerFn) {
+ ctx.inlineFns++
+ startImports.add('createServerFn')
+ startImports.add('useServerFn')
+ helpers.unshift(`const bump${name} = createServerFn({ method: 'POST' })
+ .validator((input: { amount: number }) => {
+ if (!Number.isFinite(input.amount)) {
+ throw new Error('amount must be finite')
+ }
+ return input
+ })
+ .handler(async ({ data }) => {
+ return { amount: data.amount * 2, at: Date.now() }
+ })`)
+ }
+ const usesIso = start && rng.chance(0.15)
+ const isoN = rng.int(0, 4)
+ if (usesIso) {
+ extraImports.push(
+ `import { runtimeLabel${isoN}, readViewport${isoN} } from '${imp(`src/lib/iso-${isoN}.ts`)}'`,
+ )
+ }
+ const usesClientOnly = rng.chance(0.1)
+ if (usesClientOnly) {
+ routerImports.add('ClientOnly')
+ }
+ const usesHydrate =
+ start &&
+ (probeKind === 'hydrate' ||
+ (probeKind === undefined && route.kind === 'leaf' && rng.chance(0.05)))
+ if (usesHydrate) {
+ startImports.add('Hydrate')
+ extraImports.push(
+ `import { visible } from '@tanstack/${fw}-start/hydration'`,
+ )
+ }
+ if (probeKind === 'shared-component') {
+ extraImports.push(
+ `import { ProbeWidget } from '${imp('src/components/ProbeWidget.tsx')}'`,
+ )
+ }
+ if (probeKind === 'server-fn') {
+ reactImports.add(solid ? 'onMount' : 'useEffect')
+ extraImports.push(
+ `import { getProbe } from '${imp('src/server/probe.ts')}'`,
+ )
+ }
+ if (route.kind === 'layout' || route.kind === 'pathless') {
+ routerImports.add('Outlet')
+ }
+
+ // --- component -----------------------------------------------------------
+ body.push(`function ${name}Component() {`)
+ if (hasLoader) {
+ body.push(` const data = Route.useLoaderData()`)
+ }
+ if (hasSearch) {
+ body.push(` const search = Route.useSearch()`)
+ }
+ if (route.kind === 'param') {
+ body.push(` const params = Route.useParams()`)
+ }
+ body.push(
+ solid
+ ? ` const [count, setCount] = createSignal(0)`
+ : ` const [count, setCount] = useState(0)`,
+ )
+ if (inlineServerFn) {
+ body.push(` const bump = useServerFn(bump${name})`)
+ }
+ if (probeKind === 'server-fn') {
+ body.push(
+ solid
+ ? ` onMount(() => {
+ ;(window as any).__perfProbeServerFn = () => getProbe()
+ })`
+ : ` useEffect(() => {
+ ;(window as any).__perfProbeServerFn = () => getProbe()
+ }, [])`,
+ )
+ }
+ body.push(` const rows = makeItems('${route.routePath}', ${rng.int(3, 9)})`)
+ body.push(` return (`)
+ body.push(` `)
+ body.push(`
{formatLabel('${name}')} `)
+ if (probeKind === 'route-component') {
+ body.push(`
probe-component-v0
`)
+ }
+ if (probeKind === 'route-loader') {
+ body.push(`
{data${call}.probe}
`)
+ }
+ if (probeKind === 'shared-component') {
+ body.push(`
`)
+ }
+ if (probeKind === 'server-fn') {
+ body.push(`
ready
`)
+ }
+ if (hasLoader && probeKind !== 'route-loader') {
+ body.push(`
Loaded {data${call}.items.length} rows
`)
+ }
+ if (hasSearch) {
+ body.push(`
+ Page {search${call}.page} ({search${call}.sort})
+
`)
+ }
+ if (route.kind === 'param') {
+ body.push(`
Item {params${call}.itemId}
`)
+ }
+ body.push(`
+ Home
+ About
+ `)
+ if (solid) {
+ reactImports.add('For')
+ body.push(`
+
+
+ {(row) => (
+
+ {row.id}
+ {row.value > 50 ? {row.value} : row.value}
+
+ )}
+
+
+
`)
+ } else {
+ body.push(`
+
+ {rows.map((row) => (
+
+ {row.id}
+ {row.value > 50 ? {row.value} : row.value}
+
+ ))}
+
+
`)
+ }
+ const widgetJsx = [...new Set(widgets)]
+ .map(
+ (w) =>
+ `
`,
+ )
+ .join('\n')
+ if (usesHydrate) {
+ body.push(`
+
+${probeKind === 'hydrate' ? '
probe-hydrate-v0
\n' : ''}${widgetJsx.replace(/^ {6}/gm, ' ')}
+
+ `)
+ } else {
+ body.push(widgetJsx)
+ }
+ if (usesClientOnly) {
+ body.push(`
…}>
+ {typeof window !== 'undefined' ? window.location.pathname : ''}
+ `)
+ }
+ if (usesIso) {
+ body.push(`
setCount(readViewport${isoN}() + runtimeLabel${isoN}().length)}>
+ Measure
+ `)
+ }
+ if (inlineServerFn) {
+ body.push(`
setCount((await bump({ data: { amount: count${call} + 1 } })).amount)}>
+ Bump {count${call}}
+ `)
+ } else {
+ body.push(`
setCount((value) => value + 1)}>
+ Clicked {count${call}}
+ `)
+ }
+ if (route.kind === 'layout' || route.kind === 'pathless') {
+ body.push(`
`)
+ }
+ body.push(`
`)
+ body.push(` )`)
+ body.push(`}`)
+
+ // --- assemble ------------------------------------------------------------
+ lines.push(
+ `import { ${[...reactImports].sort().join(', ')} } from '${solid ? 'solid-js' : 'react'}'`,
+ )
+ const typeOnly = [...routerImports].filter((n) => n === 'ErrorComponentProps')
+ const valueRouter = [...routerImports]
+ .filter((n) => n !== 'ErrorComponentProps')
+ .sort()
+ lines.push(
+ `import { ${valueRouter.join(', ')} } from '@tanstack/${fw}-router'`,
+ )
+ if (typeOnly.length) {
+ lines.push(
+ `import type { ${typeOnly.join(', ')} } from '@tanstack/${fw}-router'`,
+ )
+ }
+ if (startImports.size) {
+ lines.push(
+ `import { ${[...startImports].sort().join(', ')} } from '@tanstack/${fw}-start'`,
+ )
+ }
+ lines.push(...extraImports)
+ lines.push('')
+ lines.push(`export const Route = createFileRoute('${route.routePath}')({`)
+ lines.push(...options)
+ lines.push(`})`)
+ lines.push('')
+ if (helpers.length) {
+ lines.push(helpers.join('\n\n'))
+ lines.push('')
+ }
+ lines.push(body.join('\n'))
+ return lines.join('\n') + '\n'
+}
+
+function apiRouteSource(route, fw) {
+ const name = path.posix.basename(route.file, '.ts')
+ return `import { createFileRoute } from '@tanstack/${fw}-router'
+import { db } from '../../server/db.server'
+
+export const Route = createFileRoute('${route.routePath}')({
+ server: {
+ handlers: {
+ GET: async ({ request }) => {
+ const url = new URL(request.url)
+ const rows = await db.list('${name}', Number(url.searchParams.get('page') ?? 1))
+ return Response.json({ route: '${name}', rows })
+ },
+ POST: async ({ request }) => {
+ const body = await request.json()
+ return Response.json({ route: '${name}', received: body })
+ },
+ },
+ },
+})
+`
+}
+
+function navSource(fw) {
+ const links = []
+ for (let s = 0; s < SECTIONS; s++) {
+ links.push(` Section ${s}`)
+ }
+ return `import { Link } from '@tanstack/${fw}-router'
+
+export function Nav() {
+ return (
+
+ Home
+ Docs
+${links.join('\n')}
+
+ )
+}
+`
+}
+
+const hydratedMarker = ` useEffect(() => {
+ ;(window as any).__PERF_HYDRATED__ = performance.timeOrigin + performance.now()
+ }, [])`
+
+const startRootSource = `import { useEffect } from 'react'
+import type { ReactNode } from 'react'
+import { HeadContent, Outlet, Scripts, createRootRoute } from '@tanstack/react-router'
+import { Nav } from '../components/Nav'
+
+export const Route = createRootRoute({
+ head: () => ({
+ meta: [{ charSet: 'utf-8' }, { title: 'Compiler perf app' }],
+ }),
+ component: RootComponent,
+ notFoundComponent: () => Not found
,
+})
+
+function RootComponent() {
+ return (
+
+
+
+ )
+}
+
+function RootDocument({ children }: { children: ReactNode }) {
+${hydratedMarker}
+ return (
+
+
+
+
+
+
+ {children}
+
+
+
+ )
+}
+`
+
+const routerRootSource = `import { useEffect } from 'react'
+import { Outlet, createRootRoute } from '@tanstack/react-router'
+import { Nav } from '../components/Nav'
+
+export const Route = createRootRoute({
+ component: RootComponent,
+ notFoundComponent: () => Not found
,
+})
+
+function RootComponent() {
+${hydratedMarker}
+ return (
+ <>
+
+
+ >
+ )
+}
+`
+
+const startRouterSource = `import { createRouter } from '@tanstack/react-router'
+import { routeTree } from './routeTree.gen'
+
+export function getRouter() {
+ return createRouter({
+ routeTree,
+ scrollRestoration: true,
+ defaultPreload: false,
+ })
+}
+`
+
+const routerMainSource = `import { StrictMode } from 'react'
+import ReactDOM from 'react-dom/client'
+import { RouterProvider, createRouter } from '@tanstack/react-router'
+import { routeTree } from './routeTree.gen'
+
+const router = createRouter({ routeTree, defaultPreload: false })
+
+declare module '@tanstack/react-router' {
+ interface Register {
+ router: typeof router
+ }
+}
+
+ReactDOM.createRoot(document.getElementById('app')!).render(
+
+
+ ,
+)
+`
+
+const routerIndexHtml = `
+
+
+
+ Compiler perf router app
+
+
+
+
+
+
+`
+
+// The configs import the harness plugin through a relative path so the app
+// stays free of extra dependencies. The plugin is inert unless the harness
+// sets COMPILER_PERF_HOOKS_OUT.
+const startViteConfig = `import path from 'node:path'
+import { defineConfig } from 'vite'
+import viteReact from '@vitejs/plugin-react'
+import { tanstackStart } from '@tanstack/react-start/plugin/vite'
+import { hookTimingPlugin } from '../../scripts/hook-timing.mjs'
+
+export default defineConfig({
+ cacheDir: path.resolve(import.meta.dirname, '.vite-cache'),
+ logLevel: 'warn',
+ clearScreen: false,
+ build: { outDir: process.env.COMPILER_PERF_OUT_DIR ?? 'dist' },
+ plugins: [tanstackStart(), viteReact(), hookTimingPlugin()],
+})
+`
+
+const routerViteConfig = `import path from 'node:path'
+import { defineConfig } from 'vite'
+import viteReact from '@vitejs/plugin-react'
+import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { hookTimingPlugin } from '../../scripts/hook-timing.mjs'
+
+export default defineConfig({
+ cacheDir: path.resolve(import.meta.dirname, '.vite-cache'),
+ logLevel: 'warn',
+ clearScreen: false,
+ build: { outDir: process.env.COMPILER_PERF_OUT_DIR ?? 'dist' },
+ plugins: [
+ tanstackRouter({ target: 'react', autoCodeSplitting: true }),
+ viteReact(),
+ hookTimingPlugin(),
+ ],
+})
+`
+
+const startRsbuildConfig = `import { defineConfig } from '@rsbuild/core'
+import { pluginReact } from '@rsbuild/plugin-react'
+import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
+
+export default defineConfig({
+ logLevel: 'warn',
+ plugins: [pluginReact(), tanstackStart()],
+ output: {
+ distPath: { root: process.env.COMPILER_PERF_OUT_DIR ?? 'dist-rsbuild' },
+ cleanDistPath: true,
+ },
+ performance: { printFileSize: false },
+})
+`
+
+const solidHydratedMarker = ` onMount(() => {
+ ;(window as any).__PERF_HYDRATED__ = performance.timeOrigin + performance.now()
+ })`
+
+const solidStartRootSource = `import { onMount } from 'solid-js'
+import type { JSX } from 'solid-js'
+import { HydrationScript } from 'solid-js/web'
+import { HeadContent, Outlet, Scripts, createRootRoute } from '@tanstack/solid-router'
+import { Nav } from '../components/Nav'
+
+export const Route = createRootRoute({
+ head: () => ({
+ meta: [{ charSet: 'utf-8' }, { title: 'Compiler perf app' }],
+ }),
+ component: RootComponent,
+ notFoundComponent: () => Not found
,
+})
+
+function RootComponent() {
+ return (
+
+
+
+ )
+}
+
+function RootDocument(props: { children: JSX.Element }) {
+${solidHydratedMarker}
+ return (
+
+
+
+
+
+
+
+ {props.children}
+
+
+
+ )
+}
+`
+
+const solidRouterRootSource = `import { onMount } from 'solid-js'
+import { Outlet, createRootRoute } from '@tanstack/solid-router'
+import { Nav } from '../components/Nav'
+
+export const Route = createRootRoute({
+ component: RootComponent,
+ notFoundComponent: () => Not found
,
+})
+
+function RootComponent() {
+${solidHydratedMarker}
+ return (
+ <>
+
+
+ >
+ )
+}
+`
+
+const solidRouterMainSource = `import { render } from 'solid-js/web'
+import { RouterProvider, createRouter } from '@tanstack/solid-router'
+import { routeTree } from './routeTree.gen'
+
+const router = createRouter({ routeTree, defaultPreload: false })
+
+declare module '@tanstack/solid-router' {
+ interface Register {
+ router: typeof router
+ }
+}
+
+render(() => , document.getElementById('app')!)
+`
+
+const solidStartViteConfig = `import path from 'node:path'
+import { defineConfig } from 'vite'
+import solid from 'vite-plugin-solid'
+import { tanstackStart } from '@tanstack/solid-start/plugin/vite'
+import { hookTimingPlugin } from '../../scripts/hook-timing.mjs'
+
+export default defineConfig({
+ cacheDir: path.resolve(import.meta.dirname, '.vite-cache'),
+ logLevel: 'warn',
+ clearScreen: false,
+ build: { outDir: process.env.COMPILER_PERF_OUT_DIR ?? 'dist' },
+ plugins: [tanstackStart(), solid({ ssr: true }), hookTimingPlugin()],
+})
+`
+
+const solidRouterViteConfig = `import path from 'node:path'
+import { defineConfig } from 'vite'
+import solid from 'vite-plugin-solid'
+import { tanstackRouter } from '@tanstack/router-plugin/vite'
+import { hookTimingPlugin } from '../../scripts/hook-timing.mjs'
+
+export default defineConfig({
+ cacheDir: path.resolve(import.meta.dirname, '.vite-cache'),
+ logLevel: 'warn',
+ clearScreen: false,
+ build: { outDir: process.env.COMPILER_PERF_OUT_DIR ?? 'dist' },
+ plugins: [
+ tanstackRouter({ target: 'solid', autoCodeSplitting: true }),
+ solid(),
+ hookTimingPlugin(),
+ ],
+})
+`
+
+const solidTsconfig = `{
+ "compilerOptions": {
+ "strict": true,
+ "esModuleInterop": true,
+ "target": "ESNext",
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "jsx": "preserve",
+ "jsxImportSource": "solid-js",
+ "skipLibCheck": true,
+ "types": ["vite/client"]
+ },
+ "include": ["src"]
+}
+`
+
+const tsconfig = `{
+ "compilerOptions": {
+ "strict": true,
+ "esModuleInterop": true,
+ "target": "ESNext",
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "jsx": "react-jsx",
+ "skipLibCheck": true,
+ "types": ["vite/client"]
+ },
+ "include": ["src"]
+}
+`
+
+// ---------------------------------------------------------------------------
+
+export function generateFiles(variant) {
+ if (!ALL_VARIANTS.includes(variant)) {
+ throw new Error(`Unknown variant ${variant}`)
+ }
+ const start = isStart(variant)
+ const fw = frameworkOf(variant)
+ const solid = fw === 'solid'
+ const rng = createRng(SEED)
+ const files = new Map()
+ const ctx = { inlineFns: 0 }
+
+ files.set('tsconfig.json', solid ? solidTsconfig : tsconfig)
+ if (start) {
+ files.set('vite.config.ts', solid ? solidStartViteConfig : startViteConfig)
+ // Rsbuild needs @rsbuild/plugin-babel + plugin-solid for Solid; not set up.
+ if (!solid) {
+ files.set('rsbuild.config.ts', startRsbuildConfig)
+ }
+ files.set(
+ 'src/router.tsx',
+ startRouterSource.replace(
+ '@tanstack/react-router',
+ `@tanstack/${fw}-router`,
+ ),
+ )
+ files.set(
+ 'src/routes/__root.tsx',
+ solid ? solidStartRootSource : startRootSource,
+ )
+ files.set('src/server/db.server.ts', dbServerSource())
+ files.set('src/server/secrets.server.ts', secretsServerSource)
+ files.set('src/server/middleware.ts', middlewareSource(fw))
+ files.set('src/server/probe.ts', probeServerFnSource(fw))
+ for (let n = 0; n < SERVER_FN_FILES; n++) {
+ files.set(`src/server/fns-${pad(n)}.ts`, serverFnFileSource(n, rng, fw))
+ }
+ for (let n = 0; n < 5; n++) {
+ files.set(`src/lib/iso-${n}.ts`, isoSource(n, fw))
+ }
+ } else {
+ files.set(
+ 'vite.config.ts',
+ solid ? solidRouterViteConfig : routerViteConfig,
+ )
+ files.set('index.html', routerIndexHtml)
+ files.set('src/main.tsx', solid ? solidRouterMainSource : routerMainSource)
+ files.set(
+ 'src/routes/__root.tsx',
+ solid ? solidRouterRootSource : routerRootSource,
+ )
+ files.set('src/data/api.ts', dataApiSource)
+ }
+ files.set('src/lib/format.ts', formatSource)
+ files.set('src/components/Nav.tsx', navSource(fw))
+ files.set('src/components/ProbeWidget.tsx', probeWidgetSource(fw))
+ for (let n = 0; n < WIDGETS; n++) {
+ files.set(`src/components/Widget${pad(n)}.tsx`, widgetSource(n, rng, fw))
+ }
+ for (const route of routeList(variant)) {
+ files.set(route.file, routeSource(route, variant, rng, ctx))
+ }
+ return files
+}
+
+export function workloadHash(files) {
+ const hash = crypto.createHash('sha256')
+ for (const key of [...files.keys()].sort()) {
+ hash.update(key + '\0' + files.get(key) + '\0')
+ }
+ return hash.digest('hex').slice(0, 16)
+}
+
+function findPackageDir(name, fromDir) {
+ for (let dir = fromDir; ; dir = path.dirname(dir)) {
+ const candidate = path.join(dir, 'node_modules', name, 'package.json')
+ if (fs.existsSync(candidate)) {
+ return fs.realpathSync(path.dirname(candidate))
+ }
+ if (path.dirname(dir) === dir) {
+ return undefined
+ }
+ }
+}
+
+/**
+ * Bundler packages the apps must share with the TanStack plugins. A workspace
+ * can hold several peer-dependency variants of the same version (e.g. vite
+ * built against different sass versions); a second instance breaks
+ * `instanceof` checks such as Start's RunnableDevEnvironment detection, so the
+ * apps use the instance the plugin package resolves, as a single npm install
+ * would.
+ */
+export function resolveSharedPackages(variant) {
+ const pluginPath = isStart(variant)
+ ? [`@tanstack/${frameworkOf(variant)}-start`, '@tanstack/start-plugin-core']
+ : ['@tanstack/router-plugin']
+ let from = benchRoot
+ for (const name of pluginPath) {
+ from = findPackageDir(name, from) ?? from
+ }
+ const shared = {}
+ for (const name of ['vite', '@rsbuild/core']) {
+ shared[name] = findPackageDir(name, from) ?? findPackageDir(name, benchRoot)
+ }
+ return shared
+}
+
+export function appDir(variant) {
+ return path.join(appsRoot, variant)
+}
+
+/**
+ * (Re)writes the app sources. Removes stale generated sources, build output and
+ * caches so every run starts from the same inputs; keeps `routeTree.gen.ts`
+ * only if `keepRouteTree` is set.
+ */
+export function writeApp(variant, { keepRouteTree = false } = {}) {
+ const files = generateFiles(variant)
+ const dir = appDir(variant)
+ const routeTreePath = path.join(dir, 'src/routeTree.gen.ts')
+ const routeTree =
+ keepRouteTree && fs.existsSync(routeTreePath)
+ ? fs.readFileSync(routeTreePath, 'utf8')
+ : undefined
+ fs.rmSync(dir, { recursive: true, force: true })
+ for (const [rel, content] of files) {
+ const target = path.join(dir, rel)
+ fs.mkdirSync(path.dirname(target), { recursive: true })
+ fs.writeFileSync(target, content)
+ }
+ if (routeTree !== undefined) {
+ fs.writeFileSync(routeTreePath, routeTree)
+ }
+ const shared = resolveSharedPackages(variant)
+ for (const [name, target] of Object.entries(shared)) {
+ if (target) {
+ const link = path.join(dir, 'node_modules', name)
+ fs.mkdirSync(path.dirname(link), { recursive: true })
+ fs.symlinkSync(target, link, 'dir')
+ }
+ }
+ const routeCount = [...files.keys()].filter((f) =>
+ f.startsWith('src/routes/'),
+ ).length
+ const serverFnCount = [...files.values()].reduce(
+ (sum, src) => sum + (src.match(/createServerFn\(/g)?.length ?? 0),
+ 0,
+ )
+ return {
+ dir,
+ shared,
+ hash: workloadHash(files),
+ fileCount: files.size,
+ routeCount,
+ serverFnCount,
+ }
+}
+
+if (process.argv[1] === fileURLToPath(import.meta.url)) {
+ const variants = process.argv.slice(2).length
+ ? process.argv.slice(2)
+ : VARIANTS
+ for (const variant of variants) {
+ const info = writeApp(variant)
+ console.log(
+ `${variant}: ${info.fileCount} files, ${info.routeCount} route files, ${info.serverFnCount} server fns, hash ${info.hash} -> ${path.relative(process.cwd(), info.dir)}`,
+ )
+ }
+}
diff --git a/benchmarks/compiler-perf/scripts/heap-diff.mjs b/benchmarks/compiler-perf/scripts/heap-diff.mjs
new file mode 100644
index 0000000000..a9859e3e7f
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/heap-diff.mjs
@@ -0,0 +1,591 @@
+#!/usr/bin/env node
+// Diff of two V8 heap snapshots of the same process (the soak's snapshots
+// after cycles A and B; node ids are stable within a process).
+//
+// Usage: node --max-old-space-size=16000 heap-diff.mjs [--md out.md] [--json out.json] [--top 25]
+//
+// Reports:
+// - per constructor (node type + name): count and self size in A and B,
+// and the objects of B that did not exist in A ("new survivors": allocated
+// between the snapshots and still alive after GC);
+// - attribution of the new survivors' self size to the owner of their
+// retaining path: B's shortest path from the GC roots (weak edges
+// ignored) is walked from the object towards the roots, and the first
+// function (or class instance whose constructor is a function) defined in
+// a known package decides (`packages/` of this repository,
+// `node_modules/`, Node internals); the path itself is kept for the
+// largest groups.
+
+import fs from 'node:fs'
+import { parseArgs } from 'node:util'
+
+const { values: opts, positionals } = parseArgs({
+ allowPositionals: true,
+ options: {
+ md: { type: 'string' },
+ json: { type: 'string' },
+ top: { type: 'string', default: '25' },
+ // list the largest objects of one owner (a substring) in A and B, with paths
+ 'owner-detail': { type: 'string' },
+ },
+})
+const TOP = Number(opts.top)
+
+function load(file) {
+ const t0 = Date.now()
+ const snap = JSON.parse(fs.readFileSync(file, 'utf8'))
+ const meta = snap.snapshot.meta
+ const nf = meta.node_fields
+ const ef = meta.edge_fields
+ const s = {
+ file,
+ strings: snap.strings,
+ nodes: snap.nodes,
+ edges: snap.edges,
+ nodeTypes: meta.node_types[0],
+ edgeTypes: meta.edge_types[0],
+ N: nf.length,
+ E: ef.length,
+ iType: nf.indexOf('type'),
+ iName: nf.indexOf('name'),
+ iId: nf.indexOf('id'),
+ iSize: nf.indexOf('self_size'),
+ iEdges: nf.indexOf('edge_count'),
+ eType: ef.indexOf('type'),
+ eName: ef.indexOf('name_or_index'),
+ eTo: ef.indexOf('to_node'),
+ }
+ s.count = s.nodes.length / s.N
+ // first edge index of every node
+ s.firstEdge = new Uint32Array(s.count + 1)
+ let e = 0
+ for (let i = 0; i < s.count; i++) {
+ s.firstEdge[i] = e
+ e += s.nodes[i * s.N + s.iEdges] * s.E
+ }
+ s.firstEdge[s.count] = e
+ s.loadMs = Date.now() - t0
+ return s
+}
+
+const typeOf = (s, i) => s.nodeTypes[s.nodes[i * s.N + s.iType]]
+const nameOf = (s, i) => s.strings[s.nodes[i * s.N + s.iName]]
+const idOf = (s, i) => s.nodes[i * s.N + s.iId]
+const sizeOf = (s, i) => s.nodes[i * s.N + s.iSize]
+
+function* edgesOf(s, i) {
+ for (let e = s.firstEdge[i]; e < s.firstEdge[i + 1]; e += s.E) {
+ const type = s.edgeTypes[s.edges[e + s.eType]]
+ const raw = s.edges[e + s.eName]
+ const name = type === 'element' || type === 'hidden' ? raw : s.strings[raw]
+ yield { type, name, to: s.edges[e + s.eTo] / s.N }
+ }
+}
+
+function edgeTo(s, i, wanted) {
+ for (const e of edgesOf(s, i)) {
+ if (e.name === wanted) {
+ return e.to
+ }
+ }
+ return -1
+}
+
+const groupKey = (s, i) => {
+ const type = typeOf(s, i)
+ const name = nameOf(s, i)
+ if (
+ type === 'string' ||
+ type === 'concatenated string' ||
+ type === 'sliced string'
+ ) {
+ return `(string)`
+ }
+ if (type === 'number' || type === 'hidden' || type === 'code') {
+ return `(${type}) ${name.slice(0, 60)}`
+ }
+ return `${type === 'object' ? '' : `(${type}) `}${name.slice(0, 80)}`
+}
+
+/** The script URL a closure's code comes from (closure → shared → script, named by its URL). */
+function scriptOf(s, closure, cache) {
+ if (cache.has(closure)) {
+ return cache.get(closure)
+ }
+ let url = null
+ const shared = edgeTo(s, closure, 'shared')
+ if (shared >= 0) {
+ const script = edgeTo(s, shared, 'script')
+ if (script >= 0) {
+ // a Script node is named by its URL
+ url = nameOf(s, script) || null
+ }
+ }
+ cache.set(closure, url)
+ return url
+}
+
+/** Owner of a script URL: a package of this repository, an npm package, or Node. */
+export function ownerOfUrl(url) {
+ if (!url) {
+ return null
+ }
+ const u = url.replace(/^file:\/\//, '')
+ const pnpm =
+ /node_modules\/\.pnpm\/[^/]+\/node_modules\/((?:@[^/]+\/)?[^/]+)\//.exec(u)
+ if (pnpm) {
+ return pnpm[1]
+ }
+ const nm = /node_modules\/((?:@[^/]+\/)?[^/]+)\//.exec(u)
+ if (nm) {
+ return nm[1]
+ }
+ const repo = /\/packages\/([^/]+)\//.exec(u)
+ if (repo) {
+ return `@tanstack/${repo[1]} (repo)`
+ }
+ if (/\/benchmarks\/compiler-perf\/scripts\//.test(u)) {
+ return 'compiler-perf harness'
+ }
+ if (/\/benchmarks\/compiler-perf\/apps\//.test(u)) {
+ return 'app (vite.config)'
+ }
+ if (u.startsWith('node:') || !u.includes('/')) {
+ return 'node'
+ }
+ return u
+}
+
+/** The function a node is attributed to: a closure itself, or the constructor of an object. */
+function codeOwner(s, i, cache) {
+ const type = typeOf(s, i)
+ if (type === 'closure') {
+ return ownerOfUrl(scriptOf(s, i, cache))
+ }
+ if (type === 'object') {
+ // object → __proto__ → constructor (a closure for class instances)
+ const proto = edgeTo(s, i, '__proto__')
+ if (proto >= 0) {
+ const ctor = edgeTo(s, proto, 'constructor')
+ if (ctor >= 0 && typeOf(s, ctor) === 'closure') {
+ const owner = ownerOfUrl(scriptOf(s, ctor, cache))
+ // plain objects and builtins (Object, Map, Array) say nothing
+ if (owner && owner !== 'node') {
+ return owner
+ }
+ }
+ }
+ }
+ return null
+}
+
+/** Shortest-path tree from the root (BFS over strong edges). */
+function retainers(s) {
+ const parent = new Int32Array(s.count).fill(-1)
+ const via = new Int32Array(s.count).fill(-1)
+ parent[0] = 0
+ let queue = new Int32Array(s.count)
+ let head = 0
+ let tail = 0
+ queue[tail++] = 0
+ while (head < tail) {
+ const i = queue[head++]
+ // what only the snapshot's own call stack holds is no retention
+ if (
+ typeOf(s, i) === 'synthetic' &&
+ /Stack roots|Handle scope/.test(nameOf(s, i))
+ ) {
+ continue
+ }
+ for (let e = s.firstEdge[i]; e < s.firstEdge[i + 1]; e += s.E) {
+ const type = s.edgeTypes[s.edges[e + s.eType]]
+ if (type === 'weak' || type === 'shortcut') {
+ continue
+ }
+ const to = s.edges[e + s.eTo] / s.N
+ if (parent[to] === -1) {
+ parent[to] = i
+ via[to] = e
+ queue[tail++] = to
+ }
+ }
+ }
+ queue = null
+ return { parent, via }
+}
+
+function edgeLabel(s, e) {
+ const type = s.edgeTypes[s.edges[e + s.eType]]
+ const raw = s.edges[e + s.eName]
+ return type === 'element' || type === 'hidden'
+ ? `[${raw}]`
+ : type === 'internal' || type === 'context'
+ ? `<${s.strings[raw]}>`
+ : `.${s.strings[raw]}`
+}
+
+function pathOf(s, tree, i, max = 14) {
+ const parts = []
+ let cur = i
+ while (cur !== 0 && tree.parent[cur] >= 0 && parts.length < max) {
+ parts.push(`${groupKey(s, cur)}${edgeLabel(s, tree.via[cur])}`)
+ cur = tree.parent[cur]
+ }
+ return parts.reverse().join(' ← ').slice(0, 1200)
+}
+
+/** Self size of every reachable object of a snapshot, by owner of its retaining path. */
+function ownerTotals(s, detail) {
+ const tree = retainers(s)
+ const scriptCache = new Map()
+ const cache = new Map()
+ const totals = new Map()
+ const byGroup = new Map()
+ for (let i = 1; i < s.count; i++) {
+ if (tree.parent[i] === -1) {
+ continue
+ }
+ const seen = []
+ let cur = i
+ let owner = null
+ while (cur > 0) {
+ if (cache.has(cur)) {
+ owner = cache.get(cur)
+ break
+ }
+ seen.push(cur)
+ owner = codeOwner(s, cur, scriptCache)
+ if (owner) {
+ break
+ }
+ const p = tree.parent[cur]
+ if (p < 0 || p === cur) {
+ break
+ }
+ cur = p
+ }
+ owner ??= '(unattributed: root, system or builtins only)'
+ for (const n of seen) {
+ cache.set(n, owner)
+ }
+ if (detail && owner.includes(detail) && sizeOf(s, i) >= 2048) {
+ detail.list.push({
+ size: sizeOf(s, i),
+ group: groupKey(s, i),
+ path: pathOf(s, tree, i, 10),
+ })
+ }
+ totals.set(owner, (totals.get(owner) ?? 0) + sizeOf(s, i))
+ let groups = byGroup.get(owner)
+ if (!groups) {
+ groups = new Map()
+ byGroup.set(owner, groups)
+ }
+ const k = groupKey(s, i)
+ const g = groups.get(k) ?? { count: 0, size: 0 }
+ g.count++
+ g.size += sizeOf(s, i)
+ groups.set(k, g)
+ }
+ return { totals, byGroup }
+}
+
+export function diff(fileA, fileB) {
+ const a = load(fileA)
+ const byA = new Map()
+ const idsA = new Set()
+ let totalA = 0
+ for (let i = 0; i < a.count; i++) {
+ idsA.add(idOf(a, i))
+ const k = groupKey(a, i)
+ const g = byA.get(k) ?? { count: 0, size: 0 }
+ g.count++
+ g.size += sizeOf(a, i)
+ totalA += sizeOf(a, i)
+ byA.set(k, g)
+ }
+ const loadA = a.loadMs
+ const detailOf = () => {
+ if (!opts['owner-detail']) {
+ return undefined
+ }
+ const d = new String(opts['owner-detail'])
+ d.list = []
+ return d
+ }
+ const detailA = detailOf()
+ const { totals: ownersA, byGroup: groupsA } = ownerTotals(a, detailA)
+ // free A before loading B
+ a.nodes = a.edges = a.strings = null
+ const b = load(fileB)
+ const detailB = detailOf()
+ const { byGroup: groupsB } = ownerTotals(b, detailB)
+ if (detailA) {
+ for (const [name, d] of [
+ ['A', detailA],
+ ['B', detailB],
+ ]) {
+ console.log(`--- ${name}: largest objects of ${d}`)
+ for (const o of d.list.sort((x, y) => y.size - x.size).slice(0, 25)) {
+ console.log(`${(o.size / 1024).toFixed(1)} KB ${o.group}: ${o.path}`)
+ }
+ }
+ }
+ const tree = retainers(b)
+ const byB = new Map()
+ const fresh = new Map()
+ const owners = new Map()
+ const ownersAll = new Map()
+ const scriptCache = new Map()
+ const ownerCache = new Map()
+ let totalB = 0
+ let freshTotal = 0
+ let unreachable = 0
+ const ownerOfNode = (i) => {
+ // walk towards the root; the first node with a code owner decides
+ const seen = []
+ let cur = i
+ let owner = null
+ while (cur > 0) {
+ if (ownerCache.has(cur)) {
+ owner = ownerCache.get(cur)
+ break
+ }
+ seen.push(cur)
+ const o = codeOwner(b, cur, scriptCache)
+ if (o) {
+ owner = o
+ break
+ }
+ const p = tree.parent[cur]
+ if (p < 0 || p === cur) {
+ break
+ }
+ cur = p
+ }
+ owner ??= '(unattributed: root, system or builtins only)'
+ for (const n of seen) {
+ ownerCache.set(n, owner)
+ }
+ return owner
+ }
+ for (let i = 0; i < b.count; i++) {
+ const k = groupKey(b, i)
+ const size = sizeOf(b, i)
+ totalB += size
+ const g = byB.get(k) ?? { count: 0, size: 0 }
+ g.count++
+ g.size += size
+ byB.set(k, g)
+ if (tree.parent[i] !== -1 && i > 0) {
+ const owner = ownerOfNode(i)
+ ownersAll.set(owner, (ownersAll.get(owner) ?? 0) + size)
+ }
+ if (!idsA.has(idOf(b, i))) {
+ if (tree.parent[i] === -1) {
+ unreachable += size
+ continue
+ }
+ freshTotal += size
+ const f = fresh.get(k) ?? { count: 0, size: 0, sample: i }
+ f.count++
+ f.size += size
+ fresh.set(k, f)
+ const owner = ownerOfNode(i)
+ const o = owners.get(owner) ?? { count: 0, size: 0, groups: new Map() }
+ o.count++
+ o.size += size
+ const og = o.groups.get(k) ?? { count: 0, size: 0, sample: i }
+ og.count++
+ og.size += size
+ o.groups.set(k, og)
+ owners.set(owner, o)
+ }
+ }
+ const constructors = [...new Set([...byA.keys(), ...byB.keys()])]
+ .map((k) => {
+ const ga = byA.get(k) ?? { count: 0, size: 0 }
+ const gb = byB.get(k) ?? { count: 0, size: 0 }
+ return {
+ group: k,
+ countA: ga.count,
+ countB: gb.count,
+ sizeA: ga.size,
+ sizeB: gb.size,
+ dSize: gb.size - ga.size,
+ dCount: gb.count - ga.count,
+ }
+ })
+ .sort((x, y) => y.dSize - x.dSize)
+ const freshGroups = [...fresh.entries()]
+ .map(([group, f]) => ({
+ group,
+ count: f.count,
+ size: f.size,
+ path: pathOf(b, tree, f.sample),
+ }))
+ .sort((x, y) => y.size - x.size)
+ const owned = [...owners.entries()]
+ .map(([owner, o]) => ({
+ owner,
+ count: o.count,
+ size: o.size,
+ groups: [...o.groups.entries()]
+ .map(([group, g]) => ({
+ group,
+ count: g.count,
+ size: g.size,
+ path: pathOf(b, tree, g.sample),
+ }))
+ .sort((x, y) => y.size - x.size)
+ .slice(0, 6),
+ }))
+ .sort((x, y) => y.size - x.size)
+ return {
+ a: fileA,
+ b: fileB,
+ loadMs: [loadA, b.loadMs],
+ totalA,
+ totalB,
+ freshTotal,
+ unreachableFresh: unreachable,
+ constructors,
+ freshGroups,
+ owners: owned,
+ retainedByOwnerB: [...ownersAll.entries()]
+ .map(([owner, size]) => ({ owner, size }))
+ .sort((x, y) => y.size - x.size),
+ ownerDelta: [...new Set([...ownersA.keys(), ...ownersAll.keys()])]
+ .map((owner) => ({
+ owner,
+ a: ownersA.get(owner) ?? 0,
+ b: ownersAll.get(owner) ?? 0,
+ delta: (ownersAll.get(owner) ?? 0) - (ownersA.get(owner) ?? 0),
+ }))
+ .sort((x, y) => y.delta - x.delta),
+ ownerGroupDelta: [...new Set([...groupsA.keys(), ...groupsB.keys()])].map(
+ (owner) => {
+ const ga = groupsA.get(owner) ?? new Map()
+ const gb = groupsB.get(owner) ?? new Map()
+ return {
+ owner,
+ groups: [...new Set([...ga.keys(), ...gb.keys()])]
+ .map((group) => ({
+ group,
+ countA: ga.get(group)?.count ?? 0,
+ countB: gb.get(group)?.count ?? 0,
+ delta: (gb.get(group)?.size ?? 0) - (ga.get(group)?.size ?? 0),
+ }))
+ .sort((x, y) => y.delta - x.delta)
+ .slice(0, 8),
+ }
+ },
+ ),
+ }
+}
+
+const kb = (v) => (v / 1024).toFixed(1)
+
+function markdown(r) {
+ const out = []
+ out.push(
+ `Snapshots: \`${r.a.split('/').pop()}\` → \`${r.b.split('/').pop()}\`. Self size total ${kb(r.totalA)} → ${kb(r.totalB)} KB (Δ ${kb(r.totalB - r.totalA)} KB). Objects of B not in A and reachable (new survivors): ${kb(r.freshTotal)} KB.`,
+ '',
+ '**New survivors by owner of the retaining path** (first function or class instance on the shortest path towards the GC roots defined in a package):',
+ '',
+ '| owner | objects | KB | largest groups (count, KB) |',
+ '|---|---:|---:|---|',
+ )
+ for (const o of r.owners.slice(0, TOP)) {
+ out.push(
+ `| ${o.owner} | ${o.count} | ${kb(o.size)} | ${o.groups
+ .slice(0, 4)
+ .map(
+ (g) => `${g.group.replace(/\|/g, '\\|')} (${g.count}, ${kb(g.size)})`,
+ )
+ .join('; ')} |`,
+ )
+ }
+ out.push(
+ '',
+ '**Retained self size by owner, A → B** (every reachable object, attributed as above; sorted by growth):',
+ '',
+ '| owner | KB in A | KB in B | Δ KB |',
+ '|---|---:|---:|---:|',
+ ...r.ownerDelta
+ .slice(0, TOP)
+ .map((o) => `| ${o.owner} | ${kb(o.a)} | ${kb(o.b)} | ${kb(o.delta)} |`),
+ )
+ out.push(
+ '',
+ '**Growth by owner and constructor** (owners with growth, largest constructor deltas; count A → B, Δ KB):',
+ '',
+ ...r.ownerDelta
+ .filter((o) => o.delta > 1024)
+ .slice(0, 12)
+ .map((o) => {
+ const g = r.ownerGroupDelta.find((x) => x.owner === o.owner)
+ return `- ${o.owner} (+${kb(o.delta)} KB): ${g.groups
+ .filter((x) => x.delta > 0)
+ .slice(0, 6)
+ .map((x) => `${x.group} ${x.countA}→${x.countB} +${kb(x.delta)}`)
+ .join('; ')}`
+ }),
+ )
+ out.push(
+ '',
+ '**All of B by owner** (same attribution, every reachable object; KB of self size):',
+ '',
+ r.retainedByOwnerB
+ .slice(0, 15)
+ .map((o) => `${o.owner} ${kb(o.size)}`)
+ .join(' · '),
+ )
+ out.push(
+ '',
+ '**Constructors by self-size growth** (B − A):',
+ '',
+ '| group | count A → B | KB A → B | Δ KB |',
+ '|---|---|---|---:|',
+ )
+ for (const c of r.constructors.slice(0, TOP)) {
+ out.push(
+ `| ${c.group.replace(/\|/g, '\\|')} | ${c.countA} → ${c.countB} | ${kb(c.sizeA)} → ${kb(c.sizeB)} | ${kb(c.dSize)} |`,
+ )
+ }
+ out.push(
+ '',
+ '**Largest groups of new survivors, with a sample retaining path** (root first):',
+ '',
+ )
+ for (const g of r.freshGroups.slice(0, 12)) {
+ out.push(
+ `- ${g.group} — ${g.count} objects, ${kb(g.size)} KB: \`${g.path.replace(/`/g, "'")}\``,
+ )
+ }
+ return out.join('\n') + '\n'
+}
+
+if (positionals.length === 2) {
+ const r = diff(positionals[0], positionals[1])
+ const md = markdown(r)
+ if (opts.md) {
+ fs.writeFileSync(opts.md, md)
+ } else {
+ console.log(md)
+ }
+ if (opts.json) {
+ fs.writeFileSync(
+ opts.json,
+ JSON.stringify(
+ {
+ ...r,
+ constructors: r.constructors.slice(0, 200),
+ freshGroups: r.freshGroups.slice(0, 200),
+ },
+ null,
+ 2,
+ ),
+ )
+ }
+}
diff --git a/benchmarks/compiler-perf/scripts/hook-timing.mjs b/benchmarks/compiler-perf/scripts/hook-timing.mjs
new file mode 100644
index 0000000000..7ff6709e13
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/hook-timing.mjs
@@ -0,0 +1,159 @@
+// Per-plugin hook timing for Vite (dev and build).
+//
+// The app configs include `hookTimingPlugin()`; it also installs the floor
+// scenarios' record/replay (replay.mjs) when COMPILER_PERF_REPLAY is set.
+//
+// Inert unless COMPILER_PERF_HOOKS_OUT names an output file. When enabled it
+// wraps the hooks of every resolved plugin (including Vite's own JS plugins;
+// Rolldown's native builtin plugins cannot be wrapped) and writes a summary on
+// process exit.
+//
+// Two numbers per plugin/hook:
+// - syncMs: time until the hook returned (for async hooks: until the first
+// await). Sequential on the main thread, so these add up to CPU time.
+// - settledMs: time until the returned promise settled. Includes time spent
+// waiting for other work (other modules, `this.resolve`, I/O), so it overlaps
+// between concurrent calls and must not be summed against wall-clock.
+
+import fs from 'node:fs'
+import { performance } from 'node:perf_hooks'
+import { replayVitePlugin } from './replay.mjs'
+
+const HOOKS = [
+ 'buildStart',
+ 'resolveId',
+ 'load',
+ 'transform',
+ 'moduleParsed',
+ 'renderChunk',
+ 'generateBundle',
+ 'writeBundle',
+ 'buildEnd',
+ 'closeBundle',
+ 'configureServer',
+ 'transformIndexHtml',
+ 'hotUpdate',
+ 'handleHotUpdate',
+ 'watchChange',
+]
+
+const WRAPPED = Symbol.for('compiler-perf.wrapped')
+// Vite bundles the config file, and builds may load it more than once, so
+// several copies of this module can coexist in one process: keep the state
+// global.
+const state = (globalThis[Symbol.for('compiler-perf.hook-timing')] ??= {
+ stats: new Map(),
+ installed: false,
+})
+const stats = state.stats
+
+function record(plugin, hook, syncMs, settledMs) {
+ const key = plugin + '\u0000' + hook
+ let entry = stats.get(key)
+ if (!entry) {
+ entry = { plugin, hook, calls: 0, syncMs: 0, settledMs: 0 }
+ stats.set(key, entry)
+ }
+ entry.calls++
+ entry.syncMs += syncMs
+ entry.settledMs += settledMs
+}
+
+function wrapFn(fn, pluginName, hook) {
+ if (fn[WRAPPED]) {
+ return fn
+ }
+ const wrapped = function (...args) {
+ const t0 = performance.now()
+ let result
+ try {
+ result = fn.apply(this, args)
+ } catch (error) {
+ const t = performance.now() - t0
+ record(pluginName, hook, t, t)
+ throw error
+ }
+ const t1 = performance.now()
+ if (result && typeof result.then === 'function') {
+ return result.then(
+ (value) => {
+ record(pluginName, hook, t1 - t0, performance.now() - t0)
+ return value
+ },
+ (error) => {
+ record(pluginName, hook, t1 - t0, performance.now() - t0)
+ throw error
+ },
+ )
+ }
+ record(pluginName, hook, t1 - t0, t1 - t0)
+ return result
+ }
+ wrapped[WRAPPED] = true
+ return wrapped
+}
+
+export function wrapPlugin(plugin) {
+ if (!plugin || typeof plugin !== 'object' || plugin[WRAPPED]) {
+ return
+ }
+ const name = plugin.name ?? '(anonymous)'
+ for (const hook of HOOKS) {
+ const value = plugin[hook]
+ if (typeof value === 'function') {
+ plugin[hook] = wrapFn(value, name, hook)
+ } else if (
+ value &&
+ typeof value === 'object' &&
+ typeof value.handler === 'function'
+ ) {
+ value.handler = wrapFn(value.handler, name, hook)
+ }
+ }
+ try {
+ plugin[WRAPPED] = true
+ } catch {}
+}
+
+export function hookTimingSummary() {
+ return [...stats.values()].sort((a, b) => b.syncMs - a.syncMs)
+}
+
+function install(outFile) {
+ if (state.installed) {
+ return
+ }
+ state.installed = true
+ process.on('exit', () => {
+ fs.writeFileSync(
+ outFile,
+ JSON.stringify({ pid: process.pid, hooks: hookTimingSummary() }, null, 2),
+ )
+ })
+}
+
+export function hookTimingPlugin() {
+ const outFile = process.env.COMPILER_PERF_HOOKS_OUT
+ if (!outFile) {
+ return replayVitePlugin() ?? { name: 'compiler-perf:hook-timing' }
+ }
+ install(outFile)
+ return {
+ name: 'compiler-perf:hook-timing',
+ enforce: 'pre',
+ configResolved(config) {
+ for (const plugin of config.plugins) {
+ wrapPlugin(plugin)
+ }
+ },
+ // Environment plugin lists can be resolved after configResolved
+ // (applyToEnvironment may return new plugin objects).
+ configureServer(server) {
+ for (const env of Object.values(server.environments ?? {})) {
+ for (const plugin of env.plugins ?? []) {
+ wrapPlugin(plugin)
+ }
+ }
+ },
+ }
+}
diff --git a/benchmarks/compiler-perf/scripts/ipc-agent.mjs b/benchmarks/compiler-perf/scripts/ipc-agent.mjs
new file mode 100644
index 0000000000..221d932ce9
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/ipc-agent.mjs
@@ -0,0 +1,77 @@
+// IPC handlers of a measured dev server process (the Vite dev driver, or the
+// Rsbuild CLI preloaded with `node --import ipc-agent.mjs` and
+// COMPILER_PERF_IPC_AGENT=1):
+// <- { type: 'mem' } -> { type: 'mem', result }
+// <- { type: 'stats' } -> { type: 'stats', result }
+// <- { type: 'heap-snapshot', file } -> { type: 'heap-snapshot', file, ms }
+//
+// `stats` reads the compiler's cache sizes from the process-global registry
+// the TanStack packages fill when TSR_COMPILER_STATS=1 (see
+// `compilerStats()` in @tanstack/router-utils/compiler); a checkout without
+// it reports `{}`.
+
+import { performance } from 'node:perf_hooks'
+import v8 from 'node:v8'
+import { memorySnapshot } from './memory.mjs'
+
+const REGISTRY = Symbol.for('tanstack.compiler.stats')
+
+/** Cache sizes per label (summed over live instances). */
+export function compilerStatsSnapshot() {
+ const out = {}
+ for (const s of globalThis[REGISTRY] ?? []) {
+ const owner = s.owner.deref()
+ if (!owner) {
+ continue
+ }
+ const sum = (out[s.label] ??= { instances: 0 })
+ sum.instances++
+ for (const [k, v] of Object.entries(s.read(owner))) {
+ sum[k] = (sum[k] ?? 0) + v
+ }
+ }
+ return out
+}
+
+/** Full GCs with event-loop turns in between (finalizers release native memory). */
+export async function settleGc() {
+ for (let i = 0; i < 3; i++) {
+ globalThis.gc?.()
+ await new Promise((r) => setImmediate(r))
+ await new Promise((r) => setTimeout(r, 5))
+ }
+}
+
+export function installIpcAgent() {
+ if (globalThis.__compilerPerfIpcAgent || !process.send) {
+ return
+ }
+ globalThis.__compilerPerfIpcAgent = true
+ process.on('message', async (msg) => {
+ if (msg?.type === 'mem') {
+ await settleGc()
+ process.send({ type: 'mem', result: memorySnapshot() })
+ } else if (msg?.type === 'stats') {
+ const t0 = performance.now()
+ const result = compilerStatsSnapshot()
+ process.send({
+ type: 'stats',
+ result,
+ ms: performance.now() - t0,
+ })
+ } else if (msg?.type === 'heap-snapshot') {
+ await settleGc()
+ const t0 = performance.now()
+ const file = v8.writeHeapSnapshot(msg.file)
+ process.send({
+ type: 'heap-snapshot',
+ file,
+ ms: performance.now() - t0,
+ })
+ }
+ })
+}
+
+if (process.env.COMPILER_PERF_IPC_AGENT === '1') {
+ installIpcAgent()
+}
diff --git a/benchmarks/compiler-perf/scripts/memory.mjs b/benchmarks/compiler-perf/scripts/memory.mjs
new file mode 100644
index 0000000000..5110ecdeb3
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/memory.mjs
@@ -0,0 +1,101 @@
+// Memory snapshots for the harness's build and dev processes.
+//
+// - `memorySnapshot()`: forces a full GC (needs --expose-gc) and returns the
+// V8 heap, external memory and RSS of this process, its peak RSS so far,
+// and the RSS of its descendant processes.
+// - Preloaded with `node --import ` and COMPILER_PERF_MEM_OUT set,
+// writes a snapshot to that file when the process exits (CLI builds).
+
+import fs from 'node:fs'
+import v8 from 'node:v8'
+
+const MB = 2 ** 20
+
+function procStatusKb(pid, field) {
+ try {
+ const match = fs
+ .readFileSync(`/proc/${pid}/status`, 'utf8')
+ .match(new RegExp(`^${field}:\\s+(\\d+) kB`, 'm'))
+ return match ? Number(match[1]) : undefined
+ } catch {
+ return undefined
+ }
+}
+
+/** pid -> parent pid for every process (Linux). */
+function processTree() {
+ const parents = new Map()
+ try {
+ for (const entry of fs.readdirSync('/proc')) {
+ if (!/^\d+$/.test(entry)) {
+ continue
+ }
+ try {
+ const stat = fs.readFileSync(`/proc/${entry}/stat`, 'utf8')
+ parents.set(
+ Number(entry),
+ Number(stat.slice(stat.lastIndexOf(')') + 2).split(' ')[1]),
+ )
+ } catch {}
+ }
+ } catch {}
+ return parents
+}
+
+export function descendants(rootPid, parents = processTree()) {
+ const out = []
+ for (const pid of parents.keys()) {
+ for (let p = parents.get(pid); p > 1; p = parents.get(p) ?? 0) {
+ if (p === rootPid) {
+ out.push(pid)
+ break
+ }
+ }
+ }
+ return out
+}
+
+/** Current RSS (MB) of a process tree's descendants, excluding the root. */
+export function descendantsRssMb(rootPid) {
+ let kb = 0
+ for (const pid of descendants(rootPid)) {
+ kb += procStatusKb(pid, 'VmRSS') ?? 0
+ }
+ return kb / 1024
+}
+
+export function memorySnapshot() {
+ const gc = globalThis.gc
+ if (gc) {
+ // Two passes: the first can leave objects pending finalization.
+ gc()
+ gc()
+ }
+ const usage = process.memoryUsage()
+ const heap = v8.getHeapStatistics()
+ const peakKb = procStatusKb('self', 'VmHWM') ?? process.resourceUsage().maxRSS
+ const r = (v) => Math.round(v * 10) / 10
+ return {
+ gc: Boolean(gc),
+ heapUsedMb: r(heap.used_heap_size / MB),
+ heapTotalMb: r(heap.total_heap_size / MB),
+ externalMb: r(usage.external / MB),
+ arrayBuffersMb: r(usage.arrayBuffers / MB),
+ rssMb: r(usage.rss / MB),
+ peakRssMb: r(peakKb / 1024),
+ childrenRssMb: r(descendantsRssMb(process.pid)),
+ }
+}
+
+if (
+ process.env.COMPILER_PERF_MEM_OUT &&
+ !globalThis.__compilerPerfMemInstalled
+) {
+ globalThis.__compilerPerfMemInstalled = true
+ const out = process.env.COMPILER_PERF_MEM_OUT
+ // Do not pass the variable on to processes this one spawns.
+ delete process.env.COMPILER_PERF_MEM_OUT
+ process.on('exit', () => {
+ fs.writeFileSync(out, JSON.stringify(memorySnapshot()))
+ })
+}
diff --git a/benchmarks/compiler-perf/scripts/replay.mjs b/benchmarks/compiler-perf/scripts/replay.mjs
new file mode 100644
index 0000000000..367cd5142a
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/replay.mjs
@@ -0,0 +1,861 @@
+// Record/replay of the TanStack compiler's outputs, for the "floor" scenarios.
+//
+// Inert unless COMPILER_PERF_REPLAY is `record` or `replay`.
+//
+// - record: every hook of a TanStack plugin that returns code (Vite/Rolldown
+// `transform`, `load`, `renderChunk`; Rsbuild `api.transform` handlers;
+// unplugin `transform`/`load` hooks under Rspack; Rspack loaders shipped by
+// `@tanstack/*` packages) runs for real and its result is stored under
+// (environment, plugin, hook, id, hash of the input code). The store is
+// written to COMPILER_PERF_REPLAY_FILE on process exit.
+// - replay: the store is loaded when the plugin is created (before the
+// bundler starts; the load time is reported so the harness can subtract
+// it), and those hooks return the stored result without running. A call
+// without a stored result runs the real hook and counts as a miss.
+//
+// So a replay run produces the same modules as the recorded run while the
+// compiler's transforms cost (almost) nothing: its time is the floor for the
+// current output. Other hooks of the same plugins (resolveId, the route
+// generator in configResolved / Rspack beforeRun, hotUpdate, generateBundle,
+// ...) still run and are timed separately (`realHooks` in the stats).
+//
+// Plugins are selected by name (COMPILER_PERF_REPLAY_PLUGINS, a
+// case-insensitive regex, default `tanstack`) and Rspack loaders by the name
+// of the package that ships them (`@tanstack/*`), so the same harness works
+// on any compiler implementation.
+//
+// Limits: side effects of a replayed hook (state other hooks read later,
+// `this.addWatchFile`, `this.emitFile`, extra `this.load` calls) do not
+// happen in replay. The harness checks that replayed builds emit the same
+// files and that replayed dev servers serve the same modules.
+
+import crypto from 'node:crypto'
+import fs from 'node:fs'
+import path from 'node:path'
+import Module, { createRequire } from 'node:module'
+import { performance } from 'node:perf_hooks'
+import { pathToFileURL } from 'node:url'
+import v8 from 'node:v8'
+
+const env = process.env
+export const replayMode =
+ env.COMPILER_PERF_REPLAY === 'record' || env.COMPILER_PERF_REPLAY === 'replay'
+ ? env.COMPILER_PERF_REPLAY
+ : undefined
+const PLUGIN_RE = new RegExp(
+ env.COMPILER_PERF_REPLAY_PLUGINS ?? 'tanstack',
+ 'i',
+)
+
+// Hooks whose result is the code of a module or chunk.
+const REPLAYED = new Set(['transform', 'load', 'renderChunk'])
+// Other hooks of the selected plugins: run for real, timed.
+const TIMED = [
+ 'config',
+ 'configResolved',
+ 'configureServer',
+ 'buildStart',
+ 'resolveId',
+ 'moduleParsed',
+ 'generateBundle',
+ 'writeBundle',
+ 'buildEnd',
+ 'closeBundle',
+ 'transformIndexHtml',
+ 'hotUpdate',
+ 'handleHotUpdate',
+ 'watchChange',
+]
+const WRAPPED = Symbol.for('compiler-perf.replay.wrapped')
+const MISS = Symbol('miss')
+const UNDEFINED = '\u0000undefined'
+
+const require = createRequire(import.meta.url)
+
+// Vite bundles the config (and this file with it) and may load it more than
+// once per process; the loader wrapper imports this file separately. Keep the
+// state global.
+const state = (globalThis[Symbol.for('compiler-perf.replay')] ??= init())
+
+function init() {
+ const s = {
+ store: new Map(),
+ served: new Map(),
+ stats: {
+ mode: replayMode,
+ pid: process.pid,
+ loadMs: 0,
+ entries: 0,
+ hits: 0,
+ misses: 0,
+ missSamples: [],
+ missesByHook: {},
+ hitsByHook: {},
+ wrappedPlugins: [],
+ wrappedLoaders: [],
+ realHooks: {},
+ replayedHooks: {},
+ rspackHooks: {},
+ },
+ }
+ if (!replayMode) {
+ return s
+ }
+ if (replayMode === 'replay') {
+ const t0 = performance.now()
+ const raw = v8.deserialize(fs.readFileSync(env.COMPILER_PERF_REPLAY_FILE))
+ for (const [key, entry] of raw) {
+ entry.values = entry.values.map((v) =>
+ v === UNDEFINED ? undefined : revive(JSON.parse(v)),
+ )
+ s.store.set(key, entry)
+ }
+ s.stats.loadMs = performance.now() - t0
+ s.stats.entries = s.store.size
+ }
+ process.on('exit', () => {
+ if (replayMode === 'record' && env.COMPILER_PERF_REPLAY_FILE) {
+ const out = []
+ for (const [key, entry] of s.store) {
+ out.push([
+ key,
+ {
+ values: entry.values,
+ same: entry.values.every((v) => v === entry.values[0]),
+ },
+ ])
+ }
+ s.stats.entries = out.length
+ fs.mkdirSync(path.dirname(env.COMPILER_PERF_REPLAY_FILE), {
+ recursive: true,
+ })
+ fs.writeFileSync(env.COMPILER_PERF_REPLAY_FILE, v8.serialize(out))
+ }
+ if (env.COMPILER_PERF_REPLAY_STATS) {
+ const round = (o) => {
+ for (const v of Object.values(o)) {
+ v.syncMs = Math.round(v.syncMs * 10) / 10
+ v.settledMs = Math.round(v.settledMs * 10) / 10
+ }
+ return o
+ }
+ round(s.stats.realHooks)
+ round(s.stats.replayedHooks)
+ round(s.stats.rspackHooks)
+ s.stats.loadMs = Math.round(s.stats.loadMs * 10) / 10
+ fs.mkdirSync(path.dirname(env.COMPILER_PERF_REPLAY_STATS), {
+ recursive: true,
+ })
+ fs.writeFileSync(
+ env.COMPILER_PERF_REPLAY_STATS,
+ JSON.stringify(s.stats, null, 2),
+ )
+ }
+ })
+ return s
+}
+
+const stats = state.stats
+
+// ---------------------------------------------------------------------------
+// Store
+// ---------------------------------------------------------------------------
+
+export function hashCode(code) {
+ return crypto
+ .createHash('sha1')
+ .update(
+ typeof code === 'string' || Buffer.isBuffer(code) ? code : String(code),
+ )
+ .digest('base64')
+}
+
+// Fields of a hook result that bundlers read. Anything else (e.g. the lazy
+// `decodedMap`/`rawMappings` getters of a Babel generate() result returned as
+// is) is dropped.
+const RESULT_FIELDS = [
+ 'code',
+ 'content',
+ 'map',
+ 'meta',
+ 'moduleSideEffects',
+ 'moduleType',
+ 'syntheticNamedExports',
+]
+
+// Results are stored as JSON (functions dropped, maps flattened); Buffers are
+// kept as base64.
+function serialize(value) {
+ if (value === undefined) {
+ return UNDEFINED
+ }
+ if (
+ value &&
+ typeof value === 'object' &&
+ !Buffer.isBuffer(value) &&
+ ('code' in value || 'content' in value)
+ ) {
+ value = Object.fromEntries(
+ RESULT_FIELDS.filter((k) => value[k] !== undefined).map((k) => [
+ k,
+ value[k],
+ ]),
+ )
+ }
+ return JSON.stringify(value, (_key, v) =>
+ // Buffers arrive here already converted by Buffer#toJSON.
+ v?.type === 'Buffer' && Array.isArray(v.data)
+ ? { __buffer: Buffer.from(v.data).toString('base64') }
+ : v,
+ )
+}
+
+function revive(value) {
+ if (value && typeof value === 'object') {
+ if (typeof value.__buffer === 'string') {
+ return Buffer.from(value.__buffer, 'base64')
+ }
+ for (const key of Object.keys(value)) {
+ value[key] = revive(value[key])
+ }
+ }
+ return value
+}
+
+function save(key, value) {
+ let entry = state.store.get(key)
+ if (!entry) {
+ entry = { values: [] }
+ state.store.set(key, entry)
+ }
+ entry.values.push(serialize(value))
+}
+
+/** The stored result for the n-th call with this key, or MISS. */
+function take(key) {
+ const entry = state.store.get(key)
+ if (!entry) {
+ return MISS
+ }
+ const n = state.served.get(key) ?? 0
+ state.served.set(key, n + 1)
+ if (n >= entry.values.length && !entry.same) {
+ return MISS
+ }
+ const value = entry.values[Math.min(n, entry.values.length - 1)]
+ // The first use hands out the preloaded object; later ones get a copy in
+ // case the bundler mutated it.
+ return n === 0 || value === null || typeof value !== 'object'
+ ? value
+ : structuredClone(value)
+}
+
+function bump(table, label, syncMs, settledMs) {
+ const e = (table[label] ??= { calls: 0, syncMs: 0, settledMs: 0 })
+ e.calls++
+ e.syncMs += syncMs
+ e.settledMs += settledMs
+}
+
+function noteMiss(label, key) {
+ stats.misses++
+ stats.missesByHook[label] = (stats.missesByHook[label] ?? 0) + 1
+ if (stats.missSamples.length < 30) {
+ stats.missSamples.push(key.slice(0, 300))
+ }
+}
+
+/**
+ * Runs `run` (the real hook) or serves its stored result. `run` may return a
+ * promise; a replayed result is returned synchronously.
+ */
+export function serve(key, label, run) {
+ if (replayMode === 'replay') {
+ const hit = take(key)
+ if (hit !== MISS) {
+ stats.hits++
+ stats.hitsByHook[label] = (stats.hitsByHook[label] ?? 0) + 1
+ return hit
+ }
+ noteMiss(label, key)
+ return run()
+ }
+ const t0 = performance.now()
+ const result = run()
+ const t1 = performance.now()
+ if (result && typeof result.then === 'function') {
+ return result.then((value) => {
+ save(key, value)
+ bump(stats.replayedHooks, label, t1 - t0, performance.now() - t0)
+ return value
+ })
+ }
+ save(key, result)
+ bump(stats.replayedHooks, label, t1 - t0, t1 - t0)
+ return result
+}
+
+function timed(fn, label) {
+ return function (...args) {
+ const t0 = performance.now()
+ const result = fn.apply(this, args)
+ const t1 = performance.now()
+ if (result && typeof result.then === 'function') {
+ return result.then(
+ (value) => (
+ bump(stats.realHooks, label, t1 - t0, performance.now() - t0),
+ value
+ ),
+ (error) => {
+ bump(stats.realHooks, label, t1 - t0, performance.now() - t0)
+ throw error
+ },
+ )
+ }
+ bump(stats.realHooks, label, t1 - t0, t1 - t0)
+ return result
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Vite / Rolldown
+// ---------------------------------------------------------------------------
+
+function envName(ctx, options) {
+ return (
+ ctx?.environment?.name ??
+ (options?.ssr === true ? 'ssr' : options?.ssr === false ? 'client' : '')
+ )
+}
+
+// Vite's dependency optimizer and HMR add per-session `v=`/`t=` queries.
+export const stableId = (id) =>
+ typeof id === 'string' ? id.replace(/([?&])(v|t)=[\w-]+/g, '$1$2=*') : id
+
+function viteKey(ctx, plugin, hook, args) {
+ if (hook === 'transform') {
+ const [code, id, options] = args
+ return `t|${envName(ctx, options)}|${plugin}|${stableId(id)}|${hashCode(code)}`
+ }
+ if (hook === 'load') {
+ const [id, options] = args
+ return `l|${envName(ctx, options)}|${plugin}|${stableId(id)}`
+ }
+ const [code, chunk] = args
+ return `r|${envName(ctx)}|${plugin}|${chunk?.fileName}|${hashCode(code)}`
+}
+
+function wrapHook(plugin, hook, wrap) {
+ const value = plugin[hook]
+ if (typeof value === 'function') {
+ plugin[hook] = wrap(value)
+ } else if (
+ value &&
+ typeof value === 'object' &&
+ typeof value.handler === 'function'
+ ) {
+ value.handler = wrap(value.handler)
+ }
+}
+
+export function wrapVitePlugin(plugin) {
+ if (!plugin || typeof plugin !== 'object' || plugin[WRAPPED]) {
+ return
+ }
+ const name = plugin.name ?? ''
+ if (!PLUGIN_RE.test(name)) {
+ return
+ }
+ plugin[WRAPPED] = true
+ stats.wrappedPlugins.push(name)
+ for (const hook of REPLAYED) {
+ const label = `${name}:${hook}`
+ wrapHook(
+ plugin,
+ hook,
+ (fn) =>
+ function (...args) {
+ return serve(viteKey(this, name, hook, args), label, () =>
+ fn.apply(this, args),
+ )
+ },
+ )
+ }
+ for (const hook of TIMED) {
+ wrapHook(plugin, hook, (fn) => timed(fn, `${name}:${hook}`))
+ }
+}
+
+function flattenPlugins(list, out = []) {
+ for (const p of list ?? []) {
+ if (Array.isArray(p)) {
+ flattenPlugins(p, out)
+ } else if (p && typeof p === 'object' && typeof p.then !== 'function') {
+ out.push(p)
+ }
+ }
+ return out
+}
+
+/** Vite plugin that installs record/replay; undefined when inert. */
+export function replayVitePlugin() {
+ if (!replayMode) {
+ return undefined
+ }
+ return {
+ name: 'compiler-perf:replay',
+ enforce: 'pre',
+ // Wrap as early as possible so the route generator (configResolved) is
+ // timed; Vite has already flattened these plugin objects.
+ config(config) {
+ for (const p of flattenPlugins(config.plugins)) {
+ wrapVitePlugin(p)
+ }
+ },
+ configResolved(config) {
+ for (const p of config.plugins) {
+ wrapVitePlugin(p)
+ }
+ },
+ configureServer(server) {
+ for (const e of Object.values(server.environments ?? {})) {
+ for (const p of e.plugins ?? []) {
+ wrapVitePlugin(p)
+ }
+ }
+ },
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Rsbuild / Rspack
+// ---------------------------------------------------------------------------
+
+const packageNameCache = new Map()
+function packageNameOf(file) {
+ let dir = path.dirname(file)
+ const seen = []
+ let name
+ for (;;) {
+ if (packageNameCache.has(dir)) {
+ name = packageNameCache.get(dir)
+ break
+ }
+ seen.push(dir)
+ const pkg = path.join(dir, 'package.json')
+ if (fs.existsSync(pkg)) {
+ try {
+ name = JSON.parse(fs.readFileSync(pkg, 'utf8')).name
+ } catch {}
+ if (name) {
+ break
+ }
+ }
+ const parent = path.dirname(dir)
+ if (parent === dir) {
+ break
+ }
+ dir = parent
+ }
+ for (const d of seen) {
+ packageNameCache.set(d, name)
+ }
+ return name
+}
+
+function loaderPathOf(loader) {
+ if (typeof loader !== 'string' || loader.startsWith('builtin:')) {
+ return undefined
+ }
+ const file = loader.split('?')[0]
+ if (!path.isAbsolute(file)) {
+ try {
+ return require.resolve(file)
+ } catch {
+ return undefined
+ }
+ }
+ return file
+}
+
+function isTanstackLoader(loader) {
+ const file = loaderPathOf(loader)
+ return Boolean(file && packageNameOf(file)?.startsWith('@tanstack/'))
+}
+
+function compilerName(ctx) {
+ const native = ctx?.getNativeBuildContext?.()
+ return native?.compiler?.name ?? native?.compiler?.options?.name ?? ''
+}
+
+/** unplugin plugin objects reach their loaders through the loader options. */
+function wrapUnpluginPlugin(plugin) {
+ if (!plugin || plugin[WRAPPED] || !PLUGIN_RE.test(plugin.name ?? '')) {
+ return
+ }
+ plugin[WRAPPED] = true
+ const name = plugin.name
+ stats.wrappedPlugins.push(name)
+ wrapHook(
+ plugin,
+ 'transform',
+ (fn) =>
+ function (code, id) {
+ return serve(
+ `t|${compilerName(this)}|${name}|${stableId(id)}|${hashCode(code)}`,
+ `${name}:transform`,
+ () => fn.call(this, code, id),
+ )
+ },
+ )
+ wrapHook(
+ plugin,
+ 'load',
+ (fn) =>
+ function (id) {
+ return serve(
+ `l|${compilerName(this)}|${name}|${id}`,
+ `${name}:load`,
+ () => fn.call(this, id),
+ )
+ },
+ )
+ for (const hook of ['resolveId', 'buildStart', 'buildEnd', 'watchChange']) {
+ wrapHook(plugin, hook, (fn) => timed(fn, `${name}:${hook}`))
+ }
+}
+
+/**
+ * Wraps a TanStack Rspack loader in place: Rspack loads `commonjs`-type
+ * loaders with Node's require, so the wrapped function is put into the
+ * require cache under the loader's own path. The loader request (and with it
+ * module identifiers and chunk ids) stays unchanged.
+ */
+const wrappedLoaderFiles = new Set()
+function wrapLoaderFile(file) {
+ if (wrappedLoaderFiles.has(file)) {
+ return
+ }
+ wrappedLoaderFiles.add(file)
+ if (isEsmFile(file)) {
+ wrapEsmLoaderFile(file)
+ return
+ }
+ let mod
+ try {
+ mod = require(file)
+ } catch {
+ return
+ }
+ const inner = typeof mod === 'function' ? mod : mod?.default
+ if (typeof inner !== 'function' || mod.pitch || inner.pitch) {
+ return
+ }
+ const label = `loader:${packageNameOf(file)}/${path.basename(file)}`
+ const wrapped = function (source, map, meta) {
+ runWrappedLoader(this, inner, label, source, map, meta)
+ }
+ wrapped.raw = mod.raw ?? inner.raw
+ const entry = new Module(file)
+ entry.filename = file
+ entry.loaded = true
+ entry.exports = wrapped
+ require.cache[file] = entry
+ stats.wrappedLoaders.push(label)
+}
+
+function isEsmFile(file) {
+ if (file.endsWith('.mjs')) {
+ return true
+ }
+ if (!file.endsWith('.js')) {
+ return false
+ }
+ for (let dir = path.dirname(file); ; dir = path.dirname(dir)) {
+ const pkg = path.join(dir, 'package.json')
+ if (fs.existsSync(pkg)) {
+ try {
+ return JSON.parse(fs.readFileSync(pkg, 'utf8')).type === 'module'
+ } catch {
+ return false
+ }
+ }
+ if (path.dirname(dir) === dir) {
+ return false
+ }
+ }
+}
+
+/**
+ * ESM loaders (Rspack gives a loader in a `"type": "module"` package
+ * `type: 'module'` and `import()`s it): a module hook serves a wrapper module
+ * under the loader's own URL, which imports the real file under a query. The
+ * loader request stays unchanged. Must run before Rspack imports the loader.
+ */
+const ORIGINAL_QUERY = '?compiler-perf-original'
+const esmLoaderLabels = new Map()
+let esmHooksRegistered = false
+function wrapEsmLoaderFile(file) {
+ const url = pathToFileURL(file).href
+ const label = `loader:${packageNameOf(file)}/${path.basename(file)}`
+ esmLoaderLabels.set(url, label)
+ globalThis[Symbol.for('compiler-perf.replay.wrapEsmLoader')] ??= (
+ mod,
+ loaderLabel,
+ ) => {
+ const inner = mod.default
+ if (typeof inner !== 'function' || mod.pitch || inner.pitch) {
+ return inner
+ }
+ const wrapped = function (source, map, meta) {
+ runWrappedLoader(this, inner, loaderLabel, source, map, meta)
+ }
+ wrapped.raw = mod.raw ?? inner.raw
+ return wrapped
+ }
+ if (!esmHooksRegistered) {
+ esmHooksRegistered = true
+ Module.registerHooks({
+ load(target, context, nextLoad) {
+ const wrappedLabel = esmLoaderLabels.get(target)
+ if (wrappedLabel === undefined) {
+ return nextLoad(target, context)
+ }
+ return {
+ format: 'module',
+ shortCircuit: true,
+ source: `import * as mod from ${JSON.stringify(target + ORIGINAL_QUERY)}
+const wrap = globalThis[Symbol.for('compiler-perf.replay.wrapEsmLoader')]
+export default wrap(mod, ${JSON.stringify(wrappedLabel)})
+export const raw = mod.raw
+`,
+ }
+ },
+ })
+ }
+ stats.wrappedLoaders.push(label)
+}
+
+function wrapUse(use) {
+ if (typeof use === 'string') {
+ use = { loader: use }
+ }
+ if (!use || typeof use !== 'object') {
+ return use
+ }
+ const options = use.options ?? use.query
+ if (options && typeof options === 'object' && options.plugin) {
+ wrapUnpluginPlugin(options.plugin)
+ return use
+ }
+ if (isTanstackLoader(use.loader)) {
+ wrapLoaderFile(loaderPathOf(use.loader))
+ }
+ return use
+}
+
+function wrapRules(rules) {
+ if (!Array.isArray(rules)) {
+ return
+ }
+ for (const rule of rules) {
+ if (!rule || typeof rule !== 'object') {
+ continue
+ }
+ if (rule.loader && !rule.use) {
+ wrapUse({ loader: rule.loader, options: rule.options })
+ }
+ if (Array.isArray(rule.use)) {
+ rule.use.forEach(wrapUse)
+ } else if (typeof rule.use === 'function' && !rule.use[WRAPPED]) {
+ const fn = rule.use
+ rule.use = (data) => {
+ const result = fn(data)
+ ;(Array.isArray(result) ? result : [result]).forEach(wrapUse)
+ return result
+ }
+ rule.use[WRAPPED] = true
+ } else if (rule.use) {
+ wrapUse(rule.use)
+ }
+ wrapRules(rule.oneOf)
+ wrapRules(rule.rules)
+ }
+}
+
+/** Runs a wrapped loader (see wrapLoaderFile) through record/replay. */
+function runWrappedLoader(ctx, inner, label, source, map, meta) {
+ const callback = ctx.async()
+ const key = `L|${ctx._compiler?.name ?? ''}|${label}|${stableId(ctx.resource)}|${hashCode(source)}`
+ const run = () =>
+ new Promise((resolve, reject) => {
+ let done = false
+ let isAsync = false
+ const finish = (error, content, outMap) => {
+ if (done) {
+ return
+ }
+ done = true
+ if (error) {
+ reject(error)
+ } else {
+ resolve({ content, map: outMap ?? null })
+ }
+ }
+ // Same context, but the result comes back here.
+ const proxy = Object.create(ctx, {
+ async: {
+ value: () => {
+ isAsync = true
+ return finish
+ },
+ },
+ callback: {
+ value: (...a) => {
+ isAsync = true
+ finish(...a)
+ },
+ },
+ })
+ let ret
+ try {
+ ret = inner.call(proxy, source, map, meta)
+ } catch (error) {
+ finish(error)
+ return
+ }
+ if (ret && typeof ret.then === 'function') {
+ ret.then(
+ (value) => {
+ if (!isAsync) {
+ finish(null, value)
+ }
+ },
+ (error) => finish(error),
+ )
+ } else if (!isAsync) {
+ finish(null, ret)
+ }
+ })
+ Promise.resolve(serve(key, label, run)).then(
+ (result) => callback(null, result.content, result.map ?? undefined, meta),
+ (error) => callback(error),
+ )
+}
+
+/**
+ * Rspack virtual modules (`experiments.VirtualModulesPlugin#writeModule`) are
+ * how the TanStack Rsbuild/Rspack plugins emit generated modules whose content
+ * depends on what earlier transforms found (e.g. the server function
+ * resolver). Replay substitutes the n-th recorded write to a path.
+ */
+function wrapVirtualModules(rspack) {
+ const proto = rspack?.experiments?.VirtualModulesPlugin?.prototype
+ if (!proto || proto.writeModule[WRAPPED]) {
+ return
+ }
+ // The plugin keeps its compiler private; remember it to key writes by
+ // environment.
+ const compilers = new WeakMap()
+ const apply = proto.apply
+ proto.apply = function (compiler) {
+ compilers.set(this, compiler)
+ return apply.call(this, compiler)
+ }
+ const writeModule = proto.writeModule
+ proto.writeModule = function (filePath, contents) {
+ const env = compilers.get(this)?.name ?? ''
+ return writeModule.call(
+ this,
+ filePath,
+ serve(
+ `V|${env}|${filePath}`,
+ 'VirtualModulesPlugin:writeModule',
+ () => contents,
+ ),
+ )
+ }
+ proto.writeModule[WRAPPED] = true
+}
+
+class ReplayRspackPlugin {
+ apply(compiler) {
+ wrapVirtualModules(compiler.rspack)
+ const wrap = () => wrapRules(compiler.options.module?.rules)
+ wrap()
+ // The route generator runs in beforeRun/watchRun: time those hooks as a
+ // whole, from the first tap to the last.
+ for (const hook of ['beforeRun', 'watchRun']) {
+ let t0
+ compiler.hooks[hook].tap(
+ { name: 'compiler-perf:replay', stage: -1e9 },
+ () => {
+ wrap()
+ t0 = performance.now()
+ },
+ )
+ compiler.hooks[hook].tap(
+ { name: 'compiler-perf:replay', stage: 1e9 },
+ () => {
+ const ms = performance.now() - t0
+ bump(stats.rspackHooks, `${compiler.name ?? ''}:${hook}`, ms, ms)
+ },
+ )
+ }
+ }
+}
+
+function wrapRsbuildPlugin(plugin) {
+ const name = plugin.name
+ stats.wrappedPlugins.push(name)
+ return {
+ ...plugin,
+ setup(api) {
+ const proxy = new Proxy(api, {
+ get(target, prop) {
+ if (prop === 'transform') {
+ return (descriptor, handler) =>
+ target.transform(descriptor, (ctx) =>
+ serve(
+ `T|${ctx.environment?.name ?? ''}|${name}|${ctx.resource}|${hashCode(ctx.code)}`,
+ `${name}:transform`,
+ () => handler(ctx),
+ ),
+ )
+ }
+ return Reflect.get(target, prop)
+ },
+ })
+ return plugin.setup(proxy)
+ },
+ }
+}
+
+/** Wraps an Rsbuild config object (see run.mjs's rsbuild.perf.config.mjs). */
+export function wrapRsbuildConfig(config) {
+ if (!replayMode) {
+ return config
+ }
+ if (typeof config === 'function') {
+ return async (...args) => wrapRsbuildConfig(await config(...args))
+ }
+ const plugins = flattenPlugins(config.plugins).map((p) =>
+ PLUGIN_RE.test(p.name ?? '') && typeof p.setup === 'function'
+ ? wrapRsbuildPlugin(p)
+ : p,
+ )
+ plugins.push({
+ name: 'compiler-perf:replay',
+ setup(api) {
+ api.modifyRspackConfig({
+ order: 'post',
+ handler(rspackConfig, utils) {
+ wrapVirtualModules(utils.rspack)
+ wrapRules(rspackConfig.module?.rules)
+ ;(rspackConfig.plugins ??= []).push(new ReplayRspackPlugin())
+ },
+ })
+ },
+ })
+ return { ...config, plugins }
+}
diff --git a/benchmarks/compiler-perf/scripts/report.mjs b/benchmarks/compiler-perf/scripts/report.mjs
new file mode 100644
index 0000000000..b441378020
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/report.mjs
@@ -0,0 +1,254 @@
+import fs from 'node:fs'
+
+export function stats(samples) {
+ const sorted = [...samples].sort((a, b) => a - b)
+ const n = sorted.length
+ if (!n) {
+ return { n: 0 }
+ }
+ const q = (p) => sorted[Math.min(n - 1, Math.max(0, Math.ceil(p * n) - 1))]
+ const mean = sorted.reduce((a, b) => a + b, 0) / n
+ const sd = Math.sqrt(
+ sorted.reduce((a, b) => a + (b - mean) ** 2, 0) / Math.max(1, n - 1),
+ )
+ const median =
+ n % 2 ? sorted[(n - 1) / 2] : (sorted[n / 2 - 1] + sorted[n / 2]) / 2
+ const r = (v) => Math.round(v * 10) / 10
+ return {
+ n,
+ median: r(median),
+ p90: r(q(0.9)),
+ min: r(sorted[0]),
+ max: r(sorted[n - 1]),
+ mean: r(mean),
+ stdev: r(sd),
+ cv: mean ? Math.round((sd / mean) * 1000) / 1000 : 0,
+ samples,
+ }
+}
+
+export function summarize(results) {
+ const scenarios = {}
+ for (const [name, entry] of Object.entries(results.scenarios)) {
+ scenarios[name] = {
+ metrics: Object.fromEntries(
+ Object.entries(entry.metrics).map(([k, v]) => [k, stats(v)]),
+ ),
+ runs: entry.runs,
+ flaggedRuns: entry.runs.filter((r) => r.flagged).length,
+ maxOthersBusyDuring: Math.max(
+ 0,
+ ...entry.runs.map((r) => r.othersBusyDuring ?? 0),
+ ),
+ }
+ }
+ return { ...results, scenarios }
+}
+
+const fmt = (v) =>
+ v === undefined
+ ? 'n/a'
+ : v >= 100
+ ? Math.round(v).toLocaleString('en-US')
+ : String(v)
+
+const MEM_METRICS = [
+ 'peakRssMb',
+ 'heapUsedMb',
+ 'externalMb',
+ 'arrayBuffersMb',
+ 'rssMb',
+ 'childPeakRssMb',
+]
+
+// The metric each scenario is primarily judged by.
+export const PRIMARY = {
+ build: ['buildMs'],
+ 'dev-compile': ['compileAllMs', 'clientMs', 'ssrMs', 'listenMs'],
+ 'dev-cold': ['hydratedMs', 'listenMs'],
+ 'dev-warm': ['hydratedMs', 'listenMs'],
+ 'rsbuild-build': ['buildMs'],
+ 'rsbuild-dev-cold': ['hydratedMs', 'listenMs'],
+ hmr: ['updateMs'],
+ 'floor-build': [
+ 'buildMs',
+ 'rawBuildMs',
+ 'replayLoadMs',
+ 'generatorMs',
+ 'misses',
+ 'outputMismatch',
+ ],
+ 'floor-rsbuild-build': [
+ 'buildMs',
+ 'rawBuildMs',
+ 'replayLoadMs',
+ 'generatorMs',
+ 'misses',
+ 'outputMismatch',
+ ],
+ 'floor-dev-compile': [
+ 'compileAllMs',
+ 'clientMs',
+ 'ssrMs',
+ 'listenMs',
+ 'generatorMs',
+ 'misses',
+ 'outputMismatch',
+ ],
+ 'floor-dev-cold': [
+ 'hydratedMs',
+ 'listenMs',
+ 'replayLoadMs',
+ 'generatorMs',
+ 'misses',
+ ],
+ 'floor-hmr': ['updateMs'],
+ 'mem-build': MEM_METRICS,
+ 'mem-rsbuild-build': MEM_METRICS,
+ 'mem-dev-cold': MEM_METRICS,
+ 'mem-dev-compile': MEM_METRICS,
+ leak: [
+ 'heapGrowthMb',
+ 'rssGrowthMb',
+ 'externalGrowthMb',
+ 'arrayBuffersGrowthMb',
+ 'heapStartMb',
+ 'heapEndMb',
+ 'rssStartMb',
+ 'rssEndMb',
+ ],
+}
+
+// Real scenario and metric each floor scenario is compared with.
+export const FLOOR_OF = {
+ 'floor-build': ['build', 'buildMs'],
+ 'floor-rsbuild-build': ['rsbuild-build', 'buildMs'],
+ 'floor-dev-compile': ['dev-compile', 'compileAllMs'],
+ 'floor-dev-cold': ['dev-cold', 'hydratedMs'],
+ 'floor-hmr': ['hmr', 'updateMs'],
+}
+
+export function primaryMetrics(name, metrics) {
+ const kind = name.split('/')[1]
+ const keys = PRIMARY[kind] ?? Object.keys(metrics)
+ return keys.filter((k) => metrics[k])
+}
+
+export function writeMarkdown(summary, file) {
+ const lines = []
+ const m = summary.meta
+ lines.push(`# Compiler perf: ${summary.label}`)
+ lines.push('')
+ lines.push(
+ `- commit \`${m.commit}\` (${m.branch}${m.dirty ? ', dirty packages/' : ''})`,
+ )
+ lines.push(`- node ${m.node}, ${m.cpu}, ${m.memGb} GiB, ${m.platform}`)
+ lines.push(
+ `- versions: ${Object.entries(m.versions ?? {})
+ .map(([k, v]) => `${k}@${v}`)
+ .join(', ')}`,
+ )
+ lines.push(
+ `- runs ${m.options?.runs} (+${m.options?.warmup} warmup), HMR ${m.options?.hmrIterations} edits (+${m.options?.hmrWarmup} warmup); started ${m.startedAt}${m.finishedAt ? `, finished ${m.finishedAt}` : ' (incomplete)'}`,
+ )
+ for (const [variant, w] of Object.entries(summary.workloads)) {
+ lines.push(
+ `- workload ${variant}: ${w.files} files, ${w.routeFiles} route files, ${w.serverFns} server fns, hash \`${w.hash}\``,
+ )
+ }
+ lines.push('')
+ lines.push(
+ '| scenario | metric | median | p90 | min | max | cv | n | flagged | max others busy (cores) |',
+ )
+ lines.push('|---|---|---:|---:|---:|---:|---:|---:|---:|---:|')
+ for (const [name, entry] of Object.entries(summary.scenarios)) {
+ for (const key of primaryMetrics(name, entry.metrics)) {
+ const s = entry.metrics[key]
+ lines.push(
+ `| ${name} | ${key} | ${fmt(s.median)} | ${fmt(s.p90)} | ${fmt(s.min)} | ${fmt(s.max)} | ${(s.cv * 100).toFixed(1)}% | ${s.n} | ${entry.flaggedRuns || ''} | ${entry.maxOthersBusyDuring ?? ''} |`,
+ )
+ }
+ const reloads = entry.metrics.fullReloads ?? entry.metrics.reloads
+ if (reloads && reloads.max > 0) {
+ lines.push(
+ `| ${name} | ${entry.metrics.fullReloads ? 'fullReloads' : 'reloads'} (count) | ${reloads.median} | | ${reloads.min} | ${reloads.max} | | ${reloads.n} | |`,
+ )
+ }
+ }
+ const floorRows = []
+ for (const [name, entry] of Object.entries(summary.scenarios)) {
+ const [variant, kind, ...rest] = name.split('/')
+ const of = FLOOR_OF[kind]
+ const real = of && summary.scenarios[[variant, of[0], ...rest].join('/')]
+ const f = entry.metrics[of?.[1]]
+ const r = real?.metrics[of[1]]
+ if (!f || !r) {
+ continue
+ }
+ const gen = entry.metrics.generatorMs?.median
+ floorRows.push(
+ `| ${[variant, of[0], ...rest].join('/')} | ${of[1]} | ${fmt(r.median)} | ${fmt(f.median)} | ${fmt(Math.round((r.median - f.median) * 10) / 10)} | ${((f.median / r.median) * 100).toFixed(0)}% | ${gen === undefined ? '' : fmt(gen)} | ${entry.metrics.misses?.max ?? ''} | ${entry.metrics.outputMismatch?.max ?? ''} |`,
+ )
+ }
+ if (floorRows.length) {
+ lines.push('')
+ lines.push(
+ '## Floor: replayed TanStack hook outputs (medians; floor = compiler transforms cost ~0, same output)',
+ )
+ lines.push('')
+ lines.push(
+ '| scenario | metric | real | floor | real − floor | floor / real | generator (in floor) | max misses | output mismatches |',
+ )
+ lines.push('|---|---|---:|---:|---:|---:|---:|---:|---:|')
+ lines.push(...floorRows)
+ }
+ if (Object.keys(summary.attribution ?? {}).length) {
+ lines.push('')
+ lines.push(
+ '## Compiler attribution (single profiled run each; profiling inflates times)',
+ )
+ lines.push('')
+ lines.push(
+ '| run | wall ms | main-thread busy ms | compiler inclusive ms | share of busy | babel self | tanstack self | vite self | gc |',
+ )
+ lines.push('|---|---:|---:|---:|---:|---:|---:|---:|---:|')
+ for (const [name, a] of Object.entries(summary.attribution)) {
+ const cpu = a.cpu.main
+ if (!cpu) {
+ continue
+ }
+ const c = cpu.byCategory
+ lines.push(
+ `| ${name} | ${fmt(a.wallMs)} | ${fmt(cpu.busyMs)} | ${fmt(cpu.compilerInclusiveMs)} | ${(cpu.compilerShareOfBusy * 100).toFixed(1)}% | ${fmt(c.babel ?? 0)} | ${fmt(c['tanstack-compiler'] ?? 0)} | ${fmt(c.vite ?? 0)} | ${fmt(c['(gc)'] ?? 0)} |`,
+ )
+ }
+ for (const [name, a] of Object.entries(summary.attribution)) {
+ const ours = a.hooks
+ .filter((h) => /tanstack|router|start/i.test(h.plugin))
+ .slice(0, 12)
+ if (!ours.length) {
+ continue
+ }
+ lines.push('')
+ lines.push(
+ `### ${name}: TanStack plugin hooks (sync ms = main-thread time until the hook returned)`,
+ )
+ lines.push('')
+ lines.push('| plugin | hook | calls | sync ms |')
+ lines.push('|---|---|---:|---:|')
+ for (const h of ours) {
+ lines.push(
+ `| ${h.plugin} | ${h.hook} | ${h.calls} | ${fmt(Math.round(h.syncMs))} |`,
+ )
+ }
+ const allSync = a.hooks.reduce((sum, h) => sum + h.syncMs, 0)
+ const oursSync = a.hooks
+ .filter((h) => /tanstack/i.test(h.plugin))
+ .reduce((sum, h) => sum + h.syncMs, 0)
+ lines.push(
+ `| **all tanstack** | | | ${fmt(Math.round(oursSync))} of ${fmt(Math.round(allSync))} wrapped-hook ms |`,
+ )
+ }
+ }
+ fs.writeFileSync(file, lines.join('\n') + '\n')
+}
diff --git a/benchmarks/compiler-perf/scripts/run.mjs b/benchmarks/compiler-perf/scripts/run.mjs
new file mode 100644
index 0000000000..06da01ffea
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/run.mjs
@@ -0,0 +1,2097 @@
+#!/usr/bin/env node
+// Compiler performance harness: dev startup, HMR and production build on
+// generated TanStack Start / Router apps. See ../README.md.
+
+import { execFileSync, fork, spawn } from 'node:child_process'
+import fs from 'node:fs'
+import net from 'node:net'
+import os from 'node:os'
+import path from 'node:path'
+import { performance } from 'node:perf_hooks'
+import { parseArgs } from 'node:util'
+import crypto from 'node:crypto'
+import { createRequire } from 'node:module'
+import { pathToFileURL } from 'node:url'
+import { analyzeCpuProfileDir } from './cpuprofile.mjs'
+import {
+ ALL_VARIANTS,
+ PROBES,
+ VARIANTS,
+ appDir,
+ appsRoot,
+ benchRoot,
+ frameworkOf,
+ hasRsbuild,
+ isStart,
+ writeApp,
+} from './generate.mjs'
+import { descendantsRssMb } from './memory.mjs'
+import {
+ SOAK_FACTORY,
+ SOAK_RENAMED,
+ SOAK_ROUTE,
+ soakChildRoute,
+ soakFactorySource,
+ soakKinds,
+ soakRouteSource,
+ soakSetupFiles,
+} from './soak-files.mjs'
+import { summarize, writeMarkdown } from './report.mjs'
+
+const repoRoot = path.resolve(benchRoot, '../..')
+const require = createRequire(path.join(benchRoot, 'package.json'))
+const now = () => performance.timeOrigin + performance.now()
+const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
+
+const ALL_SCENARIOS = [
+ 'dev-cold',
+ 'dev-warm',
+ 'dev-compile',
+ 'hmr',
+ 'build',
+ 'profile',
+ 'rsbuild',
+]
+// Not in the default set: `rsbuild-build`, `rsbuild-dev` (the halves of
+// `rsbuild`), `floor`, `memory`, `leak`, `soak`.
+const EXTRA_SCENARIOS = [
+ 'rsbuild-build',
+ 'rsbuild-dev',
+ 'floor',
+ 'memory',
+ 'leak',
+ 'soak',
+]
+const FLOOR_KINDS = ['build', 'dev-compile', 'dev-cold', 'hmr', 'rsbuild-build']
+const { values: args } = parseArgs({
+ options: {
+ label: { type: 'string', default: 'run' },
+ out: { type: 'string' },
+ variants: { type: 'string', default: VARIANTS.join(',') },
+ scenarios: { type: 'string', default: ALL_SCENARIOS.join(',') },
+ runs: { type: 'string', default: '5' },
+ warmup: { type: 'string', default: '1' },
+ 'hmr-iterations': { type: 'string', default: '20' },
+ 'hmr-warmup': { type: 'string', default: '3' },
+ 'max-busy': { type: 'string', default: '1.5' },
+ 'quiet-timeout': { type: 'string', default: '1800' },
+ retries: { type: 'string', default: '5' },
+ 'skip-package-builds': { type: 'boolean', default: false },
+ port: { type: 'string', default: '4810' },
+ floor: { type: 'string', default: FLOOR_KINDS.join(',') },
+ 'memory-runs': { type: 'string', default: '3' },
+ 'leak-cycles': { type: 'string', default: '50' },
+ 'soak-cycles': { type: 'string', default: '500' },
+ 'soak-every': { type: 'string', default: '25' },
+ 'soak-snapshots': { type: 'string', default: '0,100,500' },
+ 'soak-bundlers': { type: 'string', default: 'vite' },
+ 'soak-modes': { type: 'string', default: 'real' },
+ 'soak-heap-dir': { type: 'string' },
+ 'soak-kinds': { type: 'string' },
+ help: { type: 'boolean', default: false },
+ },
+})
+
+if (args.help) {
+ console.log(`Usage: node scripts/run.mjs [options]
+ --label result label (default "run")
+ --out output directory (default results/)
+ --variants ${VARIANTS.join(',')} (default; all: ${ALL_VARIANTS.join(',')})
+ --scenarios ${ALL_SCENARIOS.join(',')} (default)
+ also: ${EXTRA_SCENARIOS.join(',')}
+ --runs measured runs for startup/build (default 5)
+ --warmup discarded runs before measuring (default 1)
+ --hmr-iterations measured edits per HMR kind (default 20)
+ --hmr-warmup discarded edits per HMR kind (default 3)
+ --max-busy wait until other processes use fewer cores (default 1.5)
+ --quiet-timeout max wait for a quiet machine, then flag the run (default 1800)
+ --retries repeat runs flagged for load during the run (default 5 per scenario)
+ --floor floor (record/replay) scenarios, default ${FLOOR_KINDS.join(',')}
+ --memory-runs runs per memory scenario (default 3)
+ --leak-cycles HMR edit+revert cycles in the leak check (default 50)
+ --soak-cycles edit+revert cycles of the soak (default 500)
+ --soak-every GC'd memory + compiler cache sample every n cycles (default 25)
+ --soak-snapshots cycles after which a heap snapshot is written (default 0,100,500;
+ 0 = before the first sample, so V8's one-time snapshot overhead is not growth)
+ --soak-bundlers vite,rsbuild (rsbuild: react-start only; default vite)
+ --soak-modes real (default), replay (record + replayed transforms),
+ transform-off (Router app: no splitting/HMR, nothing compiled)
+ --soak-heap-dir heap snapshot directory (default /heap)
+ --soak-kinds only these edit kinds (debugging; default all, see soak-files.mjs)
+ --skip-package-builds do not run the Nx package builds first`)
+ process.exit(0)
+}
+
+const RUNS = Number(args.runs)
+const WARMUP = Number(args.warmup)
+const HMR_ITERATIONS = Number(args['hmr-iterations'])
+const HMR_WARMUP = Number(args['hmr-warmup'])
+const MAX_BUSY = Number(args['max-busy'])
+const QUIET_TIMEOUT_MS = Number(args['quiet-timeout']) * 1000
+const RETRIES = Number(args.retries)
+const PORT = Number(args.port)
+const MEMORY_RUNS = Number(args['memory-runs'])
+const LEAK_CYCLES = Number(args['leak-cycles'])
+const SOAK_CYCLES = Number(args['soak-cycles'])
+const SOAK_EVERY = Number(args['soak-every'])
+const SOAK_SNAPSHOTS = new Set(
+ args['soak-snapshots'].split(',').filter(Boolean).map(Number),
+)
+const SOAK_BUNDLERS = args['soak-bundlers'].split(',').filter(Boolean)
+const SOAK_MODES = args['soak-modes'].split(',').filter(Boolean)
+const variants = args.variants.split(',').filter(Boolean)
+for (const variant of variants) {
+ if (!ALL_VARIANTS.includes(variant)) {
+ throw new Error(`Unknown variant ${variant}`)
+ }
+}
+const scenarios = new Set(args.scenarios.split(',').filter(Boolean))
+if (scenarios.has('rsbuild')) {
+ scenarios.add('rsbuild-build')
+ scenarios.add('rsbuild-dev')
+}
+const floorKinds = new Set(args.floor.split(',').filter(Boolean))
+const outDir = path.resolve(
+ args.out ?? path.join(benchRoot, 'results', args.label),
+)
+fs.mkdirSync(outDir, { recursive: true })
+const logFile = path.join(outDir, 'run.log')
+const log = (...parts) => {
+ const line = `[${new Date().toISOString()}] ${parts.join(' ')}`
+ console.log(line)
+ fs.appendFileSync(logFile, line + '\n')
+}
+
+// ---------------------------------------------------------------------------
+// Machine load
+// ---------------------------------------------------------------------------
+
+function readCpuTimes() {
+ const line = fs.readFileSync('/proc/stat', 'utf8').split('\n')[0]
+ const parts = line.trim().split(/\s+/).slice(1).map(Number)
+ const idle = parts[3] + (parts[4] ?? 0)
+ const total = parts.reduce((a, b) => a + b, 0)
+ return { idle, total }
+}
+
+/** Cores kept busy by other processes over `ms` while the harness is idle. */
+async function busyCores(ms = 2000) {
+ if (!fs.existsSync('/proc/stat')) {
+ return os.loadavg()[0]
+ }
+ const a = readCpuTimes()
+ await sleep(ms)
+ const b = readCpuTimes()
+ const total = b.total - a.total
+ return total ? ((total - (b.idle - a.idle)) / total) * os.cpus().length : 0
+}
+
+/** CPU jiffies of this process and all its descendants (dev servers, builds, Chromium). */
+function ownTreeJiffies() {
+ const parents = new Map()
+ const times = new Map()
+ for (const entry of fs.readdirSync('/proc')) {
+ if (!/^\d+$/.test(entry)) {
+ continue
+ }
+ try {
+ const stat = fs.readFileSync(`/proc/${entry}/stat`, 'utf8')
+ // Fields after the parenthesised command: state ppid ... utime(14) stime(15) cutime(16) cstime(17)
+ const fields = stat.slice(stat.lastIndexOf(')') + 2).split(' ')
+ parents.set(Number(entry), Number(fields[1]))
+ times.set(
+ Number(entry),
+ Number(fields[11]) +
+ Number(fields[12]) +
+ Number(fields[13]) +
+ Number(fields[14]),
+ )
+ } catch {}
+ }
+ let total = 0
+ for (const [pid, t] of times) {
+ for (let p = pid; p > 1; p = parents.get(p) ?? 0) {
+ if (p === process.pid) {
+ total += t
+ break
+ }
+ }
+ }
+ return total
+}
+
+/**
+ * Measures how many cores other processes kept busy while a run executed:
+ * system-wide busy time minus the harness's own process tree. Exited
+ * children count through cutime/cstime once reaped.
+ */
+function startCpuWatch() {
+ if (!fs.existsSync('/proc/stat')) {
+ return () => ({})
+ }
+ const sys0 = readCpuTimes()
+ const own0 = ownTreeJiffies()
+ const t0 = now()
+ return () => {
+ const sys1 = readCpuTimes()
+ const own1 = ownTreeJiffies()
+ const elapsedS = (now() - t0) / 1000
+ // /proc/stat sums all CPUs; both counters use USER_HZ (100/s).
+ const sysBusy = sys1.total - sys0.total - (sys1.idle - sys0.idle)
+ const others =
+ Math.max(0, sysBusy - (own1 - own0)) / 100 / Math.max(elapsedS, 0.01)
+ const ours = (own1 - own0) / 100 / Math.max(elapsedS, 0.01)
+ return {
+ othersBusyDuring: Math.round(others * 100) / 100,
+ ownCoresDuring: Math.round(ours * 100) / 100,
+ }
+ }
+}
+
+async function waitForQuiet(sampleMs = 2000) {
+ const t0 = Date.now()
+ let busy = await busyCores(sampleMs)
+ while (busy > MAX_BUSY && Date.now() - t0 < QUIET_TIMEOUT_MS) {
+ log(
+ `machine busy (${busy.toFixed(1)} cores used by others, load1 ${os.loadavg()[0].toFixed(2)}), waiting`,
+ )
+ await sleep(15_000)
+ busy = await busyCores(sampleMs)
+ }
+ return {
+ busyCores: Math.round(busy * 100) / 100,
+ load1: Math.round(os.loadavg()[0] * 100) / 100,
+ flagged: busy > MAX_BUSY,
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Process helpers
+// ---------------------------------------------------------------------------
+
+function clean(dir, { cache = true } = {}) {
+ for (const sub of ['dist', 'dist-rsbuild', 'node_modules/.tmp']) {
+ fs.rmSync(path.join(dir, sub), { recursive: true, force: true })
+ }
+ if (cache) {
+ fs.rmSync(path.join(dir, '.vite-cache'), { recursive: true, force: true })
+ fs.rmSync(path.join(dir, 'node_modules/.cache'), {
+ recursive: true,
+ force: true,
+ })
+ }
+}
+
+function profilingEnv(profileDir) {
+ if (!profileDir) {
+ return { execArgv: [], env: {} }
+ }
+ fs.rmSync(profileDir, { recursive: true, force: true })
+ fs.mkdirSync(profileDir, { recursive: true })
+ return {
+ execArgv: ['--cpu-prof', `--cpu-prof-dir=${profileDir}`],
+ env: { COMPILER_PERF_HOOKS_OUT: path.join(profileDir, 'hooks.json') },
+ }
+}
+
+/**
+ * Node writes a `--cpu-prof` file while its process exits, so a profile of the
+ * tree (e.g. `vite build`'s) can still be incomplete when the run resolves:
+ * retry while one does not parse yet.
+ */
+async function readAttribution(profileDir, wallMs) {
+ let cpu
+ for (let attempt = 1; ; attempt++) {
+ try {
+ cpu = analyzeCpuProfileDir(profileDir)
+ break
+ } catch (error) {
+ if (!(error instanceof SyntaxError) || attempt === 50) {
+ throw error
+ }
+ await new Promise((resolve) => setTimeout(resolve, 200))
+ }
+ }
+ const hooksFile = path.join(profileDir, 'hooks.json')
+ const hooks = fs.existsSync(hooksFile)
+ ? JSON.parse(fs.readFileSync(hooksFile, 'utf8')).hooks
+ : []
+ return { wallMs, cpu, hooks }
+}
+
+// ---------------------------------------------------------------------------
+// Floor (record/replay, see replay.mjs) and memory instrumentation
+// ---------------------------------------------------------------------------
+
+const replayRoot = path.join(appsRoot, '.replay', args.label)
+const memoryModuleUrl = pathToFileURL(
+ path.join(benchRoot, 'scripts/memory.mjs'),
+).href
+
+/**
+ * Process options for instrumented runs.
+ * - replay: { mode: 'record' | 'replay', name } (store file per name)
+ * - mem: 'ipc' (dev driver answers { type: 'mem' }) or 'exit' (CLI process
+ * writes a snapshot on exit); both expose the GC.
+ */
+function instrumentation({ replay, mem } = {}) {
+ const env = {}
+ const execArgv = []
+ let statsFile
+ let memFile
+ if (replay) {
+ fs.mkdirSync(replayRoot, { recursive: true })
+ statsFile = path.join(replayRoot, `${replay.name}.${replay.mode}.json`)
+ fs.rmSync(statsFile, { force: true })
+ Object.assign(env, {
+ COMPILER_PERF_REPLAY: replay.mode,
+ COMPILER_PERF_REPLAY_FILE: path.join(replayRoot, `${replay.name}.bin`),
+ COMPILER_PERF_REPLAY_STATS: statsFile,
+ })
+ }
+ if (mem) {
+ execArgv.push('--expose-gc')
+ if (mem === 'exit') {
+ memFile = path.join(
+ os.tmpdir(),
+ `compiler-perf-mem-${process.pid}-${Date.now()}.json`,
+ )
+ fs.rmSync(memFile, { force: true })
+ execArgv.push('--import', memoryModuleUrl)
+ env.COMPILER_PERF_MEM_OUT = memFile
+ }
+ }
+ return {
+ env,
+ execArgv,
+ replay,
+ readReplayStats() {
+ if (!statsFile || !fs.existsSync(statsFile)) {
+ throw new Error(`${replay?.name}: no replay stats (${statsFile})`)
+ }
+ const stats = JSON.parse(fs.readFileSync(statsFile, 'utf8'))
+ if (stats.mode !== replay.mode || !stats.wrappedPlugins.length) {
+ throw new Error(
+ `${replay.name}: replay was not installed (${JSON.stringify(stats).slice(0, 300)})`,
+ )
+ }
+ return stats
+ },
+ readMemFile() {
+ if (!memFile || !fs.existsSync(memFile)) {
+ throw new Error(`no memory snapshot (${memFile})`)
+ }
+ const m = JSON.parse(fs.readFileSync(memFile, 'utf8'))
+ fs.rmSync(memFile, { force: true })
+ return m
+ },
+ }
+}
+
+/** Max RSS (MB) of the descendants of `pid`, sampled until stopped. */
+function pollChildrenRss(pid) {
+ let max = 0
+ const sample = () => {
+ max = Math.max(max, descendantsRssMb(pid))
+ }
+ const timer = setInterval(sample, 200)
+ return () => {
+ clearInterval(timer)
+ sample()
+ return Math.round(max * 10) / 10
+ }
+}
+
+const MEM_KEYS = [
+ 'peakRssMb',
+ 'rssMb',
+ 'heapUsedMb',
+ 'externalMb',
+ 'arrayBuffersMb',
+ 'childrenRssMb',
+]
+const pickMem = (snapshot) =>
+ Object.fromEntries(MEM_KEYS.map((k) => [k, snapshot[k]]))
+
+const cap = (k) => k[0].toUpperCase() + k.slice(1)
+
+/** Route generator time in a replay/record run (real hooks, see replay.mjs). */
+function generatorMs(stats) {
+ let ms = 0
+ for (const [label, h] of Object.entries(stats.realHooks ?? {})) {
+ if (
+ /generator/i.test(label) &&
+ /:(config|configResolved|buildStart)$/.test(label)
+ ) {
+ ms += h.settledMs
+ }
+ }
+ const rspack = Object.values(stats.rspackHooks ?? {}).map((h) => h.settledMs)
+ return ms + (rspack.length ? Math.max(...rspack) : 0)
+}
+
+/**
+ * Adds replay counters to a run's metrics. In replay mode the store's load
+ * time (paid before the bundler starts) is subtracted from `timeKeys`; the
+ * unadjusted values are kept as raw.
+ */
+function withReplay(metrics, inst, timeKeys) {
+ if (!inst.replay) {
+ return metrics
+ }
+ const stats = inst.readReplayStats()
+ const sum = (table, key) =>
+ Object.values(table ?? {}).reduce((a, h) => a + h[key], 0)
+ const out = { ...metrics }
+ if (inst.replay.mode === 'replay') {
+ for (const key of timeKeys) {
+ if (typeof out[key] === 'number') {
+ out[`raw${cap(key)}`] = out[key]
+ out[key] = out[key] - stats.loadMs
+ }
+ }
+ out.replayLoadMs = stats.loadMs
+ out.hits = stats.hits
+ out.misses = stats.misses
+ if (stats.misses) {
+ log(
+ ` ${stats.misses} replay misses: ${JSON.stringify(stats.missesByHook)}; e.g. ${stats.missSamples.slice(0, 3).join(' ; ')}`,
+ )
+ }
+ } else {
+ out.recordedEntries = stats.entries
+ // Main-thread time of the hooks that replay skips, in this record run.
+ out.replayedHookSyncMs = Math.round(sum(stats.replayedHooks, 'syncMs'))
+ }
+ out.generatorMs = Math.round(generatorMs(stats) * 10) / 10
+ out.otherTanstackHookSyncMs = Math.round(sum(stats.realHooks, 'syncMs'))
+ out.wrappedPlugins = stats.wrappedPlugins.length
+ out.wrappedLoaders = stats.wrappedLoaders.length
+ return out
+}
+
+/** Hash of every file under `dir` (build output comparison). */
+function hashDir(dir) {
+ const hash = crypto.createHash('sha256')
+ const files = []
+ const walk = (d) => {
+ for (const entry of fs.readdirSync(d, { withFileTypes: true })) {
+ const full = path.join(d, entry.name)
+ if (entry.isDirectory()) {
+ walk(full)
+ } else {
+ files.push(full)
+ }
+ }
+ }
+ if (!fs.existsSync(dir)) {
+ return 'missing'
+ }
+ walk(dir)
+ for (const file of files.sort()) {
+ hash.update(path.relative(dir, file) + '\0')
+ hash.update(fs.readFileSync(file))
+ hash.update('\0')
+ }
+ return hash.digest('hex').slice(0, 16)
+}
+
+function startViteDev(dir, { profileDir, inst = instrumentation() } = {}) {
+ const prof = profilingEnv(profileDir)
+ const spawnedAt = now()
+ const child = fork(
+ path.join(benchRoot, 'scripts/dev-driver.mjs'),
+ [dir, String(PORT)],
+ {
+ cwd: dir,
+ execArgv: [...prof.execArgv, ...inst.execArgv],
+ env: {
+ ...process.env,
+ ...prof.env,
+ ...inst.env,
+ NODE_ENV: 'development',
+ },
+ stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
+ },
+ )
+ return devHandle(child, spawnedAt)
+}
+
+const ipcAgentUrl = pathToFileURL(
+ path.join(benchRoot, 'scripts/ipc-agent.mjs'),
+).href
+
+/**
+ * `rsbuild dev` with the IPC agent preloaded (memory, compiler stats, heap
+ * snapshots); `listening` is posted once the port opens.
+ */
+function startRsbuildDev(dir, { inst = instrumentation(), replay } = {}) {
+ const spawnedAt = now()
+ const cliArgs = ['dev', '--port', String(PORT), '--host', '127.0.0.1']
+ if (replay) {
+ fs.writeFileSync(
+ path.join(dir, 'rsbuild.perf.config.mjs'),
+ RSBUILD_REPLAY_CONFIG,
+ )
+ cliArgs.push('-c', 'rsbuild.perf.config.mjs')
+ }
+ const child = fork(binPath('@rsbuild/core', 'rsbuild', dir), cliArgs, {
+ cwd: dir,
+ execArgv: [...inst.execArgv, '--import', ipcAgentUrl],
+ env: {
+ ...process.env,
+ ...inst.env,
+ NODE_ENV: 'development',
+ COMPILER_PERF_IPC_AGENT: '1',
+ },
+ stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
+ })
+ const handle = devHandle(child, spawnedAt, { stopMessage: false })
+ waitForPort(PORT).then(
+ (at) => handle.post({ type: 'listening', epochMs: at }),
+ () => {},
+ )
+ return handle
+}
+
+/** Message plumbing of a forked dev server process. */
+function devHandle(child, spawnedAt, { stopMessage = true } = {}) {
+ const output = []
+ child.stdout.on('data', (d) => output.push(String(d)))
+ child.stderr.on('data', (d) => output.push(String(d)))
+ const messages = []
+ const waiters = []
+ // Each message is delivered to one waitFor() call.
+ const post = (msg) => {
+ const w = waiters.find((w) => w.type === msg.type)
+ if (w) {
+ waiters.splice(waiters.indexOf(w), 1)
+ w.resolve(msg)
+ } else {
+ messages.push(msg)
+ }
+ }
+ child.on('message', post)
+ const exited = new Promise((resolve) => child.on('exit', resolve))
+ const waitFor = (type, timeoutMs = 300_000) => {
+ const found = messages.findIndex((m) => m.type === type)
+ if (found !== -1) {
+ return Promise.resolve(messages.splice(found, 1)[0])
+ }
+ return new Promise((resolve, reject) => {
+ const timer = setTimeout(
+ () =>
+ reject(
+ new Error(
+ `timeout waiting for ${type}\n${output.join('').slice(-4000)}`,
+ ),
+ ),
+ timeoutMs,
+ )
+ waiters.push({ type, resolve: (m) => (clearTimeout(timer), resolve(m)) })
+ exited.then((code) =>
+ reject(
+ new Error(
+ `dev server exited (${code}) before ${type}\n${output.join('').slice(-4000)}`,
+ ),
+ ),
+ )
+ })
+ }
+ const request = async (msg, timeoutMs = 60_000) => {
+ child.send(msg)
+ return waitFor(msg.type, timeoutMs)
+ }
+ return {
+ spawnedAt,
+ pid: child.pid,
+ output,
+ waitFor,
+ post,
+ request,
+ async memory() {
+ return (await request({ type: 'mem' })).result
+ },
+ send: (msg) => child.send(msg),
+ async stop() {
+ if (child.exitCode === null) {
+ if (stopMessage) {
+ child.send({ type: 'stop' })
+ } else {
+ child.kill('SIGTERM')
+ }
+ const timer = setTimeout(() => child.kill('SIGKILL'), 20_000)
+ await exited
+ clearTimeout(timer)
+ }
+ },
+ }
+}
+
+function binPath(pkg, bin, dir) {
+ // Prefer the instance linked into the app (shared with the plugins).
+ const linked = dir && path.join(dir, 'node_modules', pkg, 'package.json')
+ const pkgJson =
+ linked && fs.existsSync(linked)
+ ? linked
+ : require.resolve(`${pkg}/package.json`)
+ const meta = JSON.parse(fs.readFileSync(pkgJson, 'utf8'))
+ const rel = typeof meta.bin === 'string' ? meta.bin : meta.bin[bin]
+ return path.join(path.dirname(pkgJson), rel)
+}
+
+function runCommand(
+ cmd,
+ cmdArgs,
+ { cwd, env = {}, execArgv = [], pollChildren = false },
+) {
+ return new Promise((resolve, reject) => {
+ const t0 = now()
+ const child = spawn(process.execPath, [...execArgv, cmd, ...cmdArgs], {
+ cwd,
+ env: { ...process.env, ...env },
+ stdio: ['ignore', 'pipe', 'pipe'],
+ })
+ const stopPoll = pollChildren ? pollChildrenRss(child.pid) : () => undefined
+ const output = []
+ child.stdout.on('data', (d) => output.push(String(d)))
+ child.stderr.on('data', (d) => output.push(String(d)))
+ child.on('exit', (code) => {
+ const ms = now() - t0
+ const childPeakRssMb = stopPoll()
+ if (code !== 0) {
+ reject(
+ new Error(
+ `${path.basename(cmd)} ${cmdArgs.join(' ')} failed (${code})\n${output.join('').slice(-4000)}`,
+ ),
+ )
+ } else {
+ resolve({ ms, output: output.join(''), childPeakRssMb })
+ }
+ })
+ })
+}
+
+function waitForPort(port, timeoutMs = 300_000) {
+ const t0 = Date.now()
+ return new Promise((resolve, reject) => {
+ const attempt = () => {
+ const socket = net.connect(port, '127.0.0.1')
+ socket.once('connect', () => {
+ socket.destroy()
+ resolve(now())
+ })
+ socket.once('error', () => {
+ socket.destroy()
+ if (Date.now() - t0 > timeoutMs) {
+ reject(new Error(`port ${port} never opened`))
+ } else {
+ setTimeout(attempt, 10)
+ }
+ })
+ }
+ attempt()
+ })
+}
+
+// ---------------------------------------------------------------------------
+// Browser
+// ---------------------------------------------------------------------------
+
+let browser
+async function getBrowser() {
+ if (!browser) {
+ const { chromium } = require('@playwright/test')
+ browser = await chromium.launch()
+ }
+ return browser
+}
+
+const PROBE_INIT_SCRIPT = `(() => {
+ const check = () => {
+ const want = sessionStorage.getItem('__perfProbeWant')
+ if (!want) return
+ const kind = sessionStorage.getItem('__perfProbeKind')
+ const el = document.querySelector('[data-probe="' + kind + '"]')
+ if (el && el.textContent.includes(want)) {
+ sessionStorage.removeItem('__perfProbeWant')
+ sessionStorage.setItem('__perfProbeHit', JSON.stringify({ token: want, t: performance.timeOrigin + performance.now() }))
+ }
+ }
+ new MutationObserver(check).observe(document, { subtree: true, childList: true, characterData: true })
+})()`
+
+async function newPage() {
+ const context = await (await getBrowser()).newContext()
+ await context.addInitScript(PROBE_INIT_SCRIPT)
+ const page = await context.newPage()
+ const errors = []
+ page.on('pageerror', (e) => errors.push(String(e.message ?? e)))
+ let loads = 0
+ page.on('load', () => loads++)
+ return { context, page, errors, loads: () => loads }
+}
+
+/**
+ * Loads `url` and waits until the root component has hydrated (or, for SPAs,
+ * mounted). Vite may reload the page once its dependency optimizer finds new
+ * dependencies; the latest hydration after a quiet period counts.
+ */
+async function loadUntilHydrated(
+ page,
+ url,
+ { quietMs = 1500, timeoutMs = 300_000 } = {},
+) {
+ const deadline = Date.now() + timeoutMs
+ // Counts document loads only; history API navigations do not fire this.
+ let docs = 0
+ const onDoc = () => {
+ docs++
+ }
+ page.on('domcontentloaded', onDoc)
+ let hydratedAt
+ try {
+ await page.goto(url, { waitUntil: 'commit', timeout: timeoutMs })
+ for (;;) {
+ if (Date.now() > deadline) {
+ throw new Error(`page never hydrated: ${url}`)
+ }
+ const t = await page
+ .waitForFunction(() => window.__PERF_HYDRATED__, null, {
+ timeout: Math.max(1, deadline - Date.now()),
+ polling: 20,
+ })
+ .then((h) => h.jsonValue())
+ .catch((error) => {
+ // A reload destroys the execution context; keep waiting.
+ if (/timeout/i.test(String(error?.message))) {
+ throw error
+ }
+ return undefined
+ })
+ if (t === undefined) {
+ continue
+ }
+ hydratedAt = t
+ const docsAtHit = docs
+ await sleep(quietMs)
+ if (docs === docsAtHit) {
+ break
+ }
+ }
+ } finally {
+ page.off('domcontentloaded', onDoc)
+ }
+ return { hydratedAt, reloads: Math.max(0, docs - 1) }
+}
+
+// ---------------------------------------------------------------------------
+// Scenarios
+// ---------------------------------------------------------------------------
+
+const results = {
+ schema: 1,
+ label: args.label,
+ meta: {},
+ workloads: {},
+ scenarios: {},
+ attribution: {},
+ // Record-run details of the floor scenarios (the replay runs are in `scenarios`).
+ floor: {},
+ // Soak series (see soakRun); also written to soak-.json.
+ soak: {},
+}
+
+function scenarioEntry(name) {
+ results.scenarios[name] ??= { runs: [], metrics: {} }
+ return results.scenarios[name]
+}
+
+function addSample(name, metrics, runInfo) {
+ const entry = scenarioEntry(name)
+ entry.runs.push({ ...runInfo, ...metrics })
+ for (const [key, value] of Object.entries(metrics)) {
+ if (typeof value === 'number') {
+ ;(entry.metrics[key] ??= []).push(Math.round(value * 10) / 10)
+ }
+ }
+}
+
+function saveResults() {
+ const summarized = summarize(results)
+ fs.writeFileSync(
+ path.join(outDir, 'results.json'),
+ JSON.stringify(summarized, null, 2),
+ )
+ writeMarkdown(summarized, path.join(outDir, 'summary.md'))
+}
+
+async function repeat(name, fn, { runs = RUNS, warmup = WARMUP } = {}) {
+ let retries = RETRIES
+ for (let i = 0; i < warmup + runs; i++) {
+ const quiet = await waitForQuiet()
+ const measured = i >= warmup
+ log(
+ `${name} ${measured ? `run ${i - warmup + 1}/${runs}` : `warmup ${i + 1}/${warmup}`} (others busy ${quiet.busyCores} cores, load1 ${quiet.load1})`,
+ )
+ const stopWatch = startCpuWatch()
+ const metrics = await fn(i)
+ const during = stopWatch()
+ Object.assign(quiet, during)
+ if (during.othersBusyDuring > MAX_BUSY) {
+ quiet.flagged = true
+ log(
+ ` flagged: other processes used ${during.othersBusyDuring} cores during the run`,
+ )
+ }
+ log(
+ ` ${Object.entries(metrics)
+ .map(([k, v]) => `${k}=${typeof v === 'number' ? v.toFixed(0) : v}`)
+ .join(' ')}`,
+ )
+ if (measured && quiet.flagged && retries > 0) {
+ retries--
+ log(` discarded (machine load), repeating; ${retries} retries left`)
+ i--
+ continue
+ }
+ if (measured) {
+ addSample(name, metrics, quiet)
+ saveResults()
+ }
+ }
+}
+
+async function devBrowserRun(variant, { cold, profileDir, replay, mem }) {
+ const dir = appDir(variant)
+ clean(dir, { cache: cold })
+ const { context, page } = await newPage()
+ const inst = instrumentation({ replay, mem: mem && 'ipc' })
+ const dev = startViteDev(dir, { profileDir, inst })
+ const stopPoll = mem ? pollChildrenRss(dev.pid) : undefined
+ let result
+ try {
+ const listening = await dev.waitFor('listening')
+ const listenMs = listening.epochMs - dev.spawnedAt
+ const url = `http://127.0.0.1:${PORT}/`
+ const navStart = now()
+ const { hydratedAt, reloads } = await loadUntilHydrated(page, url)
+ result = {
+ listenMs,
+ hydratedMs: hydratedAt - dev.spawnedAt,
+ listenToHydratedMs: hydratedAt - navStart,
+ reloads,
+ }
+ if (mem) {
+ Object.assign(result, pickMem(await dev.memory()), {
+ childPeakRssMb: stopPoll(),
+ })
+ }
+ } finally {
+ stopPoll?.()
+ await context.close()
+ await dev.stop()
+ }
+ return withReplay(result, inst, ['listenMs', 'hydratedMs'])
+}
+
+async function devCompileRun(variant, { profileDir, replay, mem } = {}) {
+ const dir = appDir(variant)
+ clean(dir)
+ const inst = instrumentation({ replay, mem: mem && 'ipc' })
+ const dev = startViteDev(dir, { profileDir, inst })
+ const stopPoll = mem ? pollChildrenRss(dev.pid) : undefined
+ let metrics
+ try {
+ const listening = await dev.waitFor('listening')
+ dev.send({ type: 'compile-all' })
+ const { result } = await dev.waitFor('compile-all', 600_000)
+ metrics = {
+ listenMs: listening.epochMs - dev.spawnedAt,
+ compileAllMs: result.totalMs,
+ }
+ for (const [env, r] of Object.entries(result.envs)) {
+ metrics[`${env}Ms`] = r.ms
+ metrics[`${env}Modules`] = r.modules
+ metrics[`${env}OutputHash`] = r.outputHash
+ if (r.errors.length) {
+ log(
+ ` ${env}: ${r.errors.length} transform errors, first: ${JSON.stringify(r.errors[0])}`,
+ )
+ metrics[`${env}Errors`] = r.errors.length
+ }
+ }
+ metrics.totalMs = now() - dev.spawnedAt
+ if (mem) {
+ Object.assign(metrics, pickMem(await dev.memory()), {
+ childPeakRssMb: stopPoll(),
+ })
+ }
+ } finally {
+ stopPoll?.()
+ await dev.stop()
+ }
+ return withReplay(metrics, inst, ['listenMs', 'totalMs'])
+}
+
+async function viteBuildRun(variant, { profileDir, replay, mem } = {}) {
+ const dir = appDir(variant)
+ clean(dir)
+ const prof = profilingEnv(profileDir)
+ const inst = instrumentation({ replay, mem: mem && 'exit' })
+ const { ms, childPeakRssMb } = await runCommand(
+ binPath('vite', 'vite', dir),
+ ['build'],
+ {
+ cwd: dir,
+ execArgv: [...prof.execArgv, ...inst.execArgv],
+ env: { ...prof.env, ...inst.env, NODE_ENV: 'production' },
+ pollChildren: Boolean(mem),
+ },
+ )
+ const metrics = { buildMs: ms, outputHash: hashDir(path.join(dir, 'dist')) }
+ if (mem) {
+ Object.assign(metrics, pickMem(inst.readMemFile()), { childPeakRssMb })
+ }
+ return withReplay(metrics, inst, ['buildMs'])
+}
+
+// Replay wraps the app's Rsbuild config (the generated config stays as is).
+const RSBUILD_REPLAY_CONFIG = `import config from './rsbuild.config.ts'
+import { wrapRsbuildConfig } from '../../scripts/replay.mjs'
+
+export default wrapRsbuildConfig(config)
+`
+
+async function rsbuildBuildRun(variant, { profileDir, replay, mem } = {}) {
+ const dir = appDir(variant)
+ clean(dir)
+ const prof = profilingEnv(profileDir)
+ const inst = instrumentation({ replay, mem: mem && 'exit' })
+ const cliArgs = ['build']
+ if (replay) {
+ fs.writeFileSync(
+ path.join(dir, 'rsbuild.perf.config.mjs'),
+ RSBUILD_REPLAY_CONFIG,
+ )
+ cliArgs.push('-c', 'rsbuild.perf.config.mjs')
+ }
+ const { ms, childPeakRssMb } = await runCommand(
+ binPath('@rsbuild/core', 'rsbuild', dir),
+ cliArgs,
+ {
+ cwd: dir,
+ execArgv: [...prof.execArgv, ...inst.execArgv],
+ env: { ...inst.env, NODE_ENV: 'production' },
+ pollChildren: Boolean(mem),
+ },
+ )
+ const metrics = {
+ buildMs: ms,
+ outputHash: hashDir(path.join(dir, 'dist-rsbuild')),
+ }
+ if (mem) {
+ Object.assign(metrics, pickMem(inst.readMemFile()), { childPeakRssMb })
+ }
+ return withReplay(metrics, inst, ['buildMs'])
+}
+
+async function rsbuildDevRun(variant) {
+ const dir = appDir(variant)
+ clean(dir)
+ const { context, page } = await newPage()
+ const t0 = now()
+ const child = spawn(
+ process.execPath,
+ [
+ binPath('@rsbuild/core', 'rsbuild', dir),
+ 'dev',
+ '--port',
+ String(PORT),
+ '--host',
+ '127.0.0.1',
+ ],
+ {
+ cwd: dir,
+ env: { ...process.env, NODE_ENV: 'development' },
+ stdio: ['ignore', 'pipe', 'pipe'],
+ },
+ )
+ const output = []
+ child.stdout.on('data', (d) => output.push(String(d)))
+ child.stderr.on('data', (d) => output.push(String(d)))
+ const exited = new Promise((resolve) => child.on('exit', resolve))
+ try {
+ const listenAt = await waitForPort(PORT)
+ const { hydratedAt, reloads } = await loadUntilHydrated(
+ page,
+ `http://127.0.0.1:${PORT}/`,
+ )
+ return { listenMs: listenAt - t0, hydratedMs: hydratedAt - t0, reloads }
+ } catch (error) {
+ error.message += '\n' + output.join('').slice(-4000)
+ throw error
+ } finally {
+ await context.close()
+ child.kill('SIGTERM')
+ const timer = setTimeout(() => child.kill('SIGKILL'), 10_000)
+ await exited
+ clearTimeout(timer)
+ }
+}
+
+/**
+ * Waits on `page` until the edit that put `token` into the probe shows up:
+ * the DOM text for UI probes, the server function's return value for
+ * `poll` probes. `write()` saves the file. Returns save → seen in ms.
+ */
+async function editAndWait({ page, errors, dev }, kind, probe, token, write) {
+ if (probe.poll) {
+ const savedAt = now()
+ write()
+ const hitAt = await page.evaluate(async (t) => {
+ const deadline = Date.now() + 30_000
+ while (Date.now() < deadline) {
+ try {
+ const fn = window.__perfProbeServerFn
+ if (fn && String(await fn()).includes(t)) {
+ return performance.timeOrigin + performance.now()
+ }
+ } catch {}
+ await new Promise((r) => setTimeout(r, 5))
+ }
+ return null
+ }, token)
+ if (hitAt === null) {
+ throw new Error(`${kind}: server function never returned ${token}`)
+ }
+ return hitAt - savedAt
+ }
+ await page.evaluate(
+ ([k, t]) => {
+ sessionStorage.setItem('__perfProbeKind', k)
+ sessionStorage.setItem('__perfProbeWant', t)
+ sessionStorage.removeItem('__perfProbeHit')
+ },
+ [kind, token],
+ )
+ const savedAt = now()
+ write()
+ const hit = await page
+ .waitForFunction(() => sessionStorage.getItem('__perfProbeHit'), null, {
+ timeout: 30_000,
+ polling: 10,
+ })
+ .then((h) => h.jsonValue())
+ .catch(() => {
+ throw new Error(
+ `${kind}: DOM never showed ${token}; page errors: ${errors.slice(-3).join(' | ')}\n${dev.output.join('').slice(-3000)}`,
+ )
+ })
+ return JSON.parse(hit).t - savedAt
+}
+
+/** Opens the probe's page and waits until the probe can be observed. */
+async function openProbe(page, kind, probe) {
+ await loadUntilHydrated(page, `http://127.0.0.1:${PORT}${probe.url}`, {
+ quietMs: 500,
+ })
+ if (probe.poll) {
+ await page.waitForFunction(
+ () => typeof window.__perfProbeServerFn === 'function',
+ null,
+ { timeout: 30_000 },
+ )
+ } else {
+ await page.waitForSelector(`[data-probe="${kind}"]`, { timeout: 30_000 })
+ // Deferred () content only hydrates on screen.
+ await page.locator(`[data-probe="${kind}"]`).scrollIntoViewIfNeeded()
+ await sleep(500)
+ }
+}
+
+/**
+ * HMR edits per probe kind. With `replay` (floor scenario) the edit tokens are
+ * deterministic so the replay run sees the recorded file contents; the
+ * record run makes enough edits to cover the replay run's retries and keeps
+ * no samples.
+ */
+async function hmrScenario(variant, { replay } = {}) {
+ const dir = appDir(variant)
+ clean(dir)
+ const probes = PROBES[variant]
+ const recording = replay?.mode === 'record'
+ const prefixName = replay ? `${variant}/floor-hmr` : `${variant}/hmr`
+ const originals = new Map(
+ Object.values(probes).map((p) => [
+ p.file,
+ fs.readFileSync(path.join(dir, p.file), 'utf8'),
+ ]),
+ )
+ const inst = instrumentation({ replay })
+ const dev = startViteDev(dir, { inst })
+ const probePage = await newPage()
+ const { page, loads } = probePage
+ const edits = HMR_WARMUP + HMR_ITERATIONS
+ try {
+ await dev.waitFor('listening')
+ // Warm the dev server (dependency optimization, first SSR) before editing.
+ await loadUntilHydrated(page, `http://127.0.0.1:${PORT}/`)
+ for (const [kind, probe] of Object.entries(probes)) {
+ const file = path.join(dir, probe.file)
+ let current = probe.token
+ const prefix = probe.token.replace(/-v0$/, '')
+ await openProbe(page, kind, probe)
+ let retries = RETRIES * 3
+ let seq = 0
+ for (let i = 0; i < (recording ? edits + retries : edits); i++) {
+ const quiet = recording
+ ? { busyCores: 0, flagged: false }
+ : await waitForQuiet(500)
+ const next = replay
+ ? `${prefix}-r${++seq}`
+ : `${prefix}-r${i + 1}x${Date.now().toString(36)}`
+ const loadsBefore = loads()
+ const source = fs.readFileSync(file, 'utf8')
+ if (!source.includes(current)) {
+ throw new Error(`${probe.file} does not contain ${current}`)
+ }
+ const stopWatch = startCpuWatch()
+ const hitAt = await editAndWait(
+ { ...probePage, dev },
+ kind,
+ probe,
+ next,
+ () => fs.writeFileSync(file, source.replace(current, next)),
+ )
+ current = next
+ const fullReloads = loads() - loadsBefore
+ // Let the update settle (late invalidations, re-fetches) before the next edit.
+ await sleep(400)
+ if (recording) {
+ continue
+ }
+ Object.assign(quiet, stopWatch())
+ if (quiet.othersBusyDuring > MAX_BUSY) {
+ quiet.flagged = true
+ }
+ if (i >= HMR_WARMUP && quiet.flagged && retries > 0) {
+ retries--
+ log(
+ `${prefixName}/${kind} edit discarded (machine load ${quiet.othersBusyDuring} cores)`,
+ )
+ i--
+ continue
+ }
+ if (i >= HMR_WARMUP) {
+ addSample(
+ `${prefixName}/${kind}`,
+ { updateMs: hitAt, fullReloads },
+ quiet,
+ )
+ }
+ log(
+ `${prefixName}/${kind} ${i < HMR_WARMUP ? 'warmup' : 'iter'} ${i + 1}: ${hitAt.toFixed(1)}ms${fullReloads ? ` (${fullReloads} full reloads)` : ''}`,
+ )
+ }
+ saveResults()
+ fs.writeFileSync(file, originals.get(probe.file))
+ await sleep(1000)
+ }
+ } finally {
+ for (const [file, content] of originals) {
+ fs.writeFileSync(path.join(dir, file), content)
+ }
+ await probePage.context.close()
+ await dev.stop()
+ }
+ if (replay) {
+ const stats = withReplay({}, inst, [])
+ log(`${prefixName} ${replay.mode}: ${JSON.stringify(stats)}`)
+ results.floor[`${variant}/hmr`] ??= {}
+ results.floor[`${variant}/hmr`][replay.mode] = stats
+ saveResults()
+ }
+}
+
+/**
+ * Leak check: after a cold start (`/` hydrated, one page per probe open),
+ * LEAK_CYCLES edit + revert cycles over the route component, loader, server
+ * function and shared module probes, then a GC'd heap/RSS snapshot compared
+ * with the one right after startup.
+ */
+async function leakRun(variant) {
+ const dir = appDir(variant)
+ clean(dir)
+ const kinds = [
+ 'route-component',
+ 'route-loader',
+ 'server-fn',
+ 'shared-component',
+ ].filter((k) => PROBES[variant][k])
+ const originals = new Map(
+ kinds.map((k) => [
+ k,
+ fs.readFileSync(path.join(dir, PROBES[variant][k].file), 'utf8'),
+ ]),
+ )
+ const inst = instrumentation({ mem: 'ipc' })
+ const dev = startViteDev(dir, { inst })
+ const stopPoll = pollChildrenRss(dev.pid)
+ const pages = []
+ try {
+ await dev.waitFor('listening')
+ const home = await newPage()
+ pages.push(home)
+ await loadUntilHydrated(home.page, `http://127.0.0.1:${PORT}/`)
+ const byKind = {}
+ for (const kind of kinds) {
+ byKind[kind] = await newPage()
+ pages.push(byKind[kind])
+ await openProbe(byKind[kind].page, kind, PROBES[variant][kind])
+ }
+ await sleep(1000)
+ const start = await dev.memory()
+ const series = [{ cycle: 0, ...pickMem(start) }]
+ const cycleMs = []
+ for (let i = 0; i < LEAK_CYCLES; i++) {
+ const kind = kinds[i % kinds.length]
+ const probe = PROBES[variant][kind]
+ const file = path.join(dir, probe.file)
+ const original = originals.get(kind)
+ const token = probe.token.replace(/-v0$/, `-leak${i + 1}`)
+ const t0 = now()
+ const target = { ...byKind[kind], dev }
+ try {
+ await editAndWait(target, kind, probe, token, () =>
+ fs.writeFileSync(file, original.replace(probe.token, token)),
+ )
+ await sleep(200)
+ await editAndWait(target, kind, probe, probe.token, () =>
+ fs.writeFileSync(file, original),
+ )
+ } catch (error) {
+ error.message = `leak cycle ${i + 1}: ${error.message}`
+ throw error
+ }
+ await sleep(200)
+ cycleMs.push(now() - t0)
+ if ((i + 1) % 10 === 0 || i === LEAK_CYCLES - 1) {
+ series.push({ cycle: i + 1, ...pickMem(await dev.memory()) })
+ }
+ }
+ await sleep(1000)
+ const end = await dev.memory()
+ const growth = (key) => Math.round((end[key] - start[key]) * 10) / 10
+ const errors = pages.reduce((n, p) => n + p.errors.length, 0)
+ return {
+ cycles: LEAK_CYCLES,
+ heapStartMb: start.heapUsedMb,
+ heapEndMb: end.heapUsedMb,
+ heapGrowthMb: growth('heapUsedMb'),
+ rssStartMb: start.rssMb,
+ rssEndMb: end.rssMb,
+ rssGrowthMb: growth('rssMb'),
+ externalGrowthMb: growth('externalMb'),
+ arrayBuffersGrowthMb: growth('arrayBuffersMb'),
+ peakRssMb: end.peakRssMb,
+ childPeakRssMb: stopPoll(),
+ cycleMsMedian: [...cycleMs].sort((a, b) => a - b)[cycleMs.length >> 1],
+ pageErrors: errors,
+ series,
+ }
+ } finally {
+ stopPoll()
+ for (const kind of kinds) {
+ fs.writeFileSync(
+ path.join(dir, PROBES[variant][kind].file),
+ originals.get(kind),
+ )
+ }
+ for (const p of pages) {
+ await p.context.close()
+ }
+ await dev.stop()
+ }
+}
+
+/**
+ * Soak: SOAK_CYCLES edit + revert cycles on one dev server (Vite or
+ * Rsbuild), rotating over the kinds of soak-files.mjs (probe edits, module
+ * and route adds/deletes, renames, `*.server.ts` imports, dependency-only
+ * factory flips). Every SOAK_EVERY cycles: forced GC, heap/external/RSS and
+ * the compiler's cache sizes (TSR_COMPILER_STATS=1); heap snapshots after
+ * the SOAK_SNAPSHOTS cycles. `replay` (floor): our transform hooks return
+ * recorded outputs (record run first, same deterministic edits).
+ */
+async function soakRun(variant, bundler, { replay, transformOff } = {}) {
+ const dir = appDir(variant)
+ clean(dir)
+ const name = `${variant}/soak-${bundler}${replay ? `-${replay.mode}` : transformOff ? '-transform-off' : ''}`
+ const probes = PROBES[variant]
+ const kinds = soakKinds(variant, probes).filter(
+ (k) => !args['soak-kinds'] || args['soak-kinds'].split(',').includes(k),
+ )
+ const abs = (rel) => path.join(dir, rel)
+ // Files the soak writes, with their content before the soak (null: absent).
+ const originals = new Map()
+ const remember = (rel) => {
+ if (!originals.has(rel)) {
+ originals.set(
+ rel,
+ fs.existsSync(abs(rel)) ? fs.readFileSync(abs(rel), 'utf8') : null,
+ )
+ }
+ }
+ const write = (rel, content) => {
+ remember(rel)
+ fs.mkdirSync(path.dirname(abs(rel)), { recursive: true })
+ fs.writeFileSync(abs(rel), content)
+ }
+ const unlink = (rel) => {
+ remember(rel)
+ fs.rmSync(abs(rel), { force: true })
+ }
+ const setup = soakSetupFiles(variant)
+ for (const [rel, content] of setup) {
+ write(rel, content)
+ }
+ for (const probe of Object.values(probes)) {
+ remember(probe.file)
+ }
+ // The soak's own files stay in place for the dev server; restore() puts every
+ // file back to its setup state (after a failed cycle) or removes it (at the end).
+ const restore = (final) => {
+ for (const [rel, before] of originals) {
+ const target = setup.has(rel) && !final ? setup.get(rel) : before
+ if (target === null) {
+ fs.rmSync(abs(rel), { force: true })
+ } else if (
+ !fs.existsSync(abs(rel)) ||
+ fs.readFileSync(abs(rel), 'utf8') !== target
+ ) {
+ fs.mkdirSync(path.dirname(abs(rel)), { recursive: true })
+ fs.writeFileSync(abs(rel), target)
+ }
+ }
+ if (final) {
+ fs.rmSync(abs('src/soak'), { recursive: true, force: true })
+ fs.rmSync(abs('src/routes/soak'), { recursive: true, force: true })
+ }
+ }
+ if (transformOff) {
+ // the router plugin without code splitting or HMR: no module reaches the
+ // compiler (the route generator still runs), the floor of the plugin
+ write(
+ 'vite.config.ts',
+ fs
+ .readFileSync(abs('vite.config.ts'), 'utf8')
+ .replace(
+ 'autoCodeSplitting: true',
+ 'autoCodeSplitting: false, codeSplittingOptions: { addHmr: false }',
+ ),
+ )
+ }
+ const inst = instrumentation({ replay, mem: 'ipc' })
+ inst.env.TSR_COMPILER_STATS = '1'
+ const dev =
+ bundler === 'rsbuild'
+ ? startRsbuildDev(dir, { inst, replay: Boolean(replay) })
+ : startViteDev(dir, { inst })
+ const stopPoll = pollChildrenRss(dev.pid)
+ const heapDir = path.resolve(
+ args['soak-heap-dir'] ?? path.join(outDir, 'heap'),
+ )
+ fs.mkdirSync(heapDir, { recursive: true })
+ const pages = []
+ const out = {
+ variant,
+ bundler,
+ mode: replay?.mode ?? (transformOff ? 'transform-off' : 'real'),
+ kinds,
+ cycles: SOAK_CYCLES,
+ series: [],
+ cycleMs: {},
+ failures: [],
+ snapshots: [],
+ }
+ const t0 = now()
+ const countFiles = (rel) => {
+ let n = 0
+ const walk = (d) => {
+ for (const e of fs.readdirSync(d, { withFileTypes: true })) {
+ if (e.isDirectory()) {
+ walk(path.join(d, e.name))
+ } else {
+ n++
+ }
+ }
+ }
+ walk(abs(rel))
+ return n
+ }
+ const sample = async (cycle) => {
+ const mem = await dev.memory()
+ const stats = await dev.request({ type: 'stats' })
+ const entry = {
+ cycle,
+ atS: Math.round((now() - t0) / 100) / 10,
+ ...pickMem(mem),
+ statsMs: Math.round(stats.ms),
+ stats: stats.result,
+ live: {
+ srcFiles: countFiles('src'),
+ routeFiles: countFiles('src/routes'),
+ },
+ failures: out.failures.length,
+ }
+ out.series.push(entry)
+ log(
+ `${name} cycle ${cycle}: heap ${entry.heapUsedMb} MB, external ${entry.externalMb} MB, rss ${entry.rssMb} MB, src files ${entry.live.srcFiles}`,
+ )
+ return entry
+ }
+ const snapshot = async (cycle) => {
+ const file = path.join(
+ heapDir,
+ `${name.replace(/\//g, '-')}-c${cycle}.heapsnapshot`,
+ )
+ const r = await dev.request({ type: 'heap-snapshot', file }, 900_000)
+ out.snapshots.push({ cycle, file: r.file, ms: Math.round(r.ms) })
+ log(`${name} heap snapshot after cycle ${cycle}: ${r.file}`)
+ }
+ const visit = async (page, url, text, timeoutMs = 45_000) => {
+ const deadline = Date.now() + timeoutMs
+ for (;;) {
+ try {
+ // a full reload the dev server announced may race with this
+ // navigation (Chromium then never commits it): retry soon
+ await page.goto(`http://127.0.0.1:${PORT}${url}`, {
+ waitUntil: 'commit',
+ timeout: 8_000,
+ })
+ await page.waitForFunction(() => window.__PERF_HYDRATED__, null, {
+ timeout: 10_000,
+ polling: 20,
+ })
+ await page.waitForFunction(
+ (t) => document.body?.textContent?.includes(t),
+ text,
+ { timeout: 3_000, polling: 20 },
+ )
+ return
+ } catch (error) {
+ if (Date.now() > deadline) {
+ throw new Error(`${url} never showed ${text}: ${error.message}`)
+ }
+ await sleep(300)
+ }
+ }
+ }
+ const SETTLE = 250
+ const routeTree = abs('src/routeTree.gen.ts')
+ const treeHas = (routePath) =>
+ fs.existsSync(routeTree) &&
+ fs.readFileSync(routeTree, 'utf8').includes(`'${routePath}'`)
+ const waitUntil = async (cond, what, timeoutMs = 30_000) => {
+ const deadline = Date.now() + timeoutMs
+ while (!cond()) {
+ if (Date.now() > deadline) {
+ throw new Error(`timeout: ${what}`)
+ }
+ await sleep(50)
+ }
+ }
+ try {
+ await dev.waitFor('listening')
+ const home = await newPage()
+ pages.push(home)
+ await loadUntilHydrated(home.page, `http://127.0.0.1:${PORT}/`)
+ const byKind = {}
+ const addPage = async () => {
+ const p = await newPage()
+ pages.push(p)
+ return p
+ }
+ /** Runs `load` on the page of `key`, replacing the page once if it crashed or never loads. */
+ const ensure = async (key, load) => {
+ try {
+ await load(byKind[key].page)
+ } catch (error) {
+ log(
+ `${name}: page ${key} replaced (${String(error?.message ?? error).split('\n')[0]})`,
+ )
+ const old = byKind[key]
+ pages.splice(pages.indexOf(old), 1)
+ await old.context.close().catch(() => {})
+ byKind[key] = await addPage()
+ await load(byKind[key].page)
+ }
+ }
+ const openPages = async () => {
+ for (const kind of kinds) {
+ if (probes[kind]) {
+ byKind[kind] ??= await addPage()
+ await ensure(kind, (page) => openProbe(page, kind, probes[kind]))
+ }
+ }
+ byKind.soak ??= await addPage()
+ await ensure('soak', async (page) => {
+ await loadUntilHydrated(page, `http://127.0.0.1:${PORT}/soak/`, {
+ quietMs: 500,
+ })
+ await page.waitForSelector('[data-probe="soak-module"]', {
+ timeout: 30_000,
+ })
+ })
+ byKind.visit ??= await addPage()
+ await ensure('visit', (page) =>
+ loadUntilHydrated(page, `http://127.0.0.1:${PORT}/`, { quietMs: 300 }),
+ )
+ }
+ await openPages()
+ const soakTarget = () => ({ ...byKind.soak, dev })
+ // Vite fully reloads open pages when a file they once loaded is deleted
+ // (a module with no importer left is a dead end of its HMR propagation):
+ // let every page finish such a reload before the next edit.
+ const settlePages = async () => {
+ await sleep(600)
+ for (const p of pages) {
+ const hydrated = (timeout) =>
+ p.page
+ .waitForFunction(() => window.__PERF_HYDRATED__, null, {
+ timeout,
+ polling: 50,
+ })
+ .then(
+ () => true,
+ () => false,
+ )
+ if (await hydrated(15_000)) {
+ continue
+ }
+ // a page stuck after a reload race: reload it once
+ out.stuckPages = [...(out.stuckPages ?? []), p.page.url()].slice(-20)
+ await p.page
+ .reload({ waitUntil: 'commit', timeout: 15_000 })
+ .catch(() => {})
+ if (!(await hydrated(30_000))) {
+ throw new Error(`page never hydrated again: ${p.page.url()}`)
+ }
+ }
+ }
+ const ui = {}
+ const runKind = async (kind, i, occurrence) => {
+ const n = i + 1
+ if (probes[kind]) {
+ const probe = probes[kind]
+ const original = originals.get(probe.file)
+ const token = probe.token.replace(/-v0$/, `-soak${n}`)
+ const target = { ...byKind[kind], dev }
+ await editAndWait(target, kind, probe, token, () =>
+ write(probe.file, original.replace(probe.token, token)),
+ )
+ await sleep(SETTLE)
+ await editAndWait(target, kind, probe, probe.token, () =>
+ write(probe.file, original),
+ )
+ return
+ }
+ if (kind === 'module-add') {
+ const mod = `src/soak/added-${n}.ts`
+ write(mod, `export const soakValue = 'soak-added-${n}'\n`)
+ await editAndWait(
+ soakTarget(),
+ 'soak-module',
+ ui,
+ `soak-added-${n}`,
+ () =>
+ write(
+ SOAK_ROUTE,
+ soakRouteSource(variant, { importFrom: `../../soak/added-${n}` }),
+ ),
+ )
+ await sleep(SETTLE)
+ await editAndWait(
+ soakTarget(),
+ 'soak-module',
+ ui,
+ 'soak-value-v0',
+ () => write(SOAK_ROUTE, soakRouteSource(variant)),
+ )
+ await sleep(SETTLE)
+ unlink(mod)
+ return
+ }
+ if (kind === 'route-add') {
+ const routePath = `/soak/r${n}`
+ const rel = `src/routes/soak/r${n}.tsx`
+ write(rel, soakChildRoute(routePath, `soak-route-${n}`))
+ await waitUntil(() => treeHas(routePath), `${routePath} in the tree`)
+ await visit(byKind.visit.page, routePath, `soak-route-${n}`)
+ unlink(rel)
+ await waitUntil(() => !treeHas(routePath), `${routePath} removed`)
+ await visit(byKind.visit.page, '/soak/', 'soak-value-v0')
+ return
+ }
+ if (kind === 'route-rename') {
+ const renamed = `src/routes/soak/renamed-${n}.tsx`
+ remember(renamed)
+ fs.renameSync(abs(SOAK_RENAMED), abs(renamed))
+ await waitUntil(
+ () => treeHas(`/soak/renamed-${n}`),
+ `/soak/renamed-${n} in the tree`,
+ )
+ await visit(byKind.visit.page, `/soak/renamed-${n}`, 'soak-renamed')
+ fs.renameSync(abs(renamed), abs(SOAK_RENAMED))
+ await waitUntil(
+ () => !treeHas(`/soak/renamed-${n}`) && treeHas('/soak/renamed'),
+ '/soak/renamed back in the tree',
+ )
+ await visit(byKind.visit.page, '/soak/renamed', 'soak-renamed')
+ return
+ }
+ if (kind === 'server-import') {
+ const server = occurrence % 2 === 0 ? 'handler' : 'client'
+ await editAndWait(
+ soakTarget(),
+ 'soak-label',
+ ui,
+ `soak-server-${n}`,
+ () =>
+ write(
+ SOAK_ROUTE,
+ soakRouteSource(variant, { server, label: `soak-server-${n}` }),
+ ),
+ )
+ await sleep(SETTLE)
+ await editAndWait(soakTarget(), 'soak-label', ui, 'soak-label-v0', () =>
+ write(SOAK_ROUTE, soakRouteSource(variant)),
+ )
+ return
+ }
+ if (kind === 'factory-flip') {
+ await editAndWait(
+ soakTarget(),
+ 'soak-factory',
+ ui,
+ 'factory-plain',
+ () => write(SOAK_FACTORY, soakFactorySource(false)),
+ )
+ await sleep(SETTLE)
+ await editAndWait(soakTarget(), 'soak-factory', ui, 'factory-rpc', () =>
+ write(SOAK_FACTORY, soakFactorySource(true)),
+ )
+ return
+ }
+ throw new Error(`unknown soak kind ${kind}`)
+ }
+ await sleep(1000)
+ if (SOAK_SNAPSHOTS.has(0)) {
+ // A first heap snapshot makes V8 keep extra data (source positions of
+ // every function, the heap profiler's object ids): take it before the
+ // baseline sample so that step is not mistaken for growth.
+ await snapshot(0)
+ }
+ await sample(0)
+ for (let i = 0; i < SOAK_CYCLES; i++) {
+ const kind = kinds[i % kinds.length]
+ const occurrence = Math.floor(i / kinds.length)
+ const c0 = now()
+ try {
+ await runKind(kind, i, occurrence)
+ await sleep(SETTLE)
+ if (['module-add', 'route-add', 'route-rename'].includes(kind)) {
+ await settlePages()
+ }
+ ;(out.cycleMs[kind] ??= []).push(Math.round(now() - c0))
+ } catch (error) {
+ const message = String(error?.message ?? error).slice(0, 2000)
+ out.failures.push({ cycle: i + 1, kind, message })
+ log(`${name} cycle ${i + 1} (${kind}) failed: ${message.slice(0, 600)}`)
+ if (out.failures.length > Math.max(25, SOAK_CYCLES / 10)) {
+ out.aborted = `too many failed cycles (${out.failures.length})`
+ log(`${name}: ${out.aborted}, stopping`)
+ break
+ }
+ restore(false)
+ await sleep(3000)
+ try {
+ await openPages()
+ } catch (reopenError) {
+ out.failures.push({
+ cycle: i + 1,
+ kind: 'reopen',
+ message: String(reopenError?.message ?? reopenError).slice(0, 500),
+ })
+ }
+ }
+ if ((i + 1) % SOAK_EVERY === 0 || i === SOAK_CYCLES - 1) {
+ await sample(i + 1)
+ }
+ if (SOAK_SNAPSHOTS.has(i + 1)) {
+ await snapshot(i + 1)
+ }
+ }
+ out.pageErrors = pages.reduce((sum, p) => sum + p.errors.length, 0)
+ out.pageErrorSamples = pages.flatMap((p) => p.errors).slice(0, 10)
+ out.childPeakRssMb = stopPoll()
+ out.cycleMsMedian = Object.fromEntries(
+ Object.entries(out.cycleMs).map(([k, v]) => [
+ k,
+ [...v].sort((a, b) => a - b)[v.length >> 1],
+ ]),
+ )
+ out.devOutputTail = dev.output.join('').slice(-6000)
+ } finally {
+ stopPoll()
+ restore(true)
+ for (const p of pages) {
+ await p.context.close().catch(() => {})
+ }
+ await dev.stop()
+ }
+ results.soak[name] = out
+ fs.writeFileSync(
+ path.join(outDir, `soak-${name.replace(/\//g, '-')}.json`),
+ JSON.stringify(out, null, 2),
+ )
+ if (replay) {
+ const stats = inst.readReplayStats()
+ out.replay = {
+ hits: stats.hits,
+ misses: stats.misses,
+ missesByHook: stats.missesByHook,
+ missSamples: stats.missSamples?.slice(0, 5),
+ loadMs: stats.loadMs,
+ }
+ log(`${name} replay: ${JSON.stringify(out.replay)}`)
+ }
+ saveResults()
+ return out
+}
+
+async function soakScenario(variant) {
+ for (const bundler of SOAK_BUNDLERS) {
+ if (bundler === 'rsbuild' && !hasRsbuild(variant)) {
+ continue
+ }
+ for (const mode of SOAK_MODES) {
+ await waitForQuiet()
+ if (mode === 'replay') {
+ const replayName = `${variant}-soak-${bundler}`
+ log(`${variant}/soak-${bundler} record run`)
+ await soakRun(variant, bundler, {
+ replay: { mode: 'record', name: replayName },
+ })
+ await soakRun(variant, bundler, {
+ replay: { mode: 'replay', name: replayName },
+ })
+ } else if (mode === 'transform-off') {
+ if (isStart(variant) || bundler !== 'vite') {
+ log(
+ `${variant}/soak-${bundler}: transform-off needs a Router app on Vite, skipped`,
+ )
+ continue
+ }
+ await soakRun(variant, bundler, { transformOff: true })
+ } else {
+ await soakRun(variant, bundler)
+ }
+ }
+ }
+}
+
+async function memoryScenario(variant) {
+ const opts = { runs: MEMORY_RUNS, warmup: 0 }
+ await repeat(
+ `${variant}/mem-build`,
+ () => viteBuildRun(variant, { mem: true }),
+ opts,
+ )
+ await repeat(
+ `${variant}/mem-dev-cold`,
+ () => devBrowserRun(variant, { cold: true, mem: true }),
+ opts,
+ )
+ await repeat(
+ `${variant}/mem-dev-compile`,
+ () => devCompileRun(variant, { mem: true }),
+ opts,
+ )
+ if (hasRsbuild(variant)) {
+ await repeat(
+ `${variant}/mem-rsbuild-build`,
+ () => rsbuildBuildRun(variant, { mem: true }),
+ opts,
+ )
+ }
+}
+
+/**
+ * Floor: per scenario kind, one record run (real compiler, results stored)
+ * and then the measured replay runs. Replayed outputs must match the record
+ * run's (`outputMismatch`), and misses should be ~0.
+ */
+async function floorScenario(variant) {
+ const runners = {
+ build: (o) => viteBuildRun(variant, o),
+ 'dev-compile': (o) => devCompileRun(variant, o),
+ 'dev-cold': (o) => devBrowserRun(variant, { cold: true, ...o }),
+ 'rsbuild-build': (o) => rsbuildBuildRun(variant, o),
+ }
+ for (const kind of FLOOR_KINDS) {
+ if (!floorKinds.has(kind)) {
+ continue
+ }
+ if (kind === 'rsbuild-build' && !hasRsbuild(variant)) {
+ continue
+ }
+ const name = `${variant}-${kind}`
+ if (kind === 'hmr') {
+ log(`${variant}/floor-hmr record`)
+ await hmrScenario(variant, { replay: { mode: 'record', name } })
+ await hmrScenario(variant, { replay: { mode: 'replay', name } })
+ continue
+ }
+ await waitForQuiet()
+ log(`${variant}/floor-${kind} record run`)
+ const recorded = await runners[kind]({ replay: { mode: 'record', name } })
+ log(` recorded: ${JSON.stringify(recorded)}`)
+ const hashKeys = Object.keys(recorded).filter((k) => /Hash$/.test(k))
+ // The record run must produce what an uninstrumented run produces.
+ const realRun = results.scenarios[`${variant}/${kind}`]?.runs.at(-1)
+ const realMatches = realRun
+ ? hashKeys.every((k) => realRun[k] === recorded[k])
+ : undefined
+ if (realMatches === false) {
+ log(` record run output differs from the real run's`)
+ }
+ results.floor[`${variant}/${kind}`] = { record: recorded, realMatches }
+ await repeat(`${variant}/floor-${kind}`, async () => {
+ const m = await runners[kind]({ replay: { mode: 'replay', name } })
+ const mismatched = hashKeys.filter((k) => m[k] !== recorded[k])
+ if (mismatched.length) {
+ log(` output differs from the record run: ${mismatched.join(', ')}`)
+ }
+ m.outputMismatch = mismatched.length
+ return m
+ })
+ }
+}
+
+async function profileScenario(variant) {
+ const base = path.join(outDir, 'profiles', variant)
+ const runs = [
+ [
+ 'dev-compile',
+ (profileDir) => devCompileRun(variant, { profileDir }),
+ (m) => m.totalMs,
+ ],
+ [
+ 'dev-cold',
+ (profileDir) => devBrowserRun(variant, { cold: true, profileDir }),
+ (m) => m.hydratedMs,
+ ],
+ [
+ 'build',
+ (profileDir) => viteBuildRun(variant, { profileDir }),
+ (m) => m.buildMs,
+ ],
+ ]
+ if (scenarios.has('rsbuild-build') && hasRsbuild(variant)) {
+ runs.push([
+ 'rsbuild-build',
+ (profileDir) => rsbuildBuildRun(variant, { profileDir }),
+ (m) => m.buildMs,
+ ])
+ }
+ for (const [name, run, wall] of runs) {
+ const quiet = await waitForQuiet()
+ const profileDir = path.join(base, name)
+ log(`${variant}/${name} profiled run (others busy ${quiet.busyCores})`)
+ const metrics = await run(profileDir)
+ results.attribution[`${variant}/${name}`] = {
+ ...(await readAttribution(profileDir, wall(metrics))),
+ metrics,
+ quiet,
+ }
+ saveResults()
+ }
+}
+
+// ---------------------------------------------------------------------------
+
+function git(argsList) {
+ try {
+ return execFileSync('git', argsList, {
+ cwd: repoRoot,
+ encoding: 'utf8',
+ }).trim()
+ } catch {
+ return undefined
+ }
+}
+
+function pkgVersion(name) {
+ try {
+ return JSON.parse(
+ fs.readFileSync(
+ path.join(benchRoot, 'node_modules', name, 'package.json'),
+ 'utf8',
+ ),
+ ).version
+ } catch {
+ return undefined
+ }
+}
+
+async function main() {
+ results.meta = {
+ startedAt: new Date().toISOString(),
+ repoRoot,
+ commit: git(['rev-parse', 'HEAD']),
+ branch: git(['rev-parse', '--abbrev-ref', 'HEAD']),
+ dirty: Boolean(git(['status', '--porcelain', '--', 'packages'])),
+ node: process.version,
+ platform: `${os.platform()} ${os.release()}`,
+ cpu: `${os.cpus()[0]?.model} x${os.cpus().length}`,
+ memGb: Math.round(os.totalmem() / 2 ** 30),
+ versions: Object.fromEntries(
+ [
+ 'vite',
+ '@vitejs/plugin-react',
+ '@rsbuild/core',
+ '@playwright/test',
+ 'react',
+ ...(variants.some((v) => frameworkOf(v) === 'solid')
+ ? ['solid-js', 'vite-plugin-solid']
+ : []),
+ ].map((n) => [n, pkgVersion(n)]),
+ ),
+ options: {
+ runs: RUNS,
+ warmup: WARMUP,
+ hmrIterations: HMR_ITERATIONS,
+ hmrWarmup: HMR_WARMUP,
+ maxBusy: MAX_BUSY,
+ memoryRuns: MEMORY_RUNS,
+ leakCycles: LEAK_CYCLES,
+ soakCycles: SOAK_CYCLES,
+ soakEvery: SOAK_EVERY,
+ },
+ }
+ log(
+ `compiler-perf ${args.label}: ${results.meta.commit} (${results.meta.branch}) node ${process.version} -> ${outDir}`,
+ )
+
+ if (!args['skip-package-builds']) {
+ log('building packages through Nx')
+ execFileSync(
+ 'pnpm',
+ [
+ 'nx',
+ 'run-many',
+ '-t',
+ 'build',
+ '-p',
+ '@tanstack/router-plugin',
+ ...new Set(
+ variants.flatMap((v) => [
+ `@tanstack/${frameworkOf(v)}-router`,
+ ...(isStart(v) ? [`@tanstack/${frameworkOf(v)}-start`] : []),
+ ]),
+ ),
+ '--outputStyle=stream',
+ '--skipRemoteCache',
+ ],
+ {
+ cwd: repoRoot,
+ stdio: 'inherit',
+ env: { ...process.env, CI: '1', NX_DAEMON: 'false' },
+ },
+ )
+ }
+
+ for (const variant of variants) {
+ const info = writeApp(variant)
+ results.meta.shared ??= {}
+ results.meta.shared[variant] = Object.fromEntries(
+ Object.entries(info.shared).map(([name, target]) => [
+ name,
+ target && path.relative(repoRoot, target),
+ ]),
+ )
+ results.workloads[variant] = {
+ hash: info.hash,
+ files: info.fileCount,
+ routeFiles: info.routeCount,
+ serverFns: info.serverFnCount,
+ }
+ log(
+ `${variant}: generated ${info.fileCount} files (${info.routeCount} route files, ${info.serverFnCount} server fns), hash ${info.hash}`,
+ )
+
+ if (scenarios.has('build')) {
+ await repeat(`${variant}/build`, () => viteBuildRun(variant))
+ }
+ if (scenarios.has('dev-compile')) {
+ await repeat(`${variant}/dev-compile`, () => devCompileRun(variant))
+ }
+ if (scenarios.has('dev-cold')) {
+ await repeat(`${variant}/dev-cold`, () =>
+ devBrowserRun(variant, { cold: true }),
+ )
+ }
+ if (scenarios.has('dev-warm')) {
+ // The first (warmup) run fills the dependency cache that later runs reuse.
+ await repeat(
+ `${variant}/dev-warm`,
+ () => devBrowserRun(variant, { cold: false }),
+ { warmup: Math.max(1, WARMUP) },
+ )
+ }
+ if (scenarios.has('hmr')) {
+ await hmrScenario(variant)
+ }
+ if (hasRsbuild(variant)) {
+ if (scenarios.has('rsbuild-build')) {
+ await repeat(`${variant}/rsbuild-build`, () => rsbuildBuildRun(variant))
+ }
+ if (scenarios.has('rsbuild-dev')) {
+ await repeat(`${variant}/rsbuild-dev-cold`, () =>
+ rsbuildDevRun(variant),
+ )
+ }
+ }
+ if (scenarios.has('floor')) {
+ await floorScenario(variant)
+ }
+ if (scenarios.has('memory')) {
+ await memoryScenario(variant)
+ }
+ if (scenarios.has('leak')) {
+ await repeat(`${variant}/leak`, () => leakRun(variant), {
+ runs: 1,
+ warmup: 0,
+ })
+ }
+ if (scenarios.has('soak')) {
+ await soakScenario(variant)
+ }
+ if (scenarios.has('profile')) {
+ await profileScenario(variant)
+ }
+ }
+ results.meta.finishedAt = new Date().toISOString()
+ saveResults()
+ log(
+ `done: ${path.join(outDir, 'results.json')}, ${path.join(outDir, 'summary.md')}`,
+ )
+}
+
+try {
+ await main()
+} finally {
+ await browser?.close()
+}
diff --git a/benchmarks/compiler-perf/scripts/soak-analyze.mjs b/benchmarks/compiler-perf/scripts/soak-analyze.mjs
new file mode 100644
index 0000000000..97b18be746
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/soak-analyze.mjs
@@ -0,0 +1,174 @@
+#!/usr/bin/env node
+// Analysis of soak series (run.mjs `--scenarios soak`, soak-*.json).
+//
+// Usage: node soak-analyze.mjs ... [--md out.md] [--json out.json]
+//
+// - Memory: ordinary least squares of each GC'd metric against the cycle
+// over the last 75% of the samples (the first quarter is warm-up), slope
+// in KB per edit cycle with a 95% confidence interval (Student t).
+// - Compiler caches (TSR_COMPILER_STATS): per label and counter, the value
+// after the first sample past warm-up and at the end, the maximum, and the
+// slope (per 100 cycles) with its CI over the same window; a counter
+// "grows" when the lower CI bound is above zero and the last value exceeds
+// the warm value.
+
+import fs from 'node:fs'
+import path from 'node:path'
+import { parseArgs } from 'node:util'
+
+const { values: opts, positionals } = parseArgs({
+ allowPositionals: true,
+ options: { md: { type: 'string' }, json: { type: 'string' } },
+})
+
+// Two-sided 97.5% quantiles of Student's t by degrees of freedom.
+const T975 = [
+ 0, 12.706, 4.303, 3.182, 2.776, 2.571, 2.447, 2.365, 2.306, 2.262, 2.228,
+ 2.201, 2.179, 2.16, 2.145, 2.131, 2.12, 2.11, 2.101, 2.093, 2.086, 2.08,
+ 2.074, 2.069, 2.064, 2.06, 2.056, 2.052, 2.048, 2.045, 2.042,
+]
+const t975 = (df) => (df < T975.length ? T975[df] : 1.96 + 2.4 / df)
+
+export function regression(xs, ys) {
+ const n = xs.length
+ if (n < 3) {
+ return null
+ }
+ const mx = xs.reduce((a, b) => a + b, 0) / n
+ const my = ys.reduce((a, b) => a + b, 0) / n
+ let sxx = 0
+ let sxy = 0
+ for (let i = 0; i < n; i++) {
+ sxx += (xs[i] - mx) ** 2
+ sxy += (xs[i] - mx) * (ys[i] - my)
+ }
+ const slope = sxx ? sxy / sxx : 0
+ const intercept = my - slope * mx
+ let sse = 0
+ for (let i = 0; i < n; i++) {
+ sse += (ys[i] - (intercept + slope * xs[i])) ** 2
+ }
+ const se = sxx ? Math.sqrt(sse / (n - 2) / sxx) : 0
+ const half = t975(n - 2) * se
+ return { n, slope, lo: slope - half, hi: slope + half, intercept }
+}
+
+const MEM = ['heapUsedMb', 'externalMb', 'arrayBuffersMb', 'rssMb']
+
+export function analyze(soak) {
+ const series = soak.series
+ const start = Math.floor(series.length / 4)
+ const window = series.slice(start)
+ const xs = window.map((s) => s.cycle)
+ const memory = {}
+ for (const key of MEM) {
+ const r = regression(
+ xs,
+ window.map((s) => s[key] * 1024),
+ )
+ memory[key] = r && {
+ kbPerEdit: round(r.slope, 3),
+ ci95: [round(r.lo, 3), round(r.hi, 3)],
+ first: series[0][key],
+ warm: series[start][key],
+ last: series.at(-1)[key],
+ max: Math.max(...series.map((s) => s[key])),
+ n: r.n,
+ }
+ }
+ const caches = {}
+ const labels = new Set(series.flatMap((s) => Object.keys(s.stats ?? {})))
+ for (const label of labels) {
+ const counters = new Set(
+ series.flatMap((s) => Object.keys(s.stats?.[label] ?? {})),
+ )
+ for (const counter of counters) {
+ const value = (s) => s.stats?.[label]?.[counter] ?? 0
+ const r = regression(
+ xs,
+ window.map((s) => value(s)),
+ )
+ const warm = value(series[start])
+ const last = value(series.at(-1))
+ const per100 = r ? r.slope * 100 : 0
+ caches[`${label}.${counter}`] = {
+ first: value(series[0]),
+ warm,
+ last,
+ max: Math.max(...series.map(value)),
+ per100Cycles: round(per100, 2),
+ ci95: r ? [round(r.lo * 100, 2), round(r.hi * 100, 2)] : null,
+ grows: Boolean(r && r.lo > 0 && last > warm),
+ }
+ }
+ }
+ return {
+ name: `${soak.variant}/soak-${soak.bundler}${soak.mode === 'real' ? '' : `-${soak.mode}`}`,
+ cycles: soak.cycles,
+ samples: series.length,
+ window: `cycles ${xs[0]}–${xs.at(-1)}`,
+ failures: soak.failures.length,
+ failureKinds: soak.failures.map((f) => `${f.cycle}:${f.kind}`),
+ pageErrors: soak.pageErrors,
+ cycleMsMedian: soak.cycleMsMedian,
+ live: { first: series[0].live, last: series.at(-1).live },
+ memory,
+ caches,
+ }
+}
+
+const round = (v, d) => Math.round(v * 10 ** d) / 10 ** d
+
+function markdown(results) {
+ const out = []
+ for (const r of results) {
+ out.push(`### ${r.name}`, '')
+ out.push(
+ `${r.cycles} cycles, ${r.samples} samples, regression window ${r.window}; failed cycles ${r.failures}${r.failures ? ` (${r.failureKinds.join(', ')})` : ''}; page errors ${r.pageErrors ?? 'n/a'}.`,
+ '',
+ )
+ out.push(
+ '| metric (after GC) | cycle 0 | warm | last | max | slope KB/edit | 95% CI |',
+ '|---|---:|---:|---:|---:|---:|---|',
+ )
+ for (const [k, m] of Object.entries(r.memory)) {
+ if (m) {
+ out.push(
+ `| ${k} | ${m.first} | ${m.warm} | ${m.last} | ${m.max} | ${m.kbPerEdit} | [${m.ci95.join(', ')}] |`,
+ )
+ }
+ }
+ out.push(
+ '',
+ '| cache counter | cycle 0 | warm | last | max | per 100 cycles | 95% CI | grows |',
+ '|---|---:|---:|---:|---:|---:|---|---|',
+ )
+ for (const [k, c] of Object.entries(r.caches)) {
+ if (k.endsWith('.instances')) {
+ continue
+ }
+ out.push(
+ `| ${k} | ${c.first} | ${c.warm} | ${c.last} | ${c.max} | ${c.per100Cycles} | ${c.ci95 ? `[${c.ci95.join(', ')}]` : ''} | ${c.grows ? '**yes**' : ''} |`,
+ )
+ }
+ out.push('')
+ }
+ return out.join('\n')
+}
+
+if (positionals.length) {
+ const results = positionals.map((file) =>
+ analyze(JSON.parse(fs.readFileSync(file, 'utf8'))),
+ )
+ const md = markdown(results)
+ if (opts.md) {
+ fs.mkdirSync(path.dirname(path.resolve(opts.md)), { recursive: true })
+ fs.writeFileSync(opts.md, md)
+ }
+ if (opts.json) {
+ fs.writeFileSync(opts.json, JSON.stringify(results, null, 2))
+ }
+ if (!opts.md) {
+ console.log(md)
+ }
+}
diff --git a/benchmarks/compiler-perf/scripts/soak-files.mjs b/benchmarks/compiler-perf/scripts/soak-files.mjs
new file mode 100644
index 0000000000..65be84ff64
--- /dev/null
+++ b/benchmarks/compiler-perf/scripts/soak-files.mjs
@@ -0,0 +1,166 @@
+// Files and edits of the soak scenario (see run.mjs `soakRun`).
+//
+// The soak adds a `/soak` route and a few modules to the generated app (only
+// for the soak's dev server; the workload hash of the other scenarios is
+// unchanged) and rotates over edit kinds, each one an edit and its revert:
+//
+// - probe edits (`route-component`, `route-loader`, `shared-component`,
+// `server-fn`, `hydrate`): the HMR probes of generate.mjs
+// - `module-add`: a new module, imported by the soak route instead of
+// `src/soak/value.ts`; then the import is restored and the module deleted
+// - `route-add`: a new route file (route tree regenerated), visited, deleted
+// - `route-rename`: `src/routes/soak/renamed.tsx` renamed (unlink + add) to a
+// new name, visited, renamed back
+// - `server-import` (Start): an import of `src/server/secrets.server.ts` added
+// to the soak route, alternately read by a server function handler (the
+// client drops it) and by client code (an import-protection violation,
+// mocked in dev); then removed
+// - `factory-flip` (Start): `src/soak/factory.ts` stops/starts exporting a
+// server-function builder; only its importer's output changes (a
+// dependency-only edit, through the compiler's export-facts digests)
+//
+// Every name is a function of the cycle index, so a record run and a replay
+// run (floor) see the same file contents.
+
+import { isStart } from './generate.mjs'
+
+const routeHeader = (fw) =>
+ `import { createFileRoute } from '@tanstack/${fw}-router'\n`
+
+export const SOAK_ROUTE = 'src/routes/soak/index.tsx'
+export const SOAK_FACTORY = 'src/soak/factory.ts'
+export const SOAK_RENAMED = 'src/routes/soak/renamed.tsx'
+
+/**
+ * The soak route. `variant.importFrom`: the module its value comes from;
+ * `server`: 'handler' | 'client' | null adds the `*.server.ts` import.
+ */
+export function soakRouteSource(
+ variant,
+ {
+ importFrom = '../../soak/value',
+ server = null,
+ label = 'soak-label-v0',
+ } = {},
+) {
+ const start = isStart(variant)
+ const lines = [
+ routeHeader('react'),
+ `import { soakValue } from '${importFrom}'\n`,
+ ]
+ if (start) {
+ lines.push(`import { soakFn } from '../../soak/uses-factory'\n`)
+ }
+ if (server) {
+ lines.push(`import { readSecret } from '../../server/secrets.server'\n`)
+ if (server === 'handler') {
+ lines.push(`import { createServerFn } from '@tanstack/react-start'\n`)
+ }
+ }
+ lines.push(`
+export const Route = createFileRoute('/soak/')({
+ component: SoakPage,
+})
+`)
+ if (server === 'handler') {
+ lines.push(`
+const soakSecret = createServerFn({ method: 'GET' }).handler(async () =>
+ readSecret('SOAK_SECRET'),
+)
+`)
+ }
+ const onClick =
+ server === 'handler'
+ ? `() => void soakSecret()`
+ : server === 'client'
+ ? `() => console.log(readSecret('SOAK_SECRET'))`
+ : `() => console.log('soak')`
+ lines.push(`
+function SoakPage() {
+ return (
+
+
{soakValue}
+
${label}
+${
+ start
+ ? `
+ {String(soakFn).includes('factory-body') ? 'factory-plain' : 'factory-rpc'}
+
+`
+ : ''
+}
+ Soak
+
+
+ )
+}
+`)
+ return lines.join('')
+}
+
+export function soakFactorySource(builder) {
+ return builder
+ ? `import { createServerFn } from '@tanstack/react-start'
+
+export const soakFactory = createServerFn
+`
+ : `export const soakFactory = (_options?: unknown) => ({
+ handler: (fn: T): T => fn,
+})
+`
+}
+
+export function soakChildRoute(routePath, text) {
+ return `${routeHeader('react')}
+export const Route = createFileRoute('${routePath}')({
+ component: () => ${text}
,
+})
+`
+}
+
+/** Files the soak adds to the app before the dev server starts. */
+export function soakSetupFiles(variant) {
+ const files = new Map([
+ [SOAK_ROUTE, soakRouteSource(variant)],
+ ['src/soak/value.ts', `export const soakValue = 'soak-value-v0'\n`],
+ [SOAK_RENAMED, soakChildRoute('/soak/renamed', 'soak-renamed')],
+ ])
+ if (isStart(variant)) {
+ files.set(SOAK_FACTORY, soakFactorySource(true))
+ files.set(
+ 'src/soak/uses-factory.ts',
+ `import { soakFactory } from './factory'
+
+export const soakFn = soakFactory({ method: 'GET' }).handler(async () => {
+ return 'factory-body'
+})
+`,
+ )
+ }
+ return files
+}
+
+/** The edit kinds of a variant, in rotation order. */
+export function soakKinds(variant, probes) {
+ const kinds = [
+ 'route-component',
+ 'module-add',
+ 'route-loader',
+ 'route-add',
+ 'shared-component',
+ 'route-rename',
+ ]
+ if (isStart(variant)) {
+ kinds.push('server-fn', 'server-import', 'hydrate', 'factory-flip')
+ }
+ return kinds.filter(
+ (k) =>
+ ![
+ 'route-component',
+ 'route-loader',
+ 'shared-component',
+ 'server-fn',
+ 'hydrate',
+ ].includes(k) || probes[k],
+ )
+}
diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
index 3cec17d9c8..5e7342c172 100644
--- a/benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
+++ b/benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts
@@ -10,30 +10,20 @@
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as BoomIdRouteImport } from './routes/boom.$id'
-import { Route as FromIdRouteImport } from './routes/from.$id'
-import { Route as HeadersIdRouteImport } from './routes/headers.$id'
-import { Route as MissingIdRouteImport } from './routes/missing.$id'
import { Route as TargetIdRouteImport } from './routes/target.$id'
+import { Route as MissingIdRouteImport } from './routes/missing.$id'
+import { Route as HeadersIdRouteImport } from './routes/headers.$id'
+import { Route as FromIdRouteImport } from './routes/from.$id'
+import { Route as BoomIdRouteImport } from './routes/boom.$id'
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const BoomIdRoute = BoomIdRouteImport.update({
- id: '/boom/$id',
- path: '/boom/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
-const FromIdRoute = FromIdRouteImport.update({
- id: '/from/$id',
- path: '/from/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
-const HeadersIdRoute = HeadersIdRouteImport.update({
- id: '/headers/$id',
- path: '/headers/$id',
+const TargetIdRoute = TargetIdRouteImport.update({
+ id: '/target/$id',
+ path: '/target/$id',
getParentRoute: () => rootRouteImport,
} as any)
const MissingIdRoute = MissingIdRouteImport.update({
@@ -41,9 +31,19 @@ const MissingIdRoute = MissingIdRouteImport.update({
path: '/missing/$id',
getParentRoute: () => rootRouteImport,
} as any)
-const TargetIdRoute = TargetIdRouteImport.update({
- id: '/target/$id',
- path: '/target/$id',
+const HeadersIdRoute = HeadersIdRouteImport.update({
+ id: '/headers/$id',
+ path: '/headers/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const FromIdRoute = FromIdRouteImport.update({
+ id: '/from/$id',
+ path: '/from/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const BoomIdRoute = BoomIdRouteImport.update({
+ id: '/boom/$id',
+ path: '/boom/$id',
getParentRoute: () => rootRouteImport,
} as any)
@@ -117,25 +117,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/boom/$id': {
- id: '/boom/$id'
- path: '/boom/$id'
- fullPath: '/boom/$id'
- preLoaderRoute: typeof BoomIdRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/from/$id': {
- id: '/from/$id'
- path: '/from/$id'
- fullPath: '/from/$id'
- preLoaderRoute: typeof FromIdRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/headers/$id': {
- id: '/headers/$id'
- path: '/headers/$id'
- fullPath: '/headers/$id'
- preLoaderRoute: typeof HeadersIdRouteImport
+ '/target/$id': {
+ id: '/target/$id'
+ path: '/target/$id'
+ fullPath: '/target/$id'
+ preLoaderRoute: typeof TargetIdRouteImport
parentRoute: typeof rootRouteImport
}
'/missing/$id': {
@@ -145,11 +131,25 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof MissingIdRouteImport
parentRoute: typeof rootRouteImport
}
- '/target/$id': {
- id: '/target/$id'
- path: '/target/$id'
- fullPath: '/target/$id'
- preLoaderRoute: typeof TargetIdRouteImport
+ '/headers/$id': {
+ id: '/headers/$id'
+ path: '/headers/$id'
+ fullPath: '/headers/$id'
+ preLoaderRoute: typeof HeadersIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/from/$id': {
+ id: '/from/$id'
+ path: '/from/$id'
+ fullPath: '/from/$id'
+ preLoaderRoute: typeof FromIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/boom/$id': {
+ id: '/boom/$id'
+ path: '/boom/$id'
+ fullPath: '/boom/$id'
+ preLoaderRoute: typeof BoomIdRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
index 65f7fa5848..28d816525e 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts
@@ -10,8 +10,8 @@
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as ApiFnUrlsRouteImport } from './routes/api.fn-urls'
import { Route as PageIdRouteImport } from './routes/page.$id'
+import { Route as ApiFnUrlsRouteImport } from './routes/api.fn-urls'
import { Route as ApiPingIdRouteImport } from './routes/api.ping.$id'
const IndexRoute = IndexRouteImport.update({
@@ -19,16 +19,16 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({
- id: '/api/fn-urls',
- path: '/api/fn-urls',
- getParentRoute: () => rootRouteImport,
-} as any)
const PageIdRoute = PageIdRouteImport.update({
id: '/page/$id',
path: '/page/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({
+ id: '/api/fn-urls',
+ path: '/api/fn-urls',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiPingIdRoute = ApiPingIdRouteImport.update({
id: '/api/ping/$id',
path: '/api/ping/$id',
@@ -78,13 +78,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/api/fn-urls': {
- id: '/api/fn-urls'
- path: '/api/fn-urls'
- fullPath: '/api/fn-urls'
- preLoaderRoute: typeof ApiFnUrlsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/page/$id': {
id: '/page/$id'
path: '/page/$id'
@@ -92,6 +85,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof PageIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/api/fn-urls': {
+ id: '/api/fn-urls'
+ path: '/api/fn-urls'
+ fullPath: '/api/fn-urls'
+ preLoaderRoute: typeof ApiFnUrlsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/api/ping/$id': {
id: '/api/ping/$id'
path: '/api/ping/$id'
diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
index b9e25f918e..69b63cffe9 100644
--- a/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
+++ b/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
@@ -9,19 +9,19 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { Route as rootRouteImport } from './routes/__root'
-import { Route as PlainIdRouteImport } from './routes/plain.$id'
import { Route as RichIdRouteImport } from './routes/rich.$id'
+import { Route as PlainIdRouteImport } from './routes/plain.$id'
-const PlainIdRoute = PlainIdRouteImport.update({
- id: '/plain/$id',
- path: '/plain/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
const RichIdRoute = RichIdRouteImport.update({
id: '/rich/$id',
path: '/rich/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const PlainIdRoute = PlainIdRouteImport.update({
+ id: '/plain/$id',
+ path: '/plain/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/plain/$id': typeof PlainIdRoute
@@ -51,13 +51,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/plain/$id': {
- id: '/plain/$id'
- path: '/plain/$id'
- fullPath: '/plain/$id'
- preLoaderRoute: typeof PlainIdRouteImport
- parentRoute: typeof rootRouteImport
- }
'/rich/$id': {
id: '/rich/$id'
path: '/rich/$id'
@@ -65,6 +58,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof RichIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/plain/$id': {
+ id: '/plain/$id'
+ path: '/plain/$id'
+ fullPath: '/plain/$id'
+ preLoaderRoute: typeof PlainIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts
index 3d0bd34eaa..3db5e487b3 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts
@@ -10,24 +10,24 @@
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as ApiFnUrlsRouteImport } from './routes/api.fn-urls'
import { Route as SsrCallIdRouteImport } from './routes/ssr-call.$id'
+import { Route as ApiFnUrlsRouteImport } from './routes/api.fn-urls'
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({
- id: '/api/fn-urls',
- path: '/api/fn-urls',
- getParentRoute: () => rootRouteImport,
-} as any)
const SsrCallIdRoute = SsrCallIdRouteImport.update({
id: '/ssr-call/$id',
path: '/ssr-call/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({
+ id: '/api/fn-urls',
+ path: '/api/fn-urls',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -68,13 +68,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/api/fn-urls': {
- id: '/api/fn-urls'
- path: '/api/fn-urls'
- fullPath: '/api/fn-urls'
- preLoaderRoute: typeof ApiFnUrlsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/ssr-call/$id': {
id: '/ssr-call/$id'
path: '/ssr-call/$id'
@@ -82,6 +75,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof SsrCallIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/api/fn-urls': {
+ id: '/api/fn-urls'
+ path: '/api/fn-urls'
+ fullPath: '/api/fn-urls'
+ preLoaderRoute: typeof ApiFnUrlsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/docs/router/api/file-based-routing.md b/docs/router/api/file-based-routing.md
index 7c94d484d1..d714be8fd6 100644
--- a/docs/router/api/file-based-routing.md
+++ b/docs/router/api/file-based-routing.md
@@ -257,9 +257,9 @@ By default, this value is set to:
### `enableRouteTreeFormatting`
-This option turns on the formatting function on the generated route tree file, which can be time-consuming for large projects.
+The generated route tree file is always printed in the configured `quoteStyle` and `semicolons`. Set this option to `true` to also format it with Prettier (loaded only then), which can be time-consuming for large projects.
-By default, this value is set to `true`.
+By default, this value is set to `false`.
### `tmpDir`
diff --git a/docs/router/guide/automatic-code-splitting.md b/docs/router/guide/automatic-code-splitting.md
index 859a19ff09..ec95cd6eb7 100644
--- a/docs/router/guide/automatic-code-splitting.md
+++ b/docs/router/guide/automatic-code-splitting.md
@@ -102,6 +102,14 @@ function PostsNotFoundComponent() {
}
```
+#### Route callbacks that read `this` are not split
+
+A route option written as a method or a function expression whose body reads `this` stays in the route file, and the build warns once, naming the file. Write such callbacks as arrow functions (or without `this`) to have them split.
+
+#### Route CSS loads with the split components
+
+A style import in a route file (`import './posts.css'`) moves into the route's split component chunks only when every component option the route defines (`component`, `errorComponent`, `pendingComponent`, `notFoundComponent`) is split. Otherwise it stays in the route file and loads with it, because the compiler cannot tell which component needs it.
+
**That's it!** There are no other restrictions. You can use any other JavaScript or TypeScript features in your route files as you normally would. If you run into any issues, please [open an issue](https://github.com/tanstack/router/issues) on GitHub.
## Granular control
diff --git a/docs/router/guide/external-data-loading.md b/docs/router/guide/external-data-loading.md
index 4ffb318686..664468752d 100644
--- a/docs/router/guide/external-data-loading.md
+++ b/docs/router/guide/external-data-loading.md
@@ -6,7 +6,7 @@ title: External Data Loading
> [!IMPORTANT]
> This guide is geared towards external state management libraries and their integration with TanStack Router for data fetching, ssr, hydration/dehydration and streaming. If you haven't read the standard [Data Loading](./data-loading.md) guide, please do so first.
-Router can coordinate loaders and an existing API without Start. If you also want an integrated server runtime and typed server functions for your React application, follow [TanStack Query with Start](/start/latest/docs/framework/react/guide/tanstack-query) for request-scoped SSR, hydration, and mutation invalidation with a tested example.
+For a full-stack React application, follow [TanStack Query with Start](/start/latest/docs/framework/react/guide/tanstack-query) for request-scoped SSR, hydration, and mutation invalidation with a tested example.
## To **Store** or to **Coordinate**?
diff --git a/docs/start/framework/react/guide/css-styling.md b/docs/start/framework/react/guide/css-styling.md
index e44b5fb29c..e8ff641d9d 100644
--- a/docs/start/framework/react/guide/css-styling.md
+++ b/docs/start/framework/react/guide/css-styling.md
@@ -71,7 +71,7 @@ Where you import the CSS controls when it is loaded:
- Import in the root route or app shell to apply it to every page.
- Import in a layout route to apply it to that layout and its child routes.
-- Import in a leaf route to load it only when that route is matched.
+- Import in a leaf route to load it only when that route is matched. On the client, it loads with the route's code-split components when every component option the route defines (`component`, `errorComponent`, `pendingComponent`, `notFoundComponent`) is split; otherwise it loads with the route file, before the route matches.
- Import from a component loaded with `import()` or `React.lazy` only when the CSS is not needed for the initial route render.
CSS imported from an async component loads with that async chunk. It is not part of Start's static route manifest for the initial route match, so `HeadContent` does not render it as an initial SSR stylesheet link, and it is not available for static Early Hints or CSS inlining.
diff --git a/docs/start/framework/react/guide/environment-functions.md b/docs/start/framework/react/guide/environment-functions.md
index 94fbb52501..f472a3a26a 100644
--- a/docs/start/framework/react/guide/environment-functions.md
+++ b/docs/start/framework/react/guide/environment-functions.md
@@ -121,37 +121,3 @@ Environment functions are tree-shaken based on the environment for each bundle p
Functions created using `createIsomorphicFn()` are tree-shaken. All codes inside `.client()` are not included in server bundle, and vice-versa.
On the server, functions created using `createClientOnlyFn()` are replaced with a function that throws an `Error` on the server. The reverse is true for `createServerOnlyFn` functions on the client.
-
-## Troubleshooting
-
-### A loader works on refresh but throws during navigation
-
-If a loader throws `createServerOnlyFn() functions can only be called on the server!` after clicking a link, check whether it calls a server-only helper directly. Route loaders also run in the browser during client navigation. `createServerOnlyFn` guards a local function, it does not send a request to the server.
-
-Wrap the server work in `createServerFn` and call that function from the loader:
-
-```tsx
-import { createFileRoute } from '@tanstack/react-router'
-import { createServerFn, createServerOnlyFn } from '@tanstack/react-start'
-
-const readOnlyOnServer = createServerOnlyFn(() => 'Read on the server')
-const readThroughRpc = createServerFn().handler(() => readOnlyOnServer())
-
-export const Route = createFileRoute('/example')({
- loader: () => readThroughRpc(),
-})
-```
-
-The server function runs directly during SSR and makes a request to the server when called in the browser. Test both a direct page request and navigation from another route. A successful refresh alone does not exercise the browser loader.
-
-The [execution-boundary tests](https://github.com/TanStack/router/blob/main/e2e/react-start/basic/tests/environment-functions.spec.ts) include the failing direct call and the working server-function version. See [Server Functions](./server-functions.md) for validation and middleware when the function accepts user input.
-
-### Browser code throws `window is not defined` on the server
-
-This means browser-only code ran during server execution. Use the stack trace to find the first application or dependency module that reads `window`, `document`, or another browser API.
-
-For a browser-only component, render it inside `ClientOnly` from `@tanstack/react-router` with a useful fallback. The Start compiler removes its children from the server bundle, which lets the bundler remove imports used only by those children. The [ClientOnly example](https://github.com/TanStack/router/blob/main/e2e/react-start/basic/src/routes/client-only.tsx) covers a component that reads `window` at module scope, and its [tests](https://github.com/TanStack/router/blob/main/e2e/react-start/basic/tests/client-only.spec.ts) check the server fallback and hydrated content.
-
-A browser API used elsewhere, such as a route loader or server function, still needs the correct execution boundary. Move component side effects into an effect or event handler. For logic that needs different server and browser implementations, use `createIsomorphicFn` with both implementations. Wrapping a function in `createClientOnlyFn` does not defer its call until the browser, calling that wrapper on the server throws the client-only guard error instead.
-
-If the stack points into build tooling or the error persists in a minimal app with the correct boundary, include that app and the installed Start and bundler versions in a [bug report](https://github.com/TanStack/router/issues/new/choose). A compiler or dependency bug needs a reproducible fix, not a blanket change to rendering mode.
diff --git a/docs/start/framework/react/guide/hosting.md b/docs/start/framework/react/guide/hosting.md
index 2d02f881b3..c8da672208 100644
--- a/docs/start/framework/react/guide/hosting.md
+++ b/docs/start/framework/react/guide/hosting.md
@@ -116,32 +116,6 @@ Deploy your application to Cloudflare Workers using their one-click deployment p
A full TanStack Start example for Cloudflare Workers is available [here](https://github.com/TanStack/router/tree/main/examples/react/start-basic-cloudflare).
-#### Deployment fails even though the Vite build succeeds
-
-If Wrangler reports a missing server entry or unresolved Start virtual modules, check whether your deployment command passes `--config wrangler.jsonc`. With the Cloudflare Vite plugin, that file is the build input. The plugin generates a deployment config with the built server entry and client assets, then writes `.wrangler/deploy/config.json` so Wrangler can find it. Forcing Wrangler to read the source config bypasses that redirect.
-
-Run these commands from the application directory to validate the generated deployment without publishing:
-
-```sh
-pnpm run build
-pnpm exec wrangler deploy --dry-run
-```
-
-Check that Wrangler reports the generated config under `dist`, rather than just the source `wrangler.jsonc`. Keep the source `main` set to `@tanstack/react-start/server-entry` or your custom server entry, and let the Vite plugin generate the deployment entry. Marking unresolved Start modules as external does not fix the missing build transformation.
-
-If your build and deployment run in separate jobs, preserve the build output and `.wrangler/deploy/config.json` with their relative paths, or explicitly pass the generated deployment config. Do not edit generated files to repair the source configuration. See Cloudflare's [generated configuration documentation](https://developers.cloudflare.com/workers/wrangler/configuration/#generated-configuration) for how Wrangler finds that output.
-
-For a named Cloudflare environment, select it when building. For example, if `env.staging` is defined in your source config:
-
-```sh
-CLOUDFLARE_ENV=staging pnpm run build
-pnpm exec wrangler deploy --dry-run
-```
-
-The plugin resolves the environment into the generated config. A later `wrangler deploy --env staging` does not select a different built environment. See [Cloudflare environments](https://developers.cloudflare.com/workers/vite-plugin/reference/cloudflare-environments/).
-
-The [Cloudflare fixture tests](https://github.com/TanStack/router/blob/main/e2e/react-start/basic-cloudflare/tests/app.spec.ts) exercise a generated-config dry run and preview the built app locally. A dry run validates packaging, it does not verify account permissions, a live domain, or deployed bindings.
-
### Netlify ⭐ _Official Partner_
diff --git a/docs/start/framework/react/guide/import-protection.md b/docs/start/framework/react/guide/import-protection.md
index 451d405f81..ebfd2a1853 100644
--- a/docs/start/framework/react/guide/import-protection.md
+++ b/docs/start/framework/react/guide/import-protection.md
@@ -509,6 +509,8 @@ importProtection: {
}
```
+In builds, `onViolation` is called once per denied import that survives tree-shaking. Returning `false` gives that import the real module, and the build runs again until no newly allowed import remains. In dev, it is called when the importing module is compiled.
+
## Disabling Import Protection
To disable import protection entirely:
diff --git a/docs/start/framework/react/guide/server-functions.md b/docs/start/framework/react/guide/server-functions.md
index 879aa9e867..1049c4d0cf 100644
--- a/docs/start/framework/react/guide/server-functions.md
+++ b/docs/start/framework/react/guide/server-functions.md
@@ -76,6 +76,9 @@ Call server functions from:
- **Other server functions** - Compose server logic
- **Event handlers** - Handle form submissions, clicks, etc.
+> [!NOTE]
+> In production builds, only server functions that client code imports can be called over HTTP. A server function that only server code calls (for example another server function's handler or a server route) is not exposed as an endpoint, and neither is one that is only returned to the client as data. The dev server still answers such calls, and logs a warning once per function, so you see it before production refuses it.
+
```tsx
// In a route loader
export const Route = createFileRoute('/posts')({
@@ -418,16 +421,14 @@ Handle request cancellation with `AbortSignal` for long-running operations.
Server functions are addressed by a generated, stable function ID under the hood. These IDs are embedded into the client/SSR builds and used by the server to locate and import the correct module at runtime.
-By default, IDs are SHA256 hashes of the same seed to keep bundles compact and avoid leaking file paths.
+By default, IDs are short hashes (22 characters, from SHA256) of the file and function name, to keep bundles compact and avoid leaking file paths.
If two server functions end up with the same ID (including when using a custom generator), the system de-duplicates by appending an incrementing suffix like `_1`, `_2`, etc.
Customization:
You can customize function ID generation for the production build by providing a `generateFunctionId` function when configuring the TanStack Start build tool plugin.
-Return `undefined` (or an empty string) to use the default ID. Prefer deterministic inputs (filename + functionName) so IDs remain stable between builds.
-
-The ID becomes one segment of the server function's URL (`/_serverFn/`), unencoded, so use only ASCII letters, digits, `-`, `.`, `_`, `~` and `$`, and not `.` or `..`. An ID with whitespace, a control or non-ASCII character, or any of `"`, `#`, `/`, `<`, `>`, `?`, `\`, `^`, `` ` ``, `{` and `}`, an ID that is `.` or `..`, or one with a percent-encoding the server reads as another ID (`%41` for `A`, lowercase hex, `%2E`) or rejects, fails the build with an error naming the file, the function and the ID: the request would reach another function or none. Other characters (`%`, `+`, `:`, `;`, `@`, `'`, `|`, `[`, `]`, …) still work, with a deprecation warning: the next major version rejects them, since proxies and servers may encode or normalise them in the URL. `filename` contains `/`, so hash it (as in the example below) rather than embedding it as is.
+The generator receives `filename` (the file's path relative to the project root) and `functionName` (the server function's export or variable name, e.g. `getUser`). Return `undefined` to use the default ID. Prefer deterministic inputs (filename + functionName) so IDs remain stable between builds.
Please note that this customization is **experimental** and subject to change.
diff --git a/docs/start/framework/react/guide/tanstack-query.md b/docs/start/framework/react/guide/tanstack-query.md
index dec42ca26c..7797ae306b 100644
--- a/docs/start/framework/react/guide/tanstack-query.md
+++ b/docs/start/framework/react/guide/tanstack-query.md
@@ -1,12 +1,6 @@
---
id: tanstack-query
title: TanStack Query
-updated: '2026-09-11'
-testedWith:
- '@tanstack/react-start': '1.168.52'
- '@tanstack/react-query': '5.102.0'
- react: '19.2.3'
- vite: '8.0.14'
description: Use TanStack Query with TanStack Start for request-isolated SSR, hydration, route preloading, streaming, and mutation invalidation.
---
diff --git a/docs/start/framework/react/migrate-from-next-js.md b/docs/start/framework/react/migrate-from-next-js.md
index dc5377df08..a9e6158444 100644
--- a/docs/start/framework/react/migrate-from-next-js.md
+++ b/docs/start/framework/react/migrate-from-next-js.md
@@ -10,7 +10,7 @@ Start does not interpret Next.js route conventions or configuration. Keep your a
## Run the reference application
-Use Node 24 or newer and pnpm 12:
+Use Node 24 or newer and pnpm 11:
```sh
git clone --depth 1 https://github.com/TanStack/router.git
diff --git a/e2e/react-router/basepath-file-based/src/routeTree.gen.ts b/e2e/react-router/basepath-file-based/src/routeTree.gen.ts
index 3badc3f843..9150466414 100644
--- a/e2e/react-router/basepath-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basepath-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -68,13 +66,7 @@ export interface FileRouteTypes {
fullPaths: '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error'
- id:
- | '__root__'
- | '/'
- | '/about'
- | '/redirect'
- | '/redirectReload'
- | '/scroll-error'
+ id: '__root__' | '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts
index c7a15cd84e..7d5242d02d 100644
--- a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -112,39 +110,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/shared-singleton'
- | '/viewport-test'
- | '/without-loader'
- | '/posts/$postId'
- | '/posts/'
- | '/layout-a'
- | '/layout-b'
+ fullPaths: '/' | '/posts' | '/shared-singleton' | '/viewport-test' | '/without-loader' | '/posts/$postId' | '/posts/' | '/layout-a' | '/layout-b'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/shared-singleton'
- | '/viewport-test'
- | '/without-loader'
- | '/posts/$postId'
- | '/posts'
- | '/layout-a'
- | '/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/posts'
- | '/shared-singleton'
- | '/viewport-test'
- | '/without-loader'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
+ to: '/' | '/shared-singleton' | '/viewport-test' | '/without-loader' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'
+ id: '__root__' | '/' | '/_layout' | '/posts' | '/shared-singleton' | '/viewport-test' | '/without-loader' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -248,9 +217,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -260,8 +227,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
diff --git a/e2e/react-router/basic-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
index 83b504992f..cd24f47ee6 100644
--- a/e2e/react-router/basic-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -157,12 +155,11 @@ const DocumentNavigationRoute = DocumentNavigationRouteImport.update({
path: '/document-navigation',
getParentRoute: () => rootRouteImport,
} as any)
-const DocumentNavigationTargetRoute =
- DocumentNavigationTargetRouteImport.update({
- id: '/document-navigation-target',
- path: '/document-navigation-target',
- getParentRoute: () => rootRouteImport,
- } as any)
+const DocumentNavigationTargetRoute = DocumentNavigationTargetRouteImport.update({
+ id: '/document-navigation-target',
+ path: '/document-navigation-target',
+ getParentRoute: () => rootRouteImport,
+} as any)
const EditingARoute = EditingARouteImport.update({
id: '/editing-a',
path: '/editing-a',
@@ -192,7 +189,8 @@ const LazyErrorRoute = LazyErrorRouteImport.update({
id: '/lazy-error',
path: '/lazy-error',
getParentRoute: () => rootRouteImport,
-} as any).lazy(() => import('./routes/lazy-error.lazy').then((d) => d.Route))
+} as any)
+ .lazy(() => import('./routes/lazy-error.lazy').then((d) => d.Route))
const MasksRoute = MasksRouteImport.update({
id: '/masks',
path: '/masks',
@@ -228,18 +226,16 @@ const SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({
path: '/search-params',
getParentRoute: () => rootRouteImport,
} as any)
-const Char45824Char54620Char48124Char44397RouteRoute =
- Char45824Char54620Char48124Char44397RouteRouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => rootRouteImport,
- } as any)
-const anotherGroupOnlyrouteinsideRoute =
- anotherGroupOnlyrouteinsideRouteImport.update({
- id: '/(another-group)/onlyrouteinside',
- path: '/onlyrouteinside',
- getParentRoute: () => rootRouteImport,
- } as any)
+const Char45824Char54620Char48124Char44397RouteRoute = Char45824Char54620Char48124Char44397RouteRouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport.update({
+ id: '/(another-group)/onlyrouteinside',
+ path: '/onlyrouteinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
const groupLayoutRoute = groupLayoutRouteImport.update({
id: '/(group)/_layout',
getParentRoute: () => rootRouteImport,
@@ -249,12 +245,11 @@ const groupInsideRoute = groupInsideRouteImport.update({
path: '/inside',
getParentRoute: () => rootRouteImport,
} as any)
-const groupLazyinsideRoute = groupLazyinsideRouteImport
- .update({
- id: '/(group)/lazyinside',
- path: '/lazyinside',
- getParentRoute: () => rootRouteImport,
- } as any)
+const groupLazyinsideRoute = groupLazyinsideRouteImport.update({
+ id: '/(group)/lazyinside',
+ path: '/lazyinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))
const LayoutLayout2Route = LayoutLayout2RouteImport.update({
id: '/_layout-2',
@@ -299,17 +294,15 @@ const ParamsPsNonNestedRouteRoute = ParamsPsNonNestedRouteRouteImport.update({
path: '/params-ps/non-nested',
getParentRoute: () => rootRouteImport,
} as any)
-const ParamsPsStrictFalseRouteRoute =
- ParamsPsStrictFalseRouteRouteImport.update({
- id: '/params-ps/strict-false',
- path: '/params-ps/strict-false',
- getParentRoute: () => rootRouteImport,
- } as any)
-const PathlessLayoutLayoutRouteRoute =
- PathlessLayoutLayoutRouteRouteImport.update({
- id: '/_layout',
- getParentRoute: () => PathlessLayoutRouteRoute,
- } as any)
+const ParamsPsStrictFalseRouteRoute = ParamsPsStrictFalseRouteRouteImport.update({
+ id: '/params-ps/strict-false',
+ path: '/params-ps/strict-false',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const PathlessLayoutLayoutRouteRoute = PathlessLayoutLayoutRouteRouteImport.update({
+ id: '/_layout',
+ getParentRoute: () => PathlessLayoutRouteRoute,
+} as any)
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -340,12 +333,11 @@ const RelativeLinkRouteRoute = RelativeLinkRouteRouteImport.update({
path: '/relative/link',
getParentRoute: () => rootRouteImport,
} as any)
-const RelativeUseNavigateRouteRoute =
- RelativeUseNavigateRouteRouteImport.update({
- id: '/relative/useNavigate',
- path: '/relative/useNavigate',
- getParentRoute: () => rootRouteImport,
- } as any)
+const RelativeUseNavigateRouteRoute = RelativeUseNavigateRouteRouteImport.update({
+ id: '/relative/useNavigate',
+ path: '/relative/useNavigate',
+ getParentRoute: () => rootRouteImport,
+} as any)
const SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({
id: '/',
path: '/',
@@ -356,12 +348,11 @@ const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({
path: '/default',
getParentRoute: () => SearchParamsRouteRoute,
} as any)
-const StructuralSharingEnabledRoute =
- StructuralSharingEnabledRouteImport.update({
- id: '/structural-sharing/$enabled',
- path: '/structural-sharing/$enabled',
- getParentRoute: () => rootRouteImport,
- } as any)
+const StructuralSharingEnabledRoute = StructuralSharingEnabledRouteImport.update({
+ id: '/structural-sharing/$enabled',
+ path: '/structural-sharing/$enabled',
+ getParentRoute: () => rootRouteImport,
+} as any)
const groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({
id: '/insidelayout',
path: '/insidelayout',
@@ -417,18 +408,16 @@ const NonNestedPathBazRouteRoute = NonNestedPathBazRouteRouteImport.update({
path: '/baz',
getParentRoute: () => NonNestedPathRouteRoute,
} as any)
-const NonNestedPrefixPrefixChar123bazChar125RouteRoute =
- NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({
- id: '/prefix{$baz}',
- path: '/prefix{$baz}',
- getParentRoute: () => NonNestedPrefixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixRouteRoute =
- NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({
- id: '/{$baz}suffix',
- path: '/{$baz}suffix',
- getParentRoute: () => NonNestedSuffixRouteRoute,
- } as any)
+const NonNestedPrefixPrefixChar123bazChar125RouteRoute = NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({
+ id: '/prefix{$baz}',
+ path: '/prefix{$baz}',
+ getParentRoute: () => NonNestedPrefixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixRouteRoute = NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({
+ id: '/{$baz}suffix',
+ path: '/{$baz}suffix',
+ getParentRoute: () => NonNestedSuffixRouteRoute,
+} as any)
const ParamsPsNamedIndexRoute = ParamsPsNamedIndexRouteImport.update({
id: '/params-ps/named/',
path: '/params-ps/named/',
@@ -439,30 +428,26 @@ const ParamsPsNamedFooRouteRoute = ParamsPsNamedFooRouteRouteImport.update({
path: '/params-ps/named/$foo',
getParentRoute: () => rootRouteImport,
} as any)
-const ParamsPsNamedPrefixChar123fooChar125Route =
- ParamsPsNamedPrefixChar123fooChar125RouteImport.update({
- id: '/params-ps/named/prefix{$foo}',
- path: '/params-ps/named/prefix{$foo}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsNamedChar123fooChar125suffixRoute =
- ParamsPsNamedChar123fooChar125suffixRouteImport.update({
- id: '/params-ps/named/{$foo}suffix',
- path: '/params-ps/named/{$foo}suffix',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsNonNestedFooRouteRoute =
- ParamsPsNonNestedFooRouteRouteImport.update({
- id: '/$foo_',
- path: '/$foo',
- getParentRoute: () => ParamsPsNonNestedRouteRoute,
- } as any)
-const ParamsPsStrictFalseVersionRouteRoute =
- ParamsPsStrictFalseVersionRouteRouteImport.update({
- id: '/$version',
- path: '/$version',
- getParentRoute: () => ParamsPsStrictFalseRouteRoute,
- } as any)
+const ParamsPsNamedPrefixChar123fooChar125Route = ParamsPsNamedPrefixChar123fooChar125RouteImport.update({
+ id: '/params-ps/named/prefix{$foo}',
+ path: '/params-ps/named/prefix{$foo}',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsNamedChar123fooChar125suffixRoute = ParamsPsNamedChar123fooChar125suffixRouteImport.update({
+ id: '/params-ps/named/{$foo}suffix',
+ path: '/params-ps/named/{$foo}suffix',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsNonNestedFooRouteRoute = ParamsPsNonNestedFooRouteRouteImport.update({
+ id: '/$foo_',
+ path: '/$foo',
+ getParentRoute: () => ParamsPsNonNestedRouteRoute,
+} as any)
+const ParamsPsStrictFalseVersionRouteRoute = ParamsPsStrictFalseVersionRouteRouteImport.update({
+ id: '/$version',
+ path: '/$version',
+ getParentRoute: () => ParamsPsStrictFalseRouteRoute,
+} as any)
const ParamsPsWildcardIndexRoute = ParamsPsWildcardIndexRouteImport.update({
id: '/params-ps/wildcard/',
path: '/params-ps/wildcard/',
@@ -473,47 +458,41 @@ const ParamsPsWildcardSplatRoute = ParamsPsWildcardSplatRouteImport.update({
path: '/params-ps/wildcard/$',
getParentRoute: () => rootRouteImport,
} as any)
-const ParamsPsWildcardPrefixAtChar45824Char123Char125Route =
- ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({
- id: '/params-ps/wildcard/prefix@대{$}',
- path: '/params-ps/wildcard/prefix@대{$}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsWildcardPrefixChar123Char125Route =
- ParamsPsWildcardPrefixChar123Char125RouteImport.update({
- id: '/params-ps/wildcard/prefix{$}',
- path: '/params-ps/wildcard/prefix{$}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsWildcardChar123Char125suffixRoute =
- ParamsPsWildcardChar123Char125suffixRouteImport.update({
- id: '/params-ps/wildcard/{$}suffix',
- path: '/params-ps/wildcard/{$}suffix',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsWildcardChar123Char125suffixAtChar45824Route =
- ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({
- id: '/params-ps/wildcard/{$}suffix@대',
- path: '/params-ps/wildcard/{$}suffix@대',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ParamsPsWildcardPrefixAtChar45824Char123Char125Route = ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({
+ id: '/params-ps/wildcard/prefix@대{$}',
+ path: '/params-ps/wildcard/prefix@대{$}',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsWildcardPrefixChar123Char125Route = ParamsPsWildcardPrefixChar123Char125RouteImport.update({
+ id: '/params-ps/wildcard/prefix{$}',
+ path: '/params-ps/wildcard/prefix{$}',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsWildcardChar123Char125suffixRoute = ParamsPsWildcardChar123Char125suffixRouteImport.update({
+ id: '/params-ps/wildcard/{$}suffix',
+ path: '/params-ps/wildcard/{$}suffix',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsWildcardChar123Char125suffixAtChar45824Route = ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({
+ id: '/params-ps/wildcard/{$}suffix@대',
+ path: '/params-ps/wildcard/{$}suffix@대',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ParamsSingleValueRoute = ParamsSingleValueRouteImport.update({
id: '/params/single/$value',
path: '/params/single/$value',
getParentRoute: () => rootRouteImport,
} as any)
-const PathlessLayoutLayoutIndexRoute =
- PathlessLayoutLayoutIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => PathlessLayoutLayoutRouteRoute,
- } as any)
-const PathlessLayoutLayoutChildRoute =
- PathlessLayoutLayoutChildRouteImport.update({
- id: '/child',
- path: '/child',
- getParentRoute: () => PathlessLayoutLayoutRouteRoute,
- } as any)
+const PathlessLayoutLayoutIndexRoute = PathlessLayoutLayoutIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => PathlessLayoutLayoutRouteRoute,
+} as any)
+const PathlessLayoutLayoutChildRoute = PathlessLayoutLayoutChildRouteImport.update({
+ id: '/child',
+ path: '/child',
+ getParentRoute: () => PathlessLayoutLayoutRouteRoute,
+} as any)
const PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({
id: '/posts_/$postId/edit',
path: '/posts/$postId/edit',
@@ -524,47 +503,41 @@ const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({
path: '/',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const RedirectTargetDestinationRoute =
- RedirectTargetDestinationRouteImport.update({
- id: '/destination',
- path: '/destination',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetViaBeforeLoadRoute =
- RedirectTargetViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetDestinationRoute = RedirectTargetDestinationRouteImport.update({
+ id: '/destination',
+ path: '/destination',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetViaBeforeLoadRoute = RedirectTargetViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const RedirectTargetViaRouteRedirectBeforeLoadRoute =
- RedirectTargetViaRouteRedirectBeforeLoadRouteImport.update({
- id: '/via-route-redirect-beforeLoad',
- path: '/via-route-redirect-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetViaRouteRedirectLoaderRoute =
- RedirectTargetViaRouteRedirectLoaderRouteImport.update({
- id: '/via-route-redirect-loader',
- path: '/via-route-redirect-loader',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetViaRouteApiRedirectBeforeLoadRoute =
- RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport.update({
- id: '/via-routeApi-redirect-beforeLoad',
- path: '/via-routeApi-redirect-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetViaRouteApiRedirectLoaderRoute =
- RedirectTargetViaRouteApiRedirectLoaderRouteImport.update({
- id: '/via-routeApi-redirect-loader',
- path: '/via-routeApi-redirect-loader',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetViaRouteRedirectBeforeLoadRoute = RedirectTargetViaRouteRedirectBeforeLoadRouteImport.update({
+ id: '/via-route-redirect-beforeLoad',
+ path: '/via-route-redirect-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetViaRouteRedirectLoaderRoute = RedirectTargetViaRouteRedirectLoaderRouteImport.update({
+ id: '/via-route-redirect-loader',
+ path: '/via-route-redirect-loader',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetViaRouteApiRedirectBeforeLoadRoute = RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport.update({
+ id: '/via-routeApi-redirect-beforeLoad',
+ path: '/via-routeApi-redirect-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetViaRouteApiRedirectLoaderRoute = RedirectTargetViaRouteApiRedirectLoaderRouteImport.update({
+ id: '/via-routeApi-redirect-loader',
+ path: '/via-routeApi-redirect-loader',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const RedirectPreloadFirstRoute = RedirectPreloadFirstRouteImport.update({
id: '/redirect/preload/first',
path: '/redirect/preload/first',
@@ -580,53 +553,46 @@ const RedirectPreloadThirdRoute = RedirectPreloadThirdRouteImport.update({
path: '/redirect/preload/third',
getParentRoute: () => rootRouteImport,
} as any)
-const RelativeLinkRelativeLinkARoute =
- RelativeLinkRelativeLinkARouteImport.update({
- id: '/relative-link-a',
- path: '/relative-link-a',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeLinkRelativeLinkBRoute =
- RelativeLinkRelativeLinkBRouteImport.update({
- id: '/relative-link-b',
- path: '/relative-link-b',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeUseNavigateRelativeUseNavigateARoute =
- RelativeUseNavigateRelativeUseNavigateARouteImport.update({
- id: '/relative-useNavigate-a',
- path: '/relative-useNavigate-a',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigateRelativeUseNavigateBRoute =
- RelativeUseNavigateRelativeUseNavigateBRouteImport.update({
- id: '/relative-useNavigate-b',
- path: '/relative-useNavigate-b',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const Char45824Char54620Char48124Char44397WildcardSplatRoute =
- Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({
- id: '/wildcard/$',
- path: '/wildcard/$',
- getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
- } as any)
-const Char45824Char54620Char48124Char44397Char55357Char56960IdRoute =
- Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({
- id: '/🚀/$id',
- path: '/🚀/$id',
- getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
- } as any)
+const RelativeLinkRelativeLinkARoute = RelativeLinkRelativeLinkARouteImport.update({
+ id: '/relative-link-a',
+ path: '/relative-link-a',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeLinkRelativeLinkBRoute = RelativeLinkRelativeLinkBRouteImport.update({
+ id: '/relative-link-b',
+ path: '/relative-link-b',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeUseNavigateRelativeUseNavigateARoute = RelativeUseNavigateRelativeUseNavigateARouteImport.update({
+ id: '/relative-useNavigate-a',
+ path: '/relative-useNavigate-a',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigateRelativeUseNavigateBRoute = RelativeUseNavigateRelativeUseNavigateBRouteImport.update({
+ id: '/relative-useNavigate-b',
+ path: '/relative-useNavigate-b',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const Char45824Char54620Char48124Char44397WildcardSplatRoute = Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({
+ id: '/wildcard/$',
+ path: '/wildcard/$',
+ getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
+} as any)
+const Char45824Char54620Char48124Char44397Char55357Char56960IdRoute = Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({
+ id: '/🚀/$id',
+ path: '/🚀/$id',
+ getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
+} as any)
const NonNestedDeepBazIndexRoute = NonNestedDeepBazIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => NonNestedDeepBazRouteRoute,
} as any)
-const NonNestedDeepBazBarRouteRoute =
- NonNestedDeepBazBarRouteRouteImport.update({
- id: '/$baz_/bar',
- path: '/$baz/bar',
- getParentRoute: () => NonNestedDeepRouteRoute,
- } as any)
+const NonNestedDeepBazBarRouteRoute = NonNestedDeepBazBarRouteRouteImport.update({
+ id: '/$baz_/bar',
+ path: '/$baz/bar',
+ getParentRoute: () => NonNestedDeepRouteRoute,
+} as any)
const NonNestedNamedBazIndexRoute = NonNestedNamedBazIndexRouteImport.update({
id: '/',
path: '/',
@@ -657,48 +623,41 @@ const NonNestedPathBazBarRoute = NonNestedPathBazBarRouteImport.update({
path: '/baz/bar',
getParentRoute: () => NonNestedPathRouteRoute,
} as any)
-const NonNestedPrefixPrefixChar123bazChar125IndexRoute =
- NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
- } as any)
-const NonNestedPrefixPrefixChar123bazChar125FooRoute =
- NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({
- id: '/foo',
- path: '/foo',
- getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
- } as any)
-const NonNestedPrefixPrefixChar123bazChar125BarRoute =
- NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({
- id: '/prefix{$baz}_/bar',
- path: '/prefix{$baz}/bar',
- getParentRoute: () => NonNestedPrefixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixIndexRoute =
- NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixFooRoute =
- NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({
- id: '/foo',
- path: '/foo',
- getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixBarRoute =
- NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({
- id: '/{$baz}suffix_/bar',
- path: '/{$baz}suffix/bar',
- getParentRoute: () => NonNestedSuffixRouteRoute,
- } as any)
-const ParamsPsNamedFooBarRouteRoute =
- ParamsPsNamedFooBarRouteRouteImport.update({
- id: '/$bar',
- path: '/$bar',
- getParentRoute: () => ParamsPsNamedFooRouteRoute,
- } as any)
+const NonNestedPrefixPrefixChar123bazChar125IndexRoute = NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
+} as any)
+const NonNestedPrefixPrefixChar123bazChar125FooRoute = NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({
+ id: '/foo',
+ path: '/foo',
+ getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
+} as any)
+const NonNestedPrefixPrefixChar123bazChar125BarRoute = NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({
+ id: '/prefix{$baz}_/bar',
+ path: '/prefix{$baz}/bar',
+ getParentRoute: () => NonNestedPrefixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixIndexRoute = NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixFooRoute = NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({
+ id: '/foo',
+ path: '/foo',
+ getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixBarRoute = NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({
+ id: '/{$baz}suffix_/bar',
+ path: '/{$baz}suffix/bar',
+ getParentRoute: () => NonNestedSuffixRouteRoute,
+} as any)
+const ParamsPsNamedFooBarRouteRoute = ParamsPsNamedFooBarRouteRouteImport.update({
+ id: '/$bar',
+ path: '/$bar',
+ getParentRoute: () => ParamsPsNamedFooRouteRoute,
+} as any)
const ParamsPsNonNestedFooBarRoute = ParamsPsNonNestedFooBarRouteImport.update({
id: '/$bar',
path: '/$bar',
@@ -714,42 +673,36 @@ const RelativeLinkPathIndexRoute = RelativeLinkPathIndexRouteImport.update({
path: '/path/',
getParentRoute: () => RelativeLinkRouteRoute,
} as any)
-const RelativeLinkWithSearchIndexRoute =
- RelativeLinkWithSearchIndexRouteImport.update({
- id: '/with-search/',
- path: '/with-search/',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeUseNavigateNestedIndexRoute =
- RelativeUseNavigateNestedIndexRouteImport.update({
- id: '/nested/',
- path: '/nested/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigatePathIndexRoute =
- RelativeUseNavigatePathIndexRouteImport.update({
- id: '/path/',
- path: '/path/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigateWithSearchIndexRoute =
- RelativeUseNavigateWithSearchIndexRouteImport.update({
- id: '/with-search/',
- path: '/with-search/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const NonNestedDeepBazBarIndexRoute =
- NonNestedDeepBazBarIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedDeepBazBarRouteRoute,
- } as any)
-const NonNestedDeepBazBarFooRouteRoute =
- NonNestedDeepBazBarFooRouteRouteImport.update({
- id: '/$foo',
- path: '/$foo',
- getParentRoute: () => NonNestedDeepBazBarRouteRoute,
- } as any)
+const RelativeLinkWithSearchIndexRoute = RelativeLinkWithSearchIndexRouteImport.update({
+ id: '/with-search/',
+ path: '/with-search/',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeUseNavigateNestedIndexRoute = RelativeUseNavigateNestedIndexRouteImport.update({
+ id: '/nested/',
+ path: '/nested/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigatePathIndexRoute = RelativeUseNavigatePathIndexRouteImport.update({
+ id: '/path/',
+ path: '/path/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigateWithSearchIndexRoute = RelativeUseNavigateWithSearchIndexRouteImport.update({
+ id: '/with-search/',
+ path: '/with-search/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const NonNestedDeepBazBarIndexRoute = NonNestedDeepBazBarIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedDeepBazBarRouteRoute,
+} as any)
+const NonNestedDeepBazBarFooRouteRoute = NonNestedDeepBazBarFooRouteRouteImport.update({
+ id: '/$foo',
+ path: '/$foo',
+ getParentRoute: () => NonNestedDeepBazBarRouteRoute,
+} as any)
const NonNestedDeepBazBarQuxRoute = NonNestedDeepBazBarQuxRouteImport.update({
id: '/$baz_/bar_/qux',
path: '/$baz/bar/qux',
@@ -760,42 +713,36 @@ const ParamsPsNamedFooBarBazRoute = ParamsPsNamedFooBarBazRouteImport.update({
path: '/$baz',
getParentRoute: () => ParamsPsNamedFooBarRouteRoute,
} as any)
-const RelativeLinkNestedDeepIndexRoute =
- RelativeLinkNestedDeepIndexRouteImport.update({
- id: '/nested/deep/',
- path: '/nested/deep/',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeLinkPathPathIndexRoute =
- RelativeLinkPathPathIndexRouteImport.update({
- id: '/path/$path/',
- path: '/path/$path/',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeUseNavigateNestedDeepIndexRoute =
- RelativeUseNavigateNestedDeepIndexRouteImport.update({
- id: '/nested/deep/',
- path: '/nested/deep/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigatePathPathIndexRoute =
- RelativeUseNavigatePathPathIndexRouteImport.update({
- id: '/path/$path/',
- path: '/path/$path/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const NonNestedDeepBazBarFooIndexRoute =
- NonNestedDeepBazBarFooIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedDeepBazBarFooRouteRoute,
- } as any)
-const NonNestedDeepBazBarFooQuxRoute =
- NonNestedDeepBazBarFooQuxRouteImport.update({
- id: '/$foo_/qux',
- path: '/$foo/qux',
- getParentRoute: () => NonNestedDeepBazBarRouteRoute,
- } as any)
+const RelativeLinkNestedDeepIndexRoute = RelativeLinkNestedDeepIndexRouteImport.update({
+ id: '/nested/deep/',
+ path: '/nested/deep/',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeLinkPathPathIndexRoute = RelativeLinkPathPathIndexRouteImport.update({
+ id: '/path/$path/',
+ path: '/path/$path/',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeUseNavigateNestedDeepIndexRoute = RelativeUseNavigateNestedDeepIndexRouteImport.update({
+ id: '/nested/deep/',
+ path: '/nested/deep/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigatePathPathIndexRoute = RelativeUseNavigatePathPathIndexRouteImport.update({
+ id: '/path/$path/',
+ path: '/path/$path/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const NonNestedDeepBazBarFooIndexRoute = NonNestedDeepBazBarFooIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedDeepBazBarFooRouteRoute,
+} as any)
+const NonNestedDeepBazBarFooQuxRoute = NonNestedDeepBazBarFooQuxRouteImport.update({
+ id: '/$foo_/qux',
+ path: '/$foo/qux',
+ getParentRoute: () => NonNestedDeepBazBarRouteRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -1153,358 +1100,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/fullpath-test'
- | '/non-nested'
- | '/pathless-layout'
- | '/search-params'
- | '/대한민국'
- | '/anchor'
- | '/component-types-test'
- | '/document-navigation'
- | '/document-navigation-target'
- | '/editing-a'
- | '/editing-b'
- | '/history-blocking'
- | '/hover-preload-hash'
- | '/lazy-error'
- | '/masks'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/non-nested/deep'
- | '/non-nested/named'
- | '/non-nested/path'
- | '/non-nested/prefix'
- | '/non-nested/suffix'
- | '/params-ps/non-nested'
- | '/params-ps/strict-false'
- | '/relative/link'
- | '/relative/useNavigate'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/redirect/$target'
- | '/search-params/default'
- | '/structural-sharing/$enabled'
- | '/params-ps/'
- | '/posts/'
- | '/redirect/'
- | '/relative/'
- | '/search-params/'
- | '/non-nested/deep/$baz'
- | '/non-nested/named/$baz'
- | '/non-nested/path/baz'
- | '/non-nested/prefix/prefix{$baz}'
- | '/non-nested/suffix/{$baz}suffix'
- | '/params-ps/named/$foo'
- | '/params-ps/non-nested/$foo'
- | '/params-ps/strict-false/$version'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/fullpath-test/$id'
- | '/masks/admin/$userId'
- | '/masks/public/$username'
- | '/params-ps/named/prefix{$foo}'
- | '/params-ps/named/{$foo}suffix'
- | '/params-ps/wildcard/$'
- | '/params-ps/wildcard/prefix@대{$}'
- | '/params-ps/wildcard/prefix{$}'
- | '/params-ps/wildcard/{$}suffix'
- | '/params-ps/wildcard/{$}suffix@대'
- | '/params/single/$value'
- | '/pathless-layout/child'
- | '/posts/$postId/edit'
- | '/redirect/$target/destination'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/redirect/$target/via-route-redirect-beforeLoad'
- | '/redirect/$target/via-route-redirect-loader'
- | '/redirect/$target/via-routeApi-redirect-beforeLoad'
- | '/redirect/$target/via-routeApi-redirect-loader'
- | '/redirect/preload/first'
- | '/redirect/preload/second'
- | '/redirect/preload/third'
- | '/relative/link/relative-link-a'
- | '/relative/link/relative-link-b'
- | '/relative/useNavigate/relative-useNavigate-a'
- | '/relative/useNavigate/relative-useNavigate-b'
- | '/대한민국/wildcard/$'
- | '/대한민국/🚀/$id'
- | '/fullpath-test/'
- | '/params-ps/named/'
- | '/params-ps/wildcard/'
- | '/pathless-layout/'
- | '/redirect/$target/'
- | '/non-nested/deep/$baz/bar'
- | '/params-ps/named/$foo/$bar'
- | '/non-nested/named/$baz/foo'
- | '/non-nested/named/$baz/bar'
- | '/non-nested/path/baz/foo'
- | '/non-nested/path/baz/bar'
- | '/non-nested/prefix/prefix{$baz}/foo'
- | '/non-nested/prefix/prefix{$baz}/bar'
- | '/non-nested/suffix/{$baz}suffix/foo'
- | '/non-nested/suffix/{$baz}suffix/bar'
- | '/params-ps/non-nested/$foo/$bar'
- | '/non-nested/deep/$baz/'
- | '/non-nested/named/$baz/'
- | '/non-nested/path/baz/'
- | '/non-nested/prefix/prefix{$baz}/'
- | '/non-nested/suffix/{$baz}suffix/'
- | '/relative/link/nested/'
- | '/relative/link/path/'
- | '/relative/link/with-search/'
- | '/relative/useNavigate/nested/'
- | '/relative/useNavigate/path/'
- | '/relative/useNavigate/with-search/'
- | '/non-nested/deep/$baz/bar/$foo'
- | '/non-nested/deep/$baz/bar/qux'
- | '/params-ps/named/$foo/$bar/$baz'
- | '/non-nested/deep/$baz/bar/'
- | '/relative/link/nested/deep/'
- | '/relative/link/path/$path/'
- | '/relative/useNavigate/nested/deep/'
- | '/relative/useNavigate/path/$path/'
- | '/non-nested/deep/$baz/bar/$foo/qux'
- | '/non-nested/deep/$baz/bar/$foo/'
+ fullPaths: '/' | '/fullpath-test' | '/non-nested' | '/pathless-layout' | '/search-params' | '/대한민국' | '/anchor' | '/component-types-test' | '/document-navigation' | '/document-navigation-target' | '/editing-a' | '/editing-b' | '/history-blocking' | '/hover-preload-hash' | '/lazy-error' | '/masks' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/non-nested/deep' | '/non-nested/named' | '/non-nested/path' | '/non-nested/prefix' | '/non-nested/suffix' | '/params-ps/non-nested' | '/params-ps/strict-false' | '/relative/link' | '/relative/useNavigate' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/redirect/$target' | '/search-params/default' | '/structural-sharing/$enabled' | '/params-ps/' | '/posts/' | '/redirect/' | '/relative/' | '/search-params/' | '/non-nested/deep/$baz' | '/non-nested/named/$baz' | '/non-nested/path/baz' | '/non-nested/prefix/prefix{$baz}' | '/non-nested/suffix/{$baz}suffix' | '/params-ps/named/$foo' | '/params-ps/non-nested/$foo' | '/params-ps/strict-false/$version' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/fullpath-test/$id' | '/masks/admin/$userId' | '/masks/public/$username' | '/params-ps/named/prefix{$foo}' | '/params-ps/named/{$foo}suffix' | '/params-ps/wildcard/$' | '/params-ps/wildcard/prefix@대{$}' | '/params-ps/wildcard/prefix{$}' | '/params-ps/wildcard/{$}suffix' | '/params-ps/wildcard/{$}suffix@대' | '/params/single/$value' | '/pathless-layout/child' | '/posts/$postId/edit' | '/redirect/$target/destination' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/redirect/$target/via-route-redirect-beforeLoad' | '/redirect/$target/via-route-redirect-loader' | '/redirect/$target/via-routeApi-redirect-beforeLoad' | '/redirect/$target/via-routeApi-redirect-loader' | '/redirect/preload/first' | '/redirect/preload/second' | '/redirect/preload/third' | '/relative/link/relative-link-a' | '/relative/link/relative-link-b' | '/relative/useNavigate/relative-useNavigate-a' | '/relative/useNavigate/relative-useNavigate-b' | '/대한민국/wildcard/$' | '/대한민국/🚀/$id' | '/fullpath-test/' | '/params-ps/named/' | '/params-ps/wildcard/' | '/pathless-layout/' | '/redirect/$target/' | '/non-nested/deep/$baz/bar' | '/params-ps/named/$foo/$bar' | '/non-nested/named/$baz/foo' | '/non-nested/named/$baz/bar' | '/non-nested/path/baz/foo' | '/non-nested/path/baz/bar' | '/non-nested/prefix/prefix{$baz}/foo' | '/non-nested/prefix/prefix{$baz}/bar' | '/non-nested/suffix/{$baz}suffix/foo' | '/non-nested/suffix/{$baz}suffix/bar' | '/params-ps/non-nested/$foo/$bar' | '/non-nested/deep/$baz/' | '/non-nested/named/$baz/' | '/non-nested/path/baz/' | '/non-nested/prefix/prefix{$baz}/' | '/non-nested/suffix/{$baz}suffix/' | '/relative/link/nested/' | '/relative/link/path/' | '/relative/link/with-search/' | '/relative/useNavigate/nested/' | '/relative/useNavigate/path/' | '/relative/useNavigate/with-search/' | '/non-nested/deep/$baz/bar/$foo' | '/non-nested/deep/$baz/bar/qux' | '/params-ps/named/$foo/$bar/$baz' | '/non-nested/deep/$baz/bar/' | '/relative/link/nested/deep/' | '/relative/link/path/$path/' | '/relative/useNavigate/nested/deep/' | '/relative/useNavigate/path/$path/' | '/non-nested/deep/$baz/bar/$foo/qux' | '/non-nested/deep/$baz/bar/$foo/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/fullpath-test'
- | '/non-nested'
- | '/pathless-layout'
- | '/대한민국'
- | '/anchor'
- | '/component-types-test'
- | '/document-navigation'
- | '/document-navigation-target'
- | '/editing-a'
- | '/editing-b'
- | '/history-blocking'
- | '/hover-preload-hash'
- | '/lazy-error'
- | '/masks'
- | '/notRemountDeps'
- | '/remountDeps'
- | '/non-nested/deep'
- | '/non-nested/named'
- | '/non-nested/path'
- | '/non-nested/prefix'
- | '/non-nested/suffix'
- | '/params-ps/non-nested'
- | '/params-ps/strict-false'
- | '/relative/link'
- | '/relative/useNavigate'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/search-params/default'
- | '/structural-sharing/$enabled'
- | '/params-ps'
- | '/posts'
- | '/redirect'
- | '/relative'
- | '/search-params'
- | '/params-ps/named/$foo'
- | '/params-ps/non-nested/$foo'
- | '/params-ps/strict-false/$version'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/fullpath-test/$id'
- | '/masks/admin/$userId'
- | '/masks/public/$username'
- | '/params-ps/named/prefix{$foo}'
- | '/params-ps/named/{$foo}suffix'
- | '/params-ps/wildcard/$'
- | '/params-ps/wildcard/prefix@대{$}'
- | '/params-ps/wildcard/prefix{$}'
- | '/params-ps/wildcard/{$}suffix'
- | '/params-ps/wildcard/{$}suffix@대'
- | '/params/single/$value'
- | '/pathless-layout/child'
- | '/posts/$postId/edit'
- | '/redirect/$target/destination'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/redirect/$target/via-route-redirect-beforeLoad'
- | '/redirect/$target/via-route-redirect-loader'
- | '/redirect/$target/via-routeApi-redirect-beforeLoad'
- | '/redirect/$target/via-routeApi-redirect-loader'
- | '/redirect/preload/first'
- | '/redirect/preload/second'
- | '/redirect/preload/third'
- | '/relative/link/relative-link-a'
- | '/relative/link/relative-link-b'
- | '/relative/useNavigate/relative-useNavigate-a'
- | '/relative/useNavigate/relative-useNavigate-b'
- | '/대한민국/wildcard/$'
- | '/대한민국/🚀/$id'
- | '/params-ps/named'
- | '/params-ps/wildcard'
- | '/redirect/$target'
- | '/params-ps/named/$foo/$bar'
- | '/non-nested/named/$baz/foo'
- | '/non-nested/named/$baz/bar'
- | '/non-nested/path/baz/foo'
- | '/non-nested/path/baz/bar'
- | '/non-nested/prefix/prefix{$baz}/foo'
- | '/non-nested/prefix/prefix{$baz}/bar'
- | '/non-nested/suffix/{$baz}suffix/foo'
- | '/non-nested/suffix/{$baz}suffix/bar'
- | '/params-ps/non-nested/$foo/$bar'
- | '/non-nested/deep/$baz'
- | '/non-nested/named/$baz'
- | '/non-nested/path/baz'
- | '/non-nested/prefix/prefix{$baz}'
- | '/non-nested/suffix/{$baz}suffix'
- | '/relative/link/nested'
- | '/relative/link/path'
- | '/relative/link/with-search'
- | '/relative/useNavigate/nested'
- | '/relative/useNavigate/path'
- | '/relative/useNavigate/with-search'
- | '/non-nested/deep/$baz/bar/qux'
- | '/params-ps/named/$foo/$bar/$baz'
- | '/non-nested/deep/$baz/bar'
- | '/relative/link/nested/deep'
- | '/relative/link/path/$path'
- | '/relative/useNavigate/nested/deep'
- | '/relative/useNavigate/path/$path'
- | '/non-nested/deep/$baz/bar/$foo/qux'
- | '/non-nested/deep/$baz/bar/$foo'
- id:
- | '__root__'
- | '/'
- | '/fullpath-test'
- | '/non-nested'
- | '/pathless-layout'
- | '/search-params'
- | '/대한민국'
- | '/_layout'
- | '/anchor'
- | '/component-types-test'
- | '/document-navigation'
- | '/document-navigation-target'
- | '/editing-a'
- | '/editing-b'
- | '/history-blocking'
- | '/hover-preload-hash'
- | '/lazy-error'
- | '/masks'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/fullpath-test/_layout'
- | '/non-nested/deep'
- | '/non-nested/named'
- | '/non-nested/path'
- | '/non-nested/prefix'
- | '/non-nested/suffix'
- | '/params-ps/non-nested'
- | '/params-ps/strict-false'
- | '/pathless-layout/_layout'
- | '/relative/link'
- | '/relative/useNavigate'
- | '/(another-group)/onlyrouteinside'
- | '/(group)/_layout'
- | '/(group)/inside'
- | '/(group)/lazyinside'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/redirect/$target'
- | '/search-params/default'
- | '/structural-sharing/$enabled'
- | '/params-ps/'
- | '/posts/'
- | '/redirect/'
- | '/relative/'
- | '/search-params/'
- | '/non-nested/deep/$baz'
- | '/non-nested/named/$baz'
- | '/non-nested/path/baz'
- | '/non-nested/prefix/prefix{$baz}'
- | '/non-nested/suffix/{$baz}suffix'
- | '/params-ps/named/$foo'
- | '/params-ps/non-nested/$foo_'
- | '/params-ps/strict-false/$version'
- | '/(group)/_layout/insidelayout'
- | '/(group)/subfolder/inside'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/fullpath-test/_layout/$id'
- | '/masks/admin/$userId'
- | '/masks/public/$username'
- | '/params-ps/named/prefix{$foo}'
- | '/params-ps/named/{$foo}suffix'
- | '/params-ps/wildcard/$'
- | '/params-ps/wildcard/prefix@대{$}'
- | '/params-ps/wildcard/prefix{$}'
- | '/params-ps/wildcard/{$}suffix'
- | '/params-ps/wildcard/{$}suffix@대'
- | '/params/single/$value'
- | '/pathless-layout/_layout/child'
- | '/posts_/$postId/edit'
- | '/redirect/$target/destination'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/redirect/$target/via-route-redirect-beforeLoad'
- | '/redirect/$target/via-route-redirect-loader'
- | '/redirect/$target/via-routeApi-redirect-beforeLoad'
- | '/redirect/$target/via-routeApi-redirect-loader'
- | '/redirect/preload/first'
- | '/redirect/preload/second'
- | '/redirect/preload/third'
- | '/relative/link/relative-link-a'
- | '/relative/link/relative-link-b'
- | '/relative/useNavigate/relative-useNavigate-a'
- | '/relative/useNavigate/relative-useNavigate-b'
- | '/대한민국/wildcard/$'
- | '/대한민국/🚀/$id'
- | '/fullpath-test/_layout/'
- | '/params-ps/named/'
- | '/params-ps/wildcard/'
- | '/pathless-layout/_layout/'
- | '/redirect/$target/'
- | '/non-nested/deep/$baz_/bar'
- | '/params-ps/named/$foo/$bar'
- | '/non-nested/named/$baz/foo'
- | '/non-nested/named/$baz_/bar'
- | '/non-nested/path/baz/foo'
- | '/non-nested/path/baz_/bar'
- | '/non-nested/prefix/prefix{$baz}/foo'
- | '/non-nested/prefix/prefix{$baz}_/bar'
- | '/non-nested/suffix/{$baz}suffix/foo'
- | '/non-nested/suffix/{$baz}suffix_/bar'
- | '/params-ps/non-nested/$foo_/$bar'
- | '/non-nested/deep/$baz/'
- | '/non-nested/named/$baz/'
- | '/non-nested/path/baz/'
- | '/non-nested/prefix/prefix{$baz}/'
- | '/non-nested/suffix/{$baz}suffix/'
- | '/relative/link/nested/'
- | '/relative/link/path/'
- | '/relative/link/with-search/'
- | '/relative/useNavigate/nested/'
- | '/relative/useNavigate/path/'
- | '/relative/useNavigate/with-search/'
- | '/non-nested/deep/$baz_/bar/$foo'
- | '/non-nested/deep/$baz_/bar_/qux'
- | '/params-ps/named/$foo/$bar/$baz'
- | '/non-nested/deep/$baz_/bar/'
- | '/relative/link/nested/deep/'
- | '/relative/link/path/$path/'
- | '/relative/useNavigate/nested/deep/'
- | '/relative/useNavigate/path/$path/'
- | '/non-nested/deep/$baz_/bar/$foo_/qux'
- | '/non-nested/deep/$baz_/bar/$foo/'
+ to: '/' | '/fullpath-test' | '/non-nested' | '/pathless-layout' | '/대한민국' | '/anchor' | '/component-types-test' | '/document-navigation' | '/document-navigation-target' | '/editing-a' | '/editing-b' | '/history-blocking' | '/hover-preload-hash' | '/lazy-error' | '/masks' | '/notRemountDeps' | '/remountDeps' | '/non-nested/deep' | '/non-nested/named' | '/non-nested/path' | '/non-nested/prefix' | '/non-nested/suffix' | '/params-ps/non-nested' | '/params-ps/strict-false' | '/relative/link' | '/relative/useNavigate' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/search-params/default' | '/structural-sharing/$enabled' | '/params-ps' | '/posts' | '/redirect' | '/relative' | '/search-params' | '/params-ps/named/$foo' | '/params-ps/non-nested/$foo' | '/params-ps/strict-false/$version' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/fullpath-test/$id' | '/masks/admin/$userId' | '/masks/public/$username' | '/params-ps/named/prefix{$foo}' | '/params-ps/named/{$foo}suffix' | '/params-ps/wildcard/$' | '/params-ps/wildcard/prefix@대{$}' | '/params-ps/wildcard/prefix{$}' | '/params-ps/wildcard/{$}suffix' | '/params-ps/wildcard/{$}suffix@대' | '/params/single/$value' | '/pathless-layout/child' | '/posts/$postId/edit' | '/redirect/$target/destination' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/redirect/$target/via-route-redirect-beforeLoad' | '/redirect/$target/via-route-redirect-loader' | '/redirect/$target/via-routeApi-redirect-beforeLoad' | '/redirect/$target/via-routeApi-redirect-loader' | '/redirect/preload/first' | '/redirect/preload/second' | '/redirect/preload/third' | '/relative/link/relative-link-a' | '/relative/link/relative-link-b' | '/relative/useNavigate/relative-useNavigate-a' | '/relative/useNavigate/relative-useNavigate-b' | '/대한민국/wildcard/$' | '/대한민국/🚀/$id' | '/params-ps/named' | '/params-ps/wildcard' | '/redirect/$target' | '/params-ps/named/$foo/$bar' | '/non-nested/named/$baz/foo' | '/non-nested/named/$baz/bar' | '/non-nested/path/baz/foo' | '/non-nested/path/baz/bar' | '/non-nested/prefix/prefix{$baz}/foo' | '/non-nested/prefix/prefix{$baz}/bar' | '/non-nested/suffix/{$baz}suffix/foo' | '/non-nested/suffix/{$baz}suffix/bar' | '/params-ps/non-nested/$foo/$bar' | '/non-nested/deep/$baz' | '/non-nested/named/$baz' | '/non-nested/path/baz' | '/non-nested/prefix/prefix{$baz}' | '/non-nested/suffix/{$baz}suffix' | '/relative/link/nested' | '/relative/link/path' | '/relative/link/with-search' | '/relative/useNavigate/nested' | '/relative/useNavigate/path' | '/relative/useNavigate/with-search' | '/non-nested/deep/$baz/bar/qux' | '/params-ps/named/$foo/$bar/$baz' | '/non-nested/deep/$baz/bar' | '/relative/link/nested/deep' | '/relative/link/path/$path' | '/relative/useNavigate/nested/deep' | '/relative/useNavigate/path/$path' | '/non-nested/deep/$baz/bar/$foo/qux' | '/non-nested/deep/$baz/bar/$foo'
+ id: '__root__' | '/' | '/fullpath-test' | '/non-nested' | '/pathless-layout' | '/search-params' | '/대한민국' | '/_layout' | '/anchor' | '/component-types-test' | '/document-navigation' | '/document-navigation-target' | '/editing-a' | '/editing-b' | '/history-blocking' | '/hover-preload-hash' | '/lazy-error' | '/masks' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/fullpath-test/_layout' | '/non-nested/deep' | '/non-nested/named' | '/non-nested/path' | '/non-nested/prefix' | '/non-nested/suffix' | '/params-ps/non-nested' | '/params-ps/strict-false' | '/pathless-layout/_layout' | '/relative/link' | '/relative/useNavigate' | '/(another-group)/onlyrouteinside' | '/(group)/_layout' | '/(group)/inside' | '/(group)/lazyinside' | '/_layout/_layout-2' | '/posts/$postId' | '/redirect/$target' | '/search-params/default' | '/structural-sharing/$enabled' | '/params-ps/' | '/posts/' | '/redirect/' | '/relative/' | '/search-params/' | '/non-nested/deep/$baz' | '/non-nested/named/$baz' | '/non-nested/path/baz' | '/non-nested/prefix/prefix{$baz}' | '/non-nested/suffix/{$baz}suffix' | '/params-ps/named/$foo' | '/params-ps/non-nested/$foo_' | '/params-ps/strict-false/$version' | '/(group)/_layout/insidelayout' | '/(group)/subfolder/inside' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/fullpath-test/_layout/$id' | '/masks/admin/$userId' | '/masks/public/$username' | '/params-ps/named/prefix{$foo}' | '/params-ps/named/{$foo}suffix' | '/params-ps/wildcard/$' | '/params-ps/wildcard/prefix@대{$}' | '/params-ps/wildcard/prefix{$}' | '/params-ps/wildcard/{$}suffix' | '/params-ps/wildcard/{$}suffix@대' | '/params/single/$value' | '/pathless-layout/_layout/child' | '/posts_/$postId/edit' | '/redirect/$target/destination' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/redirect/$target/via-route-redirect-beforeLoad' | '/redirect/$target/via-route-redirect-loader' | '/redirect/$target/via-routeApi-redirect-beforeLoad' | '/redirect/$target/via-routeApi-redirect-loader' | '/redirect/preload/first' | '/redirect/preload/second' | '/redirect/preload/third' | '/relative/link/relative-link-a' | '/relative/link/relative-link-b' | '/relative/useNavigate/relative-useNavigate-a' | '/relative/useNavigate/relative-useNavigate-b' | '/대한민국/wildcard/$' | '/대한민국/🚀/$id' | '/fullpath-test/_layout/' | '/params-ps/named/' | '/params-ps/wildcard/' | '/pathless-layout/_layout/' | '/redirect/$target/' | '/non-nested/deep/$baz_/bar' | '/params-ps/named/$foo/$bar' | '/non-nested/named/$baz/foo' | '/non-nested/named/$baz_/bar' | '/non-nested/path/baz/foo' | '/non-nested/path/baz_/bar' | '/non-nested/prefix/prefix{$baz}/foo' | '/non-nested/prefix/prefix{$baz}_/bar' | '/non-nested/suffix/{$baz}suffix/foo' | '/non-nested/suffix/{$baz}suffix_/bar' | '/params-ps/non-nested/$foo_/$bar' | '/non-nested/deep/$baz/' | '/non-nested/named/$baz/' | '/non-nested/path/baz/' | '/non-nested/prefix/prefix{$baz}/' | '/non-nested/suffix/{$baz}suffix/' | '/relative/link/nested/' | '/relative/link/path/' | '/relative/link/with-search/' | '/relative/useNavigate/nested/' | '/relative/useNavigate/path/' | '/relative/useNavigate/with-search/' | '/non-nested/deep/$baz_/bar/$foo' | '/non-nested/deep/$baz_/bar_/qux' | '/params-ps/named/$foo/$bar/$baz' | '/non-nested/deep/$baz_/bar/' | '/relative/link/nested/deep/' | '/relative/link/path/$path/' | '/relative/useNavigate/nested/deep/' | '/relative/useNavigate/path/$path/' | '/non-nested/deep/$baz_/bar/$foo_/qux' | '/non-nested/deep/$baz_/bar/$foo/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -2430,16 +2029,12 @@ interface FullpathTestLayoutRouteRouteChildren {
FullpathTestLayoutIndexRoute: typeof FullpathTestLayoutIndexRoute
}
-const FullpathTestLayoutRouteRouteChildren: FullpathTestLayoutRouteRouteChildren =
- {
- FullpathTestLayoutIdRoute: FullpathTestLayoutIdRoute,
- FullpathTestLayoutIndexRoute: FullpathTestLayoutIndexRoute,
- }
+const FullpathTestLayoutRouteRouteChildren: FullpathTestLayoutRouteRouteChildren = {
+ FullpathTestLayoutIdRoute: FullpathTestLayoutIdRoute,
+ FullpathTestLayoutIndexRoute: FullpathTestLayoutIndexRoute,
+}
-const FullpathTestLayoutRouteRouteWithChildren =
- FullpathTestLayoutRouteRoute._addFileChildren(
- FullpathTestLayoutRouteRouteChildren,
- )
+const FullpathTestLayoutRouteRouteWithChildren = FullpathTestLayoutRouteRoute._addFileChildren(FullpathTestLayoutRouteRouteChildren)
interface FullpathTestRouteRouteChildren {
FullpathTestLayoutRouteRoute: typeof FullpathTestLayoutRouteRouteWithChildren
@@ -2449,8 +2044,7 @@ const FullpathTestRouteRouteChildren: FullpathTestRouteRouteChildren = {
FullpathTestLayoutRouteRoute: FullpathTestLayoutRouteRouteWithChildren,
}
-const FullpathTestRouteRouteWithChildren =
- FullpathTestRouteRoute._addFileChildren(FullpathTestRouteRouteChildren)
+const FullpathTestRouteRouteWithChildren = FullpathTestRouteRoute._addFileChildren(FullpathTestRouteRouteChildren)
interface NonNestedDeepBazRouteRouteChildren {
NonNestedDeepBazIndexRoute: typeof NonNestedDeepBazIndexRoute
@@ -2460,24 +2054,17 @@ const NonNestedDeepBazRouteRouteChildren: NonNestedDeepBazRouteRouteChildren = {
NonNestedDeepBazIndexRoute: NonNestedDeepBazIndexRoute,
}
-const NonNestedDeepBazRouteRouteWithChildren =
- NonNestedDeepBazRouteRoute._addFileChildren(
- NonNestedDeepBazRouteRouteChildren,
- )
+const NonNestedDeepBazRouteRouteWithChildren = NonNestedDeepBazRouteRoute._addFileChildren(NonNestedDeepBazRouteRouteChildren)
interface NonNestedDeepBazBarFooRouteRouteChildren {
NonNestedDeepBazBarFooIndexRoute: typeof NonNestedDeepBazBarFooIndexRoute
}
-const NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren =
- {
- NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute,
- }
+const NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren = {
+ NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute,
+}
-const NonNestedDeepBazBarFooRouteRouteWithChildren =
- NonNestedDeepBazBarFooRouteRoute._addFileChildren(
- NonNestedDeepBazBarFooRouteRouteChildren,
- )
+const NonNestedDeepBazBarFooRouteRouteWithChildren = NonNestedDeepBazBarFooRouteRoute._addFileChildren(NonNestedDeepBazBarFooRouteRouteChildren)
interface NonNestedDeepBazBarRouteRouteChildren {
NonNestedDeepBazBarFooRouteRoute: typeof NonNestedDeepBazBarFooRouteRouteWithChildren
@@ -2485,18 +2072,13 @@ interface NonNestedDeepBazBarRouteRouteChildren {
NonNestedDeepBazBarFooQuxRoute: typeof NonNestedDeepBazBarFooQuxRoute
}
-const NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren =
- {
- NonNestedDeepBazBarFooRouteRoute:
- NonNestedDeepBazBarFooRouteRouteWithChildren,
- NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute,
- NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute,
- }
+const NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren = {
+ NonNestedDeepBazBarFooRouteRoute: NonNestedDeepBazBarFooRouteRouteWithChildren,
+ NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute,
+ NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute,
+}
-const NonNestedDeepBazBarRouteRouteWithChildren =
- NonNestedDeepBazBarRouteRoute._addFileChildren(
- NonNestedDeepBazBarRouteRouteChildren,
- )
+const NonNestedDeepBazBarRouteRouteWithChildren = NonNestedDeepBazBarRouteRoute._addFileChildren(NonNestedDeepBazBarRouteRouteChildren)
interface NonNestedDeepRouteRouteChildren {
NonNestedDeepBazRouteRoute: typeof NonNestedDeepBazRouteRouteWithChildren
@@ -2510,24 +2092,19 @@ const NonNestedDeepRouteRouteChildren: NonNestedDeepRouteRouteChildren = {
NonNestedDeepBazBarQuxRoute: NonNestedDeepBazBarQuxRoute,
}
-const NonNestedDeepRouteRouteWithChildren =
- NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren)
+const NonNestedDeepRouteRouteWithChildren = NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren)
interface NonNestedNamedBazRouteRouteChildren {
NonNestedNamedBazFooRoute: typeof NonNestedNamedBazFooRoute
NonNestedNamedBazIndexRoute: typeof NonNestedNamedBazIndexRoute
}
-const NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren =
- {
- NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute,
- NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute,
- }
+const NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren = {
+ NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute,
+ NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute,
+}
-const NonNestedNamedBazRouteRouteWithChildren =
- NonNestedNamedBazRouteRoute._addFileChildren(
- NonNestedNamedBazRouteRouteChildren,
- )
+const NonNestedNamedBazRouteRouteWithChildren = NonNestedNamedBazRouteRoute._addFileChildren(NonNestedNamedBazRouteRouteChildren)
interface NonNestedNamedRouteRouteChildren {
NonNestedNamedBazRouteRoute: typeof NonNestedNamedBazRouteRouteWithChildren
@@ -2539,8 +2116,7 @@ const NonNestedNamedRouteRouteChildren: NonNestedNamedRouteRouteChildren = {
NonNestedNamedBazBarRoute: NonNestedNamedBazBarRoute,
}
-const NonNestedNamedRouteRouteWithChildren =
- NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren)
+const NonNestedNamedRouteRouteWithChildren = NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren)
interface NonNestedPathBazRouteRouteChildren {
NonNestedPathBazFooRoute: typeof NonNestedPathBazFooRoute
@@ -2552,10 +2128,7 @@ const NonNestedPathBazRouteRouteChildren: NonNestedPathBazRouteRouteChildren = {
NonNestedPathBazIndexRoute: NonNestedPathBazIndexRoute,
}
-const NonNestedPathBazRouteRouteWithChildren =
- NonNestedPathBazRouteRoute._addFileChildren(
- NonNestedPathBazRouteRouteChildren,
- )
+const NonNestedPathBazRouteRouteWithChildren = NonNestedPathBazRouteRoute._addFileChildren(NonNestedPathBazRouteRouteChildren)
interface NonNestedPathRouteRouteChildren {
NonNestedPathBazRouteRoute: typeof NonNestedPathBazRouteRouteWithChildren
@@ -2567,26 +2140,19 @@ const NonNestedPathRouteRouteChildren: NonNestedPathRouteRouteChildren = {
NonNestedPathBazBarRoute: NonNestedPathBazBarRoute,
}
-const NonNestedPathRouteRouteWithChildren =
- NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren)
+const NonNestedPathRouteRouteWithChildren = NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren)
interface NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren {
NonNestedPrefixPrefixChar123bazChar125FooRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRoute
NonNestedPrefixPrefixChar123bazChar125IndexRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute
}
-const NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren =
- {
- NonNestedPrefixPrefixChar123bazChar125FooRoute:
- NonNestedPrefixPrefixChar123bazChar125FooRoute,
- NonNestedPrefixPrefixChar123bazChar125IndexRoute:
- NonNestedPrefixPrefixChar123bazChar125IndexRoute,
- }
+const NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren = {
+ NonNestedPrefixPrefixChar123bazChar125FooRoute: NonNestedPrefixPrefixChar123bazChar125FooRoute,
+ NonNestedPrefixPrefixChar123bazChar125IndexRoute: NonNestedPrefixPrefixChar123bazChar125IndexRoute,
+}
-const NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren =
- NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren(
- NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren,
- )
+const NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren = NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren(NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren)
interface NonNestedPrefixRouteRouteChildren {
NonNestedPrefixPrefixChar123bazChar125RouteRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren
@@ -2594,32 +2160,23 @@ interface NonNestedPrefixRouteRouteChildren {
}
const NonNestedPrefixRouteRouteChildren: NonNestedPrefixRouteRouteChildren = {
- NonNestedPrefixPrefixChar123bazChar125RouteRoute:
- NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren,
- NonNestedPrefixPrefixChar123bazChar125BarRoute:
- NonNestedPrefixPrefixChar123bazChar125BarRoute,
+ NonNestedPrefixPrefixChar123bazChar125RouteRoute: NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren,
+ NonNestedPrefixPrefixChar123bazChar125BarRoute: NonNestedPrefixPrefixChar123bazChar125BarRoute,
}
-const NonNestedPrefixRouteRouteWithChildren =
- NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren)
+const NonNestedPrefixRouteRouteWithChildren = NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren)
interface NonNestedSuffixChar123bazChar125suffixRouteRouteChildren {
NonNestedSuffixChar123bazChar125suffixFooRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRoute
NonNestedSuffixChar123bazChar125suffixIndexRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRoute
}
-const NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren =
- {
- NonNestedSuffixChar123bazChar125suffixFooRoute:
- NonNestedSuffixChar123bazChar125suffixFooRoute,
- NonNestedSuffixChar123bazChar125suffixIndexRoute:
- NonNestedSuffixChar123bazChar125suffixIndexRoute,
- }
+const NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren = {
+ NonNestedSuffixChar123bazChar125suffixFooRoute: NonNestedSuffixChar123bazChar125suffixFooRoute,
+ NonNestedSuffixChar123bazChar125suffixIndexRoute: NonNestedSuffixChar123bazChar125suffixIndexRoute,
+}
-const NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren =
- NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren(
- NonNestedSuffixChar123bazChar125suffixRouteRouteChildren,
- )
+const NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren = NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren(NonNestedSuffixChar123bazChar125suffixRouteRouteChildren)
interface NonNestedSuffixRouteRouteChildren {
NonNestedSuffixChar123bazChar125suffixRouteRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren
@@ -2627,14 +2184,11 @@ interface NonNestedSuffixRouteRouteChildren {
}
const NonNestedSuffixRouteRouteChildren: NonNestedSuffixRouteRouteChildren = {
- NonNestedSuffixChar123bazChar125suffixRouteRoute:
- NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren,
- NonNestedSuffixChar123bazChar125suffixBarRoute:
- NonNestedSuffixChar123bazChar125suffixBarRoute,
+ NonNestedSuffixChar123bazChar125suffixRouteRoute: NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren,
+ NonNestedSuffixChar123bazChar125suffixBarRoute: NonNestedSuffixChar123bazChar125suffixBarRoute,
}
-const NonNestedSuffixRouteRouteWithChildren =
- NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren)
+const NonNestedSuffixRouteRouteWithChildren = NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren)
interface NonNestedRouteRouteChildren {
NonNestedDeepRouteRoute: typeof NonNestedDeepRouteRouteWithChildren
@@ -2652,25 +2206,19 @@ const NonNestedRouteRouteChildren: NonNestedRouteRouteChildren = {
NonNestedSuffixRouteRoute: NonNestedSuffixRouteRouteWithChildren,
}
-const NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren(
- NonNestedRouteRouteChildren,
-)
+const NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren(NonNestedRouteRouteChildren)
interface PathlessLayoutLayoutRouteRouteChildren {
PathlessLayoutLayoutChildRoute: typeof PathlessLayoutLayoutChildRoute
PathlessLayoutLayoutIndexRoute: typeof PathlessLayoutLayoutIndexRoute
}
-const PathlessLayoutLayoutRouteRouteChildren: PathlessLayoutLayoutRouteRouteChildren =
- {
- PathlessLayoutLayoutChildRoute: PathlessLayoutLayoutChildRoute,
- PathlessLayoutLayoutIndexRoute: PathlessLayoutLayoutIndexRoute,
- }
+const PathlessLayoutLayoutRouteRouteChildren: PathlessLayoutLayoutRouteRouteChildren = {
+ PathlessLayoutLayoutChildRoute: PathlessLayoutLayoutChildRoute,
+ PathlessLayoutLayoutIndexRoute: PathlessLayoutLayoutIndexRoute,
+}
-const PathlessLayoutLayoutRouteRouteWithChildren =
- PathlessLayoutLayoutRouteRoute._addFileChildren(
- PathlessLayoutLayoutRouteRouteChildren,
- )
+const PathlessLayoutLayoutRouteRouteWithChildren = PathlessLayoutLayoutRouteRoute._addFileChildren(PathlessLayoutLayoutRouteRouteChildren)
interface PathlessLayoutRouteRouteChildren {
PathlessLayoutLayoutRouteRoute: typeof PathlessLayoutLayoutRouteRouteWithChildren
@@ -2680,8 +2228,7 @@ const PathlessLayoutRouteRouteChildren: PathlessLayoutRouteRouteChildren = {
PathlessLayoutLayoutRouteRoute: PathlessLayoutLayoutRouteRouteWithChildren,
}
-const PathlessLayoutRouteRouteWithChildren =
- PathlessLayoutRouteRoute._addFileChildren(PathlessLayoutRouteRouteChildren)
+const PathlessLayoutRouteRouteWithChildren = PathlessLayoutRouteRoute._addFileChildren(PathlessLayoutRouteRouteChildren)
interface SearchParamsRouteRouteChildren {
SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute
@@ -2693,26 +2240,19 @@ const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {
SearchParamsIndexRoute: SearchParamsIndexRoute,
}
-const SearchParamsRouteRouteWithChildren =
- SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
+const SearchParamsRouteRouteWithChildren = SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
interface Char45824Char54620Char48124Char44397RouteRouteChildren {
Char45824Char54620Char48124Char44397WildcardSplatRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRoute
Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute
}
-const Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren =
- {
- Char45824Char54620Char48124Char44397WildcardSplatRoute:
- Char45824Char54620Char48124Char44397WildcardSplatRoute,
- Char45824Char54620Char48124Char44397Char55357Char56960IdRoute:
- Char45824Char54620Char48124Char44397Char55357Char56960IdRoute,
- }
+const Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren = {
+ Char45824Char54620Char48124Char44397WildcardSplatRoute: Char45824Char54620Char48124Char44397WildcardSplatRoute,
+ Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: Char45824Char54620Char48124Char44397Char55357Char56960IdRoute,
+}
-const Char45824Char54620Char48124Char44397RouteRouteWithChildren =
- Char45824Char54620Char48124Char44397RouteRoute._addFileChildren(
- Char45824Char54620Char48124Char44397RouteRouteChildren,
- )
+const Char45824Char54620Char48124Char44397RouteRouteWithChildren = Char45824Char54620Char48124Char44397RouteRoute._addFileChildren(Char45824Char54620Char48124Char44397RouteRouteChildren)
interface LayoutLayout2RouteChildren {
LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute
@@ -2724,9 +2264,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -2736,8 +2274,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface MasksRouteChildren {
MasksAdminUserIdRoute: typeof MasksAdminUserIdRoute
@@ -2767,43 +2304,31 @@ interface ParamsPsNonNestedFooRouteRouteChildren {
ParamsPsNonNestedFooBarRoute: typeof ParamsPsNonNestedFooBarRoute
}
-const ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren =
- {
- ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute,
- }
+const ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren = {
+ ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute,
+}
-const ParamsPsNonNestedFooRouteRouteWithChildren =
- ParamsPsNonNestedFooRouteRoute._addFileChildren(
- ParamsPsNonNestedFooRouteRouteChildren,
- )
+const ParamsPsNonNestedFooRouteRouteWithChildren = ParamsPsNonNestedFooRouteRoute._addFileChildren(ParamsPsNonNestedFooRouteRouteChildren)
interface ParamsPsNonNestedRouteRouteChildren {
ParamsPsNonNestedFooRouteRoute: typeof ParamsPsNonNestedFooRouteRouteWithChildren
}
-const ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren =
- {
- ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren,
- }
+const ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren = {
+ ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren,
+}
-const ParamsPsNonNestedRouteRouteWithChildren =
- ParamsPsNonNestedRouteRoute._addFileChildren(
- ParamsPsNonNestedRouteRouteChildren,
- )
+const ParamsPsNonNestedRouteRouteWithChildren = ParamsPsNonNestedRouteRoute._addFileChildren(ParamsPsNonNestedRouteRouteChildren)
interface ParamsPsStrictFalseRouteRouteChildren {
ParamsPsStrictFalseVersionRouteRoute: typeof ParamsPsStrictFalseVersionRouteRoute
}
-const ParamsPsStrictFalseRouteRouteChildren: ParamsPsStrictFalseRouteRouteChildren =
- {
- ParamsPsStrictFalseVersionRouteRoute: ParamsPsStrictFalseVersionRouteRoute,
- }
+const ParamsPsStrictFalseRouteRouteChildren: ParamsPsStrictFalseRouteRouteChildren = {
+ ParamsPsStrictFalseVersionRouteRoute: ParamsPsStrictFalseVersionRouteRoute,
+}
-const ParamsPsStrictFalseRouteRouteWithChildren =
- ParamsPsStrictFalseRouteRoute._addFileChildren(
- ParamsPsStrictFalseRouteRouteChildren,
- )
+const ParamsPsStrictFalseRouteRouteWithChildren = ParamsPsStrictFalseRouteRoute._addFileChildren(ParamsPsStrictFalseRouteRouteChildren)
interface RelativeLinkRouteRouteChildren {
RelativeLinkRelativeLinkARoute: typeof RelativeLinkRelativeLinkARoute
@@ -2825,8 +2350,7 @@ const RelativeLinkRouteRouteChildren: RelativeLinkRouteRouteChildren = {
RelativeLinkPathPathIndexRoute: RelativeLinkPathPathIndexRoute,
}
-const RelativeLinkRouteRouteWithChildren =
- RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren)
+const RelativeLinkRouteRouteWithChildren = RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren)
interface RelativeUseNavigateRouteRouteChildren {
RelativeUseNavigateRelativeUseNavigateARoute: typeof RelativeUseNavigateRelativeUseNavigateARoute
@@ -2838,26 +2362,17 @@ interface RelativeUseNavigateRouteRouteChildren {
RelativeUseNavigatePathPathIndexRoute: typeof RelativeUseNavigatePathPathIndexRoute
}
-const RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren =
- {
- RelativeUseNavigateRelativeUseNavigateARoute:
- RelativeUseNavigateRelativeUseNavigateARoute,
- RelativeUseNavigateRelativeUseNavigateBRoute:
- RelativeUseNavigateRelativeUseNavigateBRoute,
- RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute,
- RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute,
- RelativeUseNavigateWithSearchIndexRoute:
- RelativeUseNavigateWithSearchIndexRoute,
- RelativeUseNavigateNestedDeepIndexRoute:
- RelativeUseNavigateNestedDeepIndexRoute,
- RelativeUseNavigatePathPathIndexRoute:
- RelativeUseNavigatePathPathIndexRoute,
- }
+const RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren = {
+ RelativeUseNavigateRelativeUseNavigateARoute: RelativeUseNavigateRelativeUseNavigateARoute,
+ RelativeUseNavigateRelativeUseNavigateBRoute: RelativeUseNavigateRelativeUseNavigateBRoute,
+ RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute,
+ RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute,
+ RelativeUseNavigateWithSearchIndexRoute: RelativeUseNavigateWithSearchIndexRoute,
+ RelativeUseNavigateNestedDeepIndexRoute: RelativeUseNavigateNestedDeepIndexRoute,
+ RelativeUseNavigatePathPathIndexRoute: RelativeUseNavigatePathPathIndexRoute,
+}
-const RelativeUseNavigateRouteRouteWithChildren =
- RelativeUseNavigateRouteRoute._addFileChildren(
- RelativeUseNavigateRouteRouteChildren,
- )
+const RelativeUseNavigateRouteRouteWithChildren = RelativeUseNavigateRouteRoute._addFileChildren(RelativeUseNavigateRouteRouteChildren)
interface groupLayoutRouteChildren {
groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute
@@ -2867,9 +2382,7 @@ const groupLayoutRouteChildren: groupLayoutRouteChildren = {
groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,
}
-const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(
- groupLayoutRouteChildren,
-)
+const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(groupLayoutRouteChildren)
interface RedirectTargetRouteChildren {
RedirectTargetDestinationRoute: typeof RedirectTargetDestinationRoute
@@ -2886,34 +2399,24 @@ const RedirectTargetRouteChildren: RedirectTargetRouteChildren = {
RedirectTargetDestinationRoute: RedirectTargetDestinationRoute,
RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,
RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,
- RedirectTargetViaRouteRedirectBeforeLoadRoute:
- RedirectTargetViaRouteRedirectBeforeLoadRoute,
- RedirectTargetViaRouteRedirectLoaderRoute:
- RedirectTargetViaRouteRedirectLoaderRoute,
- RedirectTargetViaRouteApiRedirectBeforeLoadRoute:
- RedirectTargetViaRouteApiRedirectBeforeLoadRoute,
- RedirectTargetViaRouteApiRedirectLoaderRoute:
- RedirectTargetViaRouteApiRedirectLoaderRoute,
+ RedirectTargetViaRouteRedirectBeforeLoadRoute: RedirectTargetViaRouteRedirectBeforeLoadRoute,
+ RedirectTargetViaRouteRedirectLoaderRoute: RedirectTargetViaRouteRedirectLoaderRoute,
+ RedirectTargetViaRouteApiRedirectBeforeLoadRoute: RedirectTargetViaRouteApiRedirectBeforeLoadRoute,
+ RedirectTargetViaRouteApiRedirectLoaderRoute: RedirectTargetViaRouteApiRedirectLoaderRoute,
RedirectTargetIndexRoute: RedirectTargetIndexRoute,
}
-const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(
- RedirectTargetRouteChildren,
-)
+const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(RedirectTargetRouteChildren)
interface ParamsPsNamedFooBarRouteRouteChildren {
ParamsPsNamedFooBarBazRoute: typeof ParamsPsNamedFooBarBazRoute
}
-const ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren =
- {
- ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute,
- }
+const ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren = {
+ ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute,
+}
-const ParamsPsNamedFooBarRouteRouteWithChildren =
- ParamsPsNamedFooBarRouteRoute._addFileChildren(
- ParamsPsNamedFooBarRouteRouteChildren,
- )
+const ParamsPsNamedFooBarRouteRouteWithChildren = ParamsPsNamedFooBarRouteRoute._addFileChildren(ParamsPsNamedFooBarRouteRouteChildren)
interface ParamsPsNamedFooRouteRouteChildren {
ParamsPsNamedFooBarRouteRoute: typeof ParamsPsNamedFooBarRouteRouteWithChildren
@@ -2923,10 +2426,7 @@ const ParamsPsNamedFooRouteRouteChildren: ParamsPsNamedFooRouteRouteChildren = {
ParamsPsNamedFooBarRouteRoute: ParamsPsNamedFooBarRouteRouteWithChildren,
}
-const ParamsPsNamedFooRouteRouteWithChildren =
- ParamsPsNamedFooRouteRoute._addFileChildren(
- ParamsPsNamedFooRouteRouteChildren,
- )
+const ParamsPsNamedFooRouteRouteWithChildren = ParamsPsNamedFooRouteRoute._addFileChildren(ParamsPsNamedFooRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
@@ -2934,8 +2434,7 @@ const rootRouteChildren: RootRouteChildren = {
NonNestedRouteRoute: NonNestedRouteRouteWithChildren,
PathlessLayoutRouteRoute: PathlessLayoutRouteRouteWithChildren,
SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,
- Char45824Char54620Char48124Char44397RouteRoute:
- Char45824Char54620Char48124Char44397RouteRouteWithChildren,
+ Char45824Char54620Char48124Char44397RouteRoute: Char45824Char54620Char48124Char44397RouteRouteWithChildren,
LayoutRoute: LayoutRouteWithChildren,
AnchorRoute: AnchorRoute,
ComponentTypesTestRoute: ComponentTypesTestRoute,
@@ -2965,19 +2464,13 @@ const rootRouteChildren: RootRouteChildren = {
RelativeIndexRoute: RelativeIndexRoute,
ParamsPsNamedFooRouteRoute: ParamsPsNamedFooRouteRouteWithChildren,
groupSubfolderInsideRoute: groupSubfolderInsideRoute,
- ParamsPsNamedPrefixChar123fooChar125Route:
- ParamsPsNamedPrefixChar123fooChar125Route,
- ParamsPsNamedChar123fooChar125suffixRoute:
- ParamsPsNamedChar123fooChar125suffixRoute,
+ ParamsPsNamedPrefixChar123fooChar125Route: ParamsPsNamedPrefixChar123fooChar125Route,
+ ParamsPsNamedChar123fooChar125suffixRoute: ParamsPsNamedChar123fooChar125suffixRoute,
ParamsPsWildcardSplatRoute: ParamsPsWildcardSplatRoute,
- ParamsPsWildcardPrefixAtChar45824Char123Char125Route:
- ParamsPsWildcardPrefixAtChar45824Char123Char125Route,
- ParamsPsWildcardPrefixChar123Char125Route:
- ParamsPsWildcardPrefixChar123Char125Route,
- ParamsPsWildcardChar123Char125suffixRoute:
- ParamsPsWildcardChar123Char125suffixRoute,
- ParamsPsWildcardChar123Char125suffixAtChar45824Route:
- ParamsPsWildcardChar123Char125suffixAtChar45824Route,
+ ParamsPsWildcardPrefixAtChar45824Char123Char125Route: ParamsPsWildcardPrefixAtChar45824Char123Char125Route,
+ ParamsPsWildcardPrefixChar123Char125Route: ParamsPsWildcardPrefixChar123Char125Route,
+ ParamsPsWildcardChar123Char125suffixRoute: ParamsPsWildcardChar123Char125suffixRoute,
+ ParamsPsWildcardChar123Char125suffixAtChar45824Route: ParamsPsWildcardChar123Char125suffixAtChar45824Route,
ParamsSingleValueRoute: ParamsSingleValueRoute,
PostsPostIdEditRoute: PostsPostIdEditRoute,
RedirectPreloadFirstRoute: RedirectPreloadFirstRoute,
diff --git a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts
index 115e4bce47..231d28a43e 100644
--- a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -85,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/layout-a'
- | '/layout-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/layout-a' | '/layout-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/posts'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
+ id: '__root__' | '/' | '/_layout' | '/posts' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -183,9 +166,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -195,8 +176,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
diff --git a/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts
index eb98ba28c5..24a071564d 100644
--- a/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -120,41 +118,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/classic/hello'
- | '/posts/'
- | '/posts/$postId'
- | '/layout-a'
- | '/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
+ fullPaths: '/' | '/posts' | '/classic/hello' | '/posts/' | '/posts/$postId' | '/layout-a' | '/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/layout-a'
- | '/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello'
- id:
- | '__root__'
- | '/'
- | '/_first'
- | '/posts'
- | '/classic/hello'
- | '/posts/'
- | '/_first/_second'
- | '/posts/$postId'
- | '/_first/_second/layout-a'
- | '/_first/_second/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
+ to: '/' | '/posts' | '/posts/$postId' | '/layout-a' | '/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello'
+ id: '__root__' | '/' | '/_first' | '/posts' | '/classic/hello' | '/posts/' | '/_first/_second' | '/posts/$postId' | '/_first/_second/layout-a' | '/_first/_second/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -263,8 +230,7 @@ const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {
bRoute: bRoute,
}
-const layoutSecondLayoutRouteWithChildren =
- layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
+const layoutSecondLayoutRouteWithChildren = layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
interface layoutFirstLayoutRouteChildren {
layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren
@@ -274,8 +240,7 @@ const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {
layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,
}
-const layoutFirstLayoutRouteWithChildren =
- layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
+const layoutFirstLayoutRouteWithChildren = layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
interface postsPostsRouteChildren {
postsPostsHomeRoute: typeof postsPostsHomeRoute
@@ -287,9 +252,7 @@ const postsPostsRouteChildren: postsPostsRouteChildren = {
postsPostsDetailRoute: postsPostsDetailRoute,
}
-const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(
- postsPostsRouteChildren,
-)
+const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(postsPostsRouteChildren)
interface ClassicHelloRouteRouteChildren {
ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute
@@ -303,8 +266,7 @@ const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {
ClassicHelloIndexRoute: ClassicHelloIndexRoute,
}
-const ClassicHelloRouteRouteWithChildren =
- ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
+const ClassicHelloRouteRouteWithChildren = ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
homeRoute: homeRoute,
diff --git a/e2e/react-router/basic/package.json b/e2e/react-router/basic/package.json
index 4ff68f5cda..667b016896 100644
--- a/e2e/react-router/basic/package.json
+++ b/e2e/react-router/basic/package.json
@@ -17,8 +17,7 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "catalog:",
- "tailwindcss": "^4.2.2",
- "zod": "catalog:"
+ "tailwindcss": "^4.2.2"
},
"devDependencies": {
"@playwright/test": "^1.61.0",
diff --git a/e2e/react-router/basic/src/main.tsx b/e2e/react-router/basic/src/main.tsx
index 49fa054776..36e5106654 100644
--- a/e2e/react-router/basic/src/main.tsx
+++ b/e2e/react-router/basic/src/main.tsx
@@ -1,5 +1,3 @@
-import { useState } from 'react'
-import { createPortal } from 'react-dom'
import ReactDOM from 'react-dom/client'
import {
ErrorComponent,
@@ -11,19 +9,12 @@ import {
createRouter,
redirect,
} from '@tanstack/react-router'
-import {
- TanStackRouterDevtoolsInProd as TanStackRouterDevtools,
- TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel,
-} from '@tanstack/react-router-devtools'
-import { z } from 'zod'
+import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
import { NotFoundError, fetchPost, fetchPosts } from './posts'
import './styles.css'
import type { ErrorComponentProps } from '@tanstack/react-router'
const rootRoute = createRootRoute({
- validateSearch: z.object({
- devtools: z.enum(['panel', 'shadow']).optional().catch(undefined),
- }),
component: RootComponent,
notFoundComponent: () => {
return (
@@ -36,8 +27,6 @@ const rootRoute = createRootRoute({
})
function RootComponent() {
- const { devtools } = rootRoute.useSearch()
-
return (
<>
@@ -97,57 +86,12 @@ function RootComponent() {
-
- Devtools:
- {(['floating', 'panel', 'shadow'] as const).map((mode) => (
- ({
- ...prev,
- devtools: mode === 'floating' ? undefined : mode,
- })}
- className={
- (devtools ?? 'floating') === mode ? 'font-bold' : undefined
- }
- >
- {mode}
-
- ))}
-
- {devtools === 'panel' ? (
-
- ) : devtools === 'shadow' ? (
-
- ) : (
-
- )}
+
>
)
}
-
-function ShadowDevtoolsPanel() {
- const [shadowRoot, setShadowRoot] = useState()
-
- return (
- {
- if (host) {
- setShadowRoot(host.shadowRoot ?? host.attachShadow({ mode: 'open' }))
- }
- }}
- >
- {shadowRoot
- ? createPortal(
- ,
- shadowRoot,
- )
- : null}
-
- )
-}
const indexRoute = createRoute({
getParentRoute: () => rootRoute,
path: '/',
diff --git a/e2e/react-router/basic/tests/devtools.spec.ts b/e2e/react-router/basic/tests/devtools.spec.ts
deleted file mode 100644
index b8a7e803e6..0000000000
--- a/e2e/react-router/basic/tests/devtools.spec.ts
+++ /dev/null
@@ -1,42 +0,0 @@
-import { expect } from '@playwright/test'
-import { test } from '@tanstack/router-e2e-utils'
-
-for (const mode of ['panel', 'shadow', 'floating']) {
- test(`devtools preserve typography and explorer indentation in ${mode} mode`, async ({
- page,
- }) => {
- await page.goto(mode === 'floating' ? '/' : `/?devtools=${mode}`)
- if (mode === 'floating') {
- await page
- .getByRole('button', { name: 'Open TanStack Router Devtools' })
- .click()
- }
-
- const panel = page.locator('.TanStackRouterDevtoolsPanel')
- const router = panel.getByRole('button', { name: /^Router\s*\d+ items/ })
- const state = panel.getByRole('button', { name: /^state\s*\d+ items/ })
- await expect(router).toBeVisible()
- await expect(state).toBeVisible()
- await expect(router).toHaveCSS('font-size', '12px')
- await expect(router).toHaveCSS('gap', '4px')
- await expect(
- panel.getByText('Pathname', { exact: true }).locator('..'),
- ).toHaveCSS('padding-left', '8px')
-
- const routerBox = await router.boundingBox()
- const stateBox = await state.boundingBox()
- expect(stateBox!.x - routerBox!.x).toBe(18)
-
- if (mode !== 'floating') {
- await page.addStyleTag({ content: ':root { font-size: 20px; }' })
- await expect(router).toHaveCSS('font-size', '15px')
- await expect(router).toHaveCSS('gap', '5px')
-
- await page.addStyleTag({
- content: ':root { --tsrd-font-size: 24px; }',
- })
- await expect(router).toHaveCSS('font-size', '18px')
- await expect(router).toHaveCSS('gap', '6px')
- }
- })
-}
diff --git a/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts b/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts
index 50a5f8b305..3f6f3a2657 100644
--- a/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts
+++ b/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-router/generator-cli-only/src/routeTree.gen.ts b/e2e/react-router/generator-cli-only/src/routeTree.gen.ts
index 9676858c7c..1be533f4a4 100644
--- a/e2e/react-router/generator-cli-only/src/routeTree.gen.ts
+++ b/e2e/react-router/generator-cli-only/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -32,11 +30,10 @@ const PostsRouteRoute = PostsRouteRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
} as any)
-const PathlessLayoutNestedLayoutRoute =
- PathlessLayoutNestedLayoutRouteImport.update({
- id: '/_nested-layout',
- getParentRoute: () => PathlessLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRoute = PathlessLayoutNestedLayoutRouteImport.update({
+ id: '/_nested-layout',
+ getParentRoute: () => PathlessLayoutRoute,
+} as any)
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -47,18 +44,16 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
path: '/$postId',
getParentRoute: () => PostsRouteRoute,
} as any)
-const PathlessLayoutNestedLayoutRouteARoute =
- PathlessLayoutNestedLayoutRouteARouteImport.update({
- id: '/route-a',
- path: '/route-a',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
-const PathlessLayoutNestedLayoutRouteBRoute =
- PathlessLayoutNestedLayoutRouteBRouteImport.update({
- id: '/route-b',
- path: '/route-b',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRouteARoute = PathlessLayoutNestedLayoutRouteARouteImport.update({
+ id: '/route-a',
+ path: '/route-a',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
+const PathlessLayoutNestedLayoutRouteBRoute = PathlessLayoutNestedLayoutRouteBRouteImport.update({
+ id: '/route-b',
+ path: '/route-b',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -88,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/route-a'
- | '/route-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/route-a' | '/route-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/_pathlessLayout'
- | '/_pathlessLayout/_nested-layout'
- | '/posts/$postId'
- | '/posts/'
- | '/_pathlessLayout/_nested-layout/route-a'
- | '/_pathlessLayout/_nested-layout/route-b'
+ id: '__root__' | '/' | '/posts' | '/_pathlessLayout' | '/_pathlessLayout/_nested-layout' | '/posts/$postId' | '/posts/' | '/_pathlessLayout/_nested-layout/route-a' | '/_pathlessLayout/_nested-layout/route-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -186,27 +166,19 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
interface PathlessLayoutNestedLayoutRouteChildren {
PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute
PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute
}
-const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =
- {
- PathlessLayoutNestedLayoutRouteARoute:
- PathlessLayoutNestedLayoutRouteARoute,
- PathlessLayoutNestedLayoutRouteBRoute:
- PathlessLayoutNestedLayoutRouteBRoute,
- }
+const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren = {
+ PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,
+ PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,
+}
-const PathlessLayoutNestedLayoutRouteWithChildren =
- PathlessLayoutNestedLayoutRoute._addFileChildren(
- PathlessLayoutNestedLayoutRouteChildren,
- )
+const PathlessLayoutNestedLayoutRouteWithChildren = PathlessLayoutNestedLayoutRoute._addFileChildren(PathlessLayoutNestedLayoutRouteChildren)
interface PathlessLayoutRouteChildren {
PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren
@@ -216,9 +188,7 @@ const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {
PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,
}
-const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(
- PathlessLayoutRouteChildren,
-)
+const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(PathlessLayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-router/issue-7120/src/routeTree.gen.ts b/e2e/react-router/issue-7120/src/routeTree.gen.ts
index e8c6d92110..27f367a5c1 100644
--- a/e2e/react-router/issue-7120/src/routeTree.gen.ts
+++ b/e2e/react-router/issue-7120/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -21,7 +19,8 @@ const PostsRoute = PostsRouteImport.update({
id: '/posts',
path: '/posts',
getParentRoute: () => rootRouteImport,
-} as any).lazy(() => import('./routes/posts.lazy').then((d) => d.Route))
+} as any)
+ .lazy(() => import('./routes/posts.lazy').then((d) => d.Route))
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
diff --git a/e2e/react-router/issue-7457/src/routeTree.gen.ts b/e2e/react-router/issue-7457/src/routeTree.gen.ts
index 04a2c94ce8..8ac6cdb792 100644
--- a/e2e/react-router/issue-7457/src/routeTree.gen.ts
+++ b/e2e/react-router/issue-7457/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-router/js-only-file-based/src/routeTree.gen.js b/e2e/react-router/js-only-file-based/src/routeTree.gen.js
index 80683abb30..e6877909c0 100644
--- a/e2e/react-router/js-only-file-based/src/routeTree.gen.js
+++ b/e2e/react-router/js-only-file-based/src/routeTree.gen.js
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -32,11 +30,10 @@ const PostsRouteRoute = PostsRouteRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
})
-const PathlessLayoutNestedLayoutRoute =
- PathlessLayoutNestedLayoutRouteImport.update({
- id: '/_nested-layout',
- getParentRoute: () => PathlessLayoutRoute,
- })
+const PathlessLayoutNestedLayoutRoute = PathlessLayoutNestedLayoutRouteImport.update({
+ id: '/_nested-layout',
+ getParentRoute: () => PathlessLayoutRoute,
+})
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -47,49 +44,41 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
path: '/$postId',
getParentRoute: () => PostsRouteRoute,
})
-const PathlessLayoutNestedLayoutRouteARoute =
- PathlessLayoutNestedLayoutRouteARouteImport.update({
- id: '/route-a',
- path: '/route-a',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- })
-const PathlessLayoutNestedLayoutRouteBRoute =
- PathlessLayoutNestedLayoutRouteBRouteImport.update({
- id: '/route-b',
- path: '/route-b',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- })
+const PathlessLayoutNestedLayoutRouteARoute = PathlessLayoutNestedLayoutRouteARouteImport.update({
+ id: '/route-a',
+ path: '/route-a',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+})
+const PathlessLayoutNestedLayoutRouteBRoute = PathlessLayoutNestedLayoutRouteBRouteImport.update({
+ id: '/route-b',
+ path: '/route-b',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+})
const PostsRouteRouteChildren = {
PostsPostIdRoute: PostsPostIdRoute,
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
const PathlessLayoutNestedLayoutRouteChildren = {
PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,
PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,
}
-const PathlessLayoutNestedLayoutRouteWithChildren =
- PathlessLayoutNestedLayoutRoute._addFileChildren(
- PathlessLayoutNestedLayoutRouteChildren,
- )
+const PathlessLayoutNestedLayoutRouteWithChildren = PathlessLayoutNestedLayoutRoute._addFileChildren(PathlessLayoutNestedLayoutRouteChildren)
const PathlessLayoutRouteChildren = {
PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,
}
-const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(
- PathlessLayoutRouteChildren,
-)
+const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(PathlessLayoutRouteChildren)
const rootRouteChildren = {
IndexRoute: IndexRoute,
PostsRouteRoute: PostsRouteRouteWithChildren,
PathlessLayoutRoute: PathlessLayoutRouteWithChildren,
}
-export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)
+export const routeTree = rootRouteImport
+ ._addFileChildren(rootRouteChildren)
diff --git a/e2e/react-router/rspack-basic-file-based/package.json b/e2e/react-router/rspack-basic-file-based/package.json
index 5ec9ed9862..4bff5e7801 100644
--- a/e2e/react-router/rspack-basic-file-based/package.json
+++ b/e2e/react-router/rspack-basic-file-based/package.json
@@ -18,7 +18,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/package.json b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/package.json
index 30c62d0af1..efd3f6e2c3 100644
--- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/package.json
+++ b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/package.json
@@ -18,7 +18,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts b/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
index 0c6823c368..a848bfd6c2 100644
--- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
+++ b/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -9,7 +7,6 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { createFileRoute } from '@tanstack/react-router'
-
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
import { Route as testsIssue7040SourceRouteImport } from './routes/(tests)/issue-7040-source'
@@ -19,9 +16,7 @@ import { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/la
import { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'
import { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search'
-const testsVirtualPageLazyRouteImport = createFileRoute(
- '/(tests)/virtual-page',
-)()
+const testsVirtualPageLazyRouteImport = createFileRoute('/(tests)/virtual-page')()
const IndexRoute = IndexRouteImport.update({
id: '/',
@@ -38,22 +33,18 @@ const testsIssue7040TargetRoute = testsIssue7040TargetRouteImport.update({
path: '/issue-7040-target',
getParentRoute: () => rootRouteImport,
} as any)
-const testsLazyPageRoute = testsLazyPageRouteImport
- .update({
- id: '/(tests)/lazy-page',
- path: '/lazy-page',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsLazyPageRoute = testsLazyPageRouteImport.update({
+ id: '/(tests)/lazy-page',
+ path: '/lazy-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route))
-const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport
- .update({
- id: '/(tests)/lazy-with-loader-page',
- path: '/lazy-with-loader-page',
- getParentRoute: () => rootRouteImport,
- } as any)
- .lazy(() =>
- import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route),
- )
+const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport.update({
+ id: '/(tests)/lazy-with-loader-page',
+ path: '/lazy-with-loader-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
+ .lazy(() => import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route))
const testsNormalPageRoute = testsNormalPageRouteImport.update({
id: '/(tests)/normal-page',
path: '/normal-page',
@@ -64,12 +55,11 @@ const testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({
path: '/page-with-search',
getParentRoute: () => rootRouteImport,
} as any)
-const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport
- .update({
- id: '/(tests)/virtual-page',
- path: '/virtual-page',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport.update({
+ id: '/(tests)/virtual-page',
+ path: '/virtual-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route))
export interface FileRoutesByFullPath {
@@ -105,35 +95,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/issue-7040-source'
- | '/issue-7040-target'
- | '/lazy-page'
- | '/lazy-with-loader-page'
- | '/normal-page'
- | '/page-with-search'
- | '/virtual-page'
+ fullPaths: '/' | '/issue-7040-source' | '/issue-7040-target' | '/lazy-page' | '/lazy-with-loader-page' | '/normal-page' | '/page-with-search' | '/virtual-page'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/issue-7040-source'
- | '/issue-7040-target'
- | '/lazy-page'
- | '/lazy-with-loader-page'
- | '/normal-page'
- | '/page-with-search'
- | '/virtual-page'
- id:
- | '__root__'
- | '/'
- | '/(tests)/issue-7040-source'
- | '/(tests)/issue-7040-target'
- | '/(tests)/lazy-page'
- | '/(tests)/lazy-with-loader-page'
- | '/(tests)/normal-page'
- | '/(tests)/page-with-search'
- | '/(tests)/virtual-page'
+ to: '/' | '/issue-7040-source' | '/issue-7040-target' | '/lazy-page' | '/lazy-with-loader-page' | '/normal-page' | '/page-with-search' | '/virtual-page'
+ id: '__root__' | '/' | '/(tests)/issue-7040-source' | '/(tests)/issue-7040-target' | '/(tests)/lazy-page' | '/(tests)/lazy-with-loader-page' | '/(tests)/normal-page' | '/(tests)/page-with-search' | '/(tests)/virtual-page'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-router/view-transitions/src/routeTree.gen.ts b/e2e/react-router/view-transitions/src/routeTree.gen.ts
index 8982fca68f..24914a9ed0 100644
--- a/e2e/react-router/view-transitions/src/routeTree.gen.ts
+++ b/e2e/react-router/view-transitions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -73,23 +71,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/explore'
- | '/how-it-works'
- | '/posts/$postId'
- | '/posts/'
+ fullPaths: '/' | '/posts' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/explore'
- | '/how-it-works'
- | '/posts/$postId'
- | '/posts/'
+ id: '__root__' | '/' | '/posts' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -156,9 +141,7 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/basic-cloudflare/src/routeTree.gen.ts b/e2e/react-start/basic-cloudflare/src/routeTree.gen.ts
index b29f0d8d68..748bc5f0cc 100644
--- a/e2e/react-start/basic-cloudflare/src/routeTree.gen.ts
+++ b/e2e/react-start/basic-cloudflare/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/basic-cloudflare/tests/app.spec.ts b/e2e/react-start/basic-cloudflare/tests/app.spec.ts
index c9497070dd..add28cb73e 100644
--- a/e2e/react-start/basic-cloudflare/tests/app.spec.ts
+++ b/e2e/react-start/basic-cloudflare/tests/app.spec.ts
@@ -1,5 +1,3 @@
-import { execFileSync } from 'node:child_process'
-import { fileURLToPath } from 'node:url'
import { existsSync } from 'node:fs'
import { join } from 'node:path'
import { expect } from '@playwright/test'
@@ -31,19 +29,3 @@ test('prerender with Cloudflare Workers runtime', async ({ page }) => {
'The value is Hello from Cloudflare',
)
})
-
-test('the built Cloudflare app passes a deployment dry run', () => {
- const wrangler = fileURLToPath(
- new URL('../node_modules/wrangler/bin/wrangler.js', import.meta.url),
- )
- const output = execFileSync(
- process.execPath,
- [wrangler, 'deploy', '--dry-run'],
- {
- encoding: 'utf8',
- env: { ...process.env, WRANGLER_SEND_METRICS: 'false' },
- },
- )
- expect(output).toContain('dist/server/wrangler.json')
- expect(output).toContain('--dry-run: exiting now.')
-})
diff --git a/e2e/react-start/basic-react-query/src/routeTree.gen.ts b/e2e/react-start/basic-react-query/src/routeTree.gen.ts
index 72bd9579f6..7a06c33781 100644
--- a/e2e/react-start/basic-react-query/src/routeTree.gen.ts
+++ b/e2e/react-start/basic-react-query/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -174,59 +172,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/deferred'
- | '/posts'
- | '/redirect'
- | '/suspense-transition'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts/'
- | '/users/'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- | '/transition/count/query'
+ fullPaths: '/' | '/deferred' | '/posts' | '/redirect' | '/suspense-transition' | '/users' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts/' | '/users/' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/posts/$postId/deep' | '/transition/count/query'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/deferred'
- | '/redirect'
- | '/suspense-transition'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts'
- | '/users'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- | '/transition/count/query'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/deferred'
- | '/posts'
- | '/redirect'
- | '/suspense-transition'
- | '/users'
- | '/_layout/_layout-2'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts/'
- | '/users/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/api/users/$id'
- | '/posts_/$postId/deep'
- | '/transition/count/query'
+ to: '/' | '/deferred' | '/redirect' | '/suspense-transition' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts' | '/users' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/posts/$postId/deep' | '/transition/count/query'
+ id: '__root__' | '/' | '/_layout' | '/deferred' | '/posts' | '/redirect' | '/suspense-transition' | '/users' | '/_layout/_layout-2' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts/' | '/users/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/api/users/$id' | '/posts_/$postId/deep' | '/transition/count/query'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -383,9 +332,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -395,8 +342,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -430,9 +376,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersIdRoute: ApiUsersIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts b/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts
index dceedffdc1..e8819afd9a 100644
--- a/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts
+++ b/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/basic/package.json b/e2e/react-start/basic/package.json
index 3a1a4ea9c8..be5caf72d4 100644
--- a/e2e/react-start/basic/package.json
+++ b/e2e/react-start/basic/package.json
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
@@ -50,18 +50,6 @@
"zod": "^4.4.3"
},
"nx": {
- "targets": {
- "test:e2e--vite-spa--dev": {
- "dependsOn": [
- "^build"
- ]
- },
- "test:e2e--rsbuild-spa--dev": {
- "dependsOn": [
- "^build"
- ]
- }
- },
"metadata": {
"playwrightModes": [
{
@@ -72,14 +60,6 @@
"toolchain": "vite",
"mode": "spa"
},
- {
- "toolchain": "vite",
- "mode": "spa",
- "name": "dev",
- "env": {
- "E2E_DEV_SERVER": "true"
- }
- },
{
"toolchain": "vite",
"mode": "prerender",
@@ -107,14 +87,6 @@
"toolchain": "rsbuild",
"mode": "spa"
},
- {
- "toolchain": "rsbuild",
- "mode": "spa",
- "name": "dev",
- "env": {
- "E2E_DEV_SERVER": "true"
- }
- },
{
"toolchain": "rsbuild",
"mode": "prerender",
diff --git a/e2e/react-start/basic/playwright.config.ts b/e2e/react-start/basic/playwright.config.ts
index bb4c2cb761..bdf5fd74ca 100644
--- a/e2e/react-start/basic/playwright.config.ts
+++ b/e2e/react-start/basic/playwright.config.ts
@@ -5,8 +5,6 @@ const mode = process.env.MODE ?? 'ssr'
const toolchain = process.env.E2E_TOOLCHAIN ?? 'vite'
const distDir = process.env.E2E_DIST_DIR ?? 'dist'
-// The dev runs start the dev server and run only the SPA shell spec
-const devServer = process.env.E2E_DEV_SERVER === 'true'
const PORT = Number(process.env.E2E_APP_PORT ?? 0)
const baseURL = `http://localhost:${PORT}`
@@ -14,26 +12,12 @@ const previewCommand =
toolchain === 'rsbuild'
? `pnpm preview:rsbuild --host 0.0.0.0 --port ${PORT}`
: `pnpm preview --host 0.0.0.0 --outDir ${distDir} --port ${PORT}`
-const devCommand =
- toolchain === 'rsbuild'
- ? `pnpm dev:rsbuild --port ${PORT}`
- : `pnpm dev:vite --port ${PORT}`
-const commandByMode = devServer
- ? devCommand
- : mode === 'preview'
- ? previewCommand
- : 'pnpm start'
+const commandByMode = mode === 'preview' ? previewCommand : 'pnpm start'
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './tests',
- ...(devServer
- ? {
- testMatch: 'spa-shell.spec.ts',
- globalSetup: './tests/setup/dev-server.setup.ts',
- }
- : {}),
workers: 1,
reporter: [['line']],
diff --git a/e2e/react-start/basic/src/routeTree.gen.ts b/e2e/react-start/basic/src/routeTree.gen.ts
index b6603dd01d..5d46979fcb 100644
--- a/e2e/react-start/basic/src/routeTree.gen.ts
+++ b/e2e/react-start/basic/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -15,8 +13,6 @@ import { Route as AsyncScriptsRouteImport } from './routes/async-scripts'
import { Route as AuthDocsRouteImport } from './routes/auth-docs'
import { Route as ClientOnlyRouteImport } from './routes/client-only'
import { Route as DeferredRouteImport } from './routes/deferred'
-import { Route as ExecutionLocalRouteImport } from './routes/execution-local'
-import { Route as ExecutionRpcRouteImport } from './routes/execution-rpc'
import { Route as InlineScriptsRouteImport } from './routes/inline-scripts'
import { Route as LinksRouteImport } from './routes/links'
import { Route as NotFoundRouteRouteImport } from './routes/not-found/route'
@@ -115,16 +111,6 @@ const DeferredRoute = DeferredRouteImport.update({
path: '/deferred',
getParentRoute: () => rootRouteImport,
} as any)
-const ExecutionLocalRoute = ExecutionLocalRouteImport.update({
- id: '/execution-local',
- path: '/execution-local',
- getParentRoute: () => rootRouteImport,
-} as any)
-const ExecutionRpcRoute = ExecutionRpcRouteImport.update({
- id: '/execution-rpc',
- path: '/execution-rpc',
- getParentRoute: () => rootRouteImport,
-} as any)
const InlineScriptsRoute = InlineScriptsRouteImport.update({
id: '/inline-scripts',
path: '/inline-scripts',
@@ -150,12 +136,11 @@ const PostsRoute = PostsRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
} as any)
-const PrimitiveBeforeloadErrorRoute =
- PrimitiveBeforeloadErrorRouteImport.update({
- id: '/primitive-beforeload-error',
- path: '/primitive-beforeload-error',
- getParentRoute: () => rootRouteImport,
- } as any)
+const PrimitiveBeforeloadErrorRoute = PrimitiveBeforeloadErrorRouteImport.update({
+ id: '/primitive-beforeload-error',
+ path: '/primitive-beforeload-error',
+ getParentRoute: () => rootRouteImport,
+} as any)
const RawStreamRoute = RawStreamRouteImport.update({
id: '/raw-stream',
path: '/raw-stream',
@@ -210,18 +195,16 @@ const Issue6221DashboardRoute = Issue6221DashboardRouteImport.update({
path: '/issue-6221/dashboard',
getParentRoute: () => rootRouteImport,
} as any)
-const MultiCookieRedirectIndexRoute =
- MultiCookieRedirectIndexRouteImport.update({
- id: '/multi-cookie-redirect/',
- path: '/multi-cookie-redirect/',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MultiCookieRedirectTargetRoute =
- MultiCookieRedirectTargetRouteImport.update({
- id: '/multi-cookie-redirect/target',
- path: '/multi-cookie-redirect/target',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MultiCookieRedirectIndexRoute = MultiCookieRedirectIndexRouteImport.update({
+ id: '/multi-cookie-redirect/',
+ path: '/multi-cookie-redirect/',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MultiCookieRedirectTargetRoute = MultiCookieRedirectTargetRouteImport.update({
+ id: '/multi-cookie-redirect/target',
+ path: '/multi-cookie-redirect/target',
+ getParentRoute: () => rootRouteImport,
+} as any)
const NotFoundIndexRoute = NotFoundIndexRouteImport.update({
id: '/',
path: '/',
@@ -232,23 +215,21 @@ const NotFoundDeepRouteRoute = NotFoundDeepRouteRouteImport.update({
path: '/deep',
getParentRoute: () => NotFoundRouteRoute,
} as any)
-const NotFoundParentBoundaryRouteRoute =
- NotFoundParentBoundaryRouteRouteImport.update({
- id: '/parent-boundary',
- path: '/parent-boundary',
- getParentRoute: () => NotFoundRouteRoute,
- } as any)
+const NotFoundParentBoundaryRouteRoute = NotFoundParentBoundaryRouteRouteImport.update({
+ id: '/parent-boundary',
+ path: '/parent-boundary',
+ getParentRoute: () => NotFoundRouteRoute,
+} as any)
const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({
id: '/via-beforeLoad',
path: '/via-beforeLoad',
getParentRoute: () => NotFoundRouteRoute,
} as any)
-const NotFoundViaBeforeLoadTargetRootRoute =
- NotFoundViaBeforeLoadTargetRootRouteImport.update({
- id: '/via-beforeLoad-target-root',
- path: '/via-beforeLoad-target-root',
- getParentRoute: () => NotFoundRouteRoute,
- } as any)
+const NotFoundViaBeforeLoadTargetRootRoute = NotFoundViaBeforeLoadTargetRootRouteImport.update({
+ id: '/via-beforeLoad-target-root',
+ path: '/via-beforeLoad-target-root',
+ getParentRoute: () => NotFoundRouteRoute,
+} as any)
const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
@@ -319,12 +300,11 @@ const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({
path: '/default',
getParentRoute: () => SearchParamsRouteRoute,
} as any)
-const SearchParamsLoaderThrowsRedirectRoute =
- SearchParamsLoaderThrowsRedirectRouteImport.update({
- id: '/loader-throws-redirect',
- path: '/loader-throws-redirect',
- getParentRoute: () => SearchParamsRouteRoute,
- } as any)
+const SearchParamsLoaderThrowsRedirectRoute = SearchParamsLoaderThrowsRedirectRouteImport.update({
+ id: '/loader-throws-redirect',
+ path: '/loader-throws-redirect',
+ getParentRoute: () => SearchParamsRouteRoute,
+} as any)
const SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({
id: '/$param',
path: '/$param',
@@ -335,23 +315,21 @@ const SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({
path: '/hash',
getParentRoute: () => SpecialCharsRouteRoute,
} as any)
-const SpecialCharsMalformedRouteRoute =
- SpecialCharsMalformedRouteRouteImport.update({
- id: '/malformed',
- path: '/malformed',
- getParentRoute: () => SpecialCharsRouteRoute,
- } as any)
+const SpecialCharsMalformedRouteRoute = SpecialCharsMalformedRouteRouteImport.update({
+ id: '/malformed',
+ path: '/malformed',
+ getParentRoute: () => SpecialCharsRouteRoute,
+} as any)
const SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({
id: '/search',
path: '/search',
getParentRoute: () => SpecialCharsRouteRoute,
} as any)
-const SpecialCharsChar45824Char54620Char48124Char44397Route =
- SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => SpecialCharsRouteRoute,
- } as any)
+const SpecialCharsChar45824Char54620Char48124Char44397Route = SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => SpecialCharsRouteRoute,
+} as any)
const UsersIndexRoute = UsersIndexRouteImport.update({
id: '/',
path: '/',
@@ -392,18 +370,16 @@ const NotFoundDeepBRouteRoute = NotFoundDeepBRouteRouteImport.update({
path: '/b',
getParentRoute: () => NotFoundDeepRouteRoute,
} as any)
-const NotFoundParentBoundaryIndexRoute =
- NotFoundParentBoundaryIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NotFoundParentBoundaryRouteRoute,
- } as any)
-const NotFoundParentBoundaryViaBeforeLoadRoute =
- NotFoundParentBoundaryViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => NotFoundParentBoundaryRouteRoute,
- } as any)
+const NotFoundParentBoundaryIndexRoute = NotFoundParentBoundaryIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NotFoundParentBoundaryRouteRoute,
+} as any)
+const NotFoundParentBoundaryViaBeforeLoadRoute = NotFoundParentBoundaryViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => NotFoundParentBoundaryRouteRoute,
+} as any)
const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({
id: '/posts_/$postId/deep',
path: '/posts/$postId/deep',
@@ -414,29 +390,26 @@ const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({
path: '/',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const RedirectTargetViaBeforeLoadRoute =
- RedirectTargetViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetViaBeforeLoadRoute = RedirectTargetViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const SpecialCharsMalformedParamRoute =
- SpecialCharsMalformedParamRouteImport.update({
- id: '/$param',
- path: '/$param',
- getParentRoute: () => SpecialCharsMalformedRouteRoute,
- } as any)
-const SpecialCharsMalformedSearchRoute =
- SpecialCharsMalformedSearchRouteImport.update({
- id: '/search',
- path: '/search',
- getParentRoute: () => SpecialCharsMalformedRouteRoute,
- } as any)
+const SpecialCharsMalformedParamRoute = SpecialCharsMalformedParamRouteImport.update({
+ id: '/$param',
+ path: '/$param',
+ getParentRoute: () => SpecialCharsMalformedRouteRoute,
+} as any)
+const SpecialCharsMalformedSearchRoute = SpecialCharsMalformedSearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => SpecialCharsMalformedRouteRoute,
+} as any)
const FooBarQuxHereRoute = FooBarQuxHereRouteImport.update({
id: '/foo/$bar/$qux/_here',
path: '/foo/$bar/$qux',
@@ -447,30 +420,26 @@ const NotFoundDeepBCRouteRoute = NotFoundDeepBCRouteRouteImport.update({
path: '/c',
getParentRoute: () => NotFoundDeepBRouteRoute,
} as any)
-const RedirectTargetServerFnIndexRoute =
- RedirectTargetServerFnIndexRouteImport.update({
- id: '/serverFn/',
- path: '/serverFn/',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaBeforeLoadRoute =
- RedirectTargetServerFnViaBeforeLoadRouteImport.update({
- id: '/serverFn/via-beforeLoad',
- path: '/serverFn/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaLoaderRoute =
- RedirectTargetServerFnViaLoaderRouteImport.update({
- id: '/serverFn/via-loader',
- path: '/serverFn/via-loader',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaUseServerFnRoute =
- RedirectTargetServerFnViaUseServerFnRouteImport.update({
- id: '/serverFn/via-useServerFn',
- path: '/serverFn/via-useServerFn',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetServerFnIndexRoute = RedirectTargetServerFnIndexRouteImport.update({
+ id: '/serverFn/',
+ path: '/serverFn/',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaBeforeLoadRoute = RedirectTargetServerFnViaBeforeLoadRouteImport.update({
+ id: '/serverFn/via-beforeLoad',
+ path: '/serverFn/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaLoaderRoute = RedirectTargetServerFnViaLoaderRouteImport.update({
+ id: '/serverFn/via-loader',
+ path: '/serverFn/via-loader',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaUseServerFnRoute = RedirectTargetServerFnViaUseServerFnRouteImport.update({
+ id: '/serverFn/via-useServerFn',
+ path: '/serverFn/via-useServerFn',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const FooBarQuxHereIndexRoute = FooBarQuxHereIndexRouteImport.update({
id: '/',
path: '/',
@@ -491,8 +460,6 @@ export interface FileRoutesByFullPath {
'/auth-docs': typeof AuthDocsRouteWithChildren
'/client-only': typeof ClientOnlyRoute
'/deferred': typeof DeferredRoute
- '/execution-local': typeof ExecutionLocalRoute
- '/execution-rpc': typeof ExecutionRpcRoute
'/inline-scripts': typeof InlineScriptsRoute
'/links': typeof LinksRoute
'/plain-ts-type-assertion': typeof PlainTsTypeAssertionRoute
@@ -565,8 +532,6 @@ export interface FileRoutesByTo {
'/auth-docs': typeof AuthDocsRouteWithChildren
'/client-only': typeof ClientOnlyRoute
'/deferred': typeof DeferredRoute
- '/execution-local': typeof ExecutionLocalRoute
- '/execution-rpc': typeof ExecutionRpcRoute
'/inline-scripts': typeof InlineScriptsRoute
'/links': typeof LinksRoute
'/plain-ts-type-assertion': typeof PlainTsTypeAssertionRoute
@@ -636,8 +601,6 @@ export interface FileRoutesById {
'/auth-docs': typeof AuthDocsRouteWithChildren
'/client-only': typeof ClientOnlyRoute
'/deferred': typeof DeferredRoute
- '/execution-local': typeof ExecutionLocalRoute
- '/execution-rpc': typeof ExecutionRpcRoute
'/inline-scripts': typeof InlineScriptsRoute
'/links': typeof LinksRoute
'/plain-ts-type-assertion': typeof PlainTsTypeAssertionRoute
@@ -706,226 +669,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/not-found'
- | '/search-params'
- | '/specialChars'
- | '/async-scripts'
- | '/auth-docs'
- | '/client-only'
- | '/deferred'
- | '/execution-local'
- | '/execution-rpc'
- | '/inline-scripts'
- | '/links'
- | '/plain-ts-type-assertion'
- | '/posts'
- | '/primitive-beforeload-error'
- | '/raw-stream'
- | '/scripts'
- | '/stream'
- | '/type-only-reexport'
- | '/users'
- | '/not-found/deep'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/api/users'
- | '/auth-docs/private'
- | '/issue-6221/dashboard'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/redirect/$target'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect/'
- | '/not-found/'
- | '/posts/'
- | '/raw-stream/'
- | '/redirect/'
- | '/search-params/'
- | '/users/'
- | '/not-found/deep/b'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/issue-6221/article/$id'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/not-found/deep/'
- | '/not-found/parent-boundary/'
- | '/redirect/$target/'
- | '/not-found/deep/b/c'
- | '/foo/$bar/$qux'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn/'
- | '/not-found/deep/b/c/d'
- | '/foo/$bar/$qux/'
+ fullPaths: '/' | '/not-found' | '/search-params' | '/specialChars' | '/async-scripts' | '/auth-docs' | '/client-only' | '/deferred' | '/inline-scripts' | '/links' | '/plain-ts-type-assertion' | '/posts' | '/primitive-beforeload-error' | '/raw-stream' | '/scripts' | '/stream' | '/type-only-reexport' | '/users' | '/not-found/deep' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/api/users' | '/auth-docs/private' | '/issue-6221/dashboard' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/redirect/$target' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect/' | '/not-found/' | '/posts/' | '/raw-stream/' | '/redirect/' | '/search-params/' | '/users/' | '/not-found/deep/b' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/issue-6221/article/$id' | '/not-found/parent-boundary/via-beforeLoad' | '/posts/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/not-found/deep/' | '/not-found/parent-boundary/' | '/redirect/$target/' | '/not-found/deep/b/c' | '/foo/$bar/$qux' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn/' | '/not-found/deep/b/c/d' | '/foo/$bar/$qux/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/specialChars'
- | '/async-scripts'
- | '/auth-docs'
- | '/client-only'
- | '/deferred'
- | '/execution-local'
- | '/execution-rpc'
- | '/inline-scripts'
- | '/links'
- | '/plain-ts-type-assertion'
- | '/primitive-beforeload-error'
- | '/scripts'
- | '/stream'
- | '/type-only-reexport'
- | '/specialChars/malformed'
- | '/api/users'
- | '/auth-docs/private'
- | '/issue-6221/dashboard'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect'
- | '/not-found'
- | '/posts'
- | '/raw-stream'
- | '/redirect'
- | '/search-params'
- | '/users'
- | '/not-found/deep/b'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/issue-6221/article/$id'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/not-found/deep'
- | '/not-found/parent-boundary'
- | '/redirect/$target'
- | '/not-found/deep/b/c'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn'
- | '/not-found/deep/b/c/d'
- | '/foo/$bar/$qux'
- id:
- | '__root__'
- | '/'
- | '/not-found'
- | '/search-params'
- | '/specialChars'
- | '/_layout'
- | '/async-scripts'
- | '/auth-docs'
- | '/client-only'
- | '/deferred'
- | '/execution-local'
- | '/execution-rpc'
- | '/inline-scripts'
- | '/links'
- | '/plain-ts-type-assertion'
- | '/posts'
- | '/primitive-beforeload-error'
- | '/raw-stream'
- | '/scripts'
- | '/stream'
- | '/type-only-reexport'
- | '/users'
- | '/not-found/deep'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/_layout/_layout-2'
- | '/api/users'
- | '/auth-docs/private'
- | '/issue-6221/dashboard'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/redirect/$target'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect/'
- | '/not-found/'
- | '/posts/'
- | '/raw-stream/'
- | '/redirect/'
- | '/search-params/'
- | '/users/'
- | '/not-found/deep/b'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/api/users/$id'
- | '/issue-6221/article/$id'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts_/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/not-found/deep/'
- | '/not-found/parent-boundary/'
- | '/redirect/$target/'
- | '/not-found/deep/b/c'
- | '/foo/$bar/$qux/_here'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn/'
- | '/not-found/deep/b/c/d'
- | '/foo/$bar/$qux/_here/'
+ to: '/' | '/specialChars' | '/async-scripts' | '/auth-docs' | '/client-only' | '/deferred' | '/inline-scripts' | '/links' | '/plain-ts-type-assertion' | '/primitive-beforeload-error' | '/scripts' | '/stream' | '/type-only-reexport' | '/specialChars/malformed' | '/api/users' | '/auth-docs/private' | '/issue-6221/dashboard' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect' | '/not-found' | '/posts' | '/raw-stream' | '/redirect' | '/search-params' | '/users' | '/not-found/deep/b' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/issue-6221/article/$id' | '/not-found/parent-boundary/via-beforeLoad' | '/posts/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/not-found/deep' | '/not-found/parent-boundary' | '/redirect/$target' | '/not-found/deep/b/c' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn' | '/not-found/deep/b/c/d' | '/foo/$bar/$qux'
+ id: '__root__' | '/' | '/not-found' | '/search-params' | '/specialChars' | '/_layout' | '/async-scripts' | '/auth-docs' | '/client-only' | '/deferred' | '/inline-scripts' | '/links' | '/plain-ts-type-assertion' | '/posts' | '/primitive-beforeload-error' | '/raw-stream' | '/scripts' | '/stream' | '/type-only-reexport' | '/users' | '/not-found/deep' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/_layout/_layout-2' | '/api/users' | '/auth-docs/private' | '/issue-6221/dashboard' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/redirect/$target' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect/' | '/not-found/' | '/posts/' | '/raw-stream/' | '/redirect/' | '/search-params/' | '/users/' | '/not-found/deep/b' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/api/users/$id' | '/issue-6221/article/$id' | '/not-found/parent-boundary/via-beforeLoad' | '/posts_/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/not-found/deep/' | '/not-found/parent-boundary/' | '/redirect/$target/' | '/not-found/deep/b/c' | '/foo/$bar/$qux/_here' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn/' | '/not-found/deep/b/c/d' | '/foo/$bar/$qux/_here/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -938,8 +685,6 @@ export interface RootRouteChildren {
AuthDocsRoute: typeof AuthDocsRouteWithChildren
ClientOnlyRoute: typeof ClientOnlyRoute
DeferredRoute: typeof DeferredRoute
- ExecutionLocalRoute: typeof ExecutionLocalRoute
- ExecutionRpcRoute: typeof ExecutionRpcRoute
InlineScriptsRoute: typeof InlineScriptsRoute
LinksRoute: typeof LinksRoute
PlainTsTypeAssertionRoute: typeof PlainTsTypeAssertionRoute
@@ -1005,20 +750,6 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof DeferredRouteImport
parentRoute: typeof rootRouteImport
}
- '/execution-local': {
- id: '/execution-local'
- path: '/execution-local'
- fullPath: '/execution-local'
- preLoaderRoute: typeof ExecutionLocalRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/execution-rpc': {
- id: '/execution-rpc'
- path: '/execution-rpc'
- fullPath: '/execution-rpc'
- preLoaderRoute: typeof ExecutionRpcRouteImport
- parentRoute: typeof rootRouteImport
- }
'/inline-scripts': {
id: '/inline-scripts'
path: '/inline-scripts'
@@ -1506,8 +1237,7 @@ const NotFoundDeepBCRouteRouteChildren: NotFoundDeepBCRouteRouteChildren = {
NotFoundDeepBCDRoute: NotFoundDeepBCDRoute,
}
-const NotFoundDeepBCRouteRouteWithChildren =
- NotFoundDeepBCRouteRoute._addFileChildren(NotFoundDeepBCRouteRouteChildren)
+const NotFoundDeepBCRouteRouteWithChildren = NotFoundDeepBCRouteRoute._addFileChildren(NotFoundDeepBCRouteRouteChildren)
interface NotFoundDeepBRouteRouteChildren {
NotFoundDeepBCRouteRoute: typeof NotFoundDeepBCRouteRouteWithChildren
@@ -1517,8 +1247,7 @@ const NotFoundDeepBRouteRouteChildren: NotFoundDeepBRouteRouteChildren = {
NotFoundDeepBCRouteRoute: NotFoundDeepBCRouteRouteWithChildren,
}
-const NotFoundDeepBRouteRouteWithChildren =
- NotFoundDeepBRouteRoute._addFileChildren(NotFoundDeepBRouteRouteChildren)
+const NotFoundDeepBRouteRouteWithChildren = NotFoundDeepBRouteRoute._addFileChildren(NotFoundDeepBRouteRouteChildren)
interface NotFoundDeepRouteRouteChildren {
NotFoundDeepBRouteRoute: typeof NotFoundDeepBRouteRouteWithChildren
@@ -1530,25 +1259,19 @@ const NotFoundDeepRouteRouteChildren: NotFoundDeepRouteRouteChildren = {
NotFoundDeepIndexRoute: NotFoundDeepIndexRoute,
}
-const NotFoundDeepRouteRouteWithChildren =
- NotFoundDeepRouteRoute._addFileChildren(NotFoundDeepRouteRouteChildren)
+const NotFoundDeepRouteRouteWithChildren = NotFoundDeepRouteRoute._addFileChildren(NotFoundDeepRouteRouteChildren)
interface NotFoundParentBoundaryRouteRouteChildren {
NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute
NotFoundParentBoundaryIndexRoute: typeof NotFoundParentBoundaryIndexRoute
}
-const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren =
- {
- NotFoundParentBoundaryViaBeforeLoadRoute:
- NotFoundParentBoundaryViaBeforeLoadRoute,
- NotFoundParentBoundaryIndexRoute: NotFoundParentBoundaryIndexRoute,
- }
+const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren = {
+ NotFoundParentBoundaryViaBeforeLoadRoute: NotFoundParentBoundaryViaBeforeLoadRoute,
+ NotFoundParentBoundaryIndexRoute: NotFoundParentBoundaryIndexRoute,
+}
-const NotFoundParentBoundaryRouteRouteWithChildren =
- NotFoundParentBoundaryRouteRoute._addFileChildren(
- NotFoundParentBoundaryRouteRouteChildren,
- )
+const NotFoundParentBoundaryRouteRouteWithChildren = NotFoundParentBoundaryRouteRoute._addFileChildren(NotFoundParentBoundaryRouteRouteChildren)
interface NotFoundRouteRouteChildren {
NotFoundDeepRouteRoute: typeof NotFoundDeepRouteRouteWithChildren
@@ -1561,17 +1284,14 @@ interface NotFoundRouteRouteChildren {
const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {
NotFoundDeepRouteRoute: NotFoundDeepRouteRouteWithChildren,
- NotFoundParentBoundaryRouteRoute:
- NotFoundParentBoundaryRouteRouteWithChildren,
+ NotFoundParentBoundaryRouteRoute: NotFoundParentBoundaryRouteRouteWithChildren,
NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,
NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute,
NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,
NotFoundIndexRoute: NotFoundIndexRoute,
}
-const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(
- NotFoundRouteRouteChildren,
-)
+const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(NotFoundRouteRouteChildren)
interface SearchParamsRouteRouteChildren {
SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute
@@ -1585,24 +1305,19 @@ const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {
SearchParamsIndexRoute: SearchParamsIndexRoute,
}
-const SearchParamsRouteRouteWithChildren =
- SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
+const SearchParamsRouteRouteWithChildren = SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
interface SpecialCharsMalformedRouteRouteChildren {
SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute
SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute
}
-const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren =
- {
- SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,
- SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,
- }
+const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren = {
+ SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,
+ SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,
+}
-const SpecialCharsMalformedRouteRouteWithChildren =
- SpecialCharsMalformedRouteRoute._addFileChildren(
- SpecialCharsMalformedRouteRouteChildren,
- )
+const SpecialCharsMalformedRouteRouteWithChildren = SpecialCharsMalformedRouteRoute._addFileChildren(SpecialCharsMalformedRouteRouteChildren)
interface SpecialCharsRouteRouteChildren {
SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren
@@ -1617,12 +1332,10 @@ const SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = {
SpecialCharsParamRoute: SpecialCharsParamRoute,
SpecialCharsHashRoute: SpecialCharsHashRoute,
SpecialCharsSearchRoute: SpecialCharsSearchRoute,
- SpecialCharsChar45824Char54620Char48124Char44397Route:
- SpecialCharsChar45824Char54620Char48124Char44397Route,
+ SpecialCharsChar45824Char54620Char48124Char44397Route: SpecialCharsChar45824Char54620Char48124Char44397Route,
}
-const SpecialCharsRouteRouteWithChildren =
- SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)
+const SpecialCharsRouteRouteWithChildren = SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)
interface LayoutLayout2RouteChildren {
LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute
@@ -1634,9 +1347,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -1646,8 +1357,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface AuthDocsRouteChildren {
AuthDocsPrivateRoute: typeof AuthDocsPrivateRoute
@@ -1657,9 +1367,7 @@ const AuthDocsRouteChildren: AuthDocsRouteChildren = {
AuthDocsPrivateRoute: AuthDocsPrivateRoute,
}
-const AuthDocsRouteWithChildren = AuthDocsRoute._addFileChildren(
- AuthDocsRouteChildren,
-)
+const AuthDocsRouteWithChildren = AuthDocsRoute._addFileChildren(AuthDocsRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -1693,9 +1401,7 @@ const RawStreamRouteChildren: RawStreamRouteChildren = {
RawStreamIndexRoute: RawStreamIndexRoute,
}
-const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(
- RawStreamRouteChildren,
-)
+const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(RawStreamRouteChildren)
interface UsersRouteChildren {
UsersUserIdRoute: typeof UsersUserIdRoute
@@ -1717,9 +1423,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersIdRoute: ApiUsersIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
interface RedirectTargetRouteChildren {
RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute
@@ -1735,17 +1439,13 @@ const RedirectTargetRouteChildren: RedirectTargetRouteChildren = {
RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,
RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,
RedirectTargetIndexRoute: RedirectTargetIndexRoute,
- RedirectTargetServerFnViaBeforeLoadRoute:
- RedirectTargetServerFnViaBeforeLoadRoute,
+ RedirectTargetServerFnViaBeforeLoadRoute: RedirectTargetServerFnViaBeforeLoadRoute,
RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute,
- RedirectTargetServerFnViaUseServerFnRoute:
- RedirectTargetServerFnViaUseServerFnRoute,
+ RedirectTargetServerFnViaUseServerFnRoute: RedirectTargetServerFnViaUseServerFnRoute,
RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute,
}
-const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(
- RedirectTargetRouteChildren,
-)
+const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(RedirectTargetRouteChildren)
interface FooBarQuxHereRouteChildren {
FooBarQuxHereIndexRoute: typeof FooBarQuxHereIndexRoute
@@ -1755,9 +1455,7 @@ const FooBarQuxHereRouteChildren: FooBarQuxHereRouteChildren = {
FooBarQuxHereIndexRoute: FooBarQuxHereIndexRoute,
}
-const FooBarQuxHereRouteWithChildren = FooBarQuxHereRoute._addFileChildren(
- FooBarQuxHereRouteChildren,
-)
+const FooBarQuxHereRouteWithChildren = FooBarQuxHereRoute._addFileChildren(FooBarQuxHereRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
@@ -1769,8 +1467,6 @@ const rootRouteChildren: RootRouteChildren = {
AuthDocsRoute: AuthDocsRouteWithChildren,
ClientOnlyRoute: ClientOnlyRoute,
DeferredRoute: DeferredRoute,
- ExecutionLocalRoute: ExecutionLocalRoute,
- ExecutionRpcRoute: ExecutionRpcRoute,
InlineScriptsRoute: InlineScriptsRoute,
LinksRoute: LinksRoute,
PlainTsTypeAssertionRoute: PlainTsTypeAssertionRoute,
diff --git a/e2e/react-start/basic/src/routes/__root.tsx b/e2e/react-start/basic/src/routes/__root.tsx
index ed521817d6..d8fc0d3b24 100644
--- a/e2e/react-start/basic/src/routes/__root.tsx
+++ b/e2e/react-start/basic/src/routes/__root.tsx
@@ -197,9 +197,6 @@ function RootDocument({ children }: { children: React.ReactNode }) {
>
Client Only
{' '}
-
- Server function loader
- {' '}
readOnlyOnServer(),
- component: Result,
- errorComponent: ({ error }) => (
- {error instanceof Error ? error.message : String(error)}
- ),
-})
-
-function Result() {
- return {Route.useLoaderData()}
-}
diff --git a/e2e/react-start/basic/src/routes/execution-rpc.tsx b/e2e/react-start/basic/src/routes/execution-rpc.tsx
deleted file mode 100644
index f934015522..0000000000
--- a/e2e/react-start/basic/src/routes/execution-rpc.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { createFileRoute, Link } from '@tanstack/react-router'
-import { readThroughRpc } from '~/utils/execution-functions'
-
-export const Route = createFileRoute('/execution-rpc')({
- loader: () => readThroughRpc(),
- component: Result,
-})
-
-function Result() {
- return (
- <>
- {Route.useLoaderData()}
-
- Call the server-only helper directly
-
- >
- )
-}
diff --git a/e2e/react-start/basic/src/utils/execution-functions.ts b/e2e/react-start/basic/src/utils/execution-functions.ts
deleted file mode 100644
index 97e66573d8..0000000000
--- a/e2e/react-start/basic/src/utils/execution-functions.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import { createServerFn, createServerOnlyFn } from '@tanstack/react-start'
-
-export const readOnlyOnServer = createServerOnlyFn(() => 'Read on the server')
-
-export const readThroughRpc = createServerFn().handler(() => readOnlyOnServer())
diff --git a/e2e/react-start/basic/tests/client-only.spec.ts b/e2e/react-start/basic/tests/client-only.spec.ts
index 299744f636..a3b6f99442 100644
--- a/e2e/react-start/basic/tests/client-only.spec.ts
+++ b/e2e/react-start/basic/tests/client-only.spec.ts
@@ -1,6 +1,5 @@
import { expect } from '@playwright/test'
import { test } from '@tanstack/router-e2e-utils'
-import { isSpaMode } from './utils/isSpaMode'
/**
* These tests verify the compiler optimization.
@@ -16,15 +15,7 @@ import { isSpaMode } from './utils/isSpaMode'
test('ClientOnly renders fallback on server, then client content after hydration', async ({
page,
- request,
}) => {
- const response = await request.get('/client-only')
- expect(response.status()).toBe(200)
- const html = await response.text()
- expect(html).not.toContain('data-testid="window-size"')
- if (!isSpaMode) {
- expect(html).toContain('Loading window size...')
- }
// Navigate directly to the client-only route
// If the compiler optimization isn't working, this would crash the server
// because WindowSize.tsx accesses `window` at module scope
diff --git a/e2e/react-start/basic/tests/environment-functions.spec.ts b/e2e/react-start/basic/tests/environment-functions.spec.ts
deleted file mode 100644
index 410b1d999e..0000000000
--- a/e2e/react-start/basic/tests/environment-functions.spec.ts
+++ /dev/null
@@ -1,46 +0,0 @@
-import { expect, test } from '@playwright/test'
-import { isSpaMode } from './utils/isSpaMode'
-
-const guardError =
- 'createServerOnlyFn() functions can only be called on the server!'
-
-test('a server-only loader works on the server but rejects client navigation', async ({
- page,
- request,
-}) => {
- const direct = await request.get('/execution-local')
- expect(direct.status()).toBe(200)
- if (!isSpaMode) {
- expect(await direct.text()).toContain('Read on the server')
- }
- await page.goto('/execution-rpc')
- await expect(page.getByTestId('execution-result')).toHaveText(
- 'Read on the server',
- )
- await page
- .getByRole('link', { name: 'Call the server-only helper directly' })
- .click()
- await expect(page.getByRole('alert')).toHaveText(guardError)
-})
-
-test('a server function preserves the loader result on direct requests and navigation', async ({
- page,
- request,
-}) => {
- const direct = await request.get('/execution-rpc')
- expect(direct.status()).toBe(200)
- if (!isSpaMode) {
- expect(await direct.text()).toContain('Read on the server')
- }
- await page.goto('/')
- await page
- .getByRole('link', { name: 'Server function loader', exact: true })
- .click()
- await expect(page.getByTestId('execution-result')).toHaveText(
- 'Read on the server',
- )
- await page.reload()
- await expect(page.getByTestId('execution-result')).toHaveText(
- 'Read on the server',
- )
-})
diff --git a/e2e/react-start/basic/tests/setup/dev-server.setup.ts b/e2e/react-start/basic/tests/setup/dev-server.setup.ts
deleted file mode 100644
index d16ff0bb54..0000000000
--- a/e2e/react-start/basic/tests/setup/dev-server.setup.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { preOptimizeDevServer, waitForServer } from '@tanstack/router-e2e-utils'
-
-export default async function setup() {
- const port = Number(process.env.E2E_APP_PORT ?? 0)
- const baseURL = `http://localhost:${port}`
-
- await waitForServer(baseURL)
- await preOptimizeDevServer({
- baseURL,
- warmup: async (page) => {
- await page.getByRole('heading').getByText('Welcome Home').waitFor()
- await page.goto(`${baseURL}/specialChars/search?searchParam=warmup`)
- await page.getByTestId('special-search-loaded-info').waitFor()
- await page.goto(`${baseURL}/posts`)
- await page.getByRole('link', { name: 'sunt aut facere repe' }).waitFor()
- await page.waitForLoadState('networkidle')
- },
- })
-}
diff --git a/e2e/react-start/basic/tests/spa-shell.spec.ts b/e2e/react-start/basic/tests/spa-shell.spec.ts
deleted file mode 100644
index f42195e762..0000000000
--- a/e2e/react-start/basic/tests/spa-shell.spec.ts
+++ /dev/null
@@ -1,53 +0,0 @@
-import { expect } from '@playwright/test'
-import { test } from '@tanstack/router-e2e-utils'
-import { isSpaMode } from './utils/isSpaMode'
-
-// The prod SPA run and the dev SPA runs (`E2E_DEV_SERVER`) all run this file.
-// The dev runs run nothing else.
-test.skip(!isSpaMode, 'only SPA mode answers documents with the shell')
-
-// Its loader and beforeLoad report where they ran.
-const searchRoute = '/specialChars/search?searchParam=shell'
-
-test('a document request gets the shell, not the rendered route', async ({
- request,
-}) => {
- const response = await request.get(searchRoute)
-
- expect(response.status()).toBe(200)
- const html = await response.text()
- // The root route's document renders...
- expect(html).toContain('This Route Does Not Exist')
- // ...but not the matched route, nor its loader's output.
- expect(html).not.toContain('special-search-loaded-info')
- expect(html).not.toContain('Loaded on: server')
-})
-
-test('the route loads in the browser', async ({ page }) => {
- await page.goto(searchRoute)
-
- await expect(page.getByTestId('special-search-loaded-info')).toHaveText(
- 'Loaded on: client',
- )
- await expect(page.getByTestId('special-search-before-load-info')).toHaveText(
- 'Before load on: client',
- )
- await expect(page.getByTestId('special-search-param')).toHaveText('shell')
-})
-
-test('client navigation works from the shell', async ({ page }) => {
- await page.goto('/')
- await expect(page.getByRole('heading')).toContainText('Welcome Home')
- await expect(page.getByTestId('router-status')).toHaveText('idle')
-
- // A full page load would drop this.
- await page.evaluate(() => {
- ;(window as any).__spaShellPage = true
- })
- await page.getByRole('link', { name: 'Posts' }).click()
- await page.waitForURL('/posts')
- await expect(
- page.getByRole('link', { name: 'sunt aut facere repe' }),
- ).toBeVisible()
- expect(await page.evaluate(() => (window as any).__spaShellPage)).toBe(true)
-})
diff --git a/e2e/react-start/csp/src/routeTree.gen.ts b/e2e/react-start/csp/src/routeTree.gen.ts
index dceedffdc1..e8819afd9a 100644
--- a/e2e/react-start/csp/src/routeTree.gen.ts
+++ b/e2e/react-start/csp/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/css-inline/package.json b/e2e/react-start/css-inline/package.json
index 6c5dd031c6..8e77dba817 100644
--- a/e2e/react-start/css-inline/package.json
+++ b/e2e/react-start/css-inline/package.json
@@ -24,7 +24,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
diff --git a/e2e/react-start/css-inline/src/routeTree.gen.ts b/e2e/react-start/css-inline/src/routeTree.gen.ts
index 1b5e5886b1..40eba7880f 100644
--- a/e2e/react-start/css-inline/src/routeTree.gen.ts
+++ b/e2e/react-start/css-inline/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -64,21 +62,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/app'
- | '/app/dashboard'
- | '/app/dashboard/details'
- | '/app/dashboard/'
+ fullPaths: '/' | '/app' | '/app/dashboard' | '/app/dashboard/details' | '/app/dashboard/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/app' | '/app/dashboard/details' | '/app/dashboard'
- id:
- | '__root__'
- | '/'
- | '/app'
- | '/app/dashboard'
- | '/app/dashboard/details'
- | '/app/dashboard/'
+ id: '__root__' | '/' | '/app' | '/app/dashboard' | '/app/dashboard/details' | '/app/dashboard/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -136,8 +123,7 @@ const AppDashboardRouteRouteChildren: AppDashboardRouteRouteChildren = {
AppDashboardIndexRoute: AppDashboardIndexRoute,
}
-const AppDashboardRouteRouteWithChildren =
- AppDashboardRouteRoute._addFileChildren(AppDashboardRouteRouteChildren)
+const AppDashboardRouteRouteWithChildren = AppDashboardRouteRoute._addFileChildren(AppDashboardRouteRouteChildren)
interface AppRouteRouteChildren {
AppDashboardRouteRoute: typeof AppDashboardRouteRouteWithChildren
@@ -147,9 +133,7 @@ const AppRouteRouteChildren: AppRouteRouteChildren = {
AppDashboardRouteRoute: AppDashboardRouteRouteWithChildren,
}
-const AppRouteRouteWithChildren = AppRouteRoute._addFileChildren(
- AppRouteRouteChildren,
-)
+const AppRouteRouteWithChildren = AppRouteRoute._addFileChildren(AppRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/css-modules/.gitignore b/e2e/react-start/css-modules/.gitignore
index a1fbca128d..229709a89d 100644
--- a/e2e/react-start/css-modules/.gitignore
+++ b/e2e/react-start/css-modules/.gitignore
@@ -3,4 +3,3 @@ dist
test-results
playwright-report
port*.txt
-.cloudflare
diff --git a/e2e/react-start/css-modules/cloudflare.config.ts b/e2e/react-start/css-modules/cloudflare.config.ts
deleted file mode 100644
index e2bd5e13f1..0000000000
--- a/e2e/react-start/css-modules/cloudflare.config.ts
+++ /dev/null
@@ -1,11 +0,0 @@
-import { defineConfig } from 'cf/config'
-
-// Used by rsbuild-plugin-cloudflare (E2E_RSBUILD_CLOUDFLARE=true).
-// The Vite Cloudflare variant still reads wrangler.jsonc.
-export default defineConfig({
- worker: {
- name: 'tanstack-start-css-modules',
- entrypoint: '@tanstack/react-start/server-entry',
- compatibilityDate: '2026-11-01',
- },
-})
diff --git a/e2e/react-start/css-modules/package.json b/e2e/react-start/css-modules/package.json
index 25c11d7321..93f9dadd74 100644
--- a/e2e/react-start/css-modules/package.json
+++ b/e2e/react-start/css-modules/package.json
@@ -12,8 +12,6 @@
"dev:e2e:basepath": "VITE_BASE_PATH=/my-app vite dev --port $PORT",
"dev:cloudflare": "echo 'Cloudflare dev mode has React duplication issues - use build+preview instead' && exit 1",
"dev:e2e:cloudflare": "echo 'Cloudflare dev mode has React duplication issues - use build+preview instead' && exit 1",
- "dev:e2e:rsbuild": "rsbuild dev --port $PORT",
- "dev:e2e:rsbuild-cloudflare": "E2E_RSBUILD_CLOUDFLARE=true rsbuild dev --port $PORT",
"build": "vite build && tsc --noEmit",
"preview": "vite preview",
"start": "pnpx srvx --prod -s ../client dist/server/server.js",
@@ -21,8 +19,6 @@
"test:e2e:dev:nitro": "MODE=dev VITE_CONFIG=nitro playwright test --project=chromium",
"test:e2e:dev:basepath": "MODE=dev VITE_CONFIG=basepath playwright test --project=chromium",
"_test:e2e:dev:cloudflare": "MODE=dev VITE_CONFIG=cloudflare playwright test --project=chromium",
- "test:e2e:dev:rsbuild": "MODE=dev VITE_CONFIG=rsbuild playwright test --project=chromium",
- "test:e2e:dev:rsbuild-cloudflare": "MODE=dev VITE_CONFIG=rsbuild-cloudflare playwright test --project=chromium",
"test:e2e:prod:default": "MODE=prod playwright test --project=chromium",
"test:e2e:prod": "pnpm run test:e2e:prod:default && pnpm run test:e2e:prod:css-code-split-false",
"test:e2e:prod:css-code-split-false": "MODE=prod VITE_CSS_CODE_SPLIT=false playwright test tests/css.prod.spec.ts --project=chromium",
@@ -41,7 +37,7 @@
"devDependencies": {
"@cloudflare/vite-plugin": "^1.29.0",
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@rsbuild/plugin-sass": "^2.0.1",
"@tanstack/router-e2e-utils": "workspace:*",
@@ -50,10 +46,8 @@
"@types/react-dom": "^19.0.3",
"@typescript/native": "npm:typescript@^7.0.2",
"@vitejs/plugin-react": "^6.0.1",
- "cf": "1.0.0-beta.28",
"nitro": "^3.0.260903-beta",
- "rsbuild-plugin-cloudflare": "^0.0.4",
- "sass": "^1.97.2",
+ "sass": "^1.105.1",
"srvx": "^1.0.0",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/e2e/react-start/css-modules/rsbuild.config.ts b/e2e/react-start/css-modules/rsbuild.config.ts
index 499ed67ebc..e9d4068c5c 100644
--- a/e2e/react-start/css-modules/rsbuild.config.ts
+++ b/e2e/react-start/css-modules/rsbuild.config.ts
@@ -2,25 +2,9 @@ import { defineConfig } from '@rsbuild/core'
import { pluginReact } from '@rsbuild/plugin-react'
import { pluginSass } from '@rsbuild/plugin-sass'
import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
-import { cloudflare } from 'rsbuild-plugin-cloudflare'
-
-// E2E_RSBUILD_CLOUDFLARE: Set to 'true' to run the SSR environment in workerd
-const useCloudflare = process.env.E2E_RSBUILD_CLOUDFLARE === 'true'
export default defineConfig({
- plugins: [
- pluginReact(),
- pluginSass(),
- ...(useCloudflare
- ? [
- cloudflare({
- rsbuildEnvironment: { name: 'ssr' },
- inspectorPort: false,
- }),
- ]
- : []),
- tanstackStart(),
- ],
+ plugins: [pluginReact(), pluginSass(), tanstackStart()],
output: {
distPath: {
root: process.env.E2E_DIST_DIR ?? 'dist-rsbuild-ssr',
diff --git a/e2e/react-start/css-modules/src/routeTree.gen.ts b/e2e/react-start/css-modules/src/routeTree.gen.ts
index 2789a3490a..aa3555097d 100644
--- a/e2e/react-start/css-modules/src/routeTree.gen.ts
+++ b/e2e/react-start/css-modules/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -83,20 +81,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- '/' | '/alpha' | '/beta' | '/gamma' | '/modules' | '/quotes' | '/sass-mixin'
+ fullPaths: '/' | '/alpha' | '/beta' | '/gamma' | '/modules' | '/quotes' | '/sass-mixin'
fileRoutesByTo: FileRoutesByTo
- to:
- '/' | '/alpha' | '/beta' | '/gamma' | '/modules' | '/quotes' | '/sass-mixin'
- id:
- | '__root__'
- | '/'
- | '/alpha'
- | '/beta'
- | '/gamma'
- | '/modules'
- | '/quotes'
- | '/sass-mixin'
+ to: '/' | '/alpha' | '/beta' | '/gamma' | '/modules' | '/quotes' | '/sass-mixin'
+ id: '__root__' | '/' | '/alpha' | '/beta' | '/gamma' | '/modules' | '/quotes' | '/sass-mixin'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/custom-basepath/src/routeTree.gen.ts b/e2e/react-start/custom-basepath/src/routeTree.gen.ts
index 18cc9b5163..0627bc91a9 100644
--- a/e2e/react-start/custom-basepath/src/routeTree.gen.ts
+++ b/e2e/react-start/custom-basepath/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -153,54 +151,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/deferred'
- | '/logout'
- | '/navigate-test'
- | '/posts'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts/'
- | '/redirect/'
- | '/users/'
- | '/api/users/$id'
- | '/posts/$postId/deep'
+ fullPaths: '/' | '/deferred' | '/logout' | '/navigate-test' | '/posts' | '/users' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts/' | '/redirect/' | '/users/' | '/api/users/$id' | '/posts/$postId/deep'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/deferred'
- | '/logout'
- | '/navigate-test'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts'
- | '/redirect'
- | '/users'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- id:
- | '__root__'
- | '/'
- | '/deferred'
- | '/logout'
- | '/navigate-test'
- | '/posts'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts/'
- | '/redirect/'
- | '/users/'
- | '/api/users/$id'
- | '/posts_/$postId/deep'
+ to: '/' | '/deferred' | '/logout' | '/navigate-test' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts' | '/redirect' | '/users' | '/api/users/$id' | '/posts/$postId/deep'
+ id: '__root__' | '/' | '/deferred' | '/logout' | '/navigate-test' | '/posts' | '/users' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts/' | '/redirect/' | '/users/' | '/api/users/$id' | '/posts_/$postId/deep'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -358,9 +312,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersIdRoute: ApiUsersIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/custom-server-rsbuild/package.json b/e2e/react-start/custom-server-rsbuild/package.json
index 1c5b3af393..41a825e6ff 100644
--- a/e2e/react-start/custom-server-rsbuild/package.json
+++ b/e2e/react-start/custom-server-rsbuild/package.json
@@ -21,7 +21,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
diff --git a/e2e/react-start/custom-server-rsbuild/src/routeTree.gen.ts b/e2e/react-start/custom-server-rsbuild/src/routeTree.gen.ts
index dceedffdc1..e8819afd9a 100644
--- a/e2e/react-start/custom-server-rsbuild/src/routeTree.gen.ts
+++ b/e2e/react-start/custom-server-rsbuild/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/deferred-hydration/package.json b/e2e/react-start/deferred-hydration/package.json
index 5a33407435..221fceba2b 100644
--- a/e2e/react-start/deferred-hydration/package.json
+++ b/e2e/react-start/deferred-hydration/package.json
@@ -26,7 +26,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
diff --git a/e2e/react-start/deferred-hydration/src/routeTree.gen.ts b/e2e/react-start/deferred-hydration/src/routeTree.gen.ts
index 451af49ddf..f27a1107a0 100644
--- a/e2e/react-start/deferred-hydration/src/routeTree.gen.ts
+++ b/e2e/react-start/deferred-hydration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -74,29 +72,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/components'
- | '/css'
- | '/enhanced'
- | '/imported'
- | '/scroll-restoration'
+ fullPaths: '/' | '/components' | '/css' | '/enhanced' | '/imported' | '/scroll-restoration'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/components'
- | '/css'
- | '/enhanced'
- | '/imported'
- | '/scroll-restoration'
- id:
- | '__root__'
- | '/'
- | '/components'
- | '/css'
- | '/enhanced'
- | '/imported'
- | '/scroll-restoration'
+ to: '/' | '/components' | '/css' | '/enhanced' | '/imported' | '/scroll-restoration'
+ id: '__root__' | '/' | '/components' | '/css' | '/enhanced' | '/imported' | '/scroll-restoration'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/deferred-hydration/tests/hydration.spec.ts b/e2e/react-start/deferred-hydration/tests/hydration.spec.ts
index bd097d2ead..2b564484d3 100644
--- a/e2e/react-start/deferred-hydration/tests/hydration.spec.ts
+++ b/e2e/react-start/deferred-hydration/tests/hydration.spec.ts
@@ -1,6 +1,5 @@
import { expect } from '@playwright/test'
import { createHmrFileEditor, test } from '@tanstack/router-e2e-utils'
-import crypto from 'node:crypto'
import path from 'node:path'
import type { APIRequestContext, Page } from '@playwright/test'
@@ -30,36 +29,49 @@ const componentsRouteEditor = createHmrFileEditor({
normalizeSource: (_fileKey, source) => normalizeComponentsRouteSource(source),
})
-function getVisibleHydrateVirtualPath() {
- const normalizedSourcePath = path
- .relative(process.cwd(), componentsRouteFile)
- .replaceAll('\\', '/')
- const sourceHash = crypto
- .createHash('sha1')
- .update(normalizedSourcePath)
- .digest('hex')
- .slice(0, 10)
- const params = new URLSearchParams()
- params.set('tss-hydrate', `0_${sourceHash}`)
+const componentsRouteUrl = `/${path
+ .relative(process.cwd(), componentsRouteFile)
+ .replaceAll('\\', '/')}`
- return `${componentsRouteFile}?${params.toString()}`
+// Which dev modules (split chunks, Hydrate children, shared chunks) hold the
+// edited code is compiler-internal, so follow the route's own derived
+// modules from the route module instead of guessing an id
+async function readComponentsRouteDevModules(request: APIRequestContext) {
+ const pending = [componentsRouteUrl]
+ const seen = new Set(pending)
+ const texts: Array = []
+ while (pending.length > 0) {
+ const url = pending.shift()!
+ const response = await request.get(url)
+ const text = await response.text()
+ if (!response.ok()) {
+ throw new Error(`${response.status()} ${url}: ${text.slice(0, 240)}`)
+ }
+ texts.push(text)
+ for (const match of text.matchAll(
+ /["'](\/[^"'?]*\/routes\/components\.tsx\?[^"']+)["']/g,
+ )) {
+ const next = match[1]!
+ if (!seen.has(next)) {
+ seen.add(next)
+ pending.push(next)
+ }
+ }
+ }
+ return texts
}
async function waitForVisibleHydrateVirtualModule(page: Page, marker: string) {
- const virtualPath = getVisibleHydrateVirtualPath()
-
await expect
.poll(
async () => {
try {
- const response = await page.request.get(virtualPath)
- const text = await response.text()
-
- if (response.ok() && text.includes(marker)) {
+ const texts = await readComponentsRouteDevModules(page.request)
+ if (texts.some((text) => text.includes(marker))) {
return 'ready'
}
- return `${response.status()} ${text.slice(0, 240)}`
+ return `marker not found in ${texts.length} modules`
} catch (error) {
return String(error)
}
diff --git a/e2e/react-start/dev-ssr-styles/src/routeTree.gen.ts b/e2e/react-start/dev-ssr-styles/src/routeTree.gen.ts
index 96c0a37142..dde7a52d21 100644
--- a/e2e/react-start/dev-ssr-styles/src/routeTree.gen.ts
+++ b/e2e/react-start/dev-ssr-styles/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/early-hints/src/routeTree.gen.ts b/e2e/react-start/early-hints/src/routeTree.gen.ts
index 5196090061..c24eb91a02 100644
--- a/e2e/react-start/early-hints/src/routeTree.gen.ts
+++ b/e2e/react-start/early-hints/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -83,32 +81,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/other'
- | '/parent'
- | '/redirect'
- | '/other/nested'
- | '/parent/child'
- | '/parent/child/grandchild'
+ fullPaths: '/' | '/other' | '/parent' | '/redirect' | '/other/nested' | '/parent/child' | '/parent/child/grandchild'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/other'
- | '/parent'
- | '/redirect'
- | '/other/nested'
- | '/parent/child'
- | '/parent/child/grandchild'
- id:
- | '__root__'
- | '/'
- | '/other'
- | '/parent'
- | '/redirect'
- | '/other/nested'
- | '/parent/child'
- | '/parent/child/grandchild'
+ to: '/' | '/other' | '/parent' | '/redirect' | '/other/nested' | '/parent/child' | '/parent/child/grandchild'
+ id: '__root__' | '/' | '/other' | '/parent' | '/redirect' | '/other/nested' | '/parent/child' | '/parent/child/grandchild'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -190,9 +166,7 @@ const ParentChildRouteChildren: ParentChildRouteChildren = {
ParentChildGrandchildRoute: ParentChildGrandchildRoute,
}
-const ParentChildRouteWithChildren = ParentChildRoute._addFileChildren(
- ParentChildRouteChildren,
-)
+const ParentChildRouteWithChildren = ParentChildRoute._addFileChildren(ParentChildRouteChildren)
interface ParentRouteChildren {
ParentChildRoute: typeof ParentChildRouteWithChildren
@@ -202,8 +176,7 @@ const ParentRouteChildren: ParentRouteChildren = {
ParentChildRoute: ParentChildRouteWithChildren,
}
-const ParentRouteWithChildren =
- ParentRoute._addFileChildren(ParentRouteChildren)
+const ParentRouteWithChildren = ParentRoute._addFileChildren(ParentRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/hmr/package.json b/e2e/react-start/hmr/package.json
index 76a5d86b1f..7a6dc23f76 100644
--- a/e2e/react-start/hmr/package.json
+++ b/e2e/react-start/hmr/package.json
@@ -21,7 +21,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
diff --git a/e2e/react-start/hmr/src/routeTree.gen.ts b/e2e/react-start/hmr/src/routeTree.gen.ts
index 73d8bd14f5..9ae286a1f6 100644
--- a/e2e/react-start/hmr/src/routeTree.gen.ts
+++ b/e2e/react-start/hmr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -39,41 +37,36 @@ const ComponentHmrRoute = ComponentHmrRouteImport.update({
path: '/component-hmr',
getParentRoute: () => rootRouteImport,
} as any)
-const ComponentHmrInlineErrorSplitRoute =
- ComponentHmrInlineErrorSplitRouteImport.update({
- id: '/component-hmr-inline-error-split',
- path: '/component-hmr-inline-error-split',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ComponentHmrInlineNosplitRoute =
- ComponentHmrInlineNosplitRouteImport.update({
- id: '/component-hmr-inline-nosplit',
- path: '/component-hmr-inline-nosplit',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ComponentHmrInlineErrorSplitRoute = ComponentHmrInlineErrorSplitRouteImport.update({
+ id: '/component-hmr-inline-error-split',
+ path: '/component-hmr-inline-error-split',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ComponentHmrInlineNosplitRoute = ComponentHmrInlineNosplitRouteImport.update({
+ id: '/component-hmr-inline-nosplit',
+ path: '/component-hmr-inline-nosplit',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ComponentHmrInlineSplitRoute = ComponentHmrInlineSplitRouteImport.update({
id: '/component-hmr-inline-split',
path: '/component-hmr-inline-split',
getParentRoute: () => rootRouteImport,
} as any)
-const ComponentHmrLowercaseNamedSplitRoute =
- ComponentHmrLowercaseNamedSplitRouteImport.update({
- id: '/component-hmr-lowercase-named-split',
- path: '/component-hmr-lowercase-named-split',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ComponentHmrNamedErrorSplitRoute =
- ComponentHmrNamedErrorSplitRouteImport.update({
- id: '/component-hmr-named-error-split',
- path: '/component-hmr-named-error-split',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ComponentHmrNamedNosplitRoute =
- ComponentHmrNamedNosplitRouteImport.update({
- id: '/component-hmr-named-nosplit',
- path: '/component-hmr-named-nosplit',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ComponentHmrLowercaseNamedSplitRoute = ComponentHmrLowercaseNamedSplitRouteImport.update({
+ id: '/component-hmr-lowercase-named-split',
+ path: '/component-hmr-lowercase-named-split',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ComponentHmrNamedErrorSplitRoute = ComponentHmrNamedErrorSplitRouteImport.update({
+ id: '/component-hmr-named-error-split',
+ path: '/component-hmr-named-error-split',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ComponentHmrNamedNosplitRoute = ComponentHmrNamedNosplitRouteImport.update({
+ id: '/component-hmr-named-nosplit',
+ path: '/component-hmr-named-nosplit',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ComponentHmrNamedSplitRoute = ComponentHmrNamedSplitRouteImport.update({
id: '/component-hmr-named-split',
path: '/component-hmr-named-split',
@@ -94,12 +87,11 @@ const AliasedRouteImportsIdRoute = AliasedRouteImportsIdRouteImport.update({
path: '/aliased-route-imports/$id',
getParentRoute: () => rootRouteImport,
} as any)
-const AliasedRouteImportsIdChildRoute =
- AliasedRouteImportsIdChildRouteImport.update({
- id: '/child',
- path: '/child',
- getParentRoute: () => AliasedRouteImportsIdRoute,
- } as any)
+const AliasedRouteImportsIdChildRoute = AliasedRouteImportsIdChildRouteImport.update({
+ id: '/child',
+ path: '/child',
+ getParentRoute: () => AliasedRouteImportsIdRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -152,53 +144,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/child'
- | '/component-hmr'
- | '/component-hmr-inline-error-split'
- | '/component-hmr-inline-nosplit'
- | '/component-hmr-inline-split'
- | '/component-hmr-lowercase-named-split'
- | '/component-hmr-named-error-split'
- | '/component-hmr-named-nosplit'
- | '/component-hmr-named-split'
- | '/inputs'
- | '/server-fn-hmr'
- | '/aliased-route-imports/$id'
- | '/aliased-route-imports/$id/child'
+ fullPaths: '/' | '/child' | '/component-hmr' | '/component-hmr-inline-error-split' | '/component-hmr-inline-nosplit' | '/component-hmr-inline-split' | '/component-hmr-lowercase-named-split' | '/component-hmr-named-error-split' | '/component-hmr-named-nosplit' | '/component-hmr-named-split' | '/inputs' | '/server-fn-hmr' | '/aliased-route-imports/$id' | '/aliased-route-imports/$id/child'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/child'
- | '/component-hmr'
- | '/component-hmr-inline-error-split'
- | '/component-hmr-inline-nosplit'
- | '/component-hmr-inline-split'
- | '/component-hmr-lowercase-named-split'
- | '/component-hmr-named-error-split'
- | '/component-hmr-named-nosplit'
- | '/component-hmr-named-split'
- | '/inputs'
- | '/server-fn-hmr'
- | '/aliased-route-imports/$id'
- | '/aliased-route-imports/$id/child'
- id:
- | '__root__'
- | '/'
- | '/child'
- | '/component-hmr'
- | '/component-hmr-inline-error-split'
- | '/component-hmr-inline-nosplit'
- | '/component-hmr-inline-split'
- | '/component-hmr-lowercase-named-split'
- | '/component-hmr-named-error-split'
- | '/component-hmr-named-nosplit'
- | '/component-hmr-named-split'
- | '/inputs'
- | '/server-fn-hmr'
- | '/aliased-route-imports/$id'
- | '/aliased-route-imports/$id/child'
+ to: '/' | '/child' | '/component-hmr' | '/component-hmr-inline-error-split' | '/component-hmr-inline-nosplit' | '/component-hmr-inline-split' | '/component-hmr-lowercase-named-split' | '/component-hmr-named-error-split' | '/component-hmr-named-nosplit' | '/component-hmr-named-split' | '/inputs' | '/server-fn-hmr' | '/aliased-route-imports/$id' | '/aliased-route-imports/$id/child'
+ id: '__root__' | '/' | '/child' | '/component-hmr' | '/component-hmr-inline-error-split' | '/component-hmr-inline-nosplit' | '/component-hmr-inline-split' | '/component-hmr-lowercase-named-split' | '/component-hmr-named-error-split' | '/component-hmr-named-nosplit' | '/component-hmr-named-split' | '/inputs' | '/server-fn-hmr' | '/aliased-route-imports/$id' | '/aliased-route-imports/$id/child'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -328,10 +277,7 @@ const AliasedRouteImportsIdRouteChildren: AliasedRouteImportsIdRouteChildren = {
AliasedRouteImportsIdChildRoute: AliasedRouteImportsIdChildRoute,
}
-const AliasedRouteImportsIdRouteWithChildren =
- AliasedRouteImportsIdRoute._addFileChildren(
- AliasedRouteImportsIdRouteChildren,
- )
+const AliasedRouteImportsIdRouteWithChildren = AliasedRouteImportsIdRoute._addFileChildren(AliasedRouteImportsIdRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/hmr/tests/app.spec.ts b/e2e/react-start/hmr/tests/app.spec.ts
index 645c9b06f3..eedb4eed98 100644
--- a/e2e/react-start/hmr/tests/app.spec.ts
+++ b/e2e/react-start/hmr/tests/app.spec.ts
@@ -932,7 +932,6 @@ test.describe('react-start hmr', () => {
await waitForRouteModuleUpdate(page, '/child', 'Child Updated')
},
)
- await waitForHydrationSafeReload(page, '/child', 'Child Updated')
// Second edit: change child loader again while still on /
await replaceRouteTextAndWait(
diff --git a/e2e/react-start/i18n-paraglide/src/routeTree.gen.ts b/e2e/react-start/i18n-paraglide/src/routeTree.gen.ts
index d89758e684..a72d733668 100644
--- a/e2e/react-start/i18n-paraglide/src/routeTree.gen.ts
+++ b/e2e/react-start/i18n-paraglide/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/import-protection-custom-config/src/routeTree.gen.ts b/e2e/react-start/import-protection-custom-config/src/routeTree.gen.ts
index 6a2acc53ef..1f8497186c 100644
--- a/e2e/react-start/import-protection-custom-config/src/routeTree.gen.ts
+++ b/e2e/react-start/import-protection-custom-config/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/import-protection-custom-config/tests/custom-config.spec.ts b/e2e/react-start/import-protection-custom-config/tests/custom-config.spec.ts
index ce69c08d26..e55eb2e6e6 100644
--- a/e2e/react-start/import-protection-custom-config/tests/custom-config.spec.ts
+++ b/e2e/react-start/import-protection-custom-config/tests/custom-config.spec.ts
@@ -15,7 +15,10 @@ async function readViolations(
}
test.use({
- whitelistErrors: [/mock/i, /Cannot read properties/i, /undefined/i],
+ // Mock mode: calling a mock logs the `mockAccess` runtime diagnostic in
+ // dev and production. (A list whose second item is an object would be
+ // read by Playwright as a `[value, options]` fixture tuple.)
+ whitelistErrors: [/^Error: \[import-protection\] Mocked import used/],
})
// -----------------------------------------------------------------------
diff --git a/e2e/react-start/import-protection/package.json b/e2e/react-start/import-protection/package.json
index ad06ba41ea..a87df63d6f 100644
--- a/e2e/react-start/import-protection/package.json
+++ b/e2e/react-start/import-protection/package.json
@@ -22,7 +22,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
diff --git a/e2e/react-start/import-protection/tests/import-protection.spec.ts b/e2e/react-start/import-protection/tests/import-protection.spec.ts
index 16b5b073eb..a3a51416fc 100644
--- a/e2e/react-start/import-protection/tests/import-protection.spec.ts
+++ b/e2e/react-start/import-protection/tests/import-protection.spec.ts
@@ -1,10 +1,12 @@
import path from 'node:path'
import fs from 'node:fs'
+import os from 'node:os'
import { expect } from '@playwright/test'
import { test } from '@tanstack/router-e2e-utils'
import { getViolationArtifactName } from './violations.utils'
import type { Violation } from './violations.utils'
import type { Page } from '@playwright/test'
+import type { RsbuildPlugin } from '@rsbuild/core'
const toolchain = process.env.E2E_TOOLCHAIN ?? 'vite'
const fixtureRoot = path.resolve(import.meta.dirname, '..')
@@ -14,6 +16,14 @@ function stripLocation(value: string): string {
return value.replace(/:\d+:\d+$/, '')
}
+// Traces follow the bundler graph from the real entry, through framework
+// package modules. Their steps may carry no line (SPEC J6.5: optional fields).
+function isFrameworkDistFile(file: string): boolean {
+ return /\/(node_modules|packages\/[^/]+\/dist)\//.test(
+ file.replace(/\\/g, '/'),
+ )
+}
+
function normalizeKeyPath(value: string): string {
let normalized = stripLocation(value).replace(/\\/g, '/')
const normalizedFixtureRoot = fixtureRoot.replace(/\\/g, '/')
@@ -123,9 +133,10 @@ function findTypeOnlyProtectedImportHits(
}
test.use({
- // The mock proxy returns undefined-ish values, which may cause
- // React rendering warnings — whitelist those
- whitelistErrors: [/mock/i, /Cannot read properties/i, /undefined/i],
+ // Mock mode: calling a mock logs the `mockAccess` runtime diagnostic in
+ // dev and production. (A list whose second item is an object would be
+ // read by Playwright as a `[value, options]` fixture tuple.)
+ whitelistErrors: [/^Error: \[import-protection\] Mocked import used/],
})
test.beforeEach(({}, testInfo) => {
@@ -270,6 +281,7 @@ for (const mode of ['build', 'dev'] as const) {
const step = v!.trace[i]
if (step.specifier?.includes('?tsr-split=')) continue
if (step.file.includes('routeTree.gen')) continue
+ if (step.line == null && isFrameworkDistFile(step.file)) continue
// In dev mode, the step right after a ?tsr-split= virtual step
// re-enters the same file — its import may not be locatable.
const prev = v!.trace[i - 1]
@@ -337,7 +349,18 @@ for (const mode of ['build', 'dev'] as const) {
})
}
-for (const mode of ['build', 'dev'] as const) {
+// SPEC J6.4: builds decide violations after tree-shaking. `leakyReference`
+// is exported but imported by nobody, so its `secret.server` edge is dead in
+// the client build and not reported; dev reports it.
+test('compiler leak dead edge is not reported in build', async () => {
+ const violations = await readViolations('build')
+ const v = violations.find(
+ (x) => x.envType === 'client' && x.importer.includes('compiler-leak'),
+ )
+ expect(v).toBeUndefined()
+})
+
+for (const mode of ['dev'] as const) {
test(`compiler leak violation includes line/col in importer in ${mode}`, async () => {
const violations = await readViolations(mode)
const v = violations.find(
@@ -395,7 +418,8 @@ for (const mode of ['build', 'dev', 'dev.warm'] as const) {
})
}
-for (const mode of ['build', 'dev'] as const) {
+// Dev only: the build drops compiler-leak's dead edge (SPEC J6.4, above).
+for (const mode of ['dev'] as const) {
test(`compiler-processed module has code snippet in ${mode}`, async () => {
const violations = await readViolations(mode)
@@ -668,6 +692,7 @@ test('warm run traces include line numbers', async () => {
const step = v!.trace[i]
if (step.specifier?.includes('?tsr-split=')) continue
if (step.file.includes('routeTree.gen')) continue
+ if (step.line == null && isFrameworkDistFile(step.file)) continue
const prev = v!.trace[i - 1]
if (prev.specifier?.includes('?tsr-split=')) continue
if (
@@ -1024,3 +1049,68 @@ for (const mode of ['build', 'dev', 'dev.warm'] as const) {
expect(hit).toBeDefined()
})
}
+
+test('persistent cache restores import-protection mocks and violations', async () => {
+ test.skip(toolchain !== 'rsbuild', 'Rspack persistent cache')
+ test.setTimeout(120_000)
+ const { createRsbuild, loadConfig, mergeRsbuildConfig } =
+ await import('@rsbuild/core')
+ const directory = await fs.promises.mkdtemp(
+ path.join(os.tmpdir(), 'tss-import-protection-cache-'),
+ )
+
+ const build = async () => {
+ const results: Record<
+ string,
+ { errors: Array; warnings: Array }
+ > = {}
+ const { content } = await loadConfig({ cwd: fixtureRoot })
+ const rsbuild = await createRsbuild({
+ cwd: fixtureRoot,
+ rsbuildConfig: mergeRsbuildConfig(content, {
+ root: fixtureRoot,
+ output: { distPath: { root: path.join(directory, 'dist') } },
+ performance: {
+ buildCache: { cacheDirectory: path.join(directory, 'cache') },
+ },
+ plugins: [
+ {
+ name: 'collect-import-protection-diagnostics',
+ setup(api) {
+ api.onAfterEnvironmentCompile(({ environment, stats }) => {
+ if (stats) {
+ results[environment.name] = {
+ errors: stats.compilation.errors.map((e) => e.message),
+ warnings: stats.compilation.warnings
+ .map((w) => w.message)
+ .sort(),
+ }
+ }
+ })
+ },
+ } satisfies RsbuildPlugin,
+ ],
+ }),
+ })
+ await rsbuild.build().catch(() => undefined)
+ return results
+ }
+
+ try {
+ const cold = await build()
+ const warm = await build()
+
+ for (const environment of ['client', 'ssr']) {
+ expect(cold[environment]?.errors).toEqual([])
+ expect(warm[environment]?.errors).toEqual([])
+ expect(warm[environment]?.warnings).toEqual(cold[environment]?.warnings)
+ }
+ expect(
+ warm.client?.warnings.some((warning) =>
+ warning.includes('secret.server'),
+ ),
+ ).toBe(true)
+ } finally {
+ await fs.promises.rm(directory, { recursive: true, force: true })
+ }
+})
diff --git a/e2e/react-start/issue-8049/src/routeTree.gen.ts b/e2e/react-start/issue-8049/src/routeTree.gen.ts
index 9f42873a9b..81aa16edc4 100644
--- a/e2e/react-start/issue-8049/src/routeTree.gen.ts
+++ b/e2e/react-start/issue-8049/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/query-integration/src/routeTree.gen.ts b/e2e/react-start/query-integration/src/routeTree.gen.ts
index ee7ef43f26..8273097ea0 100644
--- a/e2e/react-start/query-integration/src/routeTree.gen.ts
+++ b/e2e/react-start/query-integration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -56,19 +54,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/useQuery'
- | '/useSuspenseQuery'
- | '/loader-fetchQuery/$type'
+ fullPaths: '/' | '/useQuery' | '/useSuspenseQuery' | '/loader-fetchQuery/$type'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/useQuery' | '/useSuspenseQuery' | '/loader-fetchQuery/$type'
- id:
- | '__root__'
- | '/'
- | '/useQuery'
- | '/useSuspenseQuery'
- | '/loader-fetchQuery/$type'
+ id: '__root__' | '/' | '/useQuery' | '/useSuspenseQuery' | '/loader-fetchQuery/$type'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/response-reconciliation/package.json b/e2e/react-start/response-reconciliation/package.json
index 7ba0224962..7ec4e14415 100644
--- a/e2e/react-start/response-reconciliation/package.json
+++ b/e2e/react-start/response-reconciliation/package.json
@@ -23,7 +23,7 @@
},
"devDependencies": {
"@playwright/test": "^1.57.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.0.8",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "25.0.9",
diff --git a/e2e/react-start/response-reconciliation/src/routeTree.gen.ts b/e2e/react-start/response-reconciliation/src/routeTree.gen.ts
index 3dbb6301c3..a0227269ef 100644
--- a/e2e/react-start/response-reconciliation/src/routeTree.gen.ts
+++ b/e2e/react-start/response-reconciliation/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -72,35 +70,31 @@ const ApiClearReturnedHeadersRoute = ApiClearReturnedHeadersRouteImport.update({
path: '/api/clear-returned-headers',
getParentRoute: () => rootRouteImport,
} as any)
-const ApiDirectMutationVisibleRoute =
- ApiDirectMutationVisibleRouteImport.update({
- id: '/api/direct-mutation-visible',
- path: '/api/direct-mutation-visible',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ApiExplicitSetCookieHeaderRoute =
- ApiExplicitSetCookieHeaderRouteImport.update({
- id: '/api/explicit-set-cookie-header',
- path: '/api/explicit-set-cookie-header',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ApiDirectMutationVisibleRoute = ApiDirectMutationVisibleRouteImport.update({
+ id: '/api/direct-mutation-visible',
+ path: '/api/direct-mutation-visible',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiExplicitSetCookieHeaderRoute = ApiExplicitSetCookieHeaderRouteImport.update({
+ id: '/api/explicit-set-cookie-header',
+ path: '/api/explicit-set-cookie-header',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiFramingErrorRoute = ApiFramingErrorRouteImport.update({
id: '/api/framing-error',
path: '/api/framing-error',
getParentRoute: () => rootRouteImport,
} as any)
-const ApiGetResponseHeaderHelperRoute =
- ApiGetResponseHeaderHelperRouteImport.update({
- id: '/api/get-response-header-helper',
- path: '/api/get-response-header-helper',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ApiGetResponseHeadersHelperRoute =
- ApiGetResponseHeadersHelperRouteImport.update({
- id: '/api/get-response-headers-helper',
- path: '/api/get-response-headers-helper',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ApiGetResponseHeaderHelperRoute = ApiGetResponseHeaderHelperRouteImport.update({
+ id: '/api/get-response-header-helper',
+ path: '/api/get-response-header-helper',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiGetResponseHeadersHelperRoute = ApiGetResponseHeadersHelperRouteImport.update({
+ id: '/api/get-response-headers-helper',
+ path: '/api/get-response-headers-helper',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiMultipleCookiesRoute = ApiMultipleCookiesRouteImport.update({
id: '/api/multiple-cookies',
path: '/api/multiple-cookies',
@@ -126,18 +120,16 @@ const ApiRemoveReturnedHeaderRoute = ApiRemoveReturnedHeaderRouteImport.update({
path: '/api/remove-returned-header',
getParentRoute: () => rootRouteImport,
} as any)
-const ApiReplaceAfterDirectMutationRoute =
- ApiReplaceAfterDirectMutationRouteImport.update({
- id: '/api/replace-after-direct-mutation',
- path: '/api/replace-after-direct-mutation',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ApiReplaceExplicitSetCookieRoute =
- ApiReplaceExplicitSetCookieRouteImport.update({
- id: '/api/replace-explicit-set-cookie',
- path: '/api/replace-explicit-set-cookie',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ApiReplaceAfterDirectMutationRoute = ApiReplaceAfterDirectMutationRouteImport.update({
+ id: '/api/replace-after-direct-mutation',
+ path: '/api/replace-after-direct-mutation',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiReplaceExplicitSetCookieRoute = ApiReplaceExplicitSetCookieRouteImport.update({
+ id: '/api/replace-explicit-set-cookie',
+ path: '/api/replace-explicit-set-cookie',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ApiRouteAfterNextRoute = ApiRouteAfterNextRouteImport.update({
id: '/api/route-after-next',
path: '/api/route-after-next',
@@ -269,92 +261,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/server-functions'
- | '/ssr'
- | '/streamed'
- | '/api/base'
- | '/api/bulk-headers'
- | '/api/clear-returned-headers'
- | '/api/direct-mutation-visible'
- | '/api/explicit-set-cookie-header'
- | '/api/framing-error'
- | '/api/get-response-header-helper'
- | '/api/get-response-headers-helper'
- | '/api/multiple-cookies'
- | '/api/null-body-status'
- | '/api/readonly-after-next'
- | '/api/redirect-with-cookies'
- | '/api/remove-returned-header'
- | '/api/replace-after-direct-mutation'
- | '/api/replace-explicit-set-cookie'
- | '/api/route-after-next'
- | '/api/route-before-next'
- | '/api/same-boundary-conflict'
- | '/api/status-contracts'
- | '/api/throw-after-status'
- | '/api/tracked-stream'
- | '/api/tracked-stream-status'
- | '/api/two-returned-responses'
+ fullPaths: '/' | '/server-functions' | '/ssr' | '/streamed' | '/api/base' | '/api/bulk-headers' | '/api/clear-returned-headers' | '/api/direct-mutation-visible' | '/api/explicit-set-cookie-header' | '/api/framing-error' | '/api/get-response-header-helper' | '/api/get-response-headers-helper' | '/api/multiple-cookies' | '/api/null-body-status' | '/api/readonly-after-next' | '/api/redirect-with-cookies' | '/api/remove-returned-header' | '/api/replace-after-direct-mutation' | '/api/replace-explicit-set-cookie' | '/api/route-after-next' | '/api/route-before-next' | '/api/same-boundary-conflict' | '/api/status-contracts' | '/api/throw-after-status' | '/api/tracked-stream' | '/api/tracked-stream-status' | '/api/two-returned-responses'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/server-functions'
- | '/ssr'
- | '/streamed'
- | '/api/base'
- | '/api/bulk-headers'
- | '/api/clear-returned-headers'
- | '/api/direct-mutation-visible'
- | '/api/explicit-set-cookie-header'
- | '/api/framing-error'
- | '/api/get-response-header-helper'
- | '/api/get-response-headers-helper'
- | '/api/multiple-cookies'
- | '/api/null-body-status'
- | '/api/readonly-after-next'
- | '/api/redirect-with-cookies'
- | '/api/remove-returned-header'
- | '/api/replace-after-direct-mutation'
- | '/api/replace-explicit-set-cookie'
- | '/api/route-after-next'
- | '/api/route-before-next'
- | '/api/same-boundary-conflict'
- | '/api/status-contracts'
- | '/api/throw-after-status'
- | '/api/tracked-stream'
- | '/api/tracked-stream-status'
- | '/api/two-returned-responses'
- id:
- | '__root__'
- | '/'
- | '/server-functions'
- | '/ssr'
- | '/streamed'
- | '/api/base'
- | '/api/bulk-headers'
- | '/api/clear-returned-headers'
- | '/api/direct-mutation-visible'
- | '/api/explicit-set-cookie-header'
- | '/api/framing-error'
- | '/api/get-response-header-helper'
- | '/api/get-response-headers-helper'
- | '/api/multiple-cookies'
- | '/api/null-body-status'
- | '/api/readonly-after-next'
- | '/api/redirect-with-cookies'
- | '/api/remove-returned-header'
- | '/api/replace-after-direct-mutation'
- | '/api/replace-explicit-set-cookie'
- | '/api/route-after-next'
- | '/api/route-before-next'
- | '/api/same-boundary-conflict'
- | '/api/status-contracts'
- | '/api/throw-after-status'
- | '/api/tracked-stream'
- | '/api/tracked-stream-status'
- | '/api/two-returned-responses'
+ to: '/' | '/server-functions' | '/ssr' | '/streamed' | '/api/base' | '/api/bulk-headers' | '/api/clear-returned-headers' | '/api/direct-mutation-visible' | '/api/explicit-set-cookie-header' | '/api/framing-error' | '/api/get-response-header-helper' | '/api/get-response-headers-helper' | '/api/multiple-cookies' | '/api/null-body-status' | '/api/readonly-after-next' | '/api/redirect-with-cookies' | '/api/remove-returned-header' | '/api/replace-after-direct-mutation' | '/api/replace-explicit-set-cookie' | '/api/route-after-next' | '/api/route-before-next' | '/api/same-boundary-conflict' | '/api/status-contracts' | '/api/throw-after-status' | '/api/tracked-stream' | '/api/tracked-stream-status' | '/api/two-returned-responses'
+ id: '__root__' | '/' | '/server-functions' | '/ssr' | '/streamed' | '/api/base' | '/api/bulk-headers' | '/api/clear-returned-headers' | '/api/direct-mutation-visible' | '/api/explicit-set-cookie-header' | '/api/framing-error' | '/api/get-response-header-helper' | '/api/get-response-headers-helper' | '/api/multiple-cookies' | '/api/null-body-status' | '/api/readonly-after-next' | '/api/redirect-with-cookies' | '/api/remove-returned-header' | '/api/replace-after-direct-mutation' | '/api/replace-explicit-set-cookie' | '/api/route-after-next' | '/api/route-before-next' | '/api/same-boundary-conflict' | '/api/status-contracts' | '/api/throw-after-status' | '/api/tracked-stream' | '/api/tracked-stream-status' | '/api/two-returned-responses'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/root-document-hydration/src/routeTree.gen.ts b/e2e/react-start/root-document-hydration/src/routeTree.gen.ts
index dceedffdc1..e8819afd9a 100644
--- a/e2e/react-start/root-document-hydration/src/routeTree.gen.ts
+++ b/e2e/react-start/root-document-hydration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/rsbuild/package.json b/e2e/react-start/rsbuild/package.json
index d03ef22542..a1e1877e32 100644
--- a/e2e/react-start/rsbuild/package.json
+++ b/e2e/react-start/rsbuild/package.json
@@ -28,7 +28,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
diff --git a/e2e/react-start/rsbuild/src/routeTree.gen.ts b/e2e/react-start/rsbuild/src/routeTree.gen.ts
index dceedffdc1..e8819afd9a 100644
--- a/e2e/react-start/rsbuild/src/routeTree.gen.ts
+++ b/e2e/react-start/rsbuild/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/rsbuild/tests/error-overlay.spec.ts b/e2e/react-start/rsbuild/tests/error-overlay.spec.ts
index d90647314a..384b6a6667 100644
--- a/e2e/react-start/rsbuild/tests/error-overlay.spec.ts
+++ b/e2e/react-start/rsbuild/tests/error-overlay.spec.ts
@@ -176,11 +176,13 @@ class DevServer {
}
}
+// SPEC §5.7 leaves the wording and the reporting channel free (the bundler
+// may report a parse error itself); the file and the position must be shown.
type ErrorOverlayIssue = {
title: string | null
- description: string | null
runtime: 'client' | 'server' | null
- sourceFrame: string | null
+ file: string | null
+ errorLine: number | null
importTrace: Array
}
@@ -241,26 +243,20 @@ function getErrorRuntime(block: string): ErrorOverlayIssue['runtime'] {
)
}
-function findTrimmedLine(lines: Array, text: string): string | null {
- return lines.find((line) => line.includes(text))?.trim() ?? null
+function getErrorFile(lines: Array): string | null {
+ return lines[0]?.match(/^File: (.+?)(?::\d+:\d+)?$/)?.[1] ?? null
}
-function getSyntaxErrorDescription(lines: Array): string | null {
- return (
- findTrimmedLine(lines, 'SyntaxError:')
- ?.replace(/^.*SyntaxError:/, 'SyntaxError:')
- .trim() ?? null
- )
-}
+// The error's line, from a `(line:column)` message suffix or a code frame
+// header `[file:line:column]`, after the block's `File:` line.
+function getErrorLine(lines: Array): number | null {
+ const match = lines
+ .slice(1)
+ .join('\n')
+ .match(/\((\d+):\d+\)|\[[^\]\s]+:(\d+):\d+\]/)
+ const line = match?.[1] ?? match?.[2]
-function getSourceFrame(lines: Array): string | null {
- const sourceFrame = [
- lines[0]?.trim(),
- findTrimmedLine(lines, 'Module build failed'),
- findTrimmedLine(lines, 'SyntaxError:'),
- ].filter(Boolean)
-
- return sourceFrame.length > 0 ? sourceFrame.join('\n') : null
+ return line === undefined ? null : Number(line)
}
function getImportTrace(lines: Array): Array {
@@ -286,9 +282,9 @@ function parseErrorOverlayIssue(
return {
title,
- description: getSyntaxErrorDescription(lines),
runtime: getErrorRuntime(block),
- sourceFrame: getSourceFrame(lines),
+ file: getErrorFile(lines),
+ errorLine: getErrorLine(lines),
importTrace: getImportTrace(lines),
}
}
@@ -376,9 +372,9 @@ test('shows a module syntax error through the error overlay', async ({
[
{
"title": "Build failed",
- "description": "SyntaxError: Unexpected token (16:22)",
"runtime": "client",
- "sourceFrame": "File: ./src/routes/index.tsx:1:1\\nx Module build failed (from ):\\n-> x SyntaxError: Unexpected token (16:22)",
+ "file": "./src/routes/index.tsx",
+ "errorLine": 16,
"importTrace": [
"../../../packages/react-start/dist/plugin/default-entry/client.tsx",
"../../../packages/react-start/dist/esm/client.js",
@@ -389,9 +385,9 @@ test('shows a module syntax error through the error overlay', async ({
},
{
"title": "Build failed",
- "description": "SyntaxError: Unexpected token (16:22)",
"runtime": "server",
- "sourceFrame": "File: ./src/routes/index.tsx:1:1\\nx Module build failed (from ):\\n-> x SyntaxError: Unexpected token (16:22)",
+ "file": "./src/routes/index.tsx",
+ "errorLine": 16,
"importTrace": [
"../../../packages/react-start/dist/plugin/default-entry/server.ts",
"../../../packages/react-start/dist/esm/server.js",
diff --git a/e2e/react-start/rsc-deferred-hydration/package.json b/e2e/react-start/rsc-deferred-hydration/package.json
index 06317e59d0..e9ef601352 100644
--- a/e2e/react-start/rsc-deferred-hydration/package.json
+++ b/e2e/react-start/rsc-deferred-hydration/package.json
@@ -45,7 +45,7 @@
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
- "@vitejs/plugin-rsc": "^0.5.39",
+ "@vitejs/plugin-rsc": "^0.5.37",
"srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
diff --git a/e2e/react-start/rsc-deferred-hydration/src/routeTree.gen.ts b/e2e/react-start/rsc-deferred-hydration/src/routeTree.gen.ts
index f2a58f4f6f..c7a329d607 100644
--- a/e2e/react-start/rsc-deferred-hydration/src/routeTree.gen.ts
+++ b/e2e/react-start/rsc-deferred-hydration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/rsc-query/package.json b/e2e/react-start/rsc-query/package.json
index 68a99cd432..0b19a3244c 100644
--- a/e2e/react-start/rsc-query/package.json
+++ b/e2e/react-start/rsc-query/package.json
@@ -28,7 +28,7 @@
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
- "@vitejs/plugin-rsc": "^0.5.39",
+ "@vitejs/plugin-rsc": "^0.5.37",
"srvx": "^1.0.0",
"typescript": "^5.7.2",
"vite": "^8.0.14"
diff --git a/e2e/react-start/rsc-rsbuild/package.json b/e2e/react-start/rsc-rsbuild/package.json
index 067394fc08..e9367727e5 100644
--- a/e2e/react-start/rsc-rsbuild/package.json
+++ b/e2e/react-start/rsc-rsbuild/package.json
@@ -28,7 +28,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
diff --git a/e2e/react-start/rsc-rsbuild/src/routeTree.gen.ts b/e2e/react-start/rsc-rsbuild/src/routeTree.gen.ts
index 393ffe98a9..4cf9651e0e 100644
--- a/e2e/react-start/rsc-rsbuild/src/routeTree.gen.ts
+++ b/e2e/react-start/rsc-rsbuild/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/rsc/package.json b/e2e/react-start/rsc/package.json
index a30227d509..5a6bcceedc 100644
--- a/e2e/react-start/rsc/package.json
+++ b/e2e/react-start/rsc/package.json
@@ -13,8 +13,7 @@
"build:vite": "vite build && tsc --noEmit",
"preview": "vite preview",
"start": "node server.js",
- "test:e2e-full": "pnpm build && playwright test --project=chromium",
- "test:e2e:dev:rsbuild": "MODE=dev E2E_TOOLCHAIN=rsbuild playwright test --project=chromium"
+ "test:e2e-full": "pnpm build && playwright test --project=chromium"
},
"nx": {
"metadata": {
@@ -41,7 +40,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/eslint-plugin-start": "workspace:^",
"@tanstack/router-e2e-utils": "workspace:^",
@@ -50,7 +49,7 @@
"@types/react-dom": "^19.0.3",
"@typescript-eslint/parser": "^8.23.0",
"@vitejs/plugin-react": "^6.0.1",
- "@vitejs/plugin-rsc": "^0.5.39",
+ "@vitejs/plugin-rsc": "^0.5.37",
"eslint": "^9.22.0",
"srvx": "^1.0.0",
"typescript": "^5.7.2",
diff --git a/e2e/react-start/rsc/playwright.config.ts b/e2e/react-start/rsc/playwright.config.ts
index 075efdc5b9..6cbc07f75a 100644
--- a/e2e/react-start/rsc/playwright.config.ts
+++ b/e2e/react-start/rsc/playwright.config.ts
@@ -2,8 +2,6 @@ import { defineConfig, devices } from '@playwright/test'
import { appServerReady } from '@tanstack/router-e2e-utils'
const distDir = process.env.E2E_DIST_DIR ?? 'dist'
-// MODE=dev runs the suite against the Rsbuild dev server instead of a build
-const isRsbuildDev = process.env.MODE === 'dev'
const PORT = Number(process.env.E2E_APP_PORT ?? 0)
const baseURL = `http://localhost:${PORT}`
@@ -18,7 +16,7 @@ export default defineConfig({
},
webServer: {
- command: isRsbuildDev ? 'pnpm dev:rsbuild --port 0' : 'pnpm start',
+ command: 'pnpm start',
wait: appServerReady,
reuseExistingServer: false,
stdout: 'pipe',
diff --git a/e2e/react-start/rsc/src/routeTree.gen.ts b/e2e/react-start/rsc/src/routeTree.gen.ts
index 38137dfb4b..0ee0a60048 100644
--- a/e2e/react-start/rsc/src/routeTree.gen.ts
+++ b/e2e/react-start/rsc/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -452,155 +450,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/rsc-async-bundle'
- | '/rsc-basic'
- | '/rsc-bundle'
- | '/rsc-caching'
- | '/rsc-client-preload'
- | '/rsc-component-slot'
- | '/rsc-context'
- | '/rsc-css-autoinject'
- | '/rsc-css-modules'
- | '/rsc-css-preload-complex'
- | '/rsc-deferred'
- | '/rsc-deferred-component'
- | '/rsc-direct-loader'
- | '/rsc-error'
- | '/rsc-external'
- | '/rsc-flight-api'
- | '/rsc-forms'
- | '/rsc-global-css'
- | '/rsc-hydration'
- | '/rsc-invalidation'
- | '/rsc-large'
- | '/rsc-link'
- | '/rsc-multi'
- | '/rsc-nested'
- | '/rsc-nested-structure'
- | '/rsc-parallel'
- | '/rsc-react-cache'
- | '/rsc-request-headers'
- | '/rsc-server-not-found'
- | '/rsc-server-redirect'
- | '/rsc-slot-jsx-args'
- | '/rsc-slots'
- | '/rsc-ssr-data-only'
- | '/rsc-ssr-false'
- | '/rsc-stream-generator'
- | '/rsc-stream-loader'
- | '/rsc-stream-readable'
- | '/rsc-streaming'
- | '/rsc-suspense'
- | '/rsc-tree'
- | '/rsc-use-server-fn'
- | '/api/rsc-build-boundary'
- | '/api/rsc-flight'
- | '/rsc-css-conditional/$branch'
- | '/rsc-param/$id'
- | '/rsc-css-conditional/'
- | '/rsc-param/'
+ fullPaths: '/' | '/rsc-async-bundle' | '/rsc-basic' | '/rsc-bundle' | '/rsc-caching' | '/rsc-client-preload' | '/rsc-component-slot' | '/rsc-context' | '/rsc-css-autoinject' | '/rsc-css-modules' | '/rsc-css-preload-complex' | '/rsc-deferred' | '/rsc-deferred-component' | '/rsc-direct-loader' | '/rsc-error' | '/rsc-external' | '/rsc-flight-api' | '/rsc-forms' | '/rsc-global-css' | '/rsc-hydration' | '/rsc-invalidation' | '/rsc-large' | '/rsc-link' | '/rsc-multi' | '/rsc-nested' | '/rsc-nested-structure' | '/rsc-parallel' | '/rsc-react-cache' | '/rsc-request-headers' | '/rsc-server-not-found' | '/rsc-server-redirect' | '/rsc-slot-jsx-args' | '/rsc-slots' | '/rsc-ssr-data-only' | '/rsc-ssr-false' | '/rsc-stream-generator' | '/rsc-stream-loader' | '/rsc-stream-readable' | '/rsc-streaming' | '/rsc-suspense' | '/rsc-tree' | '/rsc-use-server-fn' | '/api/rsc-build-boundary' | '/api/rsc-flight' | '/rsc-css-conditional/$branch' | '/rsc-param/$id' | '/rsc-css-conditional/' | '/rsc-param/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/rsc-async-bundle'
- | '/rsc-basic'
- | '/rsc-bundle'
- | '/rsc-caching'
- | '/rsc-client-preload'
- | '/rsc-component-slot'
- | '/rsc-context'
- | '/rsc-css-autoinject'
- | '/rsc-css-modules'
- | '/rsc-css-preload-complex'
- | '/rsc-deferred'
- | '/rsc-deferred-component'
- | '/rsc-direct-loader'
- | '/rsc-error'
- | '/rsc-external'
- | '/rsc-flight-api'
- | '/rsc-forms'
- | '/rsc-global-css'
- | '/rsc-hydration'
- | '/rsc-invalidation'
- | '/rsc-large'
- | '/rsc-link'
- | '/rsc-multi'
- | '/rsc-nested'
- | '/rsc-nested-structure'
- | '/rsc-parallel'
- | '/rsc-react-cache'
- | '/rsc-request-headers'
- | '/rsc-server-not-found'
- | '/rsc-server-redirect'
- | '/rsc-slot-jsx-args'
- | '/rsc-slots'
- | '/rsc-ssr-data-only'
- | '/rsc-ssr-false'
- | '/rsc-stream-generator'
- | '/rsc-stream-loader'
- | '/rsc-stream-readable'
- | '/rsc-streaming'
- | '/rsc-suspense'
- | '/rsc-tree'
- | '/rsc-use-server-fn'
- | '/api/rsc-build-boundary'
- | '/api/rsc-flight'
- | '/rsc-css-conditional/$branch'
- | '/rsc-param/$id'
- | '/rsc-css-conditional'
- | '/rsc-param'
- id:
- | '__root__'
- | '/'
- | '/rsc-async-bundle'
- | '/rsc-basic'
- | '/rsc-bundle'
- | '/rsc-caching'
- | '/rsc-client-preload'
- | '/rsc-component-slot'
- | '/rsc-context'
- | '/rsc-css-autoinject'
- | '/rsc-css-modules'
- | '/rsc-css-preload-complex'
- | '/rsc-deferred'
- | '/rsc-deferred-component'
- | '/rsc-direct-loader'
- | '/rsc-error'
- | '/rsc-external'
- | '/rsc-flight-api'
- | '/rsc-forms'
- | '/rsc-global-css'
- | '/rsc-hydration'
- | '/rsc-invalidation'
- | '/rsc-large'
- | '/rsc-link'
- | '/rsc-multi'
- | '/rsc-nested'
- | '/rsc-nested-structure'
- | '/rsc-parallel'
- | '/rsc-react-cache'
- | '/rsc-request-headers'
- | '/rsc-server-not-found'
- | '/rsc-server-redirect'
- | '/rsc-slot-jsx-args'
- | '/rsc-slots'
- | '/rsc-ssr-data-only'
- | '/rsc-ssr-false'
- | '/rsc-stream-generator'
- | '/rsc-stream-loader'
- | '/rsc-stream-readable'
- | '/rsc-streaming'
- | '/rsc-suspense'
- | '/rsc-tree'
- | '/rsc-use-server-fn'
- | '/api/rsc-build-boundary'
- | '/api/rsc-flight'
- | '/rsc-css-conditional/$branch'
- | '/rsc-param/$id'
- | '/rsc-css-conditional/'
- | '/rsc-param/'
+ to: '/' | '/rsc-async-bundle' | '/rsc-basic' | '/rsc-bundle' | '/rsc-caching' | '/rsc-client-preload' | '/rsc-component-slot' | '/rsc-context' | '/rsc-css-autoinject' | '/rsc-css-modules' | '/rsc-css-preload-complex' | '/rsc-deferred' | '/rsc-deferred-component' | '/rsc-direct-loader' | '/rsc-error' | '/rsc-external' | '/rsc-flight-api' | '/rsc-forms' | '/rsc-global-css' | '/rsc-hydration' | '/rsc-invalidation' | '/rsc-large' | '/rsc-link' | '/rsc-multi' | '/rsc-nested' | '/rsc-nested-structure' | '/rsc-parallel' | '/rsc-react-cache' | '/rsc-request-headers' | '/rsc-server-not-found' | '/rsc-server-redirect' | '/rsc-slot-jsx-args' | '/rsc-slots' | '/rsc-ssr-data-only' | '/rsc-ssr-false' | '/rsc-stream-generator' | '/rsc-stream-loader' | '/rsc-stream-readable' | '/rsc-streaming' | '/rsc-suspense' | '/rsc-tree' | '/rsc-use-server-fn' | '/api/rsc-build-boundary' | '/api/rsc-flight' | '/rsc-css-conditional/$branch' | '/rsc-param/$id' | '/rsc-css-conditional' | '/rsc-param'
+ id: '__root__' | '/' | '/rsc-async-bundle' | '/rsc-basic' | '/rsc-bundle' | '/rsc-caching' | '/rsc-client-preload' | '/rsc-component-slot' | '/rsc-context' | '/rsc-css-autoinject' | '/rsc-css-modules' | '/rsc-css-preload-complex' | '/rsc-deferred' | '/rsc-deferred-component' | '/rsc-direct-loader' | '/rsc-error' | '/rsc-external' | '/rsc-flight-api' | '/rsc-forms' | '/rsc-global-css' | '/rsc-hydration' | '/rsc-invalidation' | '/rsc-large' | '/rsc-link' | '/rsc-multi' | '/rsc-nested' | '/rsc-nested-structure' | '/rsc-parallel' | '/rsc-react-cache' | '/rsc-request-headers' | '/rsc-server-not-found' | '/rsc-server-redirect' | '/rsc-slot-jsx-args' | '/rsc-slots' | '/rsc-ssr-data-only' | '/rsc-ssr-false' | '/rsc-stream-generator' | '/rsc-stream-loader' | '/rsc-stream-readable' | '/rsc-streaming' | '/rsc-suspense' | '/rsc-tree' | '/rsc-use-server-fn' | '/api/rsc-build-boundary' | '/api/rsc-flight' | '/rsc-css-conditional/$branch' | '/rsc-param/$id' | '/rsc-css-conditional/' | '/rsc-param/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/rsc/tests/rsc-css-preload-complex.spec.ts b/e2e/react-start/rsc/tests/rsc-css-preload-complex.spec.ts
index 35db86eca9..f5d8e04928 100644
--- a/e2e/react-start/rsc/tests/rsc-css-preload-complex.spec.ts
+++ b/e2e/react-start/rsc/tests/rsc-css-preload-complex.spec.ts
@@ -116,16 +116,15 @@ test.describe('RSC Complex CSS Preload Tests', () => {
test('CSS module classes are scoped for all widgets', async ({ page }) => {
await page.goto('/rsc-css-preload-complex')
- // Widget A classes should be hashed (accept Vite `_widget_xxx`, Rspack
- // `widget-xxx`, and Rsbuild dev `src-...-module__widget-xxx` scoped names)
+ // Widget A classes should be hashed (accept Vite `_widget_xxx` or Rspack `widget-xxx` scoped names)
const widgetA = page.locator('[data-testid="client-widget-a"]')
const widgetAClass = await widgetA.getAttribute('class')
- expect(widgetAClass).toMatch(/(^|\s|__)(_widget_|widget[-_])[\w-]+/)
+ expect(widgetAClass).toMatch(/(^|\s)(_widget_|widget[-_])[\w-]+/)
// Widget B classes should be hashed
const widgetB = page.locator('[data-testid="client-widget-b"]')
const widgetBClass = await widgetB.getAttribute('class')
- expect(widgetBClass).toMatch(/(^|\s|__)(_widget_|widget[-_])[\w-]+/)
+ expect(widgetBClass).toMatch(/(^|\s)(_widget_|widget[-_])[\w-]+/)
// Classes should be different (different modules)
expect(widgetAClass).not.toBe(widgetBClass)
diff --git a/e2e/react-start/scroll-restoration/src/routeTree.gen.ts b/e2e/react-start/scroll-restoration/src/routeTree.gen.ts
index f25d1f25c0..73e9235c8f 100644
--- a/e2e/react-start/scroll-restoration/src/routeTree.gen.ts
+++ b/e2e/react-start/scroll-restoration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -52,18 +50,16 @@ const testsNestedScrollAwayRoute = testsNestedScrollAwayRouteImport.update({
path: '/nested-scroll-away',
getParentRoute: () => rootRouteImport,
} as any)
-const testsNestedScrollCarryOverARoute =
- testsNestedScrollCarryOverARouteImport.update({
- id: '/(tests)/nested-scroll-carry-over-a',
- path: '/nested-scroll-carry-over-a',
- getParentRoute: () => rootRouteImport,
- } as any)
-const testsNestedScrollCarryOverBRoute =
- testsNestedScrollCarryOverBRouteImport.update({
- id: '/(tests)/nested-scroll-carry-over-b',
- path: '/nested-scroll-carry-over-b',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsNestedScrollCarryOverARoute = testsNestedScrollCarryOverARouteImport.update({
+ id: '/(tests)/nested-scroll-carry-over-a',
+ path: '/nested-scroll-carry-over-a',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const testsNestedScrollCarryOverBRoute = testsNestedScrollCarryOverBRouteImport.update({
+ id: '/(tests)/nested-scroll-carry-over-b',
+ path: '/nested-scroll-carry-over-b',
+ getParentRoute: () => rootRouteImport,
+} as any)
const testsNestedScrollSearchRoute = testsNestedScrollSearchRouteImport.update({
id: '/(tests)/nested-scroll-search',
path: '/nested-scroll-search',
@@ -174,61 +170,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/hash-scroll-about'
- | '/hash-scroll-repro'
- | '/issue-7687'
- | '/nested-scroll-away'
- | '/nested-scroll-carry-over-a'
- | '/nested-scroll-carry-over-b'
- | '/nested-scroll-search'
- | '/normal-page'
- | '/reset-scroll-false-a'
- | '/reset-scroll-false-b'
- | '/reset-scroll-false-c'
- | '/ssr-scroll-key'
- | '/with-loader'
- | '/with-search'
- | '/issue-7687/detail'
- | '/issue-7687/'
+ fullPaths: '/' | '/hash-scroll-about' | '/hash-scroll-repro' | '/issue-7687' | '/nested-scroll-away' | '/nested-scroll-carry-over-a' | '/nested-scroll-carry-over-b' | '/nested-scroll-search' | '/normal-page' | '/reset-scroll-false-a' | '/reset-scroll-false-b' | '/reset-scroll-false-c' | '/ssr-scroll-key' | '/with-loader' | '/with-search' | '/issue-7687/detail' | '/issue-7687/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/hash-scroll-about'
- | '/hash-scroll-repro'
- | '/nested-scroll-away'
- | '/nested-scroll-carry-over-a'
- | '/nested-scroll-carry-over-b'
- | '/nested-scroll-search'
- | '/normal-page'
- | '/reset-scroll-false-a'
- | '/reset-scroll-false-b'
- | '/reset-scroll-false-c'
- | '/ssr-scroll-key'
- | '/with-loader'
- | '/with-search'
- | '/issue-7687/detail'
- | '/issue-7687'
- id:
- | '__root__'
- | '/'
- | '/(tests)/hash-scroll-about'
- | '/(tests)/hash-scroll-repro'
- | '/(tests)/issue-7687'
- | '/(tests)/nested-scroll-away'
- | '/(tests)/nested-scroll-carry-over-a'
- | '/(tests)/nested-scroll-carry-over-b'
- | '/(tests)/nested-scroll-search'
- | '/(tests)/normal-page'
- | '/(tests)/reset-scroll-false-a'
- | '/(tests)/reset-scroll-false-b'
- | '/(tests)/reset-scroll-false-c'
- | '/(tests)/ssr-scroll-key'
- | '/(tests)/with-loader'
- | '/(tests)/with-search'
- | '/(tests)/issue-7687/detail'
- | '/(tests)/issue-7687/'
+ to: '/' | '/hash-scroll-about' | '/hash-scroll-repro' | '/nested-scroll-away' | '/nested-scroll-carry-over-a' | '/nested-scroll-carry-over-b' | '/nested-scroll-search' | '/normal-page' | '/reset-scroll-false-a' | '/reset-scroll-false-b' | '/reset-scroll-false-c' | '/ssr-scroll-key' | '/with-loader' | '/with-search' | '/issue-7687/detail' | '/issue-7687'
+ id: '__root__' | '/' | '/(tests)/hash-scroll-about' | '/(tests)/hash-scroll-repro' | '/(tests)/issue-7687' | '/(tests)/nested-scroll-away' | '/(tests)/nested-scroll-carry-over-a' | '/(tests)/nested-scroll-carry-over-b' | '/(tests)/nested-scroll-search' | '/(tests)/normal-page' | '/(tests)/reset-scroll-false-a' | '/(tests)/reset-scroll-false-b' | '/(tests)/reset-scroll-false-c' | '/(tests)/ssr-scroll-key' | '/(tests)/with-loader' | '/(tests)/with-search' | '/(tests)/issue-7687/detail' | '/(tests)/issue-7687/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -383,9 +328,7 @@ const testsIssue7687RouteChildren: testsIssue7687RouteChildren = {
testsIssue7687IndexRoute: testsIssue7687IndexRoute,
}
-const testsIssue7687RouteWithChildren = testsIssue7687Route._addFileChildren(
- testsIssue7687RouteChildren,
-)
+const testsIssue7687RouteWithChildren = testsIssue7687Route._addFileChildren(testsIssue7687RouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/selective-ssr/src/routeTree.gen.ts b/e2e/react-start/selective-ssr/src/routeTree.gen.ts
index 63636ce952..24ff87b869 100644
--- a/e2e/react-start/selective-ssr/src/routeTree.gen.ts
+++ b/e2e/react-start/selective-ssr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -74,29 +72,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/issue-4614'
- | '/issue-7947'
- | '/issue-7947-target'
- | '/posts'
- | '/posts/$postId'
+ fullPaths: '/' | '/issue-4614' | '/issue-7947' | '/issue-7947-target' | '/posts' | '/posts/$postId'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/issue-4614'
- | '/issue-7947'
- | '/issue-7947-target'
- | '/posts'
- | '/posts/$postId'
- id:
- | '__root__'
- | '/'
- | '/issue-4614'
- | '/issue-7947'
- | '/issue-7947-target'
- | '/posts'
- | '/posts/$postId'
+ to: '/' | '/issue-4614' | '/issue-7947' | '/issue-7947-target' | '/posts' | '/posts/$postId'
+ id: '__root__' | '/' | '/issue-4614' | '/issue-7947' | '/issue-7947-target' | '/posts' | '/posts/$postId'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/serialization-adapters/src/routeTree.gen.ts b/e2e/react-start/serialization-adapters/src/routeTree.gen.ts
index 1b21d4200b..29d39c1d49 100644
--- a/e2e/react-start/serialization-adapters/src/routeTree.gen.ts
+++ b/e2e/react-start/serialization-adapters/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -22,18 +20,16 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const ServerFunctionCustomErrorRoute =
- ServerFunctionCustomErrorRouteImport.update({
- id: '/server-function/custom-error',
- path: '/server-function/custom-error',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ServerFunctionLateRawStreamRoute =
- ServerFunctionLateRawStreamRouteImport.update({
- id: '/server-function/late-raw-stream',
- path: '/server-function/late-raw-stream',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ServerFunctionCustomErrorRoute = ServerFunctionCustomErrorRouteImport.update({
+ id: '/server-function/custom-error',
+ path: '/server-function/custom-error',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ServerFunctionLateRawStreamRoute = ServerFunctionLateRawStreamRouteImport.update({
+ id: '/server-function/late-raw-stream',
+ path: '/server-function/late-raw-stream',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ServerFunctionNestedRoute = ServerFunctionNestedRouteImport.update({
id: '/server-function/nested',
path: '/server-function/nested',
@@ -85,32 +81,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/server-function/custom-error'
- | '/server-function/late-raw-stream'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
+ fullPaths: '/' | '/server-function/custom-error' | '/server-function/late-raw-stream' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/server-function/custom-error'
- | '/server-function/late-raw-stream'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
- id:
- | '__root__'
- | '/'
- | '/server-function/custom-error'
- | '/server-function/late-raw-stream'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
+ to: '/' | '/server-function/custom-error' | '/server-function/late-raw-stream' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
+ id: '__root__' | '/' | '/server-function/custom-error' | '/server-function/late-raw-stream' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts b/e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts
index e909a808f2..384e171144 100644
--- a/e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts
+++ b/e2e/react-start/server-functions-global-middleware/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -74,29 +72,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/context-collision'
- | '/multiple-server-functions'
- | '/pathname-middleware'
- | '/send-context-contract'
- | '/simple'
+ fullPaths: '/' | '/context-collision' | '/multiple-server-functions' | '/pathname-middleware' | '/send-context-contract' | '/simple'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/context-collision'
- | '/multiple-server-functions'
- | '/pathname-middleware'
- | '/send-context-contract'
- | '/simple'
- id:
- | '__root__'
- | '/'
- | '/context-collision'
- | '/multiple-server-functions'
- | '/pathname-middleware'
- | '/send-context-contract'
- | '/simple'
+ to: '/' | '/context-collision' | '/multiple-server-functions' | '/pathname-middleware' | '/send-context-contract' | '/simple'
+ id: '__root__' | '/' | '/context-collision' | '/multiple-server-functions' | '/pathname-middleware' | '/send-context-contract' | '/simple'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/server-functions/package.json b/e2e/react-start/server-functions/package.json
index 63d8661717..0fe7507b78 100644
--- a/e2e/react-start/server-functions/package.json
+++ b/e2e/react-start/server-functions/package.json
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
diff --git a/e2e/react-start/server-functions/src/routeTree.gen.ts b/e2e/react-start/server-functions/src/routeTree.gen.ts
index 459d8fd595..4ec5fa9cce 100644
--- a/e2e/react-start/server-functions/src/routeTree.gen.ts
+++ b/e2e/react-start/server-functions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -194,53 +192,46 @@ const MiddlewareIndexRoute = MiddlewareIndexRouteImport.update({
path: '/middleware/',
getParentRoute: () => rootRouteImport,
} as any)
-const MiddlewareCatchHandlerErrorRoute =
- MiddlewareCatchHandlerErrorRouteImport.update({
- id: '/middleware/catch-handler-error',
- path: '/middleware/catch-handler-error',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareClientMiddlewareRouterRoute =
- MiddlewareClientMiddlewareRouterRouteImport.update({
- id: '/middleware/client-middleware-router',
- path: '/middleware/client-middleware-router',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareFunctionMetadataRoute =
- MiddlewareFunctionMetadataRouteImport.update({
- id: '/middleware/function-metadata',
- path: '/middleware/function-metadata',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareMiddlewareFactoryRoute =
- MiddlewareMiddlewareFactoryRouteImport.update({
- id: '/middleware/middleware-factory',
- path: '/middleware/middleware-factory',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareRequestMiddlewareRoute =
- MiddlewareRequestMiddlewareRouteImport.update({
- id: '/middleware/request-middleware',
- path: '/middleware/request-middleware',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MiddlewareCatchHandlerErrorRoute = MiddlewareCatchHandlerErrorRouteImport.update({
+ id: '/middleware/catch-handler-error',
+ path: '/middleware/catch-handler-error',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareClientMiddlewareRouterRoute = MiddlewareClientMiddlewareRouterRouteImport.update({
+ id: '/middleware/client-middleware-router',
+ path: '/middleware/client-middleware-router',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareFunctionMetadataRoute = MiddlewareFunctionMetadataRouteImport.update({
+ id: '/middleware/function-metadata',
+ path: '/middleware/function-metadata',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareMiddlewareFactoryRoute = MiddlewareMiddlewareFactoryRouteImport.update({
+ id: '/middleware/middleware-factory',
+ path: '/middleware/middleware-factory',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareRequestMiddlewareRoute = MiddlewareRequestMiddlewareRouteImport.update({
+ id: '/middleware/request-middleware',
+ path: '/middleware/request-middleware',
+ getParentRoute: () => rootRouteImport,
+} as any)
const MiddlewareSendServerFnRoute = MiddlewareSendServerFnRouteImport.update({
id: '/middleware/send-serverFn',
path: '/middleware/send-serverFn',
getParentRoute: () => rootRouteImport,
} as any)
-const MiddlewareServerImportMiddlewareRoute =
- MiddlewareServerImportMiddlewareRouteImport.update({
- id: '/middleware/server-import-middleware',
- path: '/middleware/server-import-middleware',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareUnhandledExceptionRoute =
- MiddlewareUnhandledExceptionRouteImport.update({
- id: '/middleware/unhandled-exception',
- path: '/middleware/unhandled-exception',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MiddlewareServerImportMiddlewareRoute = MiddlewareServerImportMiddlewareRouteImport.update({
+ id: '/middleware/server-import-middleware',
+ path: '/middleware/server-import-middleware',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareUnhandledExceptionRoute = MiddlewareUnhandledExceptionRouteImport.update({
+ id: '/middleware/unhandled-exception',
+ path: '/middleware/unhandled-exception',
+ getParentRoute: () => rootRouteImport,
+} as any)
const PrimitivesIndexRoute = PrimitivesIndexRouteImport.update({
id: '/primitives/',
path: '/primitives/',
@@ -266,24 +257,21 @@ const RedirectTestTargetRoute = RedirectTestTargetRouteImport.update({
path: '/redirect-test/target',
getParentRoute: () => rootRouteImport,
} as any)
-const FormdataRedirectTargetNameRoute =
- FormdataRedirectTargetNameRouteImport.update({
- id: '/formdata-redirect/target/$name',
- path: '/formdata-redirect/target/$name',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareRedirectWithMiddlewareIndexRoute =
- MiddlewareRedirectWithMiddlewareIndexRouteImport.update({
- id: '/middleware/redirect-with-middleware/',
- path: '/middleware/redirect-with-middleware/',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareRedirectWithMiddlewareTargetRoute =
- MiddlewareRedirectWithMiddlewareTargetRouteImport.update({
- id: '/middleware/redirect-with-middleware/target',
- path: '/middleware/redirect-with-middleware/target',
- getParentRoute: () => rootRouteImport,
- } as any)
+const FormdataRedirectTargetNameRoute = FormdataRedirectTargetNameRouteImport.update({
+ id: '/formdata-redirect/target/$name',
+ path: '/formdata-redirect/target/$name',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareRedirectWithMiddlewareIndexRoute = MiddlewareRedirectWithMiddlewareIndexRouteImport.update({
+ id: '/middleware/redirect-with-middleware/',
+ path: '/middleware/redirect-with-middleware/',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareRedirectWithMiddlewareTargetRoute = MiddlewareRedirectWithMiddlewareTargetRouteImport.update({
+ id: '/middleware/redirect-with-middleware/target',
+ path: '/middleware/redirect-with-middleware/target',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -426,143 +414,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/async-validation'
- | '/consistent'
- | '/custom-fetch'
- | '/dead-code-preserve'
- | '/env-only'
- | '/formdata-context'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/server-fn-in-client-only-fn'
- | '/server-only-fn'
- | '/status'
- | '/submit-post-formdata'
- | '/abort-signal/$method'
- | '/cookies/set'
- | '/method-not-allowed/$method'
- | '/middleware/catch-handler-error'
- | '/middleware/client-middleware-router'
- | '/middleware/function-metadata'
- | '/middleware/middleware-factory'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/middleware/server-import-middleware'
- | '/middleware/unhandled-exception'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/abort-signal/'
- | '/cookies/'
- | '/factory/'
- | '/formdata-redirect/'
- | '/function-metadata/'
- | '/function-method/'
- | '/method-not-allowed/'
- | '/middleware/'
- | '/primitives/'
- | '/redirect-test-ssr/'
- | '/redirect-test/'
- | '/formdata-redirect/target/$name'
- | '/middleware/redirect-with-middleware/target'
- | '/middleware/redirect-with-middleware/'
+ fullPaths: '/' | '/async-validation' | '/consistent' | '/custom-fetch' | '/dead-code-preserve' | '/env-only' | '/formdata-context' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/server-fn-in-client-only-fn' | '/server-only-fn' | '/status' | '/submit-post-formdata' | '/abort-signal/$method' | '/cookies/set' | '/method-not-allowed/$method' | '/middleware/catch-handler-error' | '/middleware/client-middleware-router' | '/middleware/function-metadata' | '/middleware/middleware-factory' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/middleware/server-import-middleware' | '/middleware/unhandled-exception' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/abort-signal/' | '/cookies/' | '/factory/' | '/formdata-redirect/' | '/function-metadata/' | '/function-method/' | '/method-not-allowed/' | '/middleware/' | '/primitives/' | '/redirect-test-ssr/' | '/redirect-test/' | '/formdata-redirect/target/$name' | '/middleware/redirect-with-middleware/target' | '/middleware/redirect-with-middleware/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/async-validation'
- | '/consistent'
- | '/custom-fetch'
- | '/dead-code-preserve'
- | '/env-only'
- | '/formdata-context'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/server-fn-in-client-only-fn'
- | '/server-only-fn'
- | '/status'
- | '/submit-post-formdata'
- | '/abort-signal/$method'
- | '/cookies/set'
- | '/method-not-allowed/$method'
- | '/middleware/catch-handler-error'
- | '/middleware/client-middleware-router'
- | '/middleware/function-metadata'
- | '/middleware/middleware-factory'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/middleware/server-import-middleware'
- | '/middleware/unhandled-exception'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/abort-signal'
- | '/cookies'
- | '/factory'
- | '/formdata-redirect'
- | '/function-metadata'
- | '/function-method'
- | '/method-not-allowed'
- | '/middleware'
- | '/primitives'
- | '/redirect-test-ssr'
- | '/redirect-test'
- | '/formdata-redirect/target/$name'
- | '/middleware/redirect-with-middleware/target'
- | '/middleware/redirect-with-middleware'
- id:
- | '__root__'
- | '/'
- | '/async-validation'
- | '/consistent'
- | '/custom-fetch'
- | '/dead-code-preserve'
- | '/env-only'
- | '/formdata-context'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/server-fn-in-client-only-fn'
- | '/server-only-fn'
- | '/status'
- | '/submit-post-formdata'
- | '/abort-signal/$method'
- | '/cookies/set'
- | '/method-not-allowed/$method'
- | '/middleware/catch-handler-error'
- | '/middleware/client-middleware-router'
- | '/middleware/function-metadata'
- | '/middleware/middleware-factory'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/middleware/server-import-middleware'
- | '/middleware/unhandled-exception'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/abort-signal/'
- | '/cookies/'
- | '/factory/'
- | '/formdata-redirect/'
- | '/function-metadata/'
- | '/function-method/'
- | '/method-not-allowed/'
- | '/middleware/'
- | '/primitives/'
- | '/redirect-test-ssr/'
- | '/redirect-test/'
- | '/formdata-redirect/target/$name'
- | '/middleware/redirect-with-middleware/target'
- | '/middleware/redirect-with-middleware/'
+ to: '/' | '/async-validation' | '/consistent' | '/custom-fetch' | '/dead-code-preserve' | '/env-only' | '/formdata-context' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/server-fn-in-client-only-fn' | '/server-only-fn' | '/status' | '/submit-post-formdata' | '/abort-signal/$method' | '/cookies/set' | '/method-not-allowed/$method' | '/middleware/catch-handler-error' | '/middleware/client-middleware-router' | '/middleware/function-metadata' | '/middleware/middleware-factory' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/middleware/server-import-middleware' | '/middleware/unhandled-exception' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/abort-signal' | '/cookies' | '/factory' | '/formdata-redirect' | '/function-metadata' | '/function-method' | '/method-not-allowed' | '/middleware' | '/primitives' | '/redirect-test-ssr' | '/redirect-test' | '/formdata-redirect/target/$name' | '/middleware/redirect-with-middleware/target' | '/middleware/redirect-with-middleware'
+ id: '__root__' | '/' | '/async-validation' | '/consistent' | '/custom-fetch' | '/dead-code-preserve' | '/env-only' | '/formdata-context' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/server-fn-in-client-only-fn' | '/server-only-fn' | '/status' | '/submit-post-formdata' | '/abort-signal/$method' | '/cookies/set' | '/method-not-allowed/$method' | '/middleware/catch-handler-error' | '/middleware/client-middleware-router' | '/middleware/function-metadata' | '/middleware/middleware-factory' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/middleware/server-import-middleware' | '/middleware/unhandled-exception' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/abort-signal/' | '/cookies/' | '/factory/' | '/formdata-redirect/' | '/function-metadata/' | '/function-method/' | '/method-not-allowed/' | '/middleware/' | '/primitives/' | '/redirect-test-ssr/' | '/redirect-test/' | '/formdata-redirect/target/$name' | '/middleware/redirect-with-middleware/target' | '/middleware/redirect-with-middleware/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -968,10 +823,8 @@ const rootRouteChildren: RootRouteChildren = {
RedirectTestSsrIndexRoute: RedirectTestSsrIndexRoute,
RedirectTestIndexRoute: RedirectTestIndexRoute,
FormdataRedirectTargetNameRoute: FormdataRedirectTargetNameRoute,
- MiddlewareRedirectWithMiddlewareTargetRoute:
- MiddlewareRedirectWithMiddlewareTargetRoute,
- MiddlewareRedirectWithMiddlewareIndexRoute:
- MiddlewareRedirectWithMiddlewareIndexRoute,
+ MiddlewareRedirectWithMiddlewareTargetRoute: MiddlewareRedirectWithMiddlewareTargetRoute,
+ MiddlewareRedirectWithMiddlewareIndexRoute: MiddlewareRedirectWithMiddlewareIndexRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
diff --git a/e2e/react-start/server-functions/start-mode-config.ts b/e2e/react-start/server-functions/start-mode-config.ts
index ba75b59693..abf46563ba 100644
--- a/e2e/react-start/server-functions/start-mode-config.ts
+++ b/e2e/react-start/server-functions/start-mode-config.ts
@@ -1,9 +1,9 @@
const FUNCTION_IDS: Record> = {
'src/routes/submit-post-formdata.tsx': {
- greetUser_createServerFn_handler: 'submit-post-formdata-greetUser',
+ greetUser: 'submit-post-formdata-greetUser',
},
'src/routes/formdata-redirect/index.tsx': {
- greetUser_createServerFn_handler: 'formdata-redirect-greetUser',
+ greetUser: 'formdata-redirect-greetUser',
},
}
diff --git a/e2e/react-start/server-routes-global-middleware/src/routeTree.gen.ts b/e2e/react-start/server-routes-global-middleware/src/routeTree.gen.ts
index 3221c03ad6..63243fb3e5 100644
--- a/e2e/react-start/server-routes-global-middleware/src/routeTree.gen.ts
+++ b/e2e/react-start/server-routes-global-middleware/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -17,12 +15,11 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const ServerRouteWithMiddlewareRoute =
- ServerRouteWithMiddlewareRouteImport.update({
- id: '/server-route-with-middleware',
- path: '/server-route-with-middleware',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ServerRouteWithMiddlewareRoute = ServerRouteWithMiddlewareRouteImport.update({
+ id: '/server-route-with-middleware',
+ path: '/server-route-with-middleware',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
diff --git a/e2e/react-start/server-routes/src/routeTree.gen.ts b/e2e/react-start/server-routes/src/routeTree.gen.ts
index 7ae1e4f551..59aad23808 100644
--- a/e2e/react-start/server-routes/src/routeTree.gen.ts
+++ b/e2e/react-start/server-routes/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -89,12 +87,11 @@ const ApiParamsFooBarRoute = ApiParamsFooBarRouteImport.update({
path: '/$bar',
getParentRoute: () => ApiParamsFooRouteRoute,
} as any)
-const ApiParsedParamsIdChildIdRoute =
- ApiParsedParamsIdChildIdRouteImport.update({
- id: '/$childId',
- path: '/$childId',
- getParentRoute: () => ApiParsedParamsIdRoute,
- } as any)
+const ApiParsedParamsIdChildIdRoute = ApiParsedParamsIdChildIdRouteImport.update({
+ id: '/$childId',
+ path: '/$childId',
+ getParentRoute: () => ApiParsedParamsIdRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -146,52 +143,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/methods'
- | '/merge-middleware-context'
- | '/api/get-and-any'
- | '/api/head-fallback'
- | '/api/head-redirect-fallback'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods/'
- | '/api/params/$foo'
- | '/api/parsed-params/$id'
- | '/api/params/$foo/$bar'
- | '/api/parsed-params/$id/$childId'
+ fullPaths: '/' | '/methods' | '/merge-middleware-context' | '/api/get-and-any' | '/api/head-fallback' | '/api/head-redirect-fallback' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods/' | '/api/params/$foo' | '/api/parsed-params/$id' | '/api/params/$foo/$bar' | '/api/parsed-params/$id/$childId'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/merge-middleware-context'
- | '/api/get-and-any'
- | '/api/head-fallback'
- | '/api/head-redirect-fallback'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods'
- | '/api/params/$foo'
- | '/api/parsed-params/$id'
- | '/api/params/$foo/$bar'
- | '/api/parsed-params/$id/$childId'
- id:
- | '__root__'
- | '/'
- | '/methods'
- | '/merge-middleware-context'
- | '/api/get-and-any'
- | '/api/head-fallback'
- | '/api/head-redirect-fallback'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods/'
- | '/api/params/$foo'
- | '/api/parsed-params/$id'
- | '/api/params/$foo/$bar'
- | '/api/parsed-params/$id/$childId'
+ to: '/' | '/merge-middleware-context' | '/api/get-and-any' | '/api/head-fallback' | '/api/head-redirect-fallback' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods' | '/api/params/$foo' | '/api/parsed-params/$id' | '/api/params/$foo/$bar' | '/api/parsed-params/$id/$childId'
+ id: '__root__' | '/' | '/methods' | '/merge-middleware-context' | '/api/get-and-any' | '/api/head-fallback' | '/api/head-redirect-fallback' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods/' | '/api/params/$foo' | '/api/parsed-params/$id' | '/api/params/$foo/$bar' | '/api/parsed-params/$id/$childId'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -320,9 +275,7 @@ const MethodsRouteRouteChildren: MethodsRouteRouteChildren = {
MethodsIndexRoute: MethodsIndexRoute,
}
-const MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(
- MethodsRouteRouteChildren,
-)
+const MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(MethodsRouteRouteChildren)
interface ApiParamsFooRouteRouteChildren {
ApiParamsFooBarRoute: typeof ApiParamsFooBarRoute
@@ -332,8 +285,7 @@ const ApiParamsFooRouteRouteChildren: ApiParamsFooRouteRouteChildren = {
ApiParamsFooBarRoute: ApiParamsFooBarRoute,
}
-const ApiParamsFooRouteRouteWithChildren =
- ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)
+const ApiParamsFooRouteRouteWithChildren = ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)
interface ApiParsedParamsIdRouteChildren {
ApiParsedParamsIdChildIdRoute: typeof ApiParsedParamsIdChildIdRoute
@@ -343,8 +295,7 @@ const ApiParsedParamsIdRouteChildren: ApiParsedParamsIdRouteChildren = {
ApiParsedParamsIdChildIdRoute: ApiParsedParamsIdChildIdRoute,
}
-const ApiParsedParamsIdRouteWithChildren =
- ApiParsedParamsIdRoute._addFileChildren(ApiParsedParamsIdRouteChildren)
+const ApiParsedParamsIdRouteWithChildren = ApiParsedParamsIdRoute._addFileChildren(ApiParsedParamsIdRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/react-start/session-handling/package.json b/e2e/react-start/session-handling/package.json
index 9dda8b2843..0fd5adb908 100644
--- a/e2e/react-start/session-handling/package.json
+++ b/e2e/react-start/session-handling/package.json
@@ -27,7 +27,7 @@
},
"devDependencies": {
"@playwright/test": "^1.57.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.0.8",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "25.0.9",
diff --git a/e2e/react-start/session-handling/src/routeTree.gen.ts b/e2e/react-start/session-handling/src/routeTree.gen.ts
index 5ecad97ab4..dbbf144ec1 100644
--- a/e2e/react-start/session-handling/src/routeTree.gen.ts
+++ b/e2e/react-start/session-handling/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -146,53 +144,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/server-functions'
- | '/ssr'
- | '/api/session'
- | '/api/session-clear'
- | '/api/session-flash'
- | '/api/session-helper-cookie'
- | '/api/session-hono'
- | '/api/session-hono-community'
- | '/api/session-hono-cookie'
- | '/api/session-iron'
- | '/api/session-middleware'
- | '/api/session-named'
- | '/api/session-redirect'
+ fullPaths: '/' | '/server-functions' | '/ssr' | '/api/session' | '/api/session-clear' | '/api/session-flash' | '/api/session-helper-cookie' | '/api/session-hono' | '/api/session-hono-community' | '/api/session-hono-cookie' | '/api/session-iron' | '/api/session-middleware' | '/api/session-named' | '/api/session-redirect'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/server-functions'
- | '/ssr'
- | '/api/session'
- | '/api/session-clear'
- | '/api/session-flash'
- | '/api/session-helper-cookie'
- | '/api/session-hono'
- | '/api/session-hono-community'
- | '/api/session-hono-cookie'
- | '/api/session-iron'
- | '/api/session-middleware'
- | '/api/session-named'
- | '/api/session-redirect'
- id:
- | '__root__'
- | '/'
- | '/server-functions'
- | '/ssr'
- | '/api/session'
- | '/api/session-clear'
- | '/api/session-flash'
- | '/api/session-helper-cookie'
- | '/api/session-hono'
- | '/api/session-hono-community'
- | '/api/session-hono-cookie'
- | '/api/session-iron'
- | '/api/session-middleware'
- | '/api/session-named'
- | '/api/session-redirect'
+ to: '/' | '/server-functions' | '/ssr' | '/api/session' | '/api/session-clear' | '/api/session-flash' | '/api/session-helper-cookie' | '/api/session-hono' | '/api/session-hono-community' | '/api/session-hono-cookie' | '/api/session-iron' | '/api/session-middleware' | '/api/session-named' | '/api/session-redirect'
+ id: '__root__' | '/' | '/server-functions' | '/ssr' | '/api/session' | '/api/session-clear' | '/api/session-flash' | '/api/session-helper-cookie' | '/api/session-hono' | '/api/session-hono-community' | '/api/session-hono-cookie' | '/api/session-iron' | '/api/session-middleware' | '/api/session-named' | '/api/session-redirect'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/spa-mode/src/routeTree.gen.ts b/e2e/react-start/spa-mode/src/routeTree.gen.ts
index 1bba3ef326..bff48a5471 100644
--- a/e2e/react-start/spa-mode/src/routeTree.gen.ts
+++ b/e2e/react-start/spa-mode/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/split-base-and-basepath/src/routeTree.gen.ts b/e2e/react-start/split-base-and-basepath/src/routeTree.gen.ts
index d89758e684..a72d733668 100644
--- a/e2e/react-start/split-base-and-basepath/src/routeTree.gen.ts
+++ b/e2e/react-start/split-base-and-basepath/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/start-manifest/src/routeTree.gen.ts b/e2e/react-start/start-manifest/src/routeTree.gen.ts
index f89a740ba6..c68b13e3b4 100644
--- a/e2e/react-start/start-manifest/src/routeTree.gen.ts
+++ b/e2e/react-start/start-manifest/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -146,53 +144,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
+ fullPaths: '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
- id:
- | '__root__'
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
+ to: '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
+ id: '__root__' | '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/static-server-functions/src/routeTree.gen.ts b/e2e/react-start/static-server-functions/src/routeTree.gen.ts
index 558b1ab4d9..75dd1e81e2 100644
--- a/e2e/react-start/static-server-functions/src/routeTree.gen.ts
+++ b/e2e/react-start/static-server-functions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/streaming-ssr/src/routeTree.gen.ts b/e2e/react-start/streaming-ssr/src/routeTree.gen.ts
index 169121003d..c56cb5eed5 100644
--- a/e2e/react-start/streaming-ssr/src/routeTree.gen.ts
+++ b/e2e/react-start/streaming-ssr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -128,47 +126,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/router-html-buffer'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
+ fullPaths: '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/router-html-buffer' | '/slow-render' | '/stream' | '/sync-only'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/router-html-buffer'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
- id:
- | '__root__'
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/router-html-buffer'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
+ to: '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/router-html-buffer' | '/slow-render' | '/stream' | '/sync-only'
+ id: '__root__' | '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/router-html-buffer' | '/slow-render' | '/stream' | '/sync-only'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/react-start/transform-asset-urls/src/routeTree.gen.ts b/e2e/react-start/transform-asset-urls/src/routeTree.gen.ts
index d89758e684..a72d733668 100644
--- a/e2e/react-start/transform-asset-urls/src/routeTree.gen.ts
+++ b/e2e/react-start/transform-asset-urls/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/react-start/virtual-routes/src/routeTree.gen.ts b/e2e/react-start/virtual-routes/src/routeTree.gen.ts
index 9addb6f078..63843b48a3 100644
--- a/e2e/react-start/virtual-routes/src/routeTree.gen.ts
+++ b/e2e/react-start/virtual-routes/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -129,44 +127,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/special|pipe'
- | '/classic/hello'
- | '/posts/'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
- | '/route-without-file/layout-a'
- | '/route-without-file/layout-b'
+ fullPaths: '/' | '/posts' | '/special|pipe' | '/classic/hello' | '/posts/' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/' | '/route-without-file/layout-a' | '/route-without-file/layout-b'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/special|pipe'
- | '/posts'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello'
- | '/route-without-file/layout-a'
- | '/route-without-file/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_first'
- | '/posts'
- | '/special|pipe'
- | '/classic/hello'
- | '/posts/'
- | '/_first/_second-layout'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
- | '/_first/_second-layout/route-without-file/layout-a'
- | '/_first/_second-layout/route-without-file/layout-b'
+ to: '/' | '/special|pipe' | '/posts' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello' | '/route-without-file/layout-a' | '/route-without-file/layout-b'
+ id: '__root__' | '/' | '/_first' | '/posts' | '/special|pipe' | '/classic/hello' | '/posts/' | '/_first/_second-layout' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/' | '/_first/_second-layout/route-without-file/layout-a' | '/_first/_second-layout/route-without-file/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -283,8 +247,7 @@ const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {
bRoute: bRoute,
}
-const layoutSecondLayoutRouteWithChildren =
- layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
+const layoutSecondLayoutRouteWithChildren = layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
interface layoutFirstLayoutRouteChildren {
layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren
@@ -294,8 +257,7 @@ const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {
layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,
}
-const layoutFirstLayoutRouteWithChildren =
- layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
+const layoutFirstLayoutRouteWithChildren = layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
interface postsPostsRouteChildren {
postsPostsHomeRoute: typeof postsPostsHomeRoute
@@ -307,9 +269,7 @@ const postsPostsRouteChildren: postsPostsRouteChildren = {
postsPostsDetailRoute: postsPostsDetailRoute,
}
-const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(
- postsPostsRouteChildren,
-)
+const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(postsPostsRouteChildren)
interface ClassicHelloRouteRouteChildren {
ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute
@@ -323,8 +283,7 @@ const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {
ClassicHelloIndexRoute: ClassicHelloIndexRoute,
}
-const ClassicHelloRouteRouteWithChildren =
- ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
+const ClassicHelloRouteRouteWithChildren = ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
homeRoute: homeRoute,
diff --git a/e2e/react-start/website/src/routeTree.gen.ts b/e2e/react-start/website/src/routeTree.gen.ts
index 03770b5ad9..17f8e9cb52 100644
--- a/e2e/react-start/website/src/routeTree.gen.ts
+++ b/e2e/react-start/website/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -45,42 +43,36 @@ const ProjectVersionDocsIndexRoute = ProjectVersionDocsIndexRouteImport.update({
path: '/$project/$version/docs/',
getParentRoute: () => rootRouteImport,
} as any)
-const LibraryProjectVersionIndexRoute =
- LibraryProjectVersionIndexRouteImport.update({
- id: '/$version/',
- path: '/$version/',
- getParentRoute: () => LibraryProjectRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkRoute =
- ProjectVersionDocsFrameworkFrameworkRouteImport.update({
- id: '/$project/$version/docs/framework/$framework',
- path: '/$project/$version/docs/framework/$framework',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkIndexRoute =
- ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkSplatRoute =
- ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({
- id: '/$',
- path: '/$',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute =
- ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRouteImport.update({
- id: '/{$}.md',
- path: '/{$}.md',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute =
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({
- id: '/examples/$',
- path: '/examples/$',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
+const LibraryProjectVersionIndexRoute = LibraryProjectVersionIndexRouteImport.update({
+ id: '/$version/',
+ path: '/$version/',
+ getParentRoute: () => LibraryProjectRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkRoute = ProjectVersionDocsFrameworkFrameworkRouteImport.update({
+ id: '/$project/$version/docs/framework/$framework',
+ path: '/$project/$version/docs/framework/$framework',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkIndexRoute = ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkSplatRoute = ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({
+ id: '/$',
+ path: '/$',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute = ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRouteImport.update({
+ id: '/{$}.md',
+ path: '/{$}.md',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute = ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({
+ id: '/examples/$',
+ path: '/examples/$',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof LibraryIndexRoute
@@ -120,40 +112,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/$project'
- | '/$project/'
- | '/$project/$version/docs/'
- | '/$project/$version/'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/{$}.md'
- | '/$project/$version/docs/framework/$framework/'
- | '/$project/$version/docs/framework/$framework/examples/$'
+ fullPaths: '/' | '/$project' | '/$project/' | '/$project/$version/docs/' | '/$project/$version/' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/{$}.md' | '/$project/$version/docs/framework/$framework/' | '/$project/$version/docs/framework/$framework/examples/$'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/$project'
- | '/'
- | '/$project/$version/docs'
- | '/$project/$version'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/{$}.md'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/examples/$'
- id:
- | '__root__'
- | '/_library'
- | '/_library/$project'
- | '/$project/'
- | '/_library/'
- | '/$project/$version/docs/'
- | '/_library/$project/$version/'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/{$}.md'
- | '/$project/$version/docs/framework/$framework/'
- | '/$project/$version/docs/framework/$framework/examples/$'
+ to: '/$project' | '/' | '/$project/$version/docs' | '/$project/$version' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/{$}.md' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/examples/$'
+ id: '__root__' | '/_library' | '/_library/$project' | '/$project/' | '/_library/' | '/$project/$version/docs/' | '/_library/$project/$version/' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/{$}.md' | '/$project/$version/docs/framework/$framework/' | '/$project/$version/docs/framework/$framework/examples/$'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -253,9 +215,7 @@ const LibraryProjectRouteChildren: LibraryProjectRouteChildren = {
LibraryProjectVersionIndexRoute: LibraryProjectVersionIndexRoute,
}
-const LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(
- LibraryProjectRouteChildren,
-)
+const LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(LibraryProjectRouteChildren)
interface LibraryRouteChildren {
LibraryProjectRoute: typeof LibraryProjectRouteWithChildren
@@ -267,8 +227,7 @@ const LibraryRouteChildren: LibraryRouteChildren = {
LibraryIndexRoute: LibraryIndexRoute,
}
-const LibraryRouteWithChildren =
- LibraryRoute._addFileChildren(LibraryRouteChildren)
+const LibraryRouteWithChildren = LibraryRoute._addFileChildren(LibraryRouteChildren)
interface ProjectVersionDocsFrameworkFrameworkRouteChildren {
ProjectVersionDocsFrameworkFrameworkSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRoute
@@ -277,29 +236,20 @@ interface ProjectVersionDocsFrameworkFrameworkRouteChildren {
ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute
}
-const ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren =
- {
- ProjectVersionDocsFrameworkFrameworkSplatRoute:
- ProjectVersionDocsFrameworkFrameworkSplatRoute,
- ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute:
- ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute,
- ProjectVersionDocsFrameworkFrameworkIndexRoute:
- ProjectVersionDocsFrameworkFrameworkIndexRoute,
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute:
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,
- }
+const ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren = {
+ ProjectVersionDocsFrameworkFrameworkSplatRoute: ProjectVersionDocsFrameworkFrameworkSplatRoute,
+ ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute: ProjectVersionDocsFrameworkFrameworkChar123Char125DotmdRoute,
+ ProjectVersionDocsFrameworkFrameworkIndexRoute: ProjectVersionDocsFrameworkFrameworkIndexRoute,
+ ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,
+}
-const ProjectVersionDocsFrameworkFrameworkRouteWithChildren =
- ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(
- ProjectVersionDocsFrameworkFrameworkRouteChildren,
- )
+const ProjectVersionDocsFrameworkFrameworkRouteWithChildren = ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(ProjectVersionDocsFrameworkFrameworkRouteChildren)
const rootRouteChildren: RootRouteChildren = {
LibraryRoute: LibraryRouteWithChildren,
ProjectIndexRoute: ProjectIndexRoute,
ProjectVersionDocsIndexRoute: ProjectVersionDocsIndexRoute,
- ProjectVersionDocsFrameworkFrameworkRoute:
- ProjectVersionDocsFrameworkFrameworkRouteWithChildren,
+ ProjectVersionDocsFrameworkFrameworkRoute: ProjectVersionDocsFrameworkFrameworkRouteWithChildren,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
diff --git a/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts b/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts
index 98df1e83d8..7c89aa1406 100644
--- a/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts
+++ b/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts
index 17076d5404..0a3ad986d9 100644
--- a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts
+++ b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -103,36 +101,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/viewport-test'
- | '/without-loader'
- | '/posts/$postId'
- | '/posts/'
- | '/layout-a'
- | '/layout-b'
+ fullPaths: '/' | '/posts' | '/viewport-test' | '/without-loader' | '/posts/$postId' | '/posts/' | '/layout-a' | '/layout-b'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/viewport-test'
- | '/without-loader'
- | '/posts/$postId'
- | '/posts'
- | '/layout-a'
- | '/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/posts'
- | '/viewport-test'
- | '/without-loader'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
+ to: '/' | '/viewport-test' | '/without-loader' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'
+ id: '__root__' | '/' | '/_layout' | '/posts' | '/viewport-test' | '/without-loader' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -228,9 +200,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -240,8 +210,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
diff --git a/e2e/solid-router/basic-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based/src/routeTree.gen.ts
index 7601b581cc..3d05bb55ca 100644
--- a/e2e/solid-router/basic-file-based/src/routeTree.gen.ts
+++ b/e2e/solid-router/basic-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -179,18 +177,16 @@ const SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({
path: '/search-params',
getParentRoute: () => rootRouteImport,
} as any)
-const Char45824Char54620Char48124Char44397RouteRoute =
- Char45824Char54620Char48124Char44397RouteRouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => rootRouteImport,
- } as any)
-const anotherGroupOnlyrouteinsideRoute =
- anotherGroupOnlyrouteinsideRouteImport.update({
- id: '/(another-group)/onlyrouteinside',
- path: '/onlyrouteinside',
- getParentRoute: () => rootRouteImport,
- } as any)
+const Char45824Char54620Char48124Char44397RouteRoute = Char45824Char54620Char48124Char44397RouteRouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport.update({
+ id: '/(another-group)/onlyrouteinside',
+ path: '/onlyrouteinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
const groupLayoutRoute = groupLayoutRouteImport.update({
id: '/(group)/_layout',
getParentRoute: () => rootRouteImport,
@@ -200,12 +196,11 @@ const groupInsideRoute = groupInsideRouteImport.update({
path: '/inside',
getParentRoute: () => rootRouteImport,
} as any)
-const groupLazyinsideRoute = groupLazyinsideRouteImport
- .update({
- id: '/(group)/lazyinside',
- path: '/lazyinside',
- getParentRoute: () => rootRouteImport,
- } as any)
+const groupLazyinsideRoute = groupLazyinsideRouteImport.update({
+ id: '/(group)/lazyinside',
+ path: '/lazyinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route))
const LayoutLayout2Route = LayoutLayout2RouteImport.update({
id: '/_layout-2',
@@ -276,12 +271,11 @@ const RelativeLinkRouteRoute = RelativeLinkRouteRouteImport.update({
path: '/relative/link',
getParentRoute: () => rootRouteImport,
} as any)
-const RelativeUseNavigateRouteRoute =
- RelativeUseNavigateRouteRouteImport.update({
- id: '/relative/useNavigate',
- path: '/relative/useNavigate',
- getParentRoute: () => rootRouteImport,
- } as any)
+const RelativeUseNavigateRouteRoute = RelativeUseNavigateRouteRouteImport.update({
+ id: '/relative/useNavigate',
+ path: '/relative/useNavigate',
+ getParentRoute: () => rootRouteImport,
+} as any)
const SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({
id: '/',
path: '/',
@@ -337,18 +331,16 @@ const NonNestedPathBazRouteRoute = NonNestedPathBazRouteRouteImport.update({
path: '/baz',
getParentRoute: () => NonNestedPathRouteRoute,
} as any)
-const NonNestedPrefixPrefixChar123bazChar125RouteRoute =
- NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({
- id: '/prefix{$baz}',
- path: '/prefix{$baz}',
- getParentRoute: () => NonNestedPrefixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixRouteRoute =
- NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({
- id: '/{$baz}suffix',
- path: '/{$baz}suffix',
- getParentRoute: () => NonNestedSuffixRouteRoute,
- } as any)
+const NonNestedPrefixPrefixChar123bazChar125RouteRoute = NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({
+ id: '/prefix{$baz}',
+ path: '/prefix{$baz}',
+ getParentRoute: () => NonNestedPrefixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixRouteRoute = NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({
+ id: '/{$baz}suffix',
+ path: '/{$baz}suffix',
+ getParentRoute: () => NonNestedSuffixRouteRoute,
+} as any)
const ParamsPsNamedIndexRoute = ParamsPsNamedIndexRouteImport.update({
id: '/params-ps/named/',
path: '/params-ps/named/',
@@ -359,24 +351,21 @@ const ParamsPsNamedFooRouteRoute = ParamsPsNamedFooRouteRouteImport.update({
path: '/params-ps/named/$foo',
getParentRoute: () => rootRouteImport,
} as any)
-const ParamsPsNamedPrefixChar123fooChar125Route =
- ParamsPsNamedPrefixChar123fooChar125RouteImport.update({
- id: '/params-ps/named/prefix{$foo}',
- path: '/params-ps/named/prefix{$foo}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsNamedChar123fooChar125suffixRoute =
- ParamsPsNamedChar123fooChar125suffixRouteImport.update({
- id: '/params-ps/named/{$foo}suffix',
- path: '/params-ps/named/{$foo}suffix',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsNonNestedFooRouteRoute =
- ParamsPsNonNestedFooRouteRouteImport.update({
- id: '/$foo_',
- path: '/$foo',
- getParentRoute: () => ParamsPsNonNestedRouteRoute,
- } as any)
+const ParamsPsNamedPrefixChar123fooChar125Route = ParamsPsNamedPrefixChar123fooChar125RouteImport.update({
+ id: '/params-ps/named/prefix{$foo}',
+ path: '/params-ps/named/prefix{$foo}',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsNamedChar123fooChar125suffixRoute = ParamsPsNamedChar123fooChar125suffixRouteImport.update({
+ id: '/params-ps/named/{$foo}suffix',
+ path: '/params-ps/named/{$foo}suffix',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsNonNestedFooRouteRoute = ParamsPsNonNestedFooRouteRouteImport.update({
+ id: '/$foo_',
+ path: '/$foo',
+ getParentRoute: () => ParamsPsNonNestedRouteRoute,
+} as any)
const ParamsPsWildcardIndexRoute = ParamsPsWildcardIndexRouteImport.update({
id: '/params-ps/wildcard/',
path: '/params-ps/wildcard/',
@@ -387,30 +376,26 @@ const ParamsPsWildcardSplatRoute = ParamsPsWildcardSplatRouteImport.update({
path: '/params-ps/wildcard/$',
getParentRoute: () => rootRouteImport,
} as any)
-const ParamsPsWildcardPrefixAtChar45824Char123Char125Route =
- ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({
- id: '/params-ps/wildcard/prefix@대{$}',
- path: '/params-ps/wildcard/prefix@대{$}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsWildcardPrefixChar123Char125Route =
- ParamsPsWildcardPrefixChar123Char125RouteImport.update({
- id: '/params-ps/wildcard/prefix{$}',
- path: '/params-ps/wildcard/prefix{$}',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsWildcardChar123Char125suffixRoute =
- ParamsPsWildcardChar123Char125suffixRouteImport.update({
- id: '/params-ps/wildcard/{$}suffix',
- path: '/params-ps/wildcard/{$}suffix',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ParamsPsWildcardChar123Char125suffixAtChar45824Route =
- ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({
- id: '/params-ps/wildcard/{$}suffix@대',
- path: '/params-ps/wildcard/{$}suffix@대',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ParamsPsWildcardPrefixAtChar45824Char123Char125Route = ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({
+ id: '/params-ps/wildcard/prefix@대{$}',
+ path: '/params-ps/wildcard/prefix@대{$}',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsWildcardPrefixChar123Char125Route = ParamsPsWildcardPrefixChar123Char125RouteImport.update({
+ id: '/params-ps/wildcard/prefix{$}',
+ path: '/params-ps/wildcard/prefix{$}',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsWildcardChar123Char125suffixRoute = ParamsPsWildcardChar123Char125suffixRouteImport.update({
+ id: '/params-ps/wildcard/{$}suffix',
+ path: '/params-ps/wildcard/{$}suffix',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ParamsPsWildcardChar123Char125suffixAtChar45824Route = ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({
+ id: '/params-ps/wildcard/{$}suffix@대',
+ path: '/params-ps/wildcard/{$}suffix@대',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ParamsSingleValueRoute = ParamsSingleValueRouteImport.update({
id: '/params/single/$value',
path: '/params/single/$value',
@@ -426,12 +411,11 @@ const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({
path: '/',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const RedirectTargetViaBeforeLoadRoute =
- RedirectTargetViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetViaBeforeLoadRoute = RedirectTargetViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
@@ -452,65 +436,56 @@ const RedirectPreloadThirdRoute = RedirectPreloadThirdRouteImport.update({
path: '/redirect/preload/third',
getParentRoute: () => rootRouteImport,
} as any)
-const RelativeLinkRelativeLinkARoute =
- RelativeLinkRelativeLinkARouteImport.update({
- id: '/relative-link-a',
- path: '/relative-link-a',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeLinkRelativeLinkBRoute =
- RelativeLinkRelativeLinkBRouteImport.update({
- id: '/relative-link-b',
- path: '/relative-link-b',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeUseNavigateRelativeUseNavigateARoute =
- RelativeUseNavigateRelativeUseNavigateARouteImport.update({
- id: '/relative-useNavigate-a',
- path: '/relative-useNavigate-a',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigateRelativeUseNavigateBRoute =
- RelativeUseNavigateRelativeUseNavigateBRouteImport.update({
- id: '/relative-useNavigate-b',
- path: '/relative-useNavigate-b',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const TransitionCountCreateResourceRoute =
- TransitionCountCreateResourceRouteImport.update({
- id: '/transition/count/create-resource',
- path: '/transition/count/create-resource',
- getParentRoute: () => rootRouteImport,
- } as any)
-const TransitionTypingCreateResourceRoute =
- TransitionTypingCreateResourceRouteImport.update({
- id: '/transition/typing/create-resource',
- path: '/transition/typing/create-resource',
- getParentRoute: () => rootRouteImport,
- } as any)
-const Char45824Char54620Char48124Char44397WildcardSplatRoute =
- Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({
- id: '/wildcard/$',
- path: '/wildcard/$',
- getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
- } as any)
-const Char45824Char54620Char48124Char44397Char55357Char56960IdRoute =
- Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({
- id: '/🚀/$id',
- path: '/🚀/$id',
- getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
- } as any)
+const RelativeLinkRelativeLinkARoute = RelativeLinkRelativeLinkARouteImport.update({
+ id: '/relative-link-a',
+ path: '/relative-link-a',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeLinkRelativeLinkBRoute = RelativeLinkRelativeLinkBRouteImport.update({
+ id: '/relative-link-b',
+ path: '/relative-link-b',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeUseNavigateRelativeUseNavigateARoute = RelativeUseNavigateRelativeUseNavigateARouteImport.update({
+ id: '/relative-useNavigate-a',
+ path: '/relative-useNavigate-a',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigateRelativeUseNavigateBRoute = RelativeUseNavigateRelativeUseNavigateBRouteImport.update({
+ id: '/relative-useNavigate-b',
+ path: '/relative-useNavigate-b',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const TransitionCountCreateResourceRoute = TransitionCountCreateResourceRouteImport.update({
+ id: '/transition/count/create-resource',
+ path: '/transition/count/create-resource',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const TransitionTypingCreateResourceRoute = TransitionTypingCreateResourceRouteImport.update({
+ id: '/transition/typing/create-resource',
+ path: '/transition/typing/create-resource',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const Char45824Char54620Char48124Char44397WildcardSplatRoute = Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({
+ id: '/wildcard/$',
+ path: '/wildcard/$',
+ getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
+} as any)
+const Char45824Char54620Char48124Char44397Char55357Char56960IdRoute = Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({
+ id: '/🚀/$id',
+ path: '/🚀/$id',
+ getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute,
+} as any)
const NonNestedDeepBazIndexRoute = NonNestedDeepBazIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => NonNestedDeepBazRouteRoute,
} as any)
-const NonNestedDeepBazBarRouteRoute =
- NonNestedDeepBazBarRouteRouteImport.update({
- id: '/$baz_/bar',
- path: '/$baz/bar',
- getParentRoute: () => NonNestedDeepRouteRoute,
- } as any)
+const NonNestedDeepBazBarRouteRoute = NonNestedDeepBazBarRouteRouteImport.update({
+ id: '/$baz_/bar',
+ path: '/$baz/bar',
+ getParentRoute: () => NonNestedDeepRouteRoute,
+} as any)
const NonNestedNamedBazIndexRoute = NonNestedNamedBazIndexRouteImport.update({
id: '/',
path: '/',
@@ -541,48 +516,41 @@ const NonNestedPathBazBarRoute = NonNestedPathBazBarRouteImport.update({
path: '/baz/bar',
getParentRoute: () => NonNestedPathRouteRoute,
} as any)
-const NonNestedPrefixPrefixChar123bazChar125IndexRoute =
- NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
- } as any)
-const NonNestedPrefixPrefixChar123bazChar125FooRoute =
- NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({
- id: '/foo',
- path: '/foo',
- getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
- } as any)
-const NonNestedPrefixPrefixChar123bazChar125BarRoute =
- NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({
- id: '/prefix{$baz}_/bar',
- path: '/prefix{$baz}/bar',
- getParentRoute: () => NonNestedPrefixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixIndexRoute =
- NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixFooRoute =
- NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({
- id: '/foo',
- path: '/foo',
- getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
- } as any)
-const NonNestedSuffixChar123bazChar125suffixBarRoute =
- NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({
- id: '/{$baz}suffix_/bar',
- path: '/{$baz}suffix/bar',
- getParentRoute: () => NonNestedSuffixRouteRoute,
- } as any)
-const ParamsPsNamedFooBarRouteRoute =
- ParamsPsNamedFooBarRouteRouteImport.update({
- id: '/$bar',
- path: '/$bar',
- getParentRoute: () => ParamsPsNamedFooRouteRoute,
- } as any)
+const NonNestedPrefixPrefixChar123bazChar125IndexRoute = NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
+} as any)
+const NonNestedPrefixPrefixChar123bazChar125FooRoute = NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({
+ id: '/foo',
+ path: '/foo',
+ getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute,
+} as any)
+const NonNestedPrefixPrefixChar123bazChar125BarRoute = NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({
+ id: '/prefix{$baz}_/bar',
+ path: '/prefix{$baz}/bar',
+ getParentRoute: () => NonNestedPrefixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixIndexRoute = NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixFooRoute = NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({
+ id: '/foo',
+ path: '/foo',
+ getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute,
+} as any)
+const NonNestedSuffixChar123bazChar125suffixBarRoute = NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({
+ id: '/{$baz}suffix_/bar',
+ path: '/{$baz}suffix/bar',
+ getParentRoute: () => NonNestedSuffixRouteRoute,
+} as any)
+const ParamsPsNamedFooBarRouteRoute = ParamsPsNamedFooBarRouteRouteImport.update({
+ id: '/$bar',
+ path: '/$bar',
+ getParentRoute: () => ParamsPsNamedFooRouteRoute,
+} as any)
const ParamsPsNonNestedFooBarRoute = ParamsPsNonNestedFooBarRouteImport.update({
id: '/$bar',
path: '/$bar',
@@ -598,42 +566,36 @@ const RelativeLinkPathIndexRoute = RelativeLinkPathIndexRouteImport.update({
path: '/path/',
getParentRoute: () => RelativeLinkRouteRoute,
} as any)
-const RelativeLinkWithSearchIndexRoute =
- RelativeLinkWithSearchIndexRouteImport.update({
- id: '/with-search/',
- path: '/with-search/',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeUseNavigateNestedIndexRoute =
- RelativeUseNavigateNestedIndexRouteImport.update({
- id: '/nested/',
- path: '/nested/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigatePathIndexRoute =
- RelativeUseNavigatePathIndexRouteImport.update({
- id: '/path/',
- path: '/path/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigateWithSearchIndexRoute =
- RelativeUseNavigateWithSearchIndexRouteImport.update({
- id: '/with-search/',
- path: '/with-search/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const NonNestedDeepBazBarIndexRoute =
- NonNestedDeepBazBarIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedDeepBazBarRouteRoute,
- } as any)
-const NonNestedDeepBazBarFooRouteRoute =
- NonNestedDeepBazBarFooRouteRouteImport.update({
- id: '/$foo',
- path: '/$foo',
- getParentRoute: () => NonNestedDeepBazBarRouteRoute,
- } as any)
+const RelativeLinkWithSearchIndexRoute = RelativeLinkWithSearchIndexRouteImport.update({
+ id: '/with-search/',
+ path: '/with-search/',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeUseNavigateNestedIndexRoute = RelativeUseNavigateNestedIndexRouteImport.update({
+ id: '/nested/',
+ path: '/nested/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigatePathIndexRoute = RelativeUseNavigatePathIndexRouteImport.update({
+ id: '/path/',
+ path: '/path/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigateWithSearchIndexRoute = RelativeUseNavigateWithSearchIndexRouteImport.update({
+ id: '/with-search/',
+ path: '/with-search/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const NonNestedDeepBazBarIndexRoute = NonNestedDeepBazBarIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedDeepBazBarRouteRoute,
+} as any)
+const NonNestedDeepBazBarFooRouteRoute = NonNestedDeepBazBarFooRouteRouteImport.update({
+ id: '/$foo',
+ path: '/$foo',
+ getParentRoute: () => NonNestedDeepBazBarRouteRoute,
+} as any)
const NonNestedDeepBazBarQuxRoute = NonNestedDeepBazBarQuxRouteImport.update({
id: '/$baz_/bar_/qux',
path: '/$baz/bar/qux',
@@ -644,42 +606,36 @@ const ParamsPsNamedFooBarBazRoute = ParamsPsNamedFooBarBazRouteImport.update({
path: '/$baz',
getParentRoute: () => ParamsPsNamedFooBarRouteRoute,
} as any)
-const RelativeLinkNestedDeepIndexRoute =
- RelativeLinkNestedDeepIndexRouteImport.update({
- id: '/nested/deep/',
- path: '/nested/deep/',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeLinkPathPathIndexRoute =
- RelativeLinkPathPathIndexRouteImport.update({
- id: '/path/$path/',
- path: '/path/$path/',
- getParentRoute: () => RelativeLinkRouteRoute,
- } as any)
-const RelativeUseNavigateNestedDeepIndexRoute =
- RelativeUseNavigateNestedDeepIndexRouteImport.update({
- id: '/nested/deep/',
- path: '/nested/deep/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const RelativeUseNavigatePathPathIndexRoute =
- RelativeUseNavigatePathPathIndexRouteImport.update({
- id: '/path/$path/',
- path: '/path/$path/',
- getParentRoute: () => RelativeUseNavigateRouteRoute,
- } as any)
-const NonNestedDeepBazBarFooIndexRoute =
- NonNestedDeepBazBarFooIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => NonNestedDeepBazBarFooRouteRoute,
- } as any)
-const NonNestedDeepBazBarFooQuxRoute =
- NonNestedDeepBazBarFooQuxRouteImport.update({
- id: '/$foo_/qux',
- path: '/$foo/qux',
- getParentRoute: () => NonNestedDeepBazBarRouteRoute,
- } as any)
+const RelativeLinkNestedDeepIndexRoute = RelativeLinkNestedDeepIndexRouteImport.update({
+ id: '/nested/deep/',
+ path: '/nested/deep/',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeLinkPathPathIndexRoute = RelativeLinkPathPathIndexRouteImport.update({
+ id: '/path/$path/',
+ path: '/path/$path/',
+ getParentRoute: () => RelativeLinkRouteRoute,
+} as any)
+const RelativeUseNavigateNestedDeepIndexRoute = RelativeUseNavigateNestedDeepIndexRouteImport.update({
+ id: '/nested/deep/',
+ path: '/nested/deep/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const RelativeUseNavigatePathPathIndexRoute = RelativeUseNavigatePathPathIndexRouteImport.update({
+ id: '/path/$path/',
+ path: '/path/$path/',
+ getParentRoute: () => RelativeUseNavigateRouteRoute,
+} as any)
+const NonNestedDeepBazBarFooIndexRoute = NonNestedDeepBazBarFooIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => NonNestedDeepBazBarFooRouteRoute,
+} as any)
+const NonNestedDeepBazBarFooQuxRoute = NonNestedDeepBazBarFooQuxRouteImport.update({
+ id: '/$foo_/qux',
+ path: '/$foo/qux',
+ getParentRoute: () => NonNestedDeepBazBarRouteRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -989,310 +945,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/non-nested'
- | '/search-params'
- | '/대한민국'
- | '/anchor'
- | '/component-types-test'
- | '/editing-a'
- | '/editing-b'
- | '/hover-preload-hash'
- | '/masks'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/non-nested/deep'
- | '/non-nested/named'
- | '/non-nested/path'
- | '/non-nested/prefix'
- | '/non-nested/suffix'
- | '/params-ps/non-nested'
- | '/relative/link'
- | '/relative/useNavigate'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/redirect/$target'
- | '/search-params/default'
- | '/params-ps/'
- | '/posts/'
- | '/redirect/'
- | '/relative/'
- | '/search-params/'
- | '/non-nested/deep/$baz'
- | '/non-nested/named/$baz'
- | '/non-nested/path/baz'
- | '/non-nested/prefix/prefix{$baz}'
- | '/non-nested/suffix/{$baz}suffix'
- | '/params-ps/named/$foo'
- | '/params-ps/non-nested/$foo'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/masks/admin/$userId'
- | '/masks/public/$username'
- | '/params-ps/named/prefix{$foo}'
- | '/params-ps/named/{$foo}suffix'
- | '/params-ps/wildcard/$'
- | '/params-ps/wildcard/prefix@대{$}'
- | '/params-ps/wildcard/prefix{$}'
- | '/params-ps/wildcard/{$}suffix'
- | '/params-ps/wildcard/{$}suffix@대'
- | '/params/single/$value'
- | '/posts/$postId/edit'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/redirect/preload/first'
- | '/redirect/preload/second'
- | '/redirect/preload/third'
- | '/relative/link/relative-link-a'
- | '/relative/link/relative-link-b'
- | '/relative/useNavigate/relative-useNavigate-a'
- | '/relative/useNavigate/relative-useNavigate-b'
- | '/transition/count/create-resource'
- | '/transition/typing/create-resource'
- | '/대한민국/wildcard/$'
- | '/대한민국/🚀/$id'
- | '/params-ps/named/'
- | '/params-ps/wildcard/'
- | '/redirect/$target/'
- | '/non-nested/deep/$baz/bar'
- | '/params-ps/named/$foo/$bar'
- | '/non-nested/named/$baz/foo'
- | '/non-nested/named/$baz/bar'
- | '/non-nested/path/baz/foo'
- | '/non-nested/path/baz/bar'
- | '/non-nested/prefix/prefix{$baz}/foo'
- | '/non-nested/prefix/prefix{$baz}/bar'
- | '/non-nested/suffix/{$baz}suffix/foo'
- | '/non-nested/suffix/{$baz}suffix/bar'
- | '/params-ps/non-nested/$foo/$bar'
- | '/non-nested/deep/$baz/'
- | '/non-nested/named/$baz/'
- | '/non-nested/path/baz/'
- | '/non-nested/prefix/prefix{$baz}/'
- | '/non-nested/suffix/{$baz}suffix/'
- | '/relative/link/nested/'
- | '/relative/link/path/'
- | '/relative/link/with-search/'
- | '/relative/useNavigate/nested/'
- | '/relative/useNavigate/path/'
- | '/relative/useNavigate/with-search/'
- | '/non-nested/deep/$baz/bar/$foo'
- | '/non-nested/deep/$baz/bar/qux'
- | '/params-ps/named/$foo/$bar/$baz'
- | '/non-nested/deep/$baz/bar/'
- | '/relative/link/nested/deep/'
- | '/relative/link/path/$path/'
- | '/relative/useNavigate/nested/deep/'
- | '/relative/useNavigate/path/$path/'
- | '/non-nested/deep/$baz/bar/$foo/qux'
- | '/non-nested/deep/$baz/bar/$foo/'
+ fullPaths: '/' | '/non-nested' | '/search-params' | '/대한민국' | '/anchor' | '/component-types-test' | '/editing-a' | '/editing-b' | '/hover-preload-hash' | '/masks' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/non-nested/deep' | '/non-nested/named' | '/non-nested/path' | '/non-nested/prefix' | '/non-nested/suffix' | '/params-ps/non-nested' | '/relative/link' | '/relative/useNavigate' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/redirect/$target' | '/search-params/default' | '/params-ps/' | '/posts/' | '/redirect/' | '/relative/' | '/search-params/' | '/non-nested/deep/$baz' | '/non-nested/named/$baz' | '/non-nested/path/baz' | '/non-nested/prefix/prefix{$baz}' | '/non-nested/suffix/{$baz}suffix' | '/params-ps/named/$foo' | '/params-ps/non-nested/$foo' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/masks/admin/$userId' | '/masks/public/$username' | '/params-ps/named/prefix{$foo}' | '/params-ps/named/{$foo}suffix' | '/params-ps/wildcard/$' | '/params-ps/wildcard/prefix@대{$}' | '/params-ps/wildcard/prefix{$}' | '/params-ps/wildcard/{$}suffix' | '/params-ps/wildcard/{$}suffix@대' | '/params/single/$value' | '/posts/$postId/edit' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/redirect/preload/first' | '/redirect/preload/second' | '/redirect/preload/third' | '/relative/link/relative-link-a' | '/relative/link/relative-link-b' | '/relative/useNavigate/relative-useNavigate-a' | '/relative/useNavigate/relative-useNavigate-b' | '/transition/count/create-resource' | '/transition/typing/create-resource' | '/대한민국/wildcard/$' | '/대한민국/🚀/$id' | '/params-ps/named/' | '/params-ps/wildcard/' | '/redirect/$target/' | '/non-nested/deep/$baz/bar' | '/params-ps/named/$foo/$bar' | '/non-nested/named/$baz/foo' | '/non-nested/named/$baz/bar' | '/non-nested/path/baz/foo' | '/non-nested/path/baz/bar' | '/non-nested/prefix/prefix{$baz}/foo' | '/non-nested/prefix/prefix{$baz}/bar' | '/non-nested/suffix/{$baz}suffix/foo' | '/non-nested/suffix/{$baz}suffix/bar' | '/params-ps/non-nested/$foo/$bar' | '/non-nested/deep/$baz/' | '/non-nested/named/$baz/' | '/non-nested/path/baz/' | '/non-nested/prefix/prefix{$baz}/' | '/non-nested/suffix/{$baz}suffix/' | '/relative/link/nested/' | '/relative/link/path/' | '/relative/link/with-search/' | '/relative/useNavigate/nested/' | '/relative/useNavigate/path/' | '/relative/useNavigate/with-search/' | '/non-nested/deep/$baz/bar/$foo' | '/non-nested/deep/$baz/bar/qux' | '/params-ps/named/$foo/$bar/$baz' | '/non-nested/deep/$baz/bar/' | '/relative/link/nested/deep/' | '/relative/link/path/$path/' | '/relative/useNavigate/nested/deep/' | '/relative/useNavigate/path/$path/' | '/non-nested/deep/$baz/bar/$foo/qux' | '/non-nested/deep/$baz/bar/$foo/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/non-nested'
- | '/대한민국'
- | '/anchor'
- | '/component-types-test'
- | '/editing-a'
- | '/editing-b'
- | '/hover-preload-hash'
- | '/masks'
- | '/notRemountDeps'
- | '/remountDeps'
- | '/non-nested/deep'
- | '/non-nested/named'
- | '/non-nested/path'
- | '/non-nested/prefix'
- | '/non-nested/suffix'
- | '/params-ps/non-nested'
- | '/relative/link'
- | '/relative/useNavigate'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/search-params/default'
- | '/params-ps'
- | '/posts'
- | '/redirect'
- | '/relative'
- | '/search-params'
- | '/params-ps/named/$foo'
- | '/params-ps/non-nested/$foo'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/masks/admin/$userId'
- | '/masks/public/$username'
- | '/params-ps/named/prefix{$foo}'
- | '/params-ps/named/{$foo}suffix'
- | '/params-ps/wildcard/$'
- | '/params-ps/wildcard/prefix@대{$}'
- | '/params-ps/wildcard/prefix{$}'
- | '/params-ps/wildcard/{$}suffix'
- | '/params-ps/wildcard/{$}suffix@대'
- | '/params/single/$value'
- | '/posts/$postId/edit'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/redirect/preload/first'
- | '/redirect/preload/second'
- | '/redirect/preload/third'
- | '/relative/link/relative-link-a'
- | '/relative/link/relative-link-b'
- | '/relative/useNavigate/relative-useNavigate-a'
- | '/relative/useNavigate/relative-useNavigate-b'
- | '/transition/count/create-resource'
- | '/transition/typing/create-resource'
- | '/대한민국/wildcard/$'
- | '/대한민국/🚀/$id'
- | '/params-ps/named'
- | '/params-ps/wildcard'
- | '/redirect/$target'
- | '/params-ps/named/$foo/$bar'
- | '/non-nested/named/$baz/foo'
- | '/non-nested/named/$baz/bar'
- | '/non-nested/path/baz/foo'
- | '/non-nested/path/baz/bar'
- | '/non-nested/prefix/prefix{$baz}/foo'
- | '/non-nested/prefix/prefix{$baz}/bar'
- | '/non-nested/suffix/{$baz}suffix/foo'
- | '/non-nested/suffix/{$baz}suffix/bar'
- | '/params-ps/non-nested/$foo/$bar'
- | '/non-nested/deep/$baz'
- | '/non-nested/named/$baz'
- | '/non-nested/path/baz'
- | '/non-nested/prefix/prefix{$baz}'
- | '/non-nested/suffix/{$baz}suffix'
- | '/relative/link/nested'
- | '/relative/link/path'
- | '/relative/link/with-search'
- | '/relative/useNavigate/nested'
- | '/relative/useNavigate/path'
- | '/relative/useNavigate/with-search'
- | '/non-nested/deep/$baz/bar/qux'
- | '/params-ps/named/$foo/$bar/$baz'
- | '/non-nested/deep/$baz/bar'
- | '/relative/link/nested/deep'
- | '/relative/link/path/$path'
- | '/relative/useNavigate/nested/deep'
- | '/relative/useNavigate/path/$path'
- | '/non-nested/deep/$baz/bar/$foo/qux'
- | '/non-nested/deep/$baz/bar/$foo'
- id:
- | '__root__'
- | '/'
- | '/non-nested'
- | '/search-params'
- | '/대한민국'
- | '/_layout'
- | '/anchor'
- | '/component-types-test'
- | '/editing-a'
- | '/editing-b'
- | '/hover-preload-hash'
- | '/masks'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/non-nested/deep'
- | '/non-nested/named'
- | '/non-nested/path'
- | '/non-nested/prefix'
- | '/non-nested/suffix'
- | '/params-ps/non-nested'
- | '/relative/link'
- | '/relative/useNavigate'
- | '/(another-group)/onlyrouteinside'
- | '/(group)/_layout'
- | '/(group)/inside'
- | '/(group)/lazyinside'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/redirect/$target'
- | '/search-params/default'
- | '/params-ps/'
- | '/posts/'
- | '/redirect/'
- | '/relative/'
- | '/search-params/'
- | '/non-nested/deep/$baz'
- | '/non-nested/named/$baz'
- | '/non-nested/path/baz'
- | '/non-nested/prefix/prefix{$baz}'
- | '/non-nested/suffix/{$baz}suffix'
- | '/params-ps/named/$foo'
- | '/params-ps/non-nested/$foo_'
- | '/(group)/_layout/insidelayout'
- | '/(group)/subfolder/inside'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/masks/admin/$userId'
- | '/masks/public/$username'
- | '/params-ps/named/prefix{$foo}'
- | '/params-ps/named/{$foo}suffix'
- | '/params-ps/wildcard/$'
- | '/params-ps/wildcard/prefix@대{$}'
- | '/params-ps/wildcard/prefix{$}'
- | '/params-ps/wildcard/{$}suffix'
- | '/params-ps/wildcard/{$}suffix@대'
- | '/params/single/$value'
- | '/posts_/$postId/edit'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/redirect/preload/first'
- | '/redirect/preload/second'
- | '/redirect/preload/third'
- | '/relative/link/relative-link-a'
- | '/relative/link/relative-link-b'
- | '/relative/useNavigate/relative-useNavigate-a'
- | '/relative/useNavigate/relative-useNavigate-b'
- | '/transition/count/create-resource'
- | '/transition/typing/create-resource'
- | '/대한민국/wildcard/$'
- | '/대한민국/🚀/$id'
- | '/params-ps/named/'
- | '/params-ps/wildcard/'
- | '/redirect/$target/'
- | '/non-nested/deep/$baz_/bar'
- | '/params-ps/named/$foo/$bar'
- | '/non-nested/named/$baz/foo'
- | '/non-nested/named/$baz_/bar'
- | '/non-nested/path/baz/foo'
- | '/non-nested/path/baz_/bar'
- | '/non-nested/prefix/prefix{$baz}/foo'
- | '/non-nested/prefix/prefix{$baz}_/bar'
- | '/non-nested/suffix/{$baz}suffix/foo'
- | '/non-nested/suffix/{$baz}suffix_/bar'
- | '/params-ps/non-nested/$foo_/$bar'
- | '/non-nested/deep/$baz/'
- | '/non-nested/named/$baz/'
- | '/non-nested/path/baz/'
- | '/non-nested/prefix/prefix{$baz}/'
- | '/non-nested/suffix/{$baz}suffix/'
- | '/relative/link/nested/'
- | '/relative/link/path/'
- | '/relative/link/with-search/'
- | '/relative/useNavigate/nested/'
- | '/relative/useNavigate/path/'
- | '/relative/useNavigate/with-search/'
- | '/non-nested/deep/$baz_/bar/$foo'
- | '/non-nested/deep/$baz_/bar_/qux'
- | '/params-ps/named/$foo/$bar/$baz'
- | '/non-nested/deep/$baz_/bar/'
- | '/relative/link/nested/deep/'
- | '/relative/link/path/$path/'
- | '/relative/useNavigate/nested/deep/'
- | '/relative/useNavigate/path/$path/'
- | '/non-nested/deep/$baz_/bar/$foo_/qux'
- | '/non-nested/deep/$baz_/bar/$foo/'
+ to: '/' | '/non-nested' | '/대한민국' | '/anchor' | '/component-types-test' | '/editing-a' | '/editing-b' | '/hover-preload-hash' | '/masks' | '/notRemountDeps' | '/remountDeps' | '/non-nested/deep' | '/non-nested/named' | '/non-nested/path' | '/non-nested/prefix' | '/non-nested/suffix' | '/params-ps/non-nested' | '/relative/link' | '/relative/useNavigate' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/search-params/default' | '/params-ps' | '/posts' | '/redirect' | '/relative' | '/search-params' | '/params-ps/named/$foo' | '/params-ps/non-nested/$foo' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/masks/admin/$userId' | '/masks/public/$username' | '/params-ps/named/prefix{$foo}' | '/params-ps/named/{$foo}suffix' | '/params-ps/wildcard/$' | '/params-ps/wildcard/prefix@대{$}' | '/params-ps/wildcard/prefix{$}' | '/params-ps/wildcard/{$}suffix' | '/params-ps/wildcard/{$}suffix@대' | '/params/single/$value' | '/posts/$postId/edit' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/redirect/preload/first' | '/redirect/preload/second' | '/redirect/preload/third' | '/relative/link/relative-link-a' | '/relative/link/relative-link-b' | '/relative/useNavigate/relative-useNavigate-a' | '/relative/useNavigate/relative-useNavigate-b' | '/transition/count/create-resource' | '/transition/typing/create-resource' | '/대한민국/wildcard/$' | '/대한민국/🚀/$id' | '/params-ps/named' | '/params-ps/wildcard' | '/redirect/$target' | '/params-ps/named/$foo/$bar' | '/non-nested/named/$baz/foo' | '/non-nested/named/$baz/bar' | '/non-nested/path/baz/foo' | '/non-nested/path/baz/bar' | '/non-nested/prefix/prefix{$baz}/foo' | '/non-nested/prefix/prefix{$baz}/bar' | '/non-nested/suffix/{$baz}suffix/foo' | '/non-nested/suffix/{$baz}suffix/bar' | '/params-ps/non-nested/$foo/$bar' | '/non-nested/deep/$baz' | '/non-nested/named/$baz' | '/non-nested/path/baz' | '/non-nested/prefix/prefix{$baz}' | '/non-nested/suffix/{$baz}suffix' | '/relative/link/nested' | '/relative/link/path' | '/relative/link/with-search' | '/relative/useNavigate/nested' | '/relative/useNavigate/path' | '/relative/useNavigate/with-search' | '/non-nested/deep/$baz/bar/qux' | '/params-ps/named/$foo/$bar/$baz' | '/non-nested/deep/$baz/bar' | '/relative/link/nested/deep' | '/relative/link/path/$path' | '/relative/useNavigate/nested/deep' | '/relative/useNavigate/path/$path' | '/non-nested/deep/$baz/bar/$foo/qux' | '/non-nested/deep/$baz/bar/$foo'
+ id: '__root__' | '/' | '/non-nested' | '/search-params' | '/대한민국' | '/_layout' | '/anchor' | '/component-types-test' | '/editing-a' | '/editing-b' | '/hover-preload-hash' | '/masks' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/non-nested/deep' | '/non-nested/named' | '/non-nested/path' | '/non-nested/prefix' | '/non-nested/suffix' | '/params-ps/non-nested' | '/relative/link' | '/relative/useNavigate' | '/(another-group)/onlyrouteinside' | '/(group)/_layout' | '/(group)/inside' | '/(group)/lazyinside' | '/_layout/_layout-2' | '/posts/$postId' | '/redirect/$target' | '/search-params/default' | '/params-ps/' | '/posts/' | '/redirect/' | '/relative/' | '/search-params/' | '/non-nested/deep/$baz' | '/non-nested/named/$baz' | '/non-nested/path/baz' | '/non-nested/prefix/prefix{$baz}' | '/non-nested/suffix/{$baz}suffix' | '/params-ps/named/$foo' | '/params-ps/non-nested/$foo_' | '/(group)/_layout/insidelayout' | '/(group)/subfolder/inside' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/masks/admin/$userId' | '/masks/public/$username' | '/params-ps/named/prefix{$foo}' | '/params-ps/named/{$foo}suffix' | '/params-ps/wildcard/$' | '/params-ps/wildcard/prefix@대{$}' | '/params-ps/wildcard/prefix{$}' | '/params-ps/wildcard/{$}suffix' | '/params-ps/wildcard/{$}suffix@대' | '/params/single/$value' | '/posts_/$postId/edit' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/redirect/preload/first' | '/redirect/preload/second' | '/redirect/preload/third' | '/relative/link/relative-link-a' | '/relative/link/relative-link-b' | '/relative/useNavigate/relative-useNavigate-a' | '/relative/useNavigate/relative-useNavigate-b' | '/transition/count/create-resource' | '/transition/typing/create-resource' | '/대한민국/wildcard/$' | '/대한민국/🚀/$id' | '/params-ps/named/' | '/params-ps/wildcard/' | '/redirect/$target/' | '/non-nested/deep/$baz_/bar' | '/params-ps/named/$foo/$bar' | '/non-nested/named/$baz/foo' | '/non-nested/named/$baz_/bar' | '/non-nested/path/baz/foo' | '/non-nested/path/baz_/bar' | '/non-nested/prefix/prefix{$baz}/foo' | '/non-nested/prefix/prefix{$baz}_/bar' | '/non-nested/suffix/{$baz}suffix/foo' | '/non-nested/suffix/{$baz}suffix_/bar' | '/params-ps/non-nested/$foo_/$bar' | '/non-nested/deep/$baz/' | '/non-nested/named/$baz/' | '/non-nested/path/baz/' | '/non-nested/prefix/prefix{$baz}/' | '/non-nested/suffix/{$baz}suffix/' | '/relative/link/nested/' | '/relative/link/path/' | '/relative/link/with-search/' | '/relative/useNavigate/nested/' | '/relative/useNavigate/path/' | '/relative/useNavigate/with-search/' | '/non-nested/deep/$baz_/bar/$foo' | '/non-nested/deep/$baz_/bar_/qux' | '/params-ps/named/$foo/$bar/$baz' | '/non-nested/deep/$baz_/bar/' | '/relative/link/nested/deep/' | '/relative/link/path/$path/' | '/relative/useNavigate/nested/deep/' | '/relative/useNavigate/path/$path/' | '/non-nested/deep/$baz_/bar/$foo_/qux' | '/non-nested/deep/$baz_/bar/$foo/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -2089,24 +1745,17 @@ const NonNestedDeepBazRouteRouteChildren: NonNestedDeepBazRouteRouteChildren = {
NonNestedDeepBazIndexRoute: NonNestedDeepBazIndexRoute,
}
-const NonNestedDeepBazRouteRouteWithChildren =
- NonNestedDeepBazRouteRoute._addFileChildren(
- NonNestedDeepBazRouteRouteChildren,
- )
+const NonNestedDeepBazRouteRouteWithChildren = NonNestedDeepBazRouteRoute._addFileChildren(NonNestedDeepBazRouteRouteChildren)
interface NonNestedDeepBazBarFooRouteRouteChildren {
NonNestedDeepBazBarFooIndexRoute: typeof NonNestedDeepBazBarFooIndexRoute
}
-const NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren =
- {
- NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute,
- }
+const NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren = {
+ NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute,
+}
-const NonNestedDeepBazBarFooRouteRouteWithChildren =
- NonNestedDeepBazBarFooRouteRoute._addFileChildren(
- NonNestedDeepBazBarFooRouteRouteChildren,
- )
+const NonNestedDeepBazBarFooRouteRouteWithChildren = NonNestedDeepBazBarFooRouteRoute._addFileChildren(NonNestedDeepBazBarFooRouteRouteChildren)
interface NonNestedDeepBazBarRouteRouteChildren {
NonNestedDeepBazBarFooRouteRoute: typeof NonNestedDeepBazBarFooRouteRouteWithChildren
@@ -2114,18 +1763,13 @@ interface NonNestedDeepBazBarRouteRouteChildren {
NonNestedDeepBazBarFooQuxRoute: typeof NonNestedDeepBazBarFooQuxRoute
}
-const NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren =
- {
- NonNestedDeepBazBarFooRouteRoute:
- NonNestedDeepBazBarFooRouteRouteWithChildren,
- NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute,
- NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute,
- }
+const NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren = {
+ NonNestedDeepBazBarFooRouteRoute: NonNestedDeepBazBarFooRouteRouteWithChildren,
+ NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute,
+ NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute,
+}
-const NonNestedDeepBazBarRouteRouteWithChildren =
- NonNestedDeepBazBarRouteRoute._addFileChildren(
- NonNestedDeepBazBarRouteRouteChildren,
- )
+const NonNestedDeepBazBarRouteRouteWithChildren = NonNestedDeepBazBarRouteRoute._addFileChildren(NonNestedDeepBazBarRouteRouteChildren)
interface NonNestedDeepRouteRouteChildren {
NonNestedDeepBazRouteRoute: typeof NonNestedDeepBazRouteRouteWithChildren
@@ -2139,24 +1783,19 @@ const NonNestedDeepRouteRouteChildren: NonNestedDeepRouteRouteChildren = {
NonNestedDeepBazBarQuxRoute: NonNestedDeepBazBarQuxRoute,
}
-const NonNestedDeepRouteRouteWithChildren =
- NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren)
+const NonNestedDeepRouteRouteWithChildren = NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren)
interface NonNestedNamedBazRouteRouteChildren {
NonNestedNamedBazFooRoute: typeof NonNestedNamedBazFooRoute
NonNestedNamedBazIndexRoute: typeof NonNestedNamedBazIndexRoute
}
-const NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren =
- {
- NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute,
- NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute,
- }
+const NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren = {
+ NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute,
+ NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute,
+}
-const NonNestedNamedBazRouteRouteWithChildren =
- NonNestedNamedBazRouteRoute._addFileChildren(
- NonNestedNamedBazRouteRouteChildren,
- )
+const NonNestedNamedBazRouteRouteWithChildren = NonNestedNamedBazRouteRoute._addFileChildren(NonNestedNamedBazRouteRouteChildren)
interface NonNestedNamedRouteRouteChildren {
NonNestedNamedBazRouteRoute: typeof NonNestedNamedBazRouteRouteWithChildren
@@ -2168,8 +1807,7 @@ const NonNestedNamedRouteRouteChildren: NonNestedNamedRouteRouteChildren = {
NonNestedNamedBazBarRoute: NonNestedNamedBazBarRoute,
}
-const NonNestedNamedRouteRouteWithChildren =
- NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren)
+const NonNestedNamedRouteRouteWithChildren = NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren)
interface NonNestedPathBazRouteRouteChildren {
NonNestedPathBazFooRoute: typeof NonNestedPathBazFooRoute
@@ -2181,10 +1819,7 @@ const NonNestedPathBazRouteRouteChildren: NonNestedPathBazRouteRouteChildren = {
NonNestedPathBazIndexRoute: NonNestedPathBazIndexRoute,
}
-const NonNestedPathBazRouteRouteWithChildren =
- NonNestedPathBazRouteRoute._addFileChildren(
- NonNestedPathBazRouteRouteChildren,
- )
+const NonNestedPathBazRouteRouteWithChildren = NonNestedPathBazRouteRoute._addFileChildren(NonNestedPathBazRouteRouteChildren)
interface NonNestedPathRouteRouteChildren {
NonNestedPathBazRouteRoute: typeof NonNestedPathBazRouteRouteWithChildren
@@ -2196,26 +1831,19 @@ const NonNestedPathRouteRouteChildren: NonNestedPathRouteRouteChildren = {
NonNestedPathBazBarRoute: NonNestedPathBazBarRoute,
}
-const NonNestedPathRouteRouteWithChildren =
- NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren)
+const NonNestedPathRouteRouteWithChildren = NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren)
interface NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren {
NonNestedPrefixPrefixChar123bazChar125FooRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRoute
NonNestedPrefixPrefixChar123bazChar125IndexRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute
}
-const NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren =
- {
- NonNestedPrefixPrefixChar123bazChar125FooRoute:
- NonNestedPrefixPrefixChar123bazChar125FooRoute,
- NonNestedPrefixPrefixChar123bazChar125IndexRoute:
- NonNestedPrefixPrefixChar123bazChar125IndexRoute,
- }
+const NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren = {
+ NonNestedPrefixPrefixChar123bazChar125FooRoute: NonNestedPrefixPrefixChar123bazChar125FooRoute,
+ NonNestedPrefixPrefixChar123bazChar125IndexRoute: NonNestedPrefixPrefixChar123bazChar125IndexRoute,
+}
-const NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren =
- NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren(
- NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren,
- )
+const NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren = NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren(NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren)
interface NonNestedPrefixRouteRouteChildren {
NonNestedPrefixPrefixChar123bazChar125RouteRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren
@@ -2223,32 +1851,23 @@ interface NonNestedPrefixRouteRouteChildren {
}
const NonNestedPrefixRouteRouteChildren: NonNestedPrefixRouteRouteChildren = {
- NonNestedPrefixPrefixChar123bazChar125RouteRoute:
- NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren,
- NonNestedPrefixPrefixChar123bazChar125BarRoute:
- NonNestedPrefixPrefixChar123bazChar125BarRoute,
+ NonNestedPrefixPrefixChar123bazChar125RouteRoute: NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren,
+ NonNestedPrefixPrefixChar123bazChar125BarRoute: NonNestedPrefixPrefixChar123bazChar125BarRoute,
}
-const NonNestedPrefixRouteRouteWithChildren =
- NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren)
+const NonNestedPrefixRouteRouteWithChildren = NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren)
interface NonNestedSuffixChar123bazChar125suffixRouteRouteChildren {
NonNestedSuffixChar123bazChar125suffixFooRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRoute
NonNestedSuffixChar123bazChar125suffixIndexRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRoute
}
-const NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren =
- {
- NonNestedSuffixChar123bazChar125suffixFooRoute:
- NonNestedSuffixChar123bazChar125suffixFooRoute,
- NonNestedSuffixChar123bazChar125suffixIndexRoute:
- NonNestedSuffixChar123bazChar125suffixIndexRoute,
- }
+const NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren = {
+ NonNestedSuffixChar123bazChar125suffixFooRoute: NonNestedSuffixChar123bazChar125suffixFooRoute,
+ NonNestedSuffixChar123bazChar125suffixIndexRoute: NonNestedSuffixChar123bazChar125suffixIndexRoute,
+}
-const NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren =
- NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren(
- NonNestedSuffixChar123bazChar125suffixRouteRouteChildren,
- )
+const NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren = NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren(NonNestedSuffixChar123bazChar125suffixRouteRouteChildren)
interface NonNestedSuffixRouteRouteChildren {
NonNestedSuffixChar123bazChar125suffixRouteRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren
@@ -2256,14 +1875,11 @@ interface NonNestedSuffixRouteRouteChildren {
}
const NonNestedSuffixRouteRouteChildren: NonNestedSuffixRouteRouteChildren = {
- NonNestedSuffixChar123bazChar125suffixRouteRoute:
- NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren,
- NonNestedSuffixChar123bazChar125suffixBarRoute:
- NonNestedSuffixChar123bazChar125suffixBarRoute,
+ NonNestedSuffixChar123bazChar125suffixRouteRoute: NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren,
+ NonNestedSuffixChar123bazChar125suffixBarRoute: NonNestedSuffixChar123bazChar125suffixBarRoute,
}
-const NonNestedSuffixRouteRouteWithChildren =
- NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren)
+const NonNestedSuffixRouteRouteWithChildren = NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren)
interface NonNestedRouteRouteChildren {
NonNestedDeepRouteRoute: typeof NonNestedDeepRouteRouteWithChildren
@@ -2281,9 +1897,7 @@ const NonNestedRouteRouteChildren: NonNestedRouteRouteChildren = {
NonNestedSuffixRouteRoute: NonNestedSuffixRouteRouteWithChildren,
}
-const NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren(
- NonNestedRouteRouteChildren,
-)
+const NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren(NonNestedRouteRouteChildren)
interface SearchParamsRouteRouteChildren {
SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute
@@ -2295,26 +1909,19 @@ const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {
SearchParamsIndexRoute: SearchParamsIndexRoute,
}
-const SearchParamsRouteRouteWithChildren =
- SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
+const SearchParamsRouteRouteWithChildren = SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
interface Char45824Char54620Char48124Char44397RouteRouteChildren {
Char45824Char54620Char48124Char44397WildcardSplatRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRoute
Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute
}
-const Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren =
- {
- Char45824Char54620Char48124Char44397WildcardSplatRoute:
- Char45824Char54620Char48124Char44397WildcardSplatRoute,
- Char45824Char54620Char48124Char44397Char55357Char56960IdRoute:
- Char45824Char54620Char48124Char44397Char55357Char56960IdRoute,
- }
+const Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren = {
+ Char45824Char54620Char48124Char44397WildcardSplatRoute: Char45824Char54620Char48124Char44397WildcardSplatRoute,
+ Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: Char45824Char54620Char48124Char44397Char55357Char56960IdRoute,
+}
-const Char45824Char54620Char48124Char44397RouteRouteWithChildren =
- Char45824Char54620Char48124Char44397RouteRoute._addFileChildren(
- Char45824Char54620Char48124Char44397RouteRouteChildren,
- )
+const Char45824Char54620Char48124Char44397RouteRouteWithChildren = Char45824Char54620Char48124Char44397RouteRoute._addFileChildren(Char45824Char54620Char48124Char44397RouteRouteChildren)
interface LayoutLayout2RouteChildren {
LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute
@@ -2326,9 +1933,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -2338,8 +1943,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface MasksRouteChildren {
MasksAdminUserIdRoute: typeof MasksAdminUserIdRoute
@@ -2369,29 +1973,21 @@ interface ParamsPsNonNestedFooRouteRouteChildren {
ParamsPsNonNestedFooBarRoute: typeof ParamsPsNonNestedFooBarRoute
}
-const ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren =
- {
- ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute,
- }
+const ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren = {
+ ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute,
+}
-const ParamsPsNonNestedFooRouteRouteWithChildren =
- ParamsPsNonNestedFooRouteRoute._addFileChildren(
- ParamsPsNonNestedFooRouteRouteChildren,
- )
+const ParamsPsNonNestedFooRouteRouteWithChildren = ParamsPsNonNestedFooRouteRoute._addFileChildren(ParamsPsNonNestedFooRouteRouteChildren)
interface ParamsPsNonNestedRouteRouteChildren {
ParamsPsNonNestedFooRouteRoute: typeof ParamsPsNonNestedFooRouteRouteWithChildren
}
-const ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren =
- {
- ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren,
- }
+const ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren = {
+ ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren,
+}
-const ParamsPsNonNestedRouteRouteWithChildren =
- ParamsPsNonNestedRouteRoute._addFileChildren(
- ParamsPsNonNestedRouteRouteChildren,
- )
+const ParamsPsNonNestedRouteRouteWithChildren = ParamsPsNonNestedRouteRoute._addFileChildren(ParamsPsNonNestedRouteRouteChildren)
interface RelativeLinkRouteRouteChildren {
RelativeLinkRelativeLinkARoute: typeof RelativeLinkRelativeLinkARoute
@@ -2413,8 +2009,7 @@ const RelativeLinkRouteRouteChildren: RelativeLinkRouteRouteChildren = {
RelativeLinkPathPathIndexRoute: RelativeLinkPathPathIndexRoute,
}
-const RelativeLinkRouteRouteWithChildren =
- RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren)
+const RelativeLinkRouteRouteWithChildren = RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren)
interface RelativeUseNavigateRouteRouteChildren {
RelativeUseNavigateRelativeUseNavigateARoute: typeof RelativeUseNavigateRelativeUseNavigateARoute
@@ -2426,26 +2021,17 @@ interface RelativeUseNavigateRouteRouteChildren {
RelativeUseNavigatePathPathIndexRoute: typeof RelativeUseNavigatePathPathIndexRoute
}
-const RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren =
- {
- RelativeUseNavigateRelativeUseNavigateARoute:
- RelativeUseNavigateRelativeUseNavigateARoute,
- RelativeUseNavigateRelativeUseNavigateBRoute:
- RelativeUseNavigateRelativeUseNavigateBRoute,
- RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute,
- RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute,
- RelativeUseNavigateWithSearchIndexRoute:
- RelativeUseNavigateWithSearchIndexRoute,
- RelativeUseNavigateNestedDeepIndexRoute:
- RelativeUseNavigateNestedDeepIndexRoute,
- RelativeUseNavigatePathPathIndexRoute:
- RelativeUseNavigatePathPathIndexRoute,
- }
+const RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren = {
+ RelativeUseNavigateRelativeUseNavigateARoute: RelativeUseNavigateRelativeUseNavigateARoute,
+ RelativeUseNavigateRelativeUseNavigateBRoute: RelativeUseNavigateRelativeUseNavigateBRoute,
+ RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute,
+ RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute,
+ RelativeUseNavigateWithSearchIndexRoute: RelativeUseNavigateWithSearchIndexRoute,
+ RelativeUseNavigateNestedDeepIndexRoute: RelativeUseNavigateNestedDeepIndexRoute,
+ RelativeUseNavigatePathPathIndexRoute: RelativeUseNavigatePathPathIndexRoute,
+}
-const RelativeUseNavigateRouteRouteWithChildren =
- RelativeUseNavigateRouteRoute._addFileChildren(
- RelativeUseNavigateRouteRouteChildren,
- )
+const RelativeUseNavigateRouteRouteWithChildren = RelativeUseNavigateRouteRoute._addFileChildren(RelativeUseNavigateRouteRouteChildren)
interface groupLayoutRouteChildren {
groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute
@@ -2455,9 +2041,7 @@ const groupLayoutRouteChildren: groupLayoutRouteChildren = {
groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,
}
-const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(
- groupLayoutRouteChildren,
-)
+const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(groupLayoutRouteChildren)
interface RedirectTargetRouteChildren {
RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute
@@ -2471,23 +2055,17 @@ const RedirectTargetRouteChildren: RedirectTargetRouteChildren = {
RedirectTargetIndexRoute: RedirectTargetIndexRoute,
}
-const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(
- RedirectTargetRouteChildren,
-)
+const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(RedirectTargetRouteChildren)
interface ParamsPsNamedFooBarRouteRouteChildren {
ParamsPsNamedFooBarBazRoute: typeof ParamsPsNamedFooBarBazRoute
}
-const ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren =
- {
- ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute,
- }
+const ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren = {
+ ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute,
+}
-const ParamsPsNamedFooBarRouteRouteWithChildren =
- ParamsPsNamedFooBarRouteRoute._addFileChildren(
- ParamsPsNamedFooBarRouteRouteChildren,
- )
+const ParamsPsNamedFooBarRouteRouteWithChildren = ParamsPsNamedFooBarRouteRoute._addFileChildren(ParamsPsNamedFooBarRouteRouteChildren)
interface ParamsPsNamedFooRouteRouteChildren {
ParamsPsNamedFooBarRouteRoute: typeof ParamsPsNamedFooBarRouteRouteWithChildren
@@ -2497,17 +2075,13 @@ const ParamsPsNamedFooRouteRouteChildren: ParamsPsNamedFooRouteRouteChildren = {
ParamsPsNamedFooBarRouteRoute: ParamsPsNamedFooBarRouteRouteWithChildren,
}
-const ParamsPsNamedFooRouteRouteWithChildren =
- ParamsPsNamedFooRouteRoute._addFileChildren(
- ParamsPsNamedFooRouteRouteChildren,
- )
+const ParamsPsNamedFooRouteRouteWithChildren = ParamsPsNamedFooRouteRoute._addFileChildren(ParamsPsNamedFooRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
NonNestedRouteRoute: NonNestedRouteRouteWithChildren,
SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren,
- Char45824Char54620Char48124Char44397RouteRoute:
- Char45824Char54620Char48124Char44397RouteRouteWithChildren,
+ Char45824Char54620Char48124Char44397RouteRoute: Char45824Char54620Char48124Char44397RouteRouteWithChildren,
LayoutRoute: LayoutRouteWithChildren,
AnchorRoute: AnchorRoute,
ComponentTypesTestRoute: ComponentTypesTestRoute,
@@ -2531,19 +2105,13 @@ const rootRouteChildren: RootRouteChildren = {
RelativeIndexRoute: RelativeIndexRoute,
ParamsPsNamedFooRouteRoute: ParamsPsNamedFooRouteRouteWithChildren,
groupSubfolderInsideRoute: groupSubfolderInsideRoute,
- ParamsPsNamedPrefixChar123fooChar125Route:
- ParamsPsNamedPrefixChar123fooChar125Route,
- ParamsPsNamedChar123fooChar125suffixRoute:
- ParamsPsNamedChar123fooChar125suffixRoute,
+ ParamsPsNamedPrefixChar123fooChar125Route: ParamsPsNamedPrefixChar123fooChar125Route,
+ ParamsPsNamedChar123fooChar125suffixRoute: ParamsPsNamedChar123fooChar125suffixRoute,
ParamsPsWildcardSplatRoute: ParamsPsWildcardSplatRoute,
- ParamsPsWildcardPrefixAtChar45824Char123Char125Route:
- ParamsPsWildcardPrefixAtChar45824Char123Char125Route,
- ParamsPsWildcardPrefixChar123Char125Route:
- ParamsPsWildcardPrefixChar123Char125Route,
- ParamsPsWildcardChar123Char125suffixRoute:
- ParamsPsWildcardChar123Char125suffixRoute,
- ParamsPsWildcardChar123Char125suffixAtChar45824Route:
- ParamsPsWildcardChar123Char125suffixAtChar45824Route,
+ ParamsPsWildcardPrefixAtChar45824Char123Char125Route: ParamsPsWildcardPrefixAtChar45824Char123Char125Route,
+ ParamsPsWildcardPrefixChar123Char125Route: ParamsPsWildcardPrefixChar123Char125Route,
+ ParamsPsWildcardChar123Char125suffixRoute: ParamsPsWildcardChar123Char125suffixRoute,
+ ParamsPsWildcardChar123Char125suffixAtChar45824Route: ParamsPsWildcardChar123Char125suffixAtChar45824Route,
ParamsSingleValueRoute: ParamsSingleValueRoute,
PostsPostIdEditRoute: PostsPostIdEditRoute,
RedirectPreloadFirstRoute: RedirectPreloadFirstRoute,
diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts
index 9cc1d71391..85cf0d5b06 100644
--- a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts
+++ b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -85,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/layout-a'
- | '/layout-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/layout-a' | '/layout-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/posts'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
+ id: '__root__' | '/' | '/_layout' | '/posts' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -183,9 +166,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -195,8 +176,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
diff --git a/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts
index 0aa373b49f..e5503291fd 100644
--- a/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts
+++ b/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -120,41 +118,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/classic/hello'
- | '/posts/'
- | '/posts/$postId'
- | '/layout-a'
- | '/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
+ fullPaths: '/' | '/posts' | '/classic/hello' | '/posts/' | '/posts/$postId' | '/layout-a' | '/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/layout-a'
- | '/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello'
- id:
- | '__root__'
- | '/'
- | '/_first'
- | '/posts'
- | '/classic/hello'
- | '/posts/'
- | '/_first/_second'
- | '/posts/$postId'
- | '/_first/_second/layout-a'
- | '/_first/_second/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
+ to: '/' | '/posts' | '/posts/$postId' | '/layout-a' | '/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello'
+ id: '__root__' | '/' | '/_first' | '/posts' | '/classic/hello' | '/posts/' | '/_first/_second' | '/posts/$postId' | '/_first/_second/layout-a' | '/_first/_second/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -263,8 +230,7 @@ const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {
bRoute: bRoute,
}
-const layoutSecondLayoutRouteWithChildren =
- layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
+const layoutSecondLayoutRouteWithChildren = layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
interface layoutFirstLayoutRouteChildren {
layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren
@@ -274,8 +240,7 @@ const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {
layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,
}
-const layoutFirstLayoutRouteWithChildren =
- layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
+const layoutFirstLayoutRouteWithChildren = layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
interface postsPostsRouteChildren {
postsPostsHomeRoute: typeof postsPostsHomeRoute
@@ -287,9 +252,7 @@ const postsPostsRouteChildren: postsPostsRouteChildren = {
postsPostsDetailRoute: postsPostsDetailRoute,
}
-const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(
- postsPostsRouteChildren,
-)
+const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(postsPostsRouteChildren)
interface ClassicHelloRouteRouteChildren {
ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute
@@ -303,8 +266,7 @@ const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {
ClassicHelloIndexRoute: ClassicHelloIndexRoute,
}
-const ClassicHelloRouteRouteWithChildren =
- ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
+const ClassicHelloRouteRouteWithChildren = ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
homeRoute: homeRoute,
diff --git a/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts b/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts
index c0f9fbabe4..965ee7876c 100644
--- a/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts
+++ b/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -32,11 +30,10 @@ const PostsRouteRoute = PostsRouteRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
} as any)
-const PathlessLayoutNestedLayoutRoute =
- PathlessLayoutNestedLayoutRouteImport.update({
- id: '/_nested-layout',
- getParentRoute: () => PathlessLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRoute = PathlessLayoutNestedLayoutRouteImport.update({
+ id: '/_nested-layout',
+ getParentRoute: () => PathlessLayoutRoute,
+} as any)
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -47,18 +44,16 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
path: '/$postId',
getParentRoute: () => PostsRouteRoute,
} as any)
-const PathlessLayoutNestedLayoutRouteARoute =
- PathlessLayoutNestedLayoutRouteARouteImport.update({
- id: '/route-a',
- path: '/route-a',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
-const PathlessLayoutNestedLayoutRouteBRoute =
- PathlessLayoutNestedLayoutRouteBRouteImport.update({
- id: '/route-b',
- path: '/route-b',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRouteARoute = PathlessLayoutNestedLayoutRouteARouteImport.update({
+ id: '/route-a',
+ path: '/route-a',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
+const PathlessLayoutNestedLayoutRouteBRoute = PathlessLayoutNestedLayoutRouteBRouteImport.update({
+ id: '/route-b',
+ path: '/route-b',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -88,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/route-a'
- | '/route-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/route-a' | '/route-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/_pathlessLayout'
- | '/_pathlessLayout/_nested-layout'
- | '/posts/$postId'
- | '/posts/'
- | '/_pathlessLayout/_nested-layout/route-a'
- | '/_pathlessLayout/_nested-layout/route-b'
+ id: '__root__' | '/' | '/posts' | '/_pathlessLayout' | '/_pathlessLayout/_nested-layout' | '/posts/$postId' | '/posts/' | '/_pathlessLayout/_nested-layout/route-a' | '/_pathlessLayout/_nested-layout/route-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -186,27 +166,19 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
interface PathlessLayoutNestedLayoutRouteChildren {
PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute
PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute
}
-const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =
- {
- PathlessLayoutNestedLayoutRouteARoute:
- PathlessLayoutNestedLayoutRouteARoute,
- PathlessLayoutNestedLayoutRouteBRoute:
- PathlessLayoutNestedLayoutRouteBRoute,
- }
+const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren = {
+ PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,
+ PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,
+}
-const PathlessLayoutNestedLayoutRouteWithChildren =
- PathlessLayoutNestedLayoutRoute._addFileChildren(
- PathlessLayoutNestedLayoutRouteChildren,
- )
+const PathlessLayoutNestedLayoutRouteWithChildren = PathlessLayoutNestedLayoutRoute._addFileChildren(PathlessLayoutNestedLayoutRouteChildren)
interface PathlessLayoutRouteChildren {
PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren
@@ -216,9 +188,7 @@ const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {
PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,
}
-const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(
- PathlessLayoutRouteChildren,
-)
+const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(PathlessLayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-router/js-only-file-based/src/routeTree.gen.js b/e2e/solid-router/js-only-file-based/src/routeTree.gen.js
index 80683abb30..e6877909c0 100644
--- a/e2e/solid-router/js-only-file-based/src/routeTree.gen.js
+++ b/e2e/solid-router/js-only-file-based/src/routeTree.gen.js
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -32,11 +30,10 @@ const PostsRouteRoute = PostsRouteRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
})
-const PathlessLayoutNestedLayoutRoute =
- PathlessLayoutNestedLayoutRouteImport.update({
- id: '/_nested-layout',
- getParentRoute: () => PathlessLayoutRoute,
- })
+const PathlessLayoutNestedLayoutRoute = PathlessLayoutNestedLayoutRouteImport.update({
+ id: '/_nested-layout',
+ getParentRoute: () => PathlessLayoutRoute,
+})
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -47,49 +44,41 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
path: '/$postId',
getParentRoute: () => PostsRouteRoute,
})
-const PathlessLayoutNestedLayoutRouteARoute =
- PathlessLayoutNestedLayoutRouteARouteImport.update({
- id: '/route-a',
- path: '/route-a',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- })
-const PathlessLayoutNestedLayoutRouteBRoute =
- PathlessLayoutNestedLayoutRouteBRouteImport.update({
- id: '/route-b',
- path: '/route-b',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- })
+const PathlessLayoutNestedLayoutRouteARoute = PathlessLayoutNestedLayoutRouteARouteImport.update({
+ id: '/route-a',
+ path: '/route-a',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+})
+const PathlessLayoutNestedLayoutRouteBRoute = PathlessLayoutNestedLayoutRouteBRouteImport.update({
+ id: '/route-b',
+ path: '/route-b',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+})
const PostsRouteRouteChildren = {
PostsPostIdRoute: PostsPostIdRoute,
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
const PathlessLayoutNestedLayoutRouteChildren = {
PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,
PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,
}
-const PathlessLayoutNestedLayoutRouteWithChildren =
- PathlessLayoutNestedLayoutRoute._addFileChildren(
- PathlessLayoutNestedLayoutRouteChildren,
- )
+const PathlessLayoutNestedLayoutRouteWithChildren = PathlessLayoutNestedLayoutRoute._addFileChildren(PathlessLayoutNestedLayoutRouteChildren)
const PathlessLayoutRouteChildren = {
PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,
}
-const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(
- PathlessLayoutRouteChildren,
-)
+const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(PathlessLayoutRouteChildren)
const rootRouteChildren = {
IndexRoute: IndexRoute,
PostsRouteRoute: PostsRouteRouteWithChildren,
PathlessLayoutRoute: PathlessLayoutRouteWithChildren,
}
-export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)
+export const routeTree = rootRouteImport
+ ._addFileChildren(rootRouteChildren)
diff --git a/e2e/solid-router/rspack-basic-file-based/package.json b/e2e/solid-router/rspack-basic-file-based/package.json
index 4015f0f606..bf1902750a 100644
--- a/e2e/solid-router/rspack-basic-file-based/package.json
+++ b/e2e/solid-router/rspack-basic-file-based/package.json
@@ -17,9 +17,9 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
- "@rsbuild/plugin-solid": "^1.1.1",
+ "@rsbuild/plugin-solid": "^1.2.2",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
"@tanstack/router-plugin": "workspace:^",
diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json
index 3772d7beb1..734a3f6a39 100644
--- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json
+++ b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json
@@ -17,9 +17,9 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
- "@rsbuild/plugin-solid": "^1.1.1",
+ "@rsbuild/plugin-solid": "^1.2.2",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
"@tanstack/router-plugin": "workspace:^",
diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
index bbd53dbfe6..3f36b50659 100644
--- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
+++ b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -9,7 +7,6 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { createFileRoute } from '@tanstack/solid-router'
-
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
import { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page'
@@ -17,31 +14,25 @@ import { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/la
import { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'
import { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search'
-const testsVirtualPageLazyRouteImport = createFileRoute(
- '/(tests)/virtual-page',
-)()
+const testsVirtualPageLazyRouteImport = createFileRoute('/(tests)/virtual-page')()
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const testsLazyPageRoute = testsLazyPageRouteImport
- .update({
- id: '/(tests)/lazy-page',
- path: '/lazy-page',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsLazyPageRoute = testsLazyPageRouteImport.update({
+ id: '/(tests)/lazy-page',
+ path: '/lazy-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route))
-const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport
- .update({
- id: '/(tests)/lazy-with-loader-page',
- path: '/lazy-with-loader-page',
- getParentRoute: () => rootRouteImport,
- } as any)
- .lazy(() =>
- import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route),
- )
+const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport.update({
+ id: '/(tests)/lazy-with-loader-page',
+ path: '/lazy-with-loader-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
+ .lazy(() => import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route))
const testsNormalPageRoute = testsNormalPageRouteImport.update({
id: '/(tests)/normal-page',
path: '/normal-page',
@@ -52,12 +43,11 @@ const testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({
path: '/page-with-search',
getParentRoute: () => rootRouteImport,
} as any)
-const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport
- .update({
- id: '/(tests)/virtual-page',
- path: '/virtual-page',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport.update({
+ id: '/(tests)/virtual-page',
+ path: '/virtual-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route))
export interface FileRoutesByFullPath {
@@ -87,29 +77,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/lazy-page'
- | '/lazy-with-loader-page'
- | '/normal-page'
- | '/page-with-search'
- | '/virtual-page'
+ fullPaths: '/' | '/lazy-page' | '/lazy-with-loader-page' | '/normal-page' | '/page-with-search' | '/virtual-page'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/lazy-page'
- | '/lazy-with-loader-page'
- | '/normal-page'
- | '/page-with-search'
- | '/virtual-page'
- id:
- | '__root__'
- | '/'
- | '/(tests)/lazy-page'
- | '/(tests)/lazy-with-loader-page'
- | '/(tests)/normal-page'
- | '/(tests)/page-with-search'
- | '/(tests)/virtual-page'
+ to: '/' | '/lazy-page' | '/lazy-with-loader-page' | '/normal-page' | '/page-with-search' | '/virtual-page'
+ id: '__root__' | '/' | '/(tests)/lazy-page' | '/(tests)/lazy-with-loader-page' | '/(tests)/normal-page' | '/(tests)/page-with-search' | '/(tests)/virtual-page'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-router/view-transitions/src/routeTree.gen.ts b/e2e/solid-router/view-transitions/src/routeTree.gen.ts
index 01843027dc..5efe1899c2 100644
--- a/e2e/solid-router/view-transitions/src/routeTree.gen.ts
+++ b/e2e/solid-router/view-transitions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -73,23 +71,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/explore'
- | '/how-it-works'
- | '/posts/$postId'
- | '/posts/'
+ fullPaths: '/' | '/posts' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/explore'
- | '/how-it-works'
- | '/posts/$postId'
- | '/posts/'
+ id: '__root__' | '/' | '/posts' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -156,9 +141,7 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/basic-auth/src/routeTree.gen.ts b/e2e/solid-start/basic-auth/src/routeTree.gen.ts
index bbebb19df3..02d8287ecc 100644
--- a/e2e/solid-start/basic-auth/src/routeTree.gen.ts
+++ b/e2e/solid-start/basic-auth/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -88,26 +86,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/login'
- | '/logout'
- | '/signup'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
+ fullPaths: '/' | '/login' | '/logout' | '/signup' | '/posts' | '/posts/$postId' | '/posts/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'
- id:
- | '__root__'
- | '/'
- | '/_authed'
- | '/login'
- | '/logout'
- | '/signup'
- | '/_authed/posts'
- | '/_authed/posts/$postId'
- | '/_authed/posts/'
+ id: '__root__' | '/' | '/_authed' | '/login' | '/logout' | '/signup' | '/_authed/posts' | '/_authed/posts/$postId' | '/_authed/posts/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -189,9 +171,7 @@ const AuthedPostsRouteChildren: AuthedPostsRouteChildren = {
AuthedPostsIndexRoute: AuthedPostsIndexRoute,
}
-const AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(
- AuthedPostsRouteChildren,
-)
+const AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(AuthedPostsRouteChildren)
interface AuthedRouteChildren {
AuthedPostsRoute: typeof AuthedPostsRouteWithChildren
@@ -201,8 +181,7 @@ const AuthedRouteChildren: AuthedRouteChildren = {
AuthedPostsRoute: AuthedPostsRouteWithChildren,
}
-const AuthedRouteWithChildren =
- AuthedRoute._addFileChildren(AuthedRouteChildren)
+const AuthedRouteWithChildren = AuthedRoute._addFileChildren(AuthedRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/basic-cloudflare/src/routeTree.gen.ts b/e2e/solid-start/basic-cloudflare/src/routeTree.gen.ts
index 4e698ade2c..8ac6b7d3ea 100644
--- a/e2e/solid-start/basic-cloudflare/src/routeTree.gen.ts
+++ b/e2e/solid-start/basic-cloudflare/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-start/basic-solid-query/src/routeTree.gen.ts b/e2e/solid-start/basic-solid-query/src/routeTree.gen.ts
index a79d1a5880..b6e2a6def2 100644
--- a/e2e/solid-start/basic-solid-query/src/routeTree.gen.ts
+++ b/e2e/solid-start/basic-solid-query/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -165,56 +163,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/deferred'
- | '/posts'
- | '/suspense-transition'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts/'
- | '/users/'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- | '/transition/count/query'
+ fullPaths: '/' | '/deferred' | '/posts' | '/suspense-transition' | '/users' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts/' | '/users/' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/posts/$postId/deep' | '/transition/count/query'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/deferred'
- | '/suspense-transition'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts'
- | '/users'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- | '/transition/count/query'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/deferred'
- | '/posts'
- | '/suspense-transition'
- | '/users'
- | '/_layout/_layout-2'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts/'
- | '/users/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/api/users/$id'
- | '/posts_/$postId/deep'
- | '/transition/count/query'
+ to: '/' | '/deferred' | '/suspense-transition' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts' | '/users' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/posts/$postId/deep' | '/transition/count/query'
+ id: '__root__' | '/' | '/_layout' | '/deferred' | '/posts' | '/suspense-transition' | '/users' | '/_layout/_layout-2' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts/' | '/users/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/api/users/$id' | '/posts_/$postId/deep' | '/transition/count/query'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -363,9 +315,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -375,8 +325,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -410,9 +359,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersIdRoute: ApiUsersIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts b/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts
index 4776246e1f..cfe4b76c42 100644
--- a/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts
+++ b/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-start/basic/package.json b/e2e/solid-start/basic/package.json
index e83ed11775..b638373f7a 100644
--- a/e2e/solid-start/basic/package.json
+++ b/e2e/solid-start/basic/package.json
@@ -27,9 +27,9 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
- "@rsbuild/plugin-solid": "^1.1.1",
+ "@rsbuild/plugin-solid": "^1.2.2",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
diff --git a/e2e/solid-start/basic/src/routeTree.gen.ts b/e2e/solid-start/basic/src/routeTree.gen.ts
index 07ba58b219..dcfeb9395f 100644
--- a/e2e/solid-start/basic/src/routeTree.gen.ts
+++ b/e2e/solid-start/basic/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -154,40 +152,36 @@ const ApiUsersRoute = ApiUsersRouteImport.update({
path: '/api/users',
getParentRoute: () => rootRouteImport,
} as any)
-const MultiCookieRedirectIndexRoute =
- MultiCookieRedirectIndexRouteImport.update({
- id: '/multi-cookie-redirect/',
- path: '/multi-cookie-redirect/',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MultiCookieRedirectTargetRoute =
- MultiCookieRedirectTargetRouteImport.update({
- id: '/multi-cookie-redirect/target',
- path: '/multi-cookie-redirect/target',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MultiCookieRedirectIndexRoute = MultiCookieRedirectIndexRouteImport.update({
+ id: '/multi-cookie-redirect/',
+ path: '/multi-cookie-redirect/',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MultiCookieRedirectTargetRoute = MultiCookieRedirectTargetRouteImport.update({
+ id: '/multi-cookie-redirect/target',
+ path: '/multi-cookie-redirect/target',
+ getParentRoute: () => rootRouteImport,
+} as any)
const NotFoundIndexRoute = NotFoundIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => NotFoundRouteRoute,
} as any)
-const NotFoundParentBoundaryRouteRoute =
- NotFoundParentBoundaryRouteRouteImport.update({
- id: '/parent-boundary',
- path: '/parent-boundary',
- getParentRoute: () => NotFoundRouteRoute,
- } as any)
+const NotFoundParentBoundaryRouteRoute = NotFoundParentBoundaryRouteRouteImport.update({
+ id: '/parent-boundary',
+ path: '/parent-boundary',
+ getParentRoute: () => NotFoundRouteRoute,
+} as any)
const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({
id: '/via-beforeLoad',
path: '/via-beforeLoad',
getParentRoute: () => NotFoundRouteRoute,
} as any)
-const NotFoundViaBeforeLoadTargetRootRoute =
- NotFoundViaBeforeLoadTargetRootRouteImport.update({
- id: '/via-beforeLoad-target-root',
- path: '/via-beforeLoad-target-root',
- getParentRoute: () => NotFoundRouteRoute,
- } as any)
+const NotFoundViaBeforeLoadTargetRootRoute = NotFoundViaBeforeLoadTargetRootRouteImport.update({
+ id: '/via-beforeLoad-target-root',
+ path: '/via-beforeLoad-target-root',
+ getParentRoute: () => NotFoundRouteRoute,
+} as any)
const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
@@ -258,12 +252,11 @@ const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({
path: '/default',
getParentRoute: () => SearchParamsRouteRoute,
} as any)
-const SearchParamsLoaderThrowsRedirectRoute =
- SearchParamsLoaderThrowsRedirectRouteImport.update({
- id: '/loader-throws-redirect',
- path: '/loader-throws-redirect',
- getParentRoute: () => SearchParamsRouteRoute,
- } as any)
+const SearchParamsLoaderThrowsRedirectRoute = SearchParamsLoaderThrowsRedirectRouteImport.update({
+ id: '/loader-throws-redirect',
+ path: '/loader-throws-redirect',
+ getParentRoute: () => SearchParamsRouteRoute,
+} as any)
const SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({
id: '/$param',
path: '/$param',
@@ -274,23 +267,21 @@ const SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({
path: '/hash',
getParentRoute: () => SpecialCharsRouteRoute,
} as any)
-const SpecialCharsMalformedRouteRoute =
- SpecialCharsMalformedRouteRouteImport.update({
- id: '/malformed',
- path: '/malformed',
- getParentRoute: () => SpecialCharsRouteRoute,
- } as any)
+const SpecialCharsMalformedRouteRoute = SpecialCharsMalformedRouteRouteImport.update({
+ id: '/malformed',
+ path: '/malformed',
+ getParentRoute: () => SpecialCharsRouteRoute,
+} as any)
const SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({
id: '/search',
path: '/search',
getParentRoute: () => SpecialCharsRouteRoute,
} as any)
-const SpecialCharsChar45824Char54620Char48124Char44397Route =
- SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => SpecialCharsRouteRoute,
- } as any)
+const SpecialCharsChar45824Char54620Char48124Char44397Route = SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => SpecialCharsRouteRoute,
+} as any)
const UsersIndexRoute = UsersIndexRouteImport.update({
id: '/',
path: '/',
@@ -316,12 +307,11 @@ const ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({
path: '/$userId',
getParentRoute: () => ApiUsersRoute,
} as any)
-const NotFoundParentBoundaryViaBeforeLoadRoute =
- NotFoundParentBoundaryViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => NotFoundParentBoundaryRouteRoute,
- } as any)
+const NotFoundParentBoundaryViaBeforeLoadRoute = NotFoundParentBoundaryViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => NotFoundParentBoundaryRouteRoute,
+} as any)
const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({
id: '/posts_/$postId/deep',
path: '/posts/$postId/deep',
@@ -332,65 +322,56 @@ const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({
path: '/',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const RedirectTargetViaBeforeLoadRoute =
- RedirectTargetViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetViaBeforeLoadRoute = RedirectTargetViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const SpecialCharsMalformedParamRoute =
- SpecialCharsMalformedParamRouteImport.update({
- id: '/$param',
- path: '/$param',
- getParentRoute: () => SpecialCharsMalformedRouteRoute,
- } as any)
-const SpecialCharsMalformedSearchRoute =
- SpecialCharsMalformedSearchRouteImport.update({
- id: '/search',
- path: '/search',
- getParentRoute: () => SpecialCharsMalformedRouteRoute,
- } as any)
-const TransitionCountCreateResourceRoute =
- TransitionCountCreateResourceRouteImport.update({
- id: '/transition/count/create-resource',
- path: '/transition/count/create-resource',
- getParentRoute: () => rootRouteImport,
- } as any)
-const TransitionTypingCreateResourceRoute =
- TransitionTypingCreateResourceRouteImport.update({
- id: '/transition/typing/create-resource',
- path: '/transition/typing/create-resource',
- getParentRoute: () => rootRouteImport,
- } as any)
-const RedirectTargetServerFnIndexRoute =
- RedirectTargetServerFnIndexRouteImport.update({
- id: '/serverFn/',
- path: '/serverFn/',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaBeforeLoadRoute =
- RedirectTargetServerFnViaBeforeLoadRouteImport.update({
- id: '/serverFn/via-beforeLoad',
- path: '/serverFn/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaLoaderRoute =
- RedirectTargetServerFnViaLoaderRouteImport.update({
- id: '/serverFn/via-loader',
- path: '/serverFn/via-loader',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaUseServerFnRoute =
- RedirectTargetServerFnViaUseServerFnRouteImport.update({
- id: '/serverFn/via-useServerFn',
- path: '/serverFn/via-useServerFn',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const SpecialCharsMalformedParamRoute = SpecialCharsMalformedParamRouteImport.update({
+ id: '/$param',
+ path: '/$param',
+ getParentRoute: () => SpecialCharsMalformedRouteRoute,
+} as any)
+const SpecialCharsMalformedSearchRoute = SpecialCharsMalformedSearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => SpecialCharsMalformedRouteRoute,
+} as any)
+const TransitionCountCreateResourceRoute = TransitionCountCreateResourceRouteImport.update({
+ id: '/transition/count/create-resource',
+ path: '/transition/count/create-resource',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const TransitionTypingCreateResourceRoute = TransitionTypingCreateResourceRouteImport.update({
+ id: '/transition/typing/create-resource',
+ path: '/transition/typing/create-resource',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const RedirectTargetServerFnIndexRoute = RedirectTargetServerFnIndexRouteImport.update({
+ id: '/serverFn/',
+ path: '/serverFn/',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaBeforeLoadRoute = RedirectTargetServerFnViaBeforeLoadRouteImport.update({
+ id: '/serverFn/via-beforeLoad',
+ path: '/serverFn/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaLoaderRoute = RedirectTargetServerFnViaLoaderRouteImport.update({
+ id: '/serverFn/via-loader',
+ path: '/serverFn/via-loader',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaUseServerFnRoute = RedirectTargetServerFnViaUseServerFnRouteImport.update({
+ id: '/serverFn/via-useServerFn',
+ path: '/serverFn/via-useServerFn',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -574,184 +555,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/not-found'
- | '/search-params'
- | '/specialChars'
- | '/deferred'
- | '/deferred-without-suspense'
- | '/error-normalization'
- | '/inline-scripts'
- | '/links'
- | '/posts'
- | '/raw-stream'
- | '/scripts'
- | '/stream'
- | '/users'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/api/users'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/redirect/$target'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect/'
- | '/not-found/'
- | '/posts/'
- | '/raw-stream/'
- | '/redirect/'
- | '/search-params/'
- | '/users/'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$userId'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/transition/count/create-resource'
- | '/transition/typing/create-resource'
- | '/redirect/$target/'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn/'
+ fullPaths: '/' | '/not-found' | '/search-params' | '/specialChars' | '/deferred' | '/deferred-without-suspense' | '/error-normalization' | '/inline-scripts' | '/links' | '/posts' | '/raw-stream' | '/scripts' | '/stream' | '/users' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/api/users' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/redirect/$target' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect/' | '/not-found/' | '/posts/' | '/raw-stream/' | '/redirect/' | '/search-params/' | '/users/' | '/layout-a' | '/layout-b' | '/api/users/$userId' | '/not-found/parent-boundary/via-beforeLoad' | '/posts/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/transition/count/create-resource' | '/transition/typing/create-resource' | '/redirect/$target/' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/specialChars'
- | '/deferred'
- | '/deferred-without-suspense'
- | '/error-normalization'
- | '/inline-scripts'
- | '/links'
- | '/scripts'
- | '/stream'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/api/users'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect'
- | '/not-found'
- | '/posts'
- | '/raw-stream'
- | '/redirect'
- | '/search-params'
- | '/users'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$userId'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/transition/count/create-resource'
- | '/transition/typing/create-resource'
- | '/redirect/$target'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn'
- id:
- | '__root__'
- | '/'
- | '/not-found'
- | '/search-params'
- | '/specialChars'
- | '/_layout'
- | '/deferred'
- | '/deferred-without-suspense'
- | '/error-normalization'
- | '/inline-scripts'
- | '/links'
- | '/posts'
- | '/raw-stream'
- | '/scripts'
- | '/stream'
- | '/users'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/_layout/_layout-2'
- | '/api/users'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/redirect/$target'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect/'
- | '/not-found/'
- | '/posts/'
- | '/raw-stream/'
- | '/redirect/'
- | '/search-params/'
- | '/users/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/api/users/$userId'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts_/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/transition/count/create-resource'
- | '/transition/typing/create-resource'
- | '/redirect/$target/'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn/'
+ to: '/' | '/specialChars' | '/deferred' | '/deferred-without-suspense' | '/error-normalization' | '/inline-scripts' | '/links' | '/scripts' | '/stream' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/api/users' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect' | '/not-found' | '/posts' | '/raw-stream' | '/redirect' | '/search-params' | '/users' | '/layout-a' | '/layout-b' | '/api/users/$userId' | '/not-found/parent-boundary/via-beforeLoad' | '/posts/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/transition/count/create-resource' | '/transition/typing/create-resource' | '/redirect/$target' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn'
+ id: '__root__' | '/' | '/not-found' | '/search-params' | '/specialChars' | '/_layout' | '/deferred' | '/deferred-without-suspense' | '/error-normalization' | '/inline-scripts' | '/links' | '/posts' | '/raw-stream' | '/scripts' | '/stream' | '/users' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/_layout/_layout-2' | '/api/users' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/redirect/$target' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect/' | '/not-found/' | '/posts/' | '/raw-stream/' | '/redirect/' | '/search-params/' | '/users/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/api/users/$userId' | '/not-found/parent-boundary/via-beforeLoad' | '/posts_/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/transition/count/create-resource' | '/transition/typing/create-resource' | '/redirect/$target/' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -1216,16 +1023,11 @@ interface NotFoundParentBoundaryRouteRouteChildren {
NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute
}
-const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren =
- {
- NotFoundParentBoundaryViaBeforeLoadRoute:
- NotFoundParentBoundaryViaBeforeLoadRoute,
- }
+const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren = {
+ NotFoundParentBoundaryViaBeforeLoadRoute: NotFoundParentBoundaryViaBeforeLoadRoute,
+}
-const NotFoundParentBoundaryRouteRouteWithChildren =
- NotFoundParentBoundaryRouteRoute._addFileChildren(
- NotFoundParentBoundaryRouteRouteChildren,
- )
+const NotFoundParentBoundaryRouteRouteWithChildren = NotFoundParentBoundaryRouteRoute._addFileChildren(NotFoundParentBoundaryRouteRouteChildren)
interface NotFoundRouteRouteChildren {
NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren
@@ -1236,17 +1038,14 @@ interface NotFoundRouteRouteChildren {
}
const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {
- NotFoundParentBoundaryRouteRoute:
- NotFoundParentBoundaryRouteRouteWithChildren,
+ NotFoundParentBoundaryRouteRoute: NotFoundParentBoundaryRouteRouteWithChildren,
NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,
NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute,
NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,
NotFoundIndexRoute: NotFoundIndexRoute,
}
-const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(
- NotFoundRouteRouteChildren,
-)
+const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(NotFoundRouteRouteChildren)
interface SearchParamsRouteRouteChildren {
SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute
@@ -1260,24 +1059,19 @@ const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {
SearchParamsIndexRoute: SearchParamsIndexRoute,
}
-const SearchParamsRouteRouteWithChildren =
- SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
+const SearchParamsRouteRouteWithChildren = SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
interface SpecialCharsMalformedRouteRouteChildren {
SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute
SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute
}
-const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren =
- {
- SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,
- SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,
- }
+const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren = {
+ SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,
+ SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,
+}
-const SpecialCharsMalformedRouteRouteWithChildren =
- SpecialCharsMalformedRouteRoute._addFileChildren(
- SpecialCharsMalformedRouteRouteChildren,
- )
+const SpecialCharsMalformedRouteRouteWithChildren = SpecialCharsMalformedRouteRoute._addFileChildren(SpecialCharsMalformedRouteRouteChildren)
interface SpecialCharsRouteRouteChildren {
SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren
@@ -1292,12 +1086,10 @@ const SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = {
SpecialCharsParamRoute: SpecialCharsParamRoute,
SpecialCharsHashRoute: SpecialCharsHashRoute,
SpecialCharsSearchRoute: SpecialCharsSearchRoute,
- SpecialCharsChar45824Char54620Char48124Char44397Route:
- SpecialCharsChar45824Char54620Char48124Char44397Route,
+ SpecialCharsChar45824Char54620Char48124Char44397Route: SpecialCharsChar45824Char54620Char48124Char44397Route,
}
-const SpecialCharsRouteRouteWithChildren =
- SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)
+const SpecialCharsRouteRouteWithChildren = SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)
interface LayoutLayout2RouteChildren {
LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute
@@ -1309,9 +1101,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -1321,8 +1111,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -1356,9 +1145,7 @@ const RawStreamRouteChildren: RawStreamRouteChildren = {
RawStreamIndexRoute: RawStreamIndexRoute,
}
-const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(
- RawStreamRouteChildren,
-)
+const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(RawStreamRouteChildren)
interface UsersRouteChildren {
UsersUserIdRoute: typeof UsersUserIdRoute
@@ -1380,9 +1167,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersUserIdRoute: ApiUsersUserIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
interface RedirectTargetRouteChildren {
RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute
@@ -1398,17 +1183,13 @@ const RedirectTargetRouteChildren: RedirectTargetRouteChildren = {
RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,
RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,
RedirectTargetIndexRoute: RedirectTargetIndexRoute,
- RedirectTargetServerFnViaBeforeLoadRoute:
- RedirectTargetServerFnViaBeforeLoadRoute,
+ RedirectTargetServerFnViaBeforeLoadRoute: RedirectTargetServerFnViaBeforeLoadRoute,
RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute,
- RedirectTargetServerFnViaUseServerFnRoute:
- RedirectTargetServerFnViaUseServerFnRoute,
+ RedirectTargetServerFnViaUseServerFnRoute: RedirectTargetServerFnViaUseServerFnRoute,
RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute,
}
-const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(
- RedirectTargetRouteChildren,
-)
+const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(RedirectTargetRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/csp/src/routeTree.gen.ts b/e2e/solid-start/csp/src/routeTree.gen.ts
index 4776246e1f..cfe4b76c42 100644
--- a/e2e/solid-start/csp/src/routeTree.gen.ts
+++ b/e2e/solid-start/csp/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-start/css-modules/package.json b/e2e/solid-start/css-modules/package.json
index 107659f43c..e3812ad8f6 100644
--- a/e2e/solid-start/css-modules/package.json
+++ b/e2e/solid-start/css-modules/package.json
@@ -22,7 +22,7 @@
"@playwright/test": "^1.61.0",
"@tanstack/router-e2e-utils": "workspace:*",
"@types/node": "^22.10.2",
- "sass": "^1.97.2",
+ "sass": "^1.105.1",
"srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
diff --git a/e2e/solid-start/custom-basepath/src/routeTree.gen.ts b/e2e/solid-start/custom-basepath/src/routeTree.gen.ts
index ddc9f81ab0..2b686a311e 100644
--- a/e2e/solid-start/custom-basepath/src/routeTree.gen.ts
+++ b/e2e/solid-start/custom-basepath/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -153,54 +151,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/deferred'
- | '/logout'
- | '/navigate-test'
- | '/posts'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts/'
- | '/redirect/'
- | '/users/'
- | '/api/users/$userId'
- | '/posts/$postId/deep'
+ fullPaths: '/' | '/deferred' | '/logout' | '/navigate-test' | '/posts' | '/users' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts/' | '/redirect/' | '/users/' | '/api/users/$userId' | '/posts/$postId/deep'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/deferred'
- | '/logout'
- | '/navigate-test'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts'
- | '/redirect'
- | '/users'
- | '/api/users/$userId'
- | '/posts/$postId/deep'
- id:
- | '__root__'
- | '/'
- | '/deferred'
- | '/logout'
- | '/navigate-test'
- | '/posts'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts/'
- | '/redirect/'
- | '/users/'
- | '/api/users/$userId'
- | '/posts_/$postId/deep'
+ to: '/' | '/deferred' | '/logout' | '/navigate-test' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts' | '/redirect' | '/users' | '/api/users/$userId' | '/posts/$postId/deep'
+ id: '__root__' | '/' | '/deferred' | '/logout' | '/navigate-test' | '/posts' | '/users' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts/' | '/redirect/' | '/users/' | '/api/users/$userId' | '/posts_/$postId/deep'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -358,9 +312,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersUserIdRoute: ApiUsersUserIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/deferred-hydration/package.json b/e2e/solid-start/deferred-hydration/package.json
index 4e2a3a1665..cc7ee33710 100644
--- a/e2e/solid-start/deferred-hydration/package.json
+++ b/e2e/solid-start/deferred-hydration/package.json
@@ -23,9 +23,9 @@
"solid-js": "^1.9.10"
},
"devDependencies": {
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
- "@rsbuild/plugin-solid": "^1.1.1",
+ "@rsbuild/plugin-solid": "^1.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
"srvx": "^1.0.0",
diff --git a/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts b/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts
index e689dd19b8..7c1dccdaac 100644
--- a/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts
+++ b/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-start/query-integration/src/routeTree.gen.ts b/e2e/solid-start/query-integration/src/routeTree.gen.ts
index 3d6686f67c..8a82c1f676 100644
--- a/e2e/solid-start/query-integration/src/routeTree.gen.ts
+++ b/e2e/solid-start/query-integration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts b/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts
index 7668df5930..ee8924e243 100644
--- a/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts
+++ b/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -59,12 +57,7 @@ export interface FileRouteTypes {
fullPaths: '/' | '/normal-page' | '/with-loader' | '/with-search'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/normal-page' | '/with-loader' | '/with-search'
- id:
- | '__root__'
- | '/'
- | '/(tests)/normal-page'
- | '/(tests)/with-loader'
- | '/(tests)/with-search'
+ id: '__root__' | '/' | '/(tests)/normal-page' | '/(tests)/with-loader' | '/(tests)/with-search'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-start/selective-ssr/src/routeTree.gen.ts b/e2e/solid-start/selective-ssr/src/routeTree.gen.ts
index d0ea8db3a2..dc669e66e1 100644
--- a/e2e/solid-start/selective-ssr/src/routeTree.gen.ts
+++ b/e2e/solid-start/selective-ssr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -20,12 +18,11 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const DataOnlyPendingComponentRoute =
- DataOnlyPendingComponentRouteImport.update({
- id: '/data-only-pending-component',
- path: '/data-only-pending-component',
- getParentRoute: () => rootRouteImport,
- } as any)
+const DataOnlyPendingComponentRoute = DataOnlyPendingComponentRouteImport.update({
+ id: '/data-only-pending-component',
+ path: '/data-only-pending-component',
+ getParentRoute: () => rootRouteImport,
+} as any)
const PostsRoute = PostsRouteImport.update({
id: '/posts',
path: '/posts',
@@ -66,26 +63,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/data-only-pending-component'
- | '/posts'
- | '/ssr-false-pending-min'
- | '/posts/$postId'
+ fullPaths: '/' | '/data-only-pending-component' | '/posts' | '/ssr-false-pending-min' | '/posts/$postId'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/data-only-pending-component'
- | '/posts'
- | '/ssr-false-pending-min'
- | '/posts/$postId'
- id:
- | '__root__'
- | '/'
- | '/data-only-pending-component'
- | '/posts'
- | '/ssr-false-pending-min'
- | '/posts/$postId'
+ to: '/' | '/data-only-pending-component' | '/posts' | '/ssr-false-pending-min' | '/posts/$postId'
+ id: '__root__' | '/' | '/data-only-pending-component' | '/posts' | '/ssr-false-pending-min' | '/posts/$postId'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-start/serialization-adapters/src/routeTree.gen.ts b/e2e/solid-start/serialization-adapters/src/routeTree.gen.ts
index 94ebb49d16..78c64a9bca 100644
--- a/e2e/solid-start/serialization-adapters/src/routeTree.gen.ts
+++ b/e2e/solid-start/serialization-adapters/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -21,12 +19,11 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const ServerFunctionCustomErrorRoute =
- ServerFunctionCustomErrorRouteImport.update({
- id: '/server-function/custom-error',
- path: '/server-function/custom-error',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ServerFunctionCustomErrorRoute = ServerFunctionCustomErrorRouteImport.update({
+ id: '/server-function/custom-error',
+ path: '/server-function/custom-error',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ServerFunctionNestedRoute = ServerFunctionNestedRouteImport.update({
id: '/server-function/nested',
path: '/server-function/nested',
@@ -75,29 +72,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/server-function/custom-error'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
+ fullPaths: '/' | '/server-function/custom-error' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/server-function/custom-error'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
- id:
- | '__root__'
- | '/'
- | '/server-function/custom-error'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
+ to: '/' | '/server-function/custom-error' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
+ id: '__root__' | '/' | '/server-function/custom-error' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-start/server-functions/src/routeTree.gen.ts b/e2e/solid-start/server-functions/src/routeTree.gen.ts
index 2d3b197b77..f862890111 100644
--- a/e2e/solid-start/server-functions/src/routeTree.gen.ts
+++ b/e2e/solid-start/server-functions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -145,18 +143,16 @@ const MiddlewareIndexRoute = MiddlewareIndexRouteImport.update({
path: '/middleware/',
getParentRoute: () => rootRouteImport,
} as any)
-const MiddlewareClientMiddlewareRouterRoute =
- MiddlewareClientMiddlewareRouterRouteImport.update({
- id: '/middleware/client-middleware-router',
- path: '/middleware/client-middleware-router',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareRequestMiddlewareRoute =
- MiddlewareRequestMiddlewareRouteImport.update({
- id: '/middleware/request-middleware',
- path: '/middleware/request-middleware',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MiddlewareClientMiddlewareRouterRoute = MiddlewareClientMiddlewareRouterRouteImport.update({
+ id: '/middleware/client-middleware-router',
+ path: '/middleware/client-middleware-router',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareRequestMiddlewareRoute = MiddlewareRequestMiddlewareRouteImport.update({
+ id: '/middleware/request-middleware',
+ path: '/middleware/request-middleware',
+ getParentRoute: () => rootRouteImport,
+} as any)
const MiddlewareSendServerFnRoute = MiddlewareSendServerFnRouteImport.update({
id: '/middleware/send-serverFn',
path: '/middleware/send-serverFn',
@@ -187,12 +183,11 @@ const RedirectTestTargetRoute = RedirectTestTargetRouteImport.update({
path: '/redirect-test/target',
getParentRoute: () => rootRouteImport,
} as any)
-const FormdataRedirectTargetNameRoute =
- FormdataRedirectTargetNameRouteImport.update({
- id: '/formdata-redirect/target/$name',
- path: '/formdata-redirect/target/$name',
- getParentRoute: () => rootRouteImport,
- } as any)
+const FormdataRedirectTargetNameRoute = FormdataRedirectTargetNameRouteImport.update({
+ id: '/formdata-redirect/target/$name',
+ path: '/formdata-redirect/target/$name',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -293,101 +288,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/consistent'
- | '/dead-code-preserve'
- | '/env-only'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/status'
- | '/submit-post-formdata'
- | '/abort-signal/$method'
- | '/cookies/set'
- | '/middleware/client-middleware-router'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/abort-signal/'
- | '/cookies/'
- | '/factory/'
- | '/formdata-redirect/'
- | '/function-metadata/'
- | '/function-method/'
- | '/middleware/'
- | '/primitives/'
- | '/redirect-test-ssr/'
- | '/redirect-test/'
- | '/formdata-redirect/target/$name'
+ fullPaths: '/' | '/consistent' | '/dead-code-preserve' | '/env-only' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/status' | '/submit-post-formdata' | '/abort-signal/$method' | '/cookies/set' | '/middleware/client-middleware-router' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/abort-signal/' | '/cookies/' | '/factory/' | '/formdata-redirect/' | '/function-metadata/' | '/function-method/' | '/middleware/' | '/primitives/' | '/redirect-test-ssr/' | '/redirect-test/' | '/formdata-redirect/target/$name'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/consistent'
- | '/dead-code-preserve'
- | '/env-only'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/status'
- | '/submit-post-formdata'
- | '/abort-signal/$method'
- | '/cookies/set'
- | '/middleware/client-middleware-router'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/abort-signal'
- | '/cookies'
- | '/factory'
- | '/formdata-redirect'
- | '/function-metadata'
- | '/function-method'
- | '/middleware'
- | '/primitives'
- | '/redirect-test-ssr'
- | '/redirect-test'
- | '/formdata-redirect/target/$name'
- id:
- | '__root__'
- | '/'
- | '/consistent'
- | '/dead-code-preserve'
- | '/env-only'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/status'
- | '/submit-post-formdata'
- | '/abort-signal/$method'
- | '/cookies/set'
- | '/middleware/client-middleware-router'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/abort-signal/'
- | '/cookies/'
- | '/factory/'
- | '/formdata-redirect/'
- | '/function-metadata/'
- | '/function-method/'
- | '/middleware/'
- | '/primitives/'
- | '/redirect-test-ssr/'
- | '/redirect-test/'
- | '/formdata-redirect/target/$name'
+ to: '/' | '/consistent' | '/dead-code-preserve' | '/env-only' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/status' | '/submit-post-formdata' | '/abort-signal/$method' | '/cookies/set' | '/middleware/client-middleware-router' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/abort-signal' | '/cookies' | '/factory' | '/formdata-redirect' | '/function-metadata' | '/function-method' | '/middleware' | '/primitives' | '/redirect-test-ssr' | '/redirect-test' | '/formdata-redirect/target/$name'
+ id: '__root__' | '/' | '/consistent' | '/dead-code-preserve' | '/env-only' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/status' | '/submit-post-formdata' | '/abort-signal/$method' | '/cookies/set' | '/middleware/client-middleware-router' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/abort-signal/' | '/cookies/' | '/factory/' | '/formdata-redirect/' | '/function-metadata/' | '/function-method/' | '/middleware/' | '/primitives/' | '/redirect-test-ssr/' | '/redirect-test/' | '/formdata-redirect/target/$name'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-start/server-functions/vite.config.ts b/e2e/solid-start/server-functions/vite.config.ts
index fc622bbfb0..d063548aac 100644
--- a/e2e/solid-start/server-functions/vite.config.ts
+++ b/e2e/solid-start/server-functions/vite.config.ts
@@ -4,8 +4,8 @@ import viteSolid from 'vite-plugin-solid'
import tailwindcss from '@tailwindcss/vite'
const FUNCTIONS_WITH_CONSTANT_ID = [
- 'src/routes/submit-post-formdata.tsx/greetUser_createServerFn_handler',
- 'src/routes/formdata-redirect/index.tsx/greetUser_createServerFn_handler',
+ 'src/routes/submit-post-formdata.tsx/greetUser',
+ 'src/routes/formdata-redirect/index.tsx/greetUser',
]
export default defineConfig({
diff --git a/e2e/solid-start/server-routes/src/routeTree.gen.ts b/e2e/solid-start/server-routes/src/routeTree.gen.ts
index 75cee36b01..5f10beb7cc 100644
--- a/e2e/solid-start/server-routes/src/routeTree.gen.ts
+++ b/e2e/solid-start/server-routes/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -100,37 +98,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/methods'
- | '/merge-middleware-context'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods/'
- | '/api/params/$foo'
- | '/api/params/$foo/$bar'
+ fullPaths: '/' | '/methods' | '/merge-middleware-context' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods/' | '/api/params/$foo' | '/api/params/$foo/$bar'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/merge-middleware-context'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods'
- | '/api/params/$foo'
- | '/api/params/$foo/$bar'
- id:
- | '__root__'
- | '/'
- | '/methods'
- | '/merge-middleware-context'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods/'
- | '/api/params/$foo'
- | '/api/params/$foo/$bar'
+ to: '/' | '/merge-middleware-context' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods' | '/api/params/$foo' | '/api/params/$foo/$bar'
+ id: '__root__' | '/' | '/methods' | '/merge-middleware-context' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods/' | '/api/params/$foo' | '/api/params/$foo/$bar'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -220,9 +191,7 @@ const MethodsRouteRouteChildren: MethodsRouteRouteChildren = {
MethodsIndexRoute: MethodsIndexRoute,
}
-const MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(
- MethodsRouteRouteChildren,
-)
+const MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(MethodsRouteRouteChildren)
interface ApiParamsFooRouteRouteChildren {
ApiParamsFooBarRoute: typeof ApiParamsFooBarRoute
@@ -232,8 +201,7 @@ const ApiParamsFooRouteRouteChildren: ApiParamsFooRouteRouteChildren = {
ApiParamsFooBarRoute: ApiParamsFooBarRoute,
}
-const ApiParamsFooRouteRouteWithChildren =
- ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)
+const ApiParamsFooRouteRouteWithChildren = ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/solid-query-layout-suspense/src/routeTree.gen.ts b/e2e/solid-start/solid-query-layout-suspense/src/routeTree.gen.ts
index 4da4991cd2..e2ccfce3dc 100644
--- a/e2e/solid-start/solid-query-layout-suspense/src/routeTree.gen.ts
+++ b/e2e/solid-start/solid-query-layout-suspense/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -92,8 +90,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutPage2Route: LayoutPage2Route,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/solid-start/spa-mode/src/routeTree.gen.ts b/e2e/solid-start/spa-mode/src/routeTree.gen.ts
index e65284f0e5..29f86221e1 100644
--- a/e2e/solid-start/spa-mode/src/routeTree.gen.ts
+++ b/e2e/solid-start/spa-mode/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/solid-start/start-manifest/src/routeTree.gen.ts b/e2e/solid-start/start-manifest/src/routeTree.gen.ts
index 5e0ea176d5..4749847238 100644
--- a/e2e/solid-start/start-manifest/src/routeTree.gen.ts
+++ b/e2e/solid-start/start-manifest/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -146,53 +144,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
+ fullPaths: '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
- id:
- | '__root__'
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
+ to: '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
+ id: '__root__' | '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-start/streaming-ssr/src/routeTree.gen.ts b/e2e/solid-start/streaming-ssr/src/routeTree.gen.ts
index 7410f165ac..72ae848844 100644
--- a/e2e/solid-start/streaming-ssr/src/routeTree.gen.ts
+++ b/e2e/solid-start/streaming-ssr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -119,44 +117,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
+ fullPaths: '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/slow-render' | '/stream' | '/sync-only'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
- id:
- | '__root__'
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
+ to: '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/slow-render' | '/stream' | '/sync-only'
+ id: '__root__' | '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/slow-render' | '/stream' | '/sync-only'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/solid-start/virtual-routes/src/routeTree.gen.ts b/e2e/solid-start/virtual-routes/src/routeTree.gen.ts
index 39172d43b4..6da22b5316 100644
--- a/e2e/solid-start/virtual-routes/src/routeTree.gen.ts
+++ b/e2e/solid-start/virtual-routes/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -129,44 +127,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/special|pipe'
- | '/classic/hello'
- | '/posts/'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
- | '/route-without-file/layout-a'
- | '/route-without-file/layout-b'
+ fullPaths: '/' | '/posts' | '/special|pipe' | '/classic/hello' | '/posts/' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/' | '/route-without-file/layout-a' | '/route-without-file/layout-b'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/special|pipe'
- | '/posts'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello'
- | '/route-without-file/layout-a'
- | '/route-without-file/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_first'
- | '/posts'
- | '/special|pipe'
- | '/classic/hello'
- | '/posts/'
- | '/_first/_second-layout'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
- | '/_first/_second-layout/route-without-file/layout-a'
- | '/_first/_second-layout/route-without-file/layout-b'
+ to: '/' | '/special|pipe' | '/posts' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello' | '/route-without-file/layout-a' | '/route-without-file/layout-b'
+ id: '__root__' | '/' | '/_first' | '/posts' | '/special|pipe' | '/classic/hello' | '/posts/' | '/_first/_second-layout' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/' | '/_first/_second-layout/route-without-file/layout-a' | '/_first/_second-layout/route-without-file/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -283,8 +247,7 @@ const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {
bRoute: bRoute,
}
-const layoutSecondLayoutRouteWithChildren =
- layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
+const layoutSecondLayoutRouteWithChildren = layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
interface layoutFirstLayoutRouteChildren {
layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren
@@ -294,8 +257,7 @@ const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {
layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,
}
-const layoutFirstLayoutRouteWithChildren =
- layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
+const layoutFirstLayoutRouteWithChildren = layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
interface postsPostsRouteChildren {
postsPostsHomeRoute: typeof postsPostsHomeRoute
@@ -307,9 +269,7 @@ const postsPostsRouteChildren: postsPostsRouteChildren = {
postsPostsDetailRoute: postsPostsDetailRoute,
}
-const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(
- postsPostsRouteChildren,
-)
+const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(postsPostsRouteChildren)
interface ClassicHelloRouteRouteChildren {
ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute
@@ -323,8 +283,7 @@ const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {
ClassicHelloIndexRoute: ClassicHelloIndexRoute,
}
-const ClassicHelloRouteRouteWithChildren =
- ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
+const ClassicHelloRouteRouteWithChildren = ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
homeRoute: homeRoute,
diff --git a/e2e/solid-start/website/src/routeTree.gen.ts b/e2e/solid-start/website/src/routeTree.gen.ts
index fcc677e13e..08e1b4f3af 100644
--- a/e2e/solid-start/website/src/routeTree.gen.ts
+++ b/e2e/solid-start/website/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -44,36 +42,31 @@ const ProjectVersionDocsIndexRoute = ProjectVersionDocsIndexRouteImport.update({
path: '/$project/$version/docs/',
getParentRoute: () => rootRouteImport,
} as any)
-const LibraryProjectVersionIndexRoute =
- LibraryProjectVersionIndexRouteImport.update({
- id: '/$version/',
- path: '/$version/',
- getParentRoute: () => LibraryProjectRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkRoute =
- ProjectVersionDocsFrameworkFrameworkRouteImport.update({
- id: '/$project/$version/docs/framework/$framework',
- path: '/$project/$version/docs/framework/$framework',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkIndexRoute =
- ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkSplatRoute =
- ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({
- id: '/$',
- path: '/$',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute =
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({
- id: '/examples/$',
- path: '/examples/$',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
+const LibraryProjectVersionIndexRoute = LibraryProjectVersionIndexRouteImport.update({
+ id: '/$version/',
+ path: '/$version/',
+ getParentRoute: () => LibraryProjectRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkRoute = ProjectVersionDocsFrameworkFrameworkRouteImport.update({
+ id: '/$project/$version/docs/framework/$framework',
+ path: '/$project/$version/docs/framework/$framework',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkIndexRoute = ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkSplatRoute = ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({
+ id: '/$',
+ path: '/$',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute = ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({
+ id: '/examples/$',
+ path: '/examples/$',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof LibraryIndexRoute
@@ -110,37 +103,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/$project'
- | '/$project/'
- | '/$project/$version/docs/'
- | '/$project/$version/'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/'
- | '/$project/$version/docs/framework/$framework/examples/$'
+ fullPaths: '/' | '/$project' | '/$project/' | '/$project/$version/docs/' | '/$project/$version/' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/' | '/$project/$version/docs/framework/$framework/examples/$'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/$project'
- | '/'
- | '/$project/$version/docs'
- | '/$project/$version'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/examples/$'
- id:
- | '__root__'
- | '/_library'
- | '/_library/$project'
- | '/$project/'
- | '/_library/'
- | '/$project/$version/docs/'
- | '/_library/$project/$version/'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/'
- | '/$project/$version/docs/framework/$framework/examples/$'
+ to: '/$project' | '/' | '/$project/$version/docs' | '/$project/$version' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/examples/$'
+ id: '__root__' | '/_library' | '/_library/$project' | '/$project/' | '/_library/' | '/$project/$version/docs/' | '/_library/$project/$version/' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/' | '/$project/$version/docs/framework/$framework/examples/$'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -233,9 +199,7 @@ const LibraryProjectRouteChildren: LibraryProjectRouteChildren = {
LibraryProjectVersionIndexRoute: LibraryProjectVersionIndexRoute,
}
-const LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(
- LibraryProjectRouteChildren,
-)
+const LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(LibraryProjectRouteChildren)
interface LibraryRouteChildren {
LibraryProjectRoute: typeof LibraryProjectRouteWithChildren
@@ -247,8 +211,7 @@ const LibraryRouteChildren: LibraryRouteChildren = {
LibraryIndexRoute: LibraryIndexRoute,
}
-const LibraryRouteWithChildren =
- LibraryRoute._addFileChildren(LibraryRouteChildren)
+const LibraryRouteWithChildren = LibraryRoute._addFileChildren(LibraryRouteChildren)
interface ProjectVersionDocsFrameworkFrameworkRouteChildren {
ProjectVersionDocsFrameworkFrameworkSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRoute
@@ -256,27 +219,19 @@ interface ProjectVersionDocsFrameworkFrameworkRouteChildren {
ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute
}
-const ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren =
- {
- ProjectVersionDocsFrameworkFrameworkSplatRoute:
- ProjectVersionDocsFrameworkFrameworkSplatRoute,
- ProjectVersionDocsFrameworkFrameworkIndexRoute:
- ProjectVersionDocsFrameworkFrameworkIndexRoute,
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute:
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,
- }
+const ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren = {
+ ProjectVersionDocsFrameworkFrameworkSplatRoute: ProjectVersionDocsFrameworkFrameworkSplatRoute,
+ ProjectVersionDocsFrameworkFrameworkIndexRoute: ProjectVersionDocsFrameworkFrameworkIndexRoute,
+ ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,
+}
-const ProjectVersionDocsFrameworkFrameworkRouteWithChildren =
- ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(
- ProjectVersionDocsFrameworkFrameworkRouteChildren,
- )
+const ProjectVersionDocsFrameworkFrameworkRouteWithChildren = ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(ProjectVersionDocsFrameworkFrameworkRouteChildren)
const rootRouteChildren: RootRouteChildren = {
LibraryRoute: LibraryRouteWithChildren,
ProjectIndexRoute: ProjectIndexRoute,
ProjectVersionDocsIndexRoute: ProjectVersionDocsIndexRoute,
- ProjectVersionDocsFrameworkFrameworkRoute:
- ProjectVersionDocsFrameworkFrameworkRouteWithChildren,
+ ProjectVersionDocsFrameworkFrameworkRoute: ProjectVersionDocsFrameworkFrameworkRouteWithChildren,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
diff --git a/e2e/vue-router/basepath-file-based/src/routeTree.gen.ts b/e2e/vue-router/basepath-file-based/src/routeTree.gen.ts
index 75b8119285..a37d21fd7e 100644
--- a/e2e/vue-router/basepath-file-based/src/routeTree.gen.ts
+++ b/e2e/vue-router/basepath-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/vue-router/basic-file-based-jsx/src/routeTree.gen.ts b/e2e/vue-router/basic-file-based-jsx/src/routeTree.gen.ts
index 5922c5f7b1..8efd834c78 100644
--- a/e2e/vue-router/basic-file-based-jsx/src/routeTree.gen.ts
+++ b/e2e/vue-router/basic-file-based-jsx/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -9,7 +7,6 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { lazyRouteComponent } from '@tanstack/vue-router'
-
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
import { Route as LayoutRouteImport } from './routes/_layout'
@@ -71,24 +68,20 @@ const SfcComponentRoute = SfcComponentRouteImport.update({
id: '/sfcComponent',
path: '/sfcComponent',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/sfcComponent.component.vue'),
- 'default',
- ),
-})
-const Char45824Char54620Char48124Char44397Route =
- Char45824Char54620Char48124Char44397RouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => rootRouteImport,
- } as any)
-const anotherGroupOnlyrouteinsideRoute =
- anotherGroupOnlyrouteinsideRouteImport.update({
- id: '/(another-group)/onlyrouteinside',
- path: '/onlyrouteinside',
- getParentRoute: () => rootRouteImport,
- } as any)
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/sfcComponent.component.vue'), 'default'),
+ })
+const Char45824Char54620Char48124Char44397Route = Char45824Char54620Char48124Char44397RouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport.update({
+ id: '/(another-group)/onlyrouteinside',
+ path: '/onlyrouteinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
const groupLayoutRoute = groupLayoutRouteImport.update({
id: '/(group)/_layout',
getParentRoute: () => rootRouteImport,
@@ -208,67 +201,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/editing-a'
- | '/editing-b'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/sfcComponent'
- | '/대한민국'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/posts/'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/posts/$postId/edit'
+ fullPaths: '/' | '/editing-a' | '/editing-b' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/sfcComponent' | '/대한민국' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/posts/' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/posts/$postId/edit'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/editing-a'
- | '/editing-b'
- | '/notRemountDeps'
- | '/remountDeps'
- | '/sfcComponent'
- | '/대한민국'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/posts'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/posts/$postId/edit'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/editing-a'
- | '/editing-b'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/sfcComponent'
- | '/대한민국'
- | '/(another-group)/onlyrouteinside'
- | '/(group)/_layout'
- | '/(group)/inside'
- | '/(group)/lazyinside'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/(group)/_layout/insidelayout'
- | '/(group)/subfolder/inside'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/posts_/$postId/edit'
+ to: '/' | '/editing-a' | '/editing-b' | '/notRemountDeps' | '/remountDeps' | '/sfcComponent' | '/대한민국' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/posts' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/posts/$postId/edit'
+ id: '__root__' | '/' | '/_layout' | '/editing-a' | '/editing-b' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/sfcComponent' | '/대한민국' | '/(another-group)/onlyrouteinside' | '/(group)/_layout' | '/(group)/inside' | '/(group)/lazyinside' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/(group)/_layout/insidelayout' | '/(group)/subfolder/inside' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/posts_/$postId/edit'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -451,9 +387,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -463,8 +397,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -486,9 +419,7 @@ const groupLayoutRouteChildren: groupLayoutRouteChildren = {
groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,
}
-const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(
- groupLayoutRouteChildren,
-)
+const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(groupLayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
@@ -499,8 +430,7 @@ const rootRouteChildren: RootRouteChildren = {
PostsRoute: PostsRouteWithChildren,
RemountDepsRoute: RemountDepsRoute,
SfcComponentRoute: SfcComponentRoute,
- Char45824Char54620Char48124Char44397Route:
- Char45824Char54620Char48124Char44397Route,
+ Char45824Char54620Char48124Char44397Route: Char45824Char54620Char48124Char44397Route,
anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,
groupLayoutRoute: groupLayoutRouteWithChildren,
groupInsideRoute: groupInsideRoute,
diff --git a/e2e/vue-router/basic-file-based-sfc/src/routeTree.gen.ts b/e2e/vue-router/basic-file-based-sfc/src/routeTree.gen.ts
index 0bfdddab3d..eb18216060 100644
--- a/e2e/vue-router/basic-file-based-sfc/src/routeTree.gen.ts
+++ b/e2e/vue-router/basic-file-based-sfc/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -9,7 +7,6 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { lazyRouteComponent } from '@tanstack/vue-router'
-
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
import { Route as LayoutRouteImport } from './routes/_layout'
@@ -36,216 +33,160 @@ const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/index.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/index.component.vue'), 'default'),
+ })
const LayoutRoute = LayoutRouteImport.update({
id: '/_layout',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/_layout.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/_layout.component.vue'), 'default'),
+ })
const EditingARoute = EditingARouteImport.update({
id: '/editing-a',
path: '/editing-a',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/editing-a.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/editing-a.component.vue'), 'default'),
+ })
const EditingBRoute = EditingBRouteImport.update({
id: '/editing-b',
path: '/editing-b',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/editing-b.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/editing-b.component.vue'), 'default'),
+ })
const NotRemountDepsRoute = NotRemountDepsRouteImport.update({
id: '/notRemountDeps',
path: '/notRemountDeps',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/notRemountDeps.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/notRemountDeps.component.vue'), 'default'),
+ })
const PostsRoute = PostsRouteImport.update({
id: '/posts',
path: '/posts',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/posts.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/posts.component.vue'), 'default'),
+ })
const RemountDepsRoute = RemountDepsRouteImport.update({
id: '/remountDeps',
path: '/remountDeps',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/remountDeps.component.vue'),
- 'default',
- ),
-})
-const Char45824Char54620Char48124Char44397Route =
- Char45824Char54620Char48124Char44397RouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => rootRouteImport,
- } as any).update({
- component: lazyRouteComponent(
- () => import('./routes/대한민국.component.vue'),
- 'default',
- ),
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/remountDeps.component.vue'), 'default'),
})
-const anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport
+const Char45824Char54620Char48124Char44397Route = Char45824Char54620Char48124Char44397RouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => rootRouteImport,
+} as any)
.update({
- id: '/(another-group)/onlyrouteinside',
- path: '/onlyrouteinside',
- getParentRoute: () => rootRouteImport,
- } as any)
- .update({
- component: lazyRouteComponent(
- () => import('./routes/(another-group)/onlyrouteinside.component.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/대한민국.component.vue'), 'default'),
})
-const groupLayoutRoute = groupLayoutRouteImport
+const anotherGroupOnlyrouteinsideRoute = anotherGroupOnlyrouteinsideRouteImport.update({
+ id: '/(another-group)/onlyrouteinside',
+ path: '/onlyrouteinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
.update({
- id: '/(group)/_layout',
- getParentRoute: () => rootRouteImport,
- } as any)
- .update({
- component: lazyRouteComponent(
- () => import('./routes/(group)/_layout.component.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/(another-group)/onlyrouteinside.component.vue'), 'default'),
})
-const groupInsideRoute = groupInsideRouteImport
+const groupLayoutRoute = groupLayoutRouteImport.update({
+ id: '/(group)/_layout',
+ getParentRoute: () => rootRouteImport,
+} as any)
.update({
- id: '/(group)/inside',
- path: '/inside',
- getParentRoute: () => rootRouteImport,
- } as any)
- .update({
- component: lazyRouteComponent(
- () => import('./routes/(group)/inside.component.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/(group)/_layout.component.vue'), 'default'),
})
-const groupLazyinsideRoute = groupLazyinsideRouteImport
+const groupInsideRoute = groupInsideRouteImport.update({
+ id: '/(group)/inside',
+ path: '/inside',
+ getParentRoute: () => rootRouteImport,
+} as any)
.update({
- id: '/(group)/lazyinside',
- path: '/lazyinside',
- getParentRoute: () => rootRouteImport,
- } as any)
+ component: lazyRouteComponent(() => import('./routes/(group)/inside.component.vue'), 'default'),
+ })
+const groupLazyinsideRoute = groupLazyinsideRouteImport.update({
+ id: '/(group)/lazyinside',
+ path: '/lazyinside',
+ getParentRoute: () => rootRouteImport,
+} as any)
.update({
- component: lazyRouteComponent(
- () => import('./routes/(group)/lazyinside.component.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/(group)/lazyinside.component.vue'), 'default'),
})
const LayoutLayout2Route = LayoutLayout2RouteImport.update({
id: '/_layout-2',
getParentRoute: () => LayoutRoute,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/_layout/_layout-2.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/_layout/_layout-2.component.vue'), 'default'),
+ })
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => PostsRoute,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/posts.index.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/posts.index.component.vue'), 'default'),
+ })
const PostsPostIdRoute = PostsPostIdRouteImport.update({
id: '/$postId',
path: '/$postId',
getParentRoute: () => PostsRoute,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/posts.$postId.component.vue'),
- 'default',
- ),
- errorComponent: lazyRouteComponent(
- () => import('./routes/posts.$postId.errorComponent.vue'),
- 'default',
- ),
-})
-const groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport
+} as any)
.update({
- id: '/insidelayout',
- path: '/insidelayout',
- getParentRoute: () => groupLayoutRoute,
- } as any)
- .update({
- component: lazyRouteComponent(
- () => import('./routes/(group)/_layout.insidelayout.component.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/posts.$postId.component.vue'), 'default'),
+ errorComponent: lazyRouteComponent(() => import('./routes/posts.$postId.errorComponent.vue'), 'default'),
})
-const groupSubfolderInsideRoute = groupSubfolderInsideRouteImport
+const groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({
+ id: '/insidelayout',
+ path: '/insidelayout',
+ getParentRoute: () => groupLayoutRoute,
+} as any)
.update({
- id: '/(group)/subfolder/inside',
- path: '/subfolder/inside',
- getParentRoute: () => rootRouteImport,
- } as any)
+ component: lazyRouteComponent(() => import('./routes/(group)/_layout.insidelayout.component.vue'), 'default'),
+ })
+const groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({
+ id: '/(group)/subfolder/inside',
+ path: '/subfolder/inside',
+ getParentRoute: () => rootRouteImport,
+} as any)
.update({
- component: lazyRouteComponent(
- () => import('./routes/(group)/subfolder/inside.component.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/(group)/subfolder/inside.component.vue'), 'default'),
})
const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({
id: '/layout-a',
path: '/layout-a',
getParentRoute: () => LayoutLayout2Route,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/_layout/_layout-2/layout-a.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/_layout/_layout-2/layout-a.component.vue'), 'default'),
+ })
const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({
id: '/layout-b',
path: '/layout-b',
getParentRoute: () => LayoutLayout2Route,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/_layout/_layout-2/layout-b.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/_layout/_layout-2/layout-b.component.vue'), 'default'),
+ })
const PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({
id: '/posts_/$postId/edit',
path: '/posts/$postId/edit',
getParentRoute: () => rootRouteImport,
-} as any).update({
- component: lazyRouteComponent(
- () => import('./routes/posts_.$postId.edit.component.vue'),
- 'default',
- ),
-})
+} as any)
+ .update({
+ component: lazyRouteComponent(() => import('./routes/posts_.$postId.edit.component.vue'), 'default'),
+ })
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -309,64 +250,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/editing-a'
- | '/editing-b'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/대한민국'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/posts/'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/posts/$postId/edit'
+ fullPaths: '/' | '/editing-a' | '/editing-b' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/대한민국' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/posts/' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/posts/$postId/edit'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/editing-a'
- | '/editing-b'
- | '/notRemountDeps'
- | '/remountDeps'
- | '/대한민국'
- | '/onlyrouteinside'
- | '/inside'
- | '/lazyinside'
- | '/posts/$postId'
- | '/posts'
- | '/insidelayout'
- | '/subfolder/inside'
- | '/layout-a'
- | '/layout-b'
- | '/posts/$postId/edit'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/editing-a'
- | '/editing-b'
- | '/notRemountDeps'
- | '/posts'
- | '/remountDeps'
- | '/대한민국'
- | '/(another-group)/onlyrouteinside'
- | '/(group)/_layout'
- | '/(group)/inside'
- | '/(group)/lazyinside'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/(group)/_layout/insidelayout'
- | '/(group)/subfolder/inside'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/posts_/$postId/edit'
+ to: '/' | '/editing-a' | '/editing-b' | '/notRemountDeps' | '/remountDeps' | '/대한민국' | '/onlyrouteinside' | '/inside' | '/lazyinside' | '/posts/$postId' | '/posts' | '/insidelayout' | '/subfolder/inside' | '/layout-a' | '/layout-b' | '/posts/$postId/edit'
+ id: '__root__' | '/' | '/_layout' | '/editing-a' | '/editing-b' | '/notRemountDeps' | '/posts' | '/remountDeps' | '/대한민국' | '/(another-group)/onlyrouteinside' | '/(group)/_layout' | '/(group)/inside' | '/(group)/lazyinside' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/(group)/_layout/insidelayout' | '/(group)/subfolder/inside' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/posts_/$postId/edit'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -541,9 +428,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -553,8 +438,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -576,9 +460,7 @@ const groupLayoutRouteChildren: groupLayoutRouteChildren = {
groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute,
}
-const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(
- groupLayoutRouteChildren,
-)
+const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren(groupLayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
@@ -588,8 +470,7 @@ const rootRouteChildren: RootRouteChildren = {
NotRemountDepsRoute: NotRemountDepsRoute,
PostsRoute: PostsRouteWithChildren,
RemountDepsRoute: RemountDepsRoute,
- Char45824Char54620Char48124Char44397Route:
- Char45824Char54620Char48124Char44397Route,
+ Char45824Char54620Char48124Char44397Route: Char45824Char54620Char48124Char44397Route,
anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute,
groupLayoutRoute: groupLayoutRouteWithChildren,
groupInsideRoute: groupInsideRoute,
@@ -599,14 +480,8 @@ const rootRouteChildren: RootRouteChildren = {
}
export const routeTree = rootRouteImport
.update({
- component: lazyRouteComponent(
- () => import('./routes/__root.component.vue'),
- 'default',
- ),
- notFoundComponent: lazyRouteComponent(
- () => import('./routes/__root.notFoundComponent.vue'),
- 'default',
- ),
+ component: lazyRouteComponent(() => import('./routes/__root.component.vue'), 'default'),
+ notFoundComponent: lazyRouteComponent(() => import('./routes/__root.notFoundComponent.vue'), 'default'),
})
._addFileChildren(rootRouteChildren)
._addFileTypes()
diff --git a/e2e/vue-router/basic-virtual-file-based/src/routeTree.gen.ts b/e2e/vue-router/basic-virtual-file-based/src/routeTree.gen.ts
index 1bae3d69a1..0d05c60449 100644
--- a/e2e/vue-router/basic-virtual-file-based/src/routeTree.gen.ts
+++ b/e2e/vue-router/basic-virtual-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -120,41 +118,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/classic/hello'
- | '/posts/'
- | '/posts/$postId'
- | '/layout-a'
- | '/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
+ fullPaths: '/' | '/posts' | '/classic/hello' | '/posts/' | '/posts/$postId' | '/layout-a' | '/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/layout-a'
- | '/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello'
- id:
- | '__root__'
- | '/'
- | '/_first'
- | '/posts'
- | '/classic/hello'
- | '/posts/'
- | '/_first/_second'
- | '/posts/$postId'
- | '/_first/_second/layout-a'
- | '/_first/_second/layout-b'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
+ to: '/' | '/posts' | '/posts/$postId' | '/layout-a' | '/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello'
+ id: '__root__' | '/' | '/_first' | '/posts' | '/classic/hello' | '/posts/' | '/_first/_second' | '/posts/$postId' | '/_first/_second/layout-a' | '/_first/_second/layout-b' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -263,8 +230,7 @@ const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {
bRoute: bRoute,
}
-const layoutSecondLayoutRouteWithChildren =
- layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
+const layoutSecondLayoutRouteWithChildren = layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
interface layoutFirstLayoutRouteChildren {
layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren
@@ -274,8 +240,7 @@ const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {
layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,
}
-const layoutFirstLayoutRouteWithChildren =
- layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
+const layoutFirstLayoutRouteWithChildren = layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
interface postsPostsRouteChildren {
postsPostsHomeRoute: typeof postsPostsHomeRoute
@@ -287,9 +252,7 @@ const postsPostsRouteChildren: postsPostsRouteChildren = {
postsPostsDetailRoute: postsPostsDetailRoute,
}
-const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(
- postsPostsRouteChildren,
-)
+const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(postsPostsRouteChildren)
interface ClassicHelloRouteRouteChildren {
ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute
@@ -303,8 +266,7 @@ const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {
ClassicHelloIndexRoute: ClassicHelloIndexRoute,
}
-const ClassicHelloRouteRouteWithChildren =
- ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
+const ClassicHelloRouteRouteWithChildren = ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
homeRoute: homeRoute,
diff --git a/e2e/vue-router/basic-vue-query-file-based/src/routeTree.gen.ts b/e2e/vue-router/basic-vue-query-file-based/src/routeTree.gen.ts
index 0af0e21dbd..6c21841746 100644
--- a/e2e/vue-router/basic-vue-query-file-based/src/routeTree.gen.ts
+++ b/e2e/vue-router/basic-vue-query-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -85,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/layout-a'
- | '/layout-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/layout-a' | '/layout-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/posts'
- | '/_layout/_layout-2'
- | '/posts/$postId'
- | '/posts/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
+ id: '__root__' | '/' | '/_layout' | '/posts' | '/_layout/_layout-2' | '/posts/$postId' | '/posts/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -183,9 +166,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -195,8 +176,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
diff --git a/e2e/vue-router/generator-cli-only/src/routeTree.gen.ts b/e2e/vue-router/generator-cli-only/src/routeTree.gen.ts
index decb53754c..1fbf81ef30 100644
--- a/e2e/vue-router/generator-cli-only/src/routeTree.gen.ts
+++ b/e2e/vue-router/generator-cli-only/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -32,11 +30,10 @@ const PostsRouteRoute = PostsRouteRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
} as any)
-const PathlessLayoutNestedLayoutRoute =
- PathlessLayoutNestedLayoutRouteImport.update({
- id: '/_nested-layout',
- getParentRoute: () => PathlessLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRoute = PathlessLayoutNestedLayoutRouteImport.update({
+ id: '/_nested-layout',
+ getParentRoute: () => PathlessLayoutRoute,
+} as any)
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -47,18 +44,16 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
path: '/$postId',
getParentRoute: () => PostsRouteRoute,
} as any)
-const PathlessLayoutNestedLayoutRouteARoute =
- PathlessLayoutNestedLayoutRouteARouteImport.update({
- id: '/route-a',
- path: '/route-a',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
-const PathlessLayoutNestedLayoutRouteBRoute =
- PathlessLayoutNestedLayoutRouteBRouteImport.update({
- id: '/route-b',
- path: '/route-b',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRouteARoute = PathlessLayoutNestedLayoutRouteARouteImport.update({
+ id: '/route-a',
+ path: '/route-a',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
+const PathlessLayoutNestedLayoutRouteBRoute = PathlessLayoutNestedLayoutRouteBRouteImport.update({
+ id: '/route-b',
+ path: '/route-b',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -88,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/route-a'
- | '/route-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/route-a' | '/route-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/_pathlessLayout'
- | '/_pathlessLayout/_nested-layout'
- | '/posts/$postId'
- | '/posts/'
- | '/_pathlessLayout/_nested-layout/route-a'
- | '/_pathlessLayout/_nested-layout/route-b'
+ id: '__root__' | '/' | '/posts' | '/_pathlessLayout' | '/_pathlessLayout/_nested-layout' | '/posts/$postId' | '/posts/' | '/_pathlessLayout/_nested-layout/route-a' | '/_pathlessLayout/_nested-layout/route-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -186,27 +166,19 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
interface PathlessLayoutNestedLayoutRouteChildren {
PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute
PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute
}
-const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =
- {
- PathlessLayoutNestedLayoutRouteARoute:
- PathlessLayoutNestedLayoutRouteARoute,
- PathlessLayoutNestedLayoutRouteBRoute:
- PathlessLayoutNestedLayoutRouteBRoute,
- }
+const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren = {
+ PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,
+ PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,
+}
-const PathlessLayoutNestedLayoutRouteWithChildren =
- PathlessLayoutNestedLayoutRoute._addFileChildren(
- PathlessLayoutNestedLayoutRouteChildren,
- )
+const PathlessLayoutNestedLayoutRouteWithChildren = PathlessLayoutNestedLayoutRoute._addFileChildren(PathlessLayoutNestedLayoutRouteChildren)
interface PathlessLayoutRouteChildren {
PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren
@@ -216,9 +188,7 @@ const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {
PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,
}
-const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(
- PathlessLayoutRouteChildren,
-)
+const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(PathlessLayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-router/js-only-file-based/src/routeTree.gen.ts b/e2e/vue-router/js-only-file-based/src/routeTree.gen.ts
index decb53754c..1fbf81ef30 100644
--- a/e2e/vue-router/js-only-file-based/src/routeTree.gen.ts
+++ b/e2e/vue-router/js-only-file-based/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -32,11 +30,10 @@ const PostsRouteRoute = PostsRouteRouteImport.update({
path: '/posts',
getParentRoute: () => rootRouteImport,
} as any)
-const PathlessLayoutNestedLayoutRoute =
- PathlessLayoutNestedLayoutRouteImport.update({
- id: '/_nested-layout',
- getParentRoute: () => PathlessLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRoute = PathlessLayoutNestedLayoutRouteImport.update({
+ id: '/_nested-layout',
+ getParentRoute: () => PathlessLayoutRoute,
+} as any)
const PostsIndexRoute = PostsIndexRouteImport.update({
id: '/',
path: '/',
@@ -47,18 +44,16 @@ const PostsPostIdRoute = PostsPostIdRouteImport.update({
path: '/$postId',
getParentRoute: () => PostsRouteRoute,
} as any)
-const PathlessLayoutNestedLayoutRouteARoute =
- PathlessLayoutNestedLayoutRouteARouteImport.update({
- id: '/route-a',
- path: '/route-a',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
-const PathlessLayoutNestedLayoutRouteBRoute =
- PathlessLayoutNestedLayoutRouteBRouteImport.update({
- id: '/route-b',
- path: '/route-b',
- getParentRoute: () => PathlessLayoutNestedLayoutRoute,
- } as any)
+const PathlessLayoutNestedLayoutRouteARoute = PathlessLayoutNestedLayoutRouteARouteImport.update({
+ id: '/route-a',
+ path: '/route-a',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
+const PathlessLayoutNestedLayoutRouteBRoute = PathlessLayoutNestedLayoutRouteBRouteImport.update({
+ id: '/route-b',
+ path: '/route-b',
+ getParentRoute: () => PathlessLayoutNestedLayoutRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -88,25 +83,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
- | '/route-a'
- | '/route-b'
+ fullPaths: '/' | '/posts' | '/posts/$postId' | '/posts/' | '/route-a' | '/route-b'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/_pathlessLayout'
- | '/_pathlessLayout/_nested-layout'
- | '/posts/$postId'
- | '/posts/'
- | '/_pathlessLayout/_nested-layout/route-a'
- | '/_pathlessLayout/_nested-layout/route-b'
+ id: '__root__' | '/' | '/posts' | '/_pathlessLayout' | '/_pathlessLayout/_nested-layout' | '/posts/$postId' | '/posts/' | '/_pathlessLayout/_nested-layout/route-a' | '/_pathlessLayout/_nested-layout/route-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -186,27 +166,19 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
interface PathlessLayoutNestedLayoutRouteChildren {
PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute
PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute
}
-const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren =
- {
- PathlessLayoutNestedLayoutRouteARoute:
- PathlessLayoutNestedLayoutRouteARoute,
- PathlessLayoutNestedLayoutRouteBRoute:
- PathlessLayoutNestedLayoutRouteBRoute,
- }
+const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren = {
+ PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute,
+ PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute,
+}
-const PathlessLayoutNestedLayoutRouteWithChildren =
- PathlessLayoutNestedLayoutRoute._addFileChildren(
- PathlessLayoutNestedLayoutRouteChildren,
- )
+const PathlessLayoutNestedLayoutRouteWithChildren = PathlessLayoutNestedLayoutRoute._addFileChildren(PathlessLayoutNestedLayoutRouteChildren)
interface PathlessLayoutRouteChildren {
PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren
@@ -216,9 +188,7 @@ const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = {
PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren,
}
-const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(
- PathlessLayoutRouteChildren,
-)
+const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren(PathlessLayoutRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-router/rspack-basic-file-based/package.json b/e2e/vue-router/rspack-basic-file-based/package.json
index 93439f7d5b..b420125e51 100644
--- a/e2e/vue-router/rspack-basic-file-based/package.json
+++ b/e2e/vue-router/rspack-basic-file-based/package.json
@@ -17,7 +17,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-vue": "^1.2.7",
"@rsbuild/plugin-vue-jsx": "^2.0.0",
diff --git a/e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/package.json b/e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/package.json
index 536435a09e..f1259e5e7a 100644
--- a/e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/package.json
+++ b/e2e/vue-router/rspack-basic-virtual-named-export-config-file-based/package.json
@@ -17,7 +17,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-vue": "^1.2.7",
"@rsbuild/plugin-vue-jsx": "^2.0.0",
diff --git a/e2e/vue-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts b/e2e/vue-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
index e85be2bf37..9d20d974c7 100644
--- a/e2e/vue-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
+++ b/e2e/vue-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -9,7 +7,6 @@
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.
import { createFileRoute } from '@tanstack/vue-router'
-
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
import { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page'
@@ -17,31 +14,25 @@ import { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/la
import { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page'
import { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search'
-const testsVirtualPageLazyRouteImport = createFileRoute(
- '/(tests)/virtual-page',
-)()
+const testsVirtualPageLazyRouteImport = createFileRoute('/(tests)/virtual-page')()
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const testsLazyPageRoute = testsLazyPageRouteImport
- .update({
- id: '/(tests)/lazy-page',
- path: '/lazy-page',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsLazyPageRoute = testsLazyPageRouteImport.update({
+ id: '/(tests)/lazy-page',
+ path: '/lazy-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route))
-const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport
- .update({
- id: '/(tests)/lazy-with-loader-page',
- path: '/lazy-with-loader-page',
- getParentRoute: () => rootRouteImport,
- } as any)
- .lazy(() =>
- import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route),
- )
+const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport.update({
+ id: '/(tests)/lazy-with-loader-page',
+ path: '/lazy-with-loader-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
+ .lazy(() => import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route))
const testsNormalPageRoute = testsNormalPageRouteImport.update({
id: '/(tests)/normal-page',
path: '/normal-page',
@@ -52,12 +43,11 @@ const testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({
path: '/page-with-search',
getParentRoute: () => rootRouteImport,
} as any)
-const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport
- .update({
- id: '/(tests)/virtual-page',
- path: '/virtual-page',
- getParentRoute: () => rootRouteImport,
- } as any)
+const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport.update({
+ id: '/(tests)/virtual-page',
+ path: '/virtual-page',
+ getParentRoute: () => rootRouteImport,
+} as any)
.lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route))
export interface FileRoutesByFullPath {
@@ -87,29 +77,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/lazy-page'
- | '/lazy-with-loader-page'
- | '/normal-page'
- | '/page-with-search'
- | '/virtual-page'
+ fullPaths: '/' | '/lazy-page' | '/lazy-with-loader-page' | '/normal-page' | '/page-with-search' | '/virtual-page'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/lazy-page'
- | '/lazy-with-loader-page'
- | '/normal-page'
- | '/page-with-search'
- | '/virtual-page'
- id:
- | '__root__'
- | '/'
- | '/(tests)/lazy-page'
- | '/(tests)/lazy-with-loader-page'
- | '/(tests)/normal-page'
- | '/(tests)/page-with-search'
- | '/(tests)/virtual-page'
+ to: '/' | '/lazy-page' | '/lazy-with-loader-page' | '/normal-page' | '/page-with-search' | '/virtual-page'
+ id: '__root__' | '/' | '/(tests)/lazy-page' | '/(tests)/lazy-with-loader-page' | '/(tests)/normal-page' | '/(tests)/page-with-search' | '/(tests)/virtual-page'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/vue-router/view-transitions/src/routeTree.gen.ts b/e2e/vue-router/view-transitions/src/routeTree.gen.ts
index 04708c29a8..efc13d2308 100644
--- a/e2e/vue-router/view-transitions/src/routeTree.gen.ts
+++ b/e2e/vue-router/view-transitions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -73,23 +71,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/explore'
- | '/how-it-works'
- | '/posts/$postId'
- | '/posts/'
+ fullPaths: '/' | '/posts' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts'
- id:
- | '__root__'
- | '/'
- | '/posts'
- | '/explore'
- | '/how-it-works'
- | '/posts/$postId'
- | '/posts/'
+ id: '__root__' | '/' | '/posts' | '/explore' | '/how-it-works' | '/posts/$postId' | '/posts/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -156,9 +141,7 @@ const PostsRouteRouteChildren: PostsRouteRouteChildren = {
PostsIndexRoute: PostsIndexRoute,
}
-const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(
- PostsRouteRouteChildren,
-)
+const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren(PostsRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-start/basic-auth/src/routeTree.gen.ts b/e2e/vue-start/basic-auth/src/routeTree.gen.ts
index 058f8674ac..4acc3b0bca 100644
--- a/e2e/vue-start/basic-auth/src/routeTree.gen.ts
+++ b/e2e/vue-start/basic-auth/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -88,26 +86,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/login'
- | '/logout'
- | '/signup'
- | '/posts'
- | '/posts/$postId'
- | '/posts/'
+ fullPaths: '/' | '/login' | '/logout' | '/signup' | '/posts' | '/posts/$postId' | '/posts/'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/login' | '/logout' | '/signup' | '/posts/$postId' | '/posts'
- id:
- | '__root__'
- | '/'
- | '/_authed'
- | '/login'
- | '/logout'
- | '/signup'
- | '/_authed/posts'
- | '/_authed/posts/$postId'
- | '/_authed/posts/'
+ id: '__root__' | '/' | '/_authed' | '/login' | '/logout' | '/signup' | '/_authed/posts' | '/_authed/posts/$postId' | '/_authed/posts/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -189,9 +171,7 @@ const AuthedPostsRouteChildren: AuthedPostsRouteChildren = {
AuthedPostsIndexRoute: AuthedPostsIndexRoute,
}
-const AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(
- AuthedPostsRouteChildren,
-)
+const AuthedPostsRouteWithChildren = AuthedPostsRoute._addFileChildren(AuthedPostsRouteChildren)
interface AuthedRouteChildren {
AuthedPostsRoute: typeof AuthedPostsRouteWithChildren
@@ -201,8 +181,7 @@ const AuthedRouteChildren: AuthedRouteChildren = {
AuthedPostsRoute: AuthedPostsRouteWithChildren,
}
-const AuthedRouteWithChildren =
- AuthedRoute._addFileChildren(AuthedRouteChildren)
+const AuthedRouteWithChildren = AuthedRoute._addFileChildren(AuthedRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-start/basic-cloudflare/src/routeTree.gen.ts b/e2e/vue-start/basic-cloudflare/src/routeTree.gen.ts
index c52a88360b..82383fa88c 100644
--- a/e2e/vue-start/basic-cloudflare/src/routeTree.gen.ts
+++ b/e2e/vue-start/basic-cloudflare/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/vue-start/basic-tsr-config/src/app/routeTree.gen.ts b/e2e/vue-start/basic-tsr-config/src/app/routeTree.gen.ts
index 7a8d4c0038..849fa73d9d 100644
--- a/e2e/vue-start/basic-tsr-config/src/app/routeTree.gen.ts
+++ b/e2e/vue-start/basic-tsr-config/src/app/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/vue-start/basic-vue-query/src/routeTree.gen.ts b/e2e/vue-start/basic-vue-query/src/routeTree.gen.ts
index 10e8a56450..c0391460fe 100644
--- a/e2e/vue-start/basic-vue-query/src/routeTree.gen.ts
+++ b/e2e/vue-start/basic-vue-query/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -165,56 +163,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/deferred'
- | '/posts'
- | '/suspense-transition'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts/'
- | '/users/'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- | '/transition/count/query'
+ fullPaths: '/' | '/deferred' | '/posts' | '/suspense-transition' | '/users' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts/' | '/users/' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/posts/$postId/deep' | '/transition/count/query'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/deferred'
- | '/suspense-transition'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts'
- | '/users'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$id'
- | '/posts/$postId/deep'
- | '/transition/count/query'
- id:
- | '__root__'
- | '/'
- | '/_layout'
- | '/deferred'
- | '/posts'
- | '/suspense-transition'
- | '/users'
- | '/_layout/_layout-2'
- | '/api/users'
- | '/posts/$postId'
- | '/users/$userId'
- | '/posts/'
- | '/users/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/api/users/$id'
- | '/posts_/$postId/deep'
- | '/transition/count/query'
+ to: '/' | '/deferred' | '/suspense-transition' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts' | '/users' | '/layout-a' | '/layout-b' | '/api/users/$id' | '/posts/$postId/deep' | '/transition/count/query'
+ id: '__root__' | '/' | '/_layout' | '/deferred' | '/posts' | '/suspense-transition' | '/users' | '/_layout/_layout-2' | '/api/users' | '/posts/$postId' | '/users/$userId' | '/posts/' | '/users/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/api/users/$id' | '/posts_/$postId/deep' | '/transition/count/query'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -363,9 +315,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -375,8 +325,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -410,9 +359,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersIdRoute: ApiUsersIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-start/basic/package.json b/e2e/vue-start/basic/package.json
index 2ff8329543..a8f77e633f 100644
--- a/e2e/vue-start/basic/package.json
+++ b/e2e/vue-start/basic/package.json
@@ -27,7 +27,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
"@rsbuild/plugin-vue": "^1.2.7",
"@rsbuild/plugin-vue-jsx": "^2.0.0",
diff --git a/e2e/vue-start/basic/src/routeTree.gen.ts b/e2e/vue-start/basic/src/routeTree.gen.ts
index 7fbcd192b6..754bf4e1c7 100644
--- a/e2e/vue-start/basic/src/routeTree.gen.ts
+++ b/e2e/vue-start/basic/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -140,40 +138,36 @@ const ApiUsersRoute = ApiUsersRouteImport.update({
path: '/api/users',
getParentRoute: () => rootRouteImport,
} as any)
-const MultiCookieRedirectIndexRoute =
- MultiCookieRedirectIndexRouteImport.update({
- id: '/multi-cookie-redirect/',
- path: '/multi-cookie-redirect/',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MultiCookieRedirectTargetRoute =
- MultiCookieRedirectTargetRouteImport.update({
- id: '/multi-cookie-redirect/target',
- path: '/multi-cookie-redirect/target',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MultiCookieRedirectIndexRoute = MultiCookieRedirectIndexRouteImport.update({
+ id: '/multi-cookie-redirect/',
+ path: '/multi-cookie-redirect/',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MultiCookieRedirectTargetRoute = MultiCookieRedirectTargetRouteImport.update({
+ id: '/multi-cookie-redirect/target',
+ path: '/multi-cookie-redirect/target',
+ getParentRoute: () => rootRouteImport,
+} as any)
const NotFoundIndexRoute = NotFoundIndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => NotFoundRouteRoute,
} as any)
-const NotFoundParentBoundaryRouteRoute =
- NotFoundParentBoundaryRouteRouteImport.update({
- id: '/parent-boundary',
- path: '/parent-boundary',
- getParentRoute: () => NotFoundRouteRoute,
- } as any)
+const NotFoundParentBoundaryRouteRoute = NotFoundParentBoundaryRouteRouteImport.update({
+ id: '/parent-boundary',
+ path: '/parent-boundary',
+ getParentRoute: () => NotFoundRouteRoute,
+} as any)
const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({
id: '/via-beforeLoad',
path: '/via-beforeLoad',
getParentRoute: () => NotFoundRouteRoute,
} as any)
-const NotFoundViaBeforeLoadTargetRootRoute =
- NotFoundViaBeforeLoadTargetRootRouteImport.update({
- id: '/via-beforeLoad-target-root',
- path: '/via-beforeLoad-target-root',
- getParentRoute: () => NotFoundRouteRoute,
- } as any)
+const NotFoundViaBeforeLoadTargetRootRoute = NotFoundViaBeforeLoadTargetRootRouteImport.update({
+ id: '/via-beforeLoad-target-root',
+ path: '/via-beforeLoad-target-root',
+ getParentRoute: () => NotFoundRouteRoute,
+} as any)
const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
@@ -244,12 +238,11 @@ const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({
path: '/default',
getParentRoute: () => SearchParamsRouteRoute,
} as any)
-const SearchParamsLoaderThrowsRedirectRoute =
- SearchParamsLoaderThrowsRedirectRouteImport.update({
- id: '/loader-throws-redirect',
- path: '/loader-throws-redirect',
- getParentRoute: () => SearchParamsRouteRoute,
- } as any)
+const SearchParamsLoaderThrowsRedirectRoute = SearchParamsLoaderThrowsRedirectRouteImport.update({
+ id: '/loader-throws-redirect',
+ path: '/loader-throws-redirect',
+ getParentRoute: () => SearchParamsRouteRoute,
+} as any)
const SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({
id: '/$param',
path: '/$param',
@@ -260,23 +253,21 @@ const SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({
path: '/hash',
getParentRoute: () => SpecialCharsRouteRoute,
} as any)
-const SpecialCharsMalformedRouteRoute =
- SpecialCharsMalformedRouteRouteImport.update({
- id: '/malformed',
- path: '/malformed',
- getParentRoute: () => SpecialCharsRouteRoute,
- } as any)
+const SpecialCharsMalformedRouteRoute = SpecialCharsMalformedRouteRouteImport.update({
+ id: '/malformed',
+ path: '/malformed',
+ getParentRoute: () => SpecialCharsRouteRoute,
+} as any)
const SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({
id: '/search',
path: '/search',
getParentRoute: () => SpecialCharsRouteRoute,
} as any)
-const SpecialCharsChar45824Char54620Char48124Char44397Route =
- SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({
- id: '/대한민국',
- path: '/대한민국',
- getParentRoute: () => SpecialCharsRouteRoute,
- } as any)
+const SpecialCharsChar45824Char54620Char48124Char44397Route = SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({
+ id: '/대한민국',
+ path: '/대한민국',
+ getParentRoute: () => SpecialCharsRouteRoute,
+} as any)
const UsersIndexRoute = UsersIndexRouteImport.update({
id: '/',
path: '/',
@@ -302,12 +293,11 @@ const ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({
path: '/$userId',
getParentRoute: () => ApiUsersRoute,
} as any)
-const NotFoundParentBoundaryViaBeforeLoadRoute =
- NotFoundParentBoundaryViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => NotFoundParentBoundaryRouteRoute,
- } as any)
+const NotFoundParentBoundaryViaBeforeLoadRoute = NotFoundParentBoundaryViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => NotFoundParentBoundaryRouteRoute,
+} as any)
const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({
id: '/posts_/$postId/deep',
path: '/posts/$postId/deep',
@@ -318,53 +308,46 @@ const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({
path: '/',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const RedirectTargetViaBeforeLoadRoute =
- RedirectTargetViaBeforeLoadRouteImport.update({
- id: '/via-beforeLoad',
- path: '/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const RedirectTargetViaBeforeLoadRoute = RedirectTargetViaBeforeLoadRouteImport.update({
+ id: '/via-beforeLoad',
+ path: '/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({
id: '/via-loader',
path: '/via-loader',
getParentRoute: () => RedirectTargetRoute,
} as any)
-const SpecialCharsMalformedParamRoute =
- SpecialCharsMalformedParamRouteImport.update({
- id: '/$param',
- path: '/$param',
- getParentRoute: () => SpecialCharsMalformedRouteRoute,
- } as any)
-const SpecialCharsMalformedSearchRoute =
- SpecialCharsMalformedSearchRouteImport.update({
- id: '/search',
- path: '/search',
- getParentRoute: () => SpecialCharsMalformedRouteRoute,
- } as any)
-const RedirectTargetServerFnIndexRoute =
- RedirectTargetServerFnIndexRouteImport.update({
- id: '/serverFn/',
- path: '/serverFn/',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaBeforeLoadRoute =
- RedirectTargetServerFnViaBeforeLoadRouteImport.update({
- id: '/serverFn/via-beforeLoad',
- path: '/serverFn/via-beforeLoad',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaLoaderRoute =
- RedirectTargetServerFnViaLoaderRouteImport.update({
- id: '/serverFn/via-loader',
- path: '/serverFn/via-loader',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
-const RedirectTargetServerFnViaUseServerFnRoute =
- RedirectTargetServerFnViaUseServerFnRouteImport.update({
- id: '/serverFn/via-useServerFn',
- path: '/serverFn/via-useServerFn',
- getParentRoute: () => RedirectTargetRoute,
- } as any)
+const SpecialCharsMalformedParamRoute = SpecialCharsMalformedParamRouteImport.update({
+ id: '/$param',
+ path: '/$param',
+ getParentRoute: () => SpecialCharsMalformedRouteRoute,
+} as any)
+const SpecialCharsMalformedSearchRoute = SpecialCharsMalformedSearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => SpecialCharsMalformedRouteRoute,
+} as any)
+const RedirectTargetServerFnIndexRoute = RedirectTargetServerFnIndexRouteImport.update({
+ id: '/serverFn/',
+ path: '/serverFn/',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaBeforeLoadRoute = RedirectTargetServerFnViaBeforeLoadRouteImport.update({
+ id: '/serverFn/via-beforeLoad',
+ path: '/serverFn/via-beforeLoad',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaLoaderRoute = RedirectTargetServerFnViaLoaderRouteImport.update({
+ id: '/serverFn/via-loader',
+ path: '/serverFn/via-loader',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
+const RedirectTargetServerFnViaUseServerFnRoute = RedirectTargetServerFnViaUseServerFnRouteImport.update({
+ id: '/serverFn/via-useServerFn',
+ path: '/serverFn/via-useServerFn',
+ getParentRoute: () => RedirectTargetRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -536,172 +519,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/not-found'
- | '/search-params'
- | '/specialChars'
- | '/deferred'
- | '/inline-scripts'
- | '/links'
- | '/posts'
- | '/raw-stream'
- | '/scripts'
- | '/stream'
- | '/users'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/api/users'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/redirect/$target'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect/'
- | '/not-found/'
- | '/posts/'
- | '/raw-stream/'
- | '/redirect/'
- | '/search-params/'
- | '/users/'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$userId'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/redirect/$target/'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn/'
+ fullPaths: '/' | '/not-found' | '/search-params' | '/specialChars' | '/deferred' | '/inline-scripts' | '/links' | '/posts' | '/raw-stream' | '/scripts' | '/stream' | '/users' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/api/users' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/redirect/$target' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect/' | '/not-found/' | '/posts/' | '/raw-stream/' | '/redirect/' | '/search-params/' | '/users/' | '/layout-a' | '/layout-b' | '/api/users/$userId' | '/not-found/parent-boundary/via-beforeLoad' | '/posts/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/redirect/$target/' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn/'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/specialChars'
- | '/deferred'
- | '/inline-scripts'
- | '/links'
- | '/scripts'
- | '/stream'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/api/users'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect'
- | '/not-found'
- | '/posts'
- | '/raw-stream'
- | '/redirect'
- | '/search-params'
- | '/users'
- | '/layout-a'
- | '/layout-b'
- | '/api/users/$userId'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/redirect/$target'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn'
- id:
- | '__root__'
- | '/'
- | '/not-found'
- | '/search-params'
- | '/specialChars'
- | '/_layout'
- | '/deferred'
- | '/inline-scripts'
- | '/links'
- | '/posts'
- | '/raw-stream'
- | '/scripts'
- | '/stream'
- | '/users'
- | '/not-found/parent-boundary'
- | '/specialChars/malformed'
- | '/_layout/_layout-2'
- | '/api/users'
- | '/multi-cookie-redirect/target'
- | '/not-found/via-beforeLoad'
- | '/not-found/via-beforeLoad-target-root'
- | '/not-found/via-loader'
- | '/posts/$postId'
- | '/raw-stream/client-call'
- | '/raw-stream/ssr-binary-hint'
- | '/raw-stream/ssr-mixed'
- | '/raw-stream/ssr-multiple'
- | '/raw-stream/ssr-single'
- | '/raw-stream/ssr-text-hint'
- | '/redirect/$target'
- | '/search-params/default'
- | '/search-params/loader-throws-redirect'
- | '/specialChars/$param'
- | '/specialChars/hash'
- | '/specialChars/search'
- | '/specialChars/대한민국'
- | '/users/$userId'
- | '/multi-cookie-redirect/'
- | '/not-found/'
- | '/posts/'
- | '/raw-stream/'
- | '/redirect/'
- | '/search-params/'
- | '/users/'
- | '/_layout/_layout-2/layout-a'
- | '/_layout/_layout-2/layout-b'
- | '/api/users/$userId'
- | '/not-found/parent-boundary/via-beforeLoad'
- | '/posts_/$postId/deep'
- | '/redirect/$target/via-beforeLoad'
- | '/redirect/$target/via-loader'
- | '/specialChars/malformed/$param'
- | '/specialChars/malformed/search'
- | '/redirect/$target/'
- | '/redirect/$target/serverFn/via-beforeLoad'
- | '/redirect/$target/serverFn/via-loader'
- | '/redirect/$target/serverFn/via-useServerFn'
- | '/redirect/$target/serverFn/'
+ to: '/' | '/specialChars' | '/deferred' | '/inline-scripts' | '/links' | '/scripts' | '/stream' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/api/users' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect' | '/not-found' | '/posts' | '/raw-stream' | '/redirect' | '/search-params' | '/users' | '/layout-a' | '/layout-b' | '/api/users/$userId' | '/not-found/parent-boundary/via-beforeLoad' | '/posts/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/redirect/$target' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn'
+ id: '__root__' | '/' | '/not-found' | '/search-params' | '/specialChars' | '/_layout' | '/deferred' | '/inline-scripts' | '/links' | '/posts' | '/raw-stream' | '/scripts' | '/stream' | '/users' | '/not-found/parent-boundary' | '/specialChars/malformed' | '/_layout/_layout-2' | '/api/users' | '/multi-cookie-redirect/target' | '/not-found/via-beforeLoad' | '/not-found/via-beforeLoad-target-root' | '/not-found/via-loader' | '/posts/$postId' | '/raw-stream/client-call' | '/raw-stream/ssr-binary-hint' | '/raw-stream/ssr-mixed' | '/raw-stream/ssr-multiple' | '/raw-stream/ssr-single' | '/raw-stream/ssr-text-hint' | '/redirect/$target' | '/search-params/default' | '/search-params/loader-throws-redirect' | '/specialChars/$param' | '/specialChars/hash' | '/specialChars/search' | '/specialChars/대한민국' | '/users/$userId' | '/multi-cookie-redirect/' | '/not-found/' | '/posts/' | '/raw-stream/' | '/redirect/' | '/search-params/' | '/users/' | '/_layout/_layout-2/layout-a' | '/_layout/_layout-2/layout-b' | '/api/users/$userId' | '/not-found/parent-boundary/via-beforeLoad' | '/posts_/$postId/deep' | '/redirect/$target/via-beforeLoad' | '/redirect/$target/via-loader' | '/specialChars/malformed/$param' | '/specialChars/malformed/search' | '/redirect/$target/' | '/redirect/$target/serverFn/via-beforeLoad' | '/redirect/$target/serverFn/via-loader' | '/redirect/$target/serverFn/via-useServerFn' | '/redirect/$target/serverFn/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -1134,16 +955,11 @@ interface NotFoundParentBoundaryRouteRouteChildren {
NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute
}
-const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren =
- {
- NotFoundParentBoundaryViaBeforeLoadRoute:
- NotFoundParentBoundaryViaBeforeLoadRoute,
- }
+const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren = {
+ NotFoundParentBoundaryViaBeforeLoadRoute: NotFoundParentBoundaryViaBeforeLoadRoute,
+}
-const NotFoundParentBoundaryRouteRouteWithChildren =
- NotFoundParentBoundaryRouteRoute._addFileChildren(
- NotFoundParentBoundaryRouteRouteChildren,
- )
+const NotFoundParentBoundaryRouteRouteWithChildren = NotFoundParentBoundaryRouteRoute._addFileChildren(NotFoundParentBoundaryRouteRouteChildren)
interface NotFoundRouteRouteChildren {
NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren
@@ -1154,17 +970,14 @@ interface NotFoundRouteRouteChildren {
}
const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = {
- NotFoundParentBoundaryRouteRoute:
- NotFoundParentBoundaryRouteRouteWithChildren,
+ NotFoundParentBoundaryRouteRoute: NotFoundParentBoundaryRouteRouteWithChildren,
NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute,
NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute,
NotFoundViaLoaderRoute: NotFoundViaLoaderRoute,
NotFoundIndexRoute: NotFoundIndexRoute,
}
-const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(
- NotFoundRouteRouteChildren,
-)
+const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren(NotFoundRouteRouteChildren)
interface SearchParamsRouteRouteChildren {
SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute
@@ -1178,24 +991,19 @@ const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = {
SearchParamsIndexRoute: SearchParamsIndexRoute,
}
-const SearchParamsRouteRouteWithChildren =
- SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
+const SearchParamsRouteRouteWithChildren = SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren)
interface SpecialCharsMalformedRouteRouteChildren {
SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute
SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute
}
-const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren =
- {
- SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,
- SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,
- }
+const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren = {
+ SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute,
+ SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute,
+}
-const SpecialCharsMalformedRouteRouteWithChildren =
- SpecialCharsMalformedRouteRoute._addFileChildren(
- SpecialCharsMalformedRouteRouteChildren,
- )
+const SpecialCharsMalformedRouteRouteWithChildren = SpecialCharsMalformedRouteRoute._addFileChildren(SpecialCharsMalformedRouteRouteChildren)
interface SpecialCharsRouteRouteChildren {
SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren
@@ -1210,12 +1018,10 @@ const SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = {
SpecialCharsParamRoute: SpecialCharsParamRoute,
SpecialCharsHashRoute: SpecialCharsHashRoute,
SpecialCharsSearchRoute: SpecialCharsSearchRoute,
- SpecialCharsChar45824Char54620Char48124Char44397Route:
- SpecialCharsChar45824Char54620Char48124Char44397Route,
+ SpecialCharsChar45824Char54620Char48124Char44397Route: SpecialCharsChar45824Char54620Char48124Char44397Route,
}
-const SpecialCharsRouteRouteWithChildren =
- SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)
+const SpecialCharsRouteRouteWithChildren = SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren)
interface LayoutLayout2RouteChildren {
LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute
@@ -1227,9 +1033,7 @@ const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = {
LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute,
}
-const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(
- LayoutLayout2RouteChildren,
-)
+const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren(LayoutLayout2RouteChildren)
interface LayoutRouteChildren {
LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren
@@ -1239,8 +1043,7 @@ const LayoutRouteChildren: LayoutRouteChildren = {
LayoutLayout2Route: LayoutLayout2RouteWithChildren,
}
-const LayoutRouteWithChildren =
- LayoutRoute._addFileChildren(LayoutRouteChildren)
+const LayoutRouteWithChildren = LayoutRoute._addFileChildren(LayoutRouteChildren)
interface PostsRouteChildren {
PostsPostIdRoute: typeof PostsPostIdRoute
@@ -1274,9 +1077,7 @@ const RawStreamRouteChildren: RawStreamRouteChildren = {
RawStreamIndexRoute: RawStreamIndexRoute,
}
-const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(
- RawStreamRouteChildren,
-)
+const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren(RawStreamRouteChildren)
interface UsersRouteChildren {
UsersUserIdRoute: typeof UsersUserIdRoute
@@ -1298,9 +1099,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersUserIdRoute: ApiUsersUserIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
interface RedirectTargetRouteChildren {
RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute
@@ -1316,17 +1115,13 @@ const RedirectTargetRouteChildren: RedirectTargetRouteChildren = {
RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute,
RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute,
RedirectTargetIndexRoute: RedirectTargetIndexRoute,
- RedirectTargetServerFnViaBeforeLoadRoute:
- RedirectTargetServerFnViaBeforeLoadRoute,
+ RedirectTargetServerFnViaBeforeLoadRoute: RedirectTargetServerFnViaBeforeLoadRoute,
RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute,
- RedirectTargetServerFnViaUseServerFnRoute:
- RedirectTargetServerFnViaUseServerFnRoute,
+ RedirectTargetServerFnViaUseServerFnRoute: RedirectTargetServerFnViaUseServerFnRoute,
RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute,
}
-const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(
- RedirectTargetRouteChildren,
-)
+const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren(RedirectTargetRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-start/css-modules/package.json b/e2e/vue-start/css-modules/package.json
index 3671774644..03303f6921 100644
--- a/e2e/vue-start/css-modules/package.json
+++ b/e2e/vue-start/css-modules/package.json
@@ -23,7 +23,7 @@
"@tanstack/router-e2e-utils": "workspace:*",
"@types/node": "^22.10.2",
"@vitejs/plugin-vue-jsx": "^5.1.5",
- "sass": "^1.97.2",
+ "sass": "^1.105.1",
"srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
diff --git a/e2e/vue-start/custom-basepath/src/routeTree.gen.ts b/e2e/vue-start/custom-basepath/src/routeTree.gen.ts
index 605193fbec..4f14941325 100644
--- a/e2e/vue-start/custom-basepath/src/routeTree.gen.ts
+++ b/e2e/vue-start/custom-basepath/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -144,51 +142,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/deferred'
- | '/logout'
- | '/posts'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts/'
- | '/redirect/'
- | '/users/'
- | '/api/users/$userId'
- | '/posts/$postId/deep'
+ fullPaths: '/' | '/deferred' | '/logout' | '/posts' | '/users' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts/' | '/redirect/' | '/users/' | '/api/users/$userId' | '/posts/$postId/deep'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/deferred'
- | '/logout'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts'
- | '/redirect'
- | '/users'
- | '/api/users/$userId'
- | '/posts/$postId/deep'
- id:
- | '__root__'
- | '/'
- | '/deferred'
- | '/logout'
- | '/posts'
- | '/users'
- | '/api/users'
- | '/posts/$postId'
- | '/redirect/throw-it'
- | '/users/$userId'
- | '/posts/'
- | '/redirect/'
- | '/users/'
- | '/api/users/$userId'
- | '/posts_/$postId/deep'
+ to: '/' | '/deferred' | '/logout' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts' | '/redirect' | '/users' | '/api/users/$userId' | '/posts/$postId/deep'
+ id: '__root__' | '/' | '/deferred' | '/logout' | '/posts' | '/users' | '/api/users' | '/posts/$postId' | '/redirect/throw-it' | '/users/$userId' | '/posts/' | '/redirect/' | '/users/' | '/api/users/$userId' | '/posts_/$postId/deep'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -338,9 +295,7 @@ const ApiUsersRouteChildren: ApiUsersRouteChildren = {
ApiUsersUserIdRoute: ApiUsersUserIdRoute,
}
-const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(
- ApiUsersRouteChildren,
-)
+const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren(ApiUsersRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-start/query-integration/src/routeTree.gen.ts b/e2e/vue-start/query-integration/src/routeTree.gen.ts
index c5a9f02a7a..4f434bbde5 100644
--- a/e2e/vue-start/query-integration/src/routeTree.gen.ts
+++ b/e2e/vue-start/query-integration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/vue-start/scroll-restoration/src/routeTree.gen.ts b/e2e/vue-start/scroll-restoration/src/routeTree.gen.ts
index 49b34fc68f..b0a828b25e 100644
--- a/e2e/vue-start/scroll-restoration/src/routeTree.gen.ts
+++ b/e2e/vue-start/scroll-restoration/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -59,12 +57,7 @@ export interface FileRouteTypes {
fullPaths: '/' | '/normal-page' | '/with-loader' | '/with-search'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/normal-page' | '/with-loader' | '/with-search'
- id:
- | '__root__'
- | '/'
- | '/(tests)/normal-page'
- | '/(tests)/with-loader'
- | '/(tests)/with-search'
+ id: '__root__' | '/' | '/(tests)/normal-page' | '/(tests)/with-loader' | '/(tests)/with-search'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/vue-start/selective-ssr/src/routeTree.gen.ts b/e2e/vue-start/selective-ssr/src/routeTree.gen.ts
index 0d44b648ee..d4a68b7adf 100644
--- a/e2e/vue-start/selective-ssr/src/routeTree.gen.ts
+++ b/e2e/vue-start/selective-ssr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/vue-start/serialization-adapters/src/routeTree.gen.ts b/e2e/vue-start/serialization-adapters/src/routeTree.gen.ts
index c684bbc82c..e4a0715955 100644
--- a/e2e/vue-start/serialization-adapters/src/routeTree.gen.ts
+++ b/e2e/vue-start/serialization-adapters/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -21,12 +19,11 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const ServerFunctionCustomErrorRoute =
- ServerFunctionCustomErrorRouteImport.update({
- id: '/server-function/custom-error',
- path: '/server-function/custom-error',
- getParentRoute: () => rootRouteImport,
- } as any)
+const ServerFunctionCustomErrorRoute = ServerFunctionCustomErrorRouteImport.update({
+ id: '/server-function/custom-error',
+ path: '/server-function/custom-error',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ServerFunctionNestedRoute = ServerFunctionNestedRouteImport.update({
id: '/server-function/nested',
path: '/server-function/nested',
@@ -75,29 +72,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/server-function/custom-error'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
+ fullPaths: '/' | '/server-function/custom-error' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/server-function/custom-error'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
- id:
- | '__root__'
- | '/'
- | '/server-function/custom-error'
- | '/server-function/nested'
- | '/ssr/data-only'
- | '/ssr/nested'
- | '/ssr/stream'
+ to: '/' | '/server-function/custom-error' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
+ id: '__root__' | '/' | '/server-function/custom-error' | '/server-function/nested' | '/ssr/data-only' | '/ssr/nested' | '/ssr/stream'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/vue-start/server-functions/src/routeTree.gen.ts b/e2e/vue-start/server-functions/src/routeTree.gen.ts
index 96e5b7ba29..a23cc0be8a 100644
--- a/e2e/vue-start/server-functions/src/routeTree.gen.ts
+++ b/e2e/vue-start/server-functions/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -139,18 +137,16 @@ const MiddlewareIndexRoute = MiddlewareIndexRouteImport.update({
path: '/middleware/',
getParentRoute: () => rootRouteImport,
} as any)
-const MiddlewareClientMiddlewareRouterRoute =
- MiddlewareClientMiddlewareRouterRouteImport.update({
- id: '/middleware/client-middleware-router',
- path: '/middleware/client-middleware-router',
- getParentRoute: () => rootRouteImport,
- } as any)
-const MiddlewareRequestMiddlewareRoute =
- MiddlewareRequestMiddlewareRouteImport.update({
- id: '/middleware/request-middleware',
- path: '/middleware/request-middleware',
- getParentRoute: () => rootRouteImport,
- } as any)
+const MiddlewareClientMiddlewareRouterRoute = MiddlewareClientMiddlewareRouterRouteImport.update({
+ id: '/middleware/client-middleware-router',
+ path: '/middleware/client-middleware-router',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MiddlewareRequestMiddlewareRoute = MiddlewareRequestMiddlewareRouteImport.update({
+ id: '/middleware/request-middleware',
+ path: '/middleware/request-middleware',
+ getParentRoute: () => rootRouteImport,
+} as any)
const MiddlewareSendServerFnRoute = MiddlewareSendServerFnRouteImport.update({
id: '/middleware/send-serverFn',
path: '/middleware/send-serverFn',
@@ -181,12 +177,11 @@ const RedirectTestTargetRoute = RedirectTestTargetRouteImport.update({
path: '/redirect-test/target',
getParentRoute: () => rootRouteImport,
} as any)
-const FormdataRedirectTargetNameRoute =
- FormdataRedirectTargetNameRouteImport.update({
- id: '/formdata-redirect/target/$name',
- path: '/formdata-redirect/target/$name',
- getParentRoute: () => rootRouteImport,
- } as any)
+const FormdataRedirectTargetNameRoute = FormdataRedirectTargetNameRouteImport.update({
+ id: '/formdata-redirect/target/$name',
+ path: '/formdata-redirect/target/$name',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -284,98 +279,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/abort-signal'
- | '/consistent'
- | '/dead-code-preserve'
- | '/env-only'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/status'
- | '/submit-post-formdata'
- | '/cookies/set'
- | '/middleware/client-middleware-router'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/cookies/'
- | '/factory/'
- | '/formdata-redirect/'
- | '/function-metadata/'
- | '/function-method/'
- | '/middleware/'
- | '/primitives/'
- | '/redirect-test-ssr/'
- | '/redirect-test/'
- | '/formdata-redirect/target/$name'
+ fullPaths: '/' | '/abort-signal' | '/consistent' | '/dead-code-preserve' | '/env-only' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/status' | '/submit-post-formdata' | '/cookies/set' | '/middleware/client-middleware-router' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/cookies/' | '/factory/' | '/formdata-redirect/' | '/function-metadata/' | '/function-method/' | '/middleware/' | '/primitives/' | '/redirect-test-ssr/' | '/redirect-test/' | '/formdata-redirect/target/$name'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/abort-signal'
- | '/consistent'
- | '/dead-code-preserve'
- | '/env-only'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/status'
- | '/submit-post-formdata'
- | '/cookies/set'
- | '/middleware/client-middleware-router'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/cookies'
- | '/factory'
- | '/formdata-redirect'
- | '/function-metadata'
- | '/function-method'
- | '/middleware'
- | '/primitives'
- | '/redirect-test-ssr'
- | '/redirect-test'
- | '/formdata-redirect/target/$name'
- id:
- | '__root__'
- | '/'
- | '/abort-signal'
- | '/consistent'
- | '/dead-code-preserve'
- | '/env-only'
- | '/headers'
- | '/isomorphic-fns'
- | '/multipart'
- | '/raw-response'
- | '/return-null'
- | '/serialize-form-data'
- | '/status'
- | '/submit-post-formdata'
- | '/cookies/set'
- | '/middleware/client-middleware-router'
- | '/middleware/request-middleware'
- | '/middleware/send-serverFn'
- | '/redirect-test-ssr/target'
- | '/redirect-test/target'
- | '/cookies/'
- | '/factory/'
- | '/formdata-redirect/'
- | '/function-metadata/'
- | '/function-method/'
- | '/middleware/'
- | '/primitives/'
- | '/redirect-test-ssr/'
- | '/redirect-test/'
- | '/formdata-redirect/target/$name'
+ to: '/' | '/abort-signal' | '/consistent' | '/dead-code-preserve' | '/env-only' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/status' | '/submit-post-formdata' | '/cookies/set' | '/middleware/client-middleware-router' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/cookies' | '/factory' | '/formdata-redirect' | '/function-metadata' | '/function-method' | '/middleware' | '/primitives' | '/redirect-test-ssr' | '/redirect-test' | '/formdata-redirect/target/$name'
+ id: '__root__' | '/' | '/abort-signal' | '/consistent' | '/dead-code-preserve' | '/env-only' | '/headers' | '/isomorphic-fns' | '/multipart' | '/raw-response' | '/return-null' | '/serialize-form-data' | '/status' | '/submit-post-formdata' | '/cookies/set' | '/middleware/client-middleware-router' | '/middleware/request-middleware' | '/middleware/send-serverFn' | '/redirect-test-ssr/target' | '/redirect-test/target' | '/cookies/' | '/factory/' | '/formdata-redirect/' | '/function-metadata/' | '/function-method/' | '/middleware/' | '/primitives/' | '/redirect-test-ssr/' | '/redirect-test/' | '/formdata-redirect/target/$name'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/vue-start/server-functions/vite.config.ts b/e2e/vue-start/server-functions/vite.config.ts
index 362cf4e122..97b2fe2328 100644
--- a/e2e/vue-start/server-functions/vite.config.ts
+++ b/e2e/vue-start/server-functions/vite.config.ts
@@ -5,8 +5,8 @@ import vueJsx from '@vitejs/plugin-vue-jsx'
import tailwindcss from '@tailwindcss/vite'
const FUNCTIONS_WITH_CONSTANT_ID = [
- 'src/routes/submit-post-formdata.tsx/greetUser_createServerFn_handler',
- 'src/routes/formdata-redirect/index.tsx/greetUser_createServerFn_handler',
+ 'src/routes/submit-post-formdata.tsx/greetUser',
+ 'src/routes/formdata-redirect/index.tsx/greetUser',
]
export default defineConfig({
diff --git a/e2e/vue-start/server-routes/src/routeTree.gen.ts b/e2e/vue-start/server-routes/src/routeTree.gen.ts
index 603560da2a..a09f7d24db 100644
--- a/e2e/vue-start/server-routes/src/routeTree.gen.ts
+++ b/e2e/vue-start/server-routes/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -100,37 +98,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/methods'
- | '/merge-middleware-context'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods/'
- | '/api/params/$foo'
- | '/api/params/$foo/$bar'
+ fullPaths: '/' | '/methods' | '/merge-middleware-context' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods/' | '/api/params/$foo' | '/api/params/$foo/$bar'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/merge-middleware-context'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods'
- | '/api/params/$foo'
- | '/api/params/$foo/$bar'
- id:
- | '__root__'
- | '/'
- | '/methods'
- | '/merge-middleware-context'
- | '/api/middleware-context'
- | '/api/only-any'
- | '/methods/only-any'
- | '/methods/'
- | '/api/params/$foo'
- | '/api/params/$foo/$bar'
+ to: '/' | '/merge-middleware-context' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods' | '/api/params/$foo' | '/api/params/$foo/$bar'
+ id: '__root__' | '/' | '/methods' | '/merge-middleware-context' | '/api/middleware-context' | '/api/only-any' | '/methods/only-any' | '/methods/' | '/api/params/$foo' | '/api/params/$foo/$bar'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -220,9 +191,7 @@ const MethodsRouteRouteChildren: MethodsRouteRouteChildren = {
MethodsIndexRoute: MethodsIndexRoute,
}
-const MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(
- MethodsRouteRouteChildren,
-)
+const MethodsRouteRouteWithChildren = MethodsRouteRoute._addFileChildren(MethodsRouteRouteChildren)
interface ApiParamsFooRouteRouteChildren {
ApiParamsFooBarRoute: typeof ApiParamsFooBarRoute
@@ -232,8 +201,7 @@ const ApiParamsFooRouteRouteChildren: ApiParamsFooRouteRouteChildren = {
ApiParamsFooBarRoute: ApiParamsFooBarRoute,
}
-const ApiParamsFooRouteRouteWithChildren =
- ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)
+const ApiParamsFooRouteRouteWithChildren = ApiParamsFooRouteRoute._addFileChildren(ApiParamsFooRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
diff --git a/e2e/vue-start/spa-mode/src/routeTree.gen.ts b/e2e/vue-start/spa-mode/src/routeTree.gen.ts
index 0d44b648ee..d4a68b7adf 100644
--- a/e2e/vue-start/spa-mode/src/routeTree.gen.ts
+++ b/e2e/vue-start/spa-mode/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/e2e/vue-start/start-manifest/src/routeTree.gen.ts b/e2e/vue-start/start-manifest/src/routeTree.gen.ts
index fc42a1e404..6c57685c2b 100644
--- a/e2e/vue-start/start-manifest/src/routeTree.gen.ts
+++ b/e2e/vue-start/start-manifest/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -146,53 +144,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
+ fullPaths: '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
- id:
- | '__root__'
- | '/'
- | '/a'
- | '/b'
- | '/lazy-css-lazy'
- | '/lazy-css-static'
- | '/r1'
- | '/r2'
- | '/r3'
- | '/r4'
- | '/r5'
- | '/r6'
- | '/shared-a'
- | '/shared-b'
- | '/shared-c'
+ to: '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
+ id: '__root__' | '/' | '/a' | '/b' | '/lazy-css-lazy' | '/lazy-css-static' | '/r1' | '/r2' | '/r3' | '/r4' | '/r5' | '/r6' | '/shared-a' | '/shared-b' | '/shared-c'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/vue-start/streaming-ssr/src/routeTree.gen.ts b/e2e/vue-start/streaming-ssr/src/routeTree.gen.ts
index ac4c9ab156..f6ed3ae8b3 100644
--- a/e2e/vue-start/streaming-ssr/src/routeTree.gen.ts
+++ b/e2e/vue-start/streaming-ssr/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -119,44 +117,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
+ fullPaths: '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/slow-render' | '/stream' | '/sync-only'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
- id:
- | '__root__'
- | '/'
- | '/concurrent'
- | '/deferred'
- | '/deferred-rejection'
- | '/fast-serial'
- | '/many-promises'
- | '/nested-deferred'
- | '/query-heavy'
- | '/slow-render'
- | '/stream'
- | '/sync-only'
+ to: '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/slow-render' | '/stream' | '/sync-only'
+ id: '__root__' | '/' | '/concurrent' | '/deferred' | '/deferred-rejection' | '/fast-serial' | '/many-promises' | '/nested-deferred' | '/query-heavy' | '/slow-render' | '/stream' | '/sync-only'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
diff --git a/e2e/vue-start/virtual-routes/src/routeTree.gen.ts b/e2e/vue-start/virtual-routes/src/routeTree.gen.ts
index 1a1bc2d27b..b0c22c86f2 100644
--- a/e2e/vue-start/virtual-routes/src/routeTree.gen.ts
+++ b/e2e/vue-start/virtual-routes/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -129,44 +127,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/posts'
- | '/special|pipe'
- | '/classic/hello'
- | '/posts/'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
- | '/route-without-file/layout-a'
- | '/route-without-file/layout-b'
+ fullPaths: '/' | '/posts' | '/special|pipe' | '/classic/hello' | '/posts/' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/' | '/route-without-file/layout-a' | '/route-without-file/layout-b'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/'
- | '/special|pipe'
- | '/posts'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello'
- | '/route-without-file/layout-a'
- | '/route-without-file/layout-b'
- id:
- | '__root__'
- | '/'
- | '/_first'
- | '/posts'
- | '/special|pipe'
- | '/classic/hello'
- | '/posts/'
- | '/_first/_second-layout'
- | '/posts/$postId'
- | '/classic/hello/universe'
- | '/classic/hello/world'
- | '/classic/hello/'
- | '/_first/_second-layout/route-without-file/layout-a'
- | '/_first/_second-layout/route-without-file/layout-b'
+ to: '/' | '/special|pipe' | '/posts' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello' | '/route-without-file/layout-a' | '/route-without-file/layout-b'
+ id: '__root__' | '/' | '/_first' | '/posts' | '/special|pipe' | '/classic/hello' | '/posts/' | '/_first/_second-layout' | '/posts/$postId' | '/classic/hello/universe' | '/classic/hello/world' | '/classic/hello/' | '/_first/_second-layout/route-without-file/layout-a' | '/_first/_second-layout/route-without-file/layout-b'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -283,8 +247,7 @@ const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = {
bRoute: bRoute,
}
-const layoutSecondLayoutRouteWithChildren =
- layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
+const layoutSecondLayoutRouteWithChildren = layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren)
interface layoutFirstLayoutRouteChildren {
layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren
@@ -294,8 +257,7 @@ const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = {
layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren,
}
-const layoutFirstLayoutRouteWithChildren =
- layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
+const layoutFirstLayoutRouteWithChildren = layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren)
interface postsPostsRouteChildren {
postsPostsHomeRoute: typeof postsPostsHomeRoute
@@ -307,9 +269,7 @@ const postsPostsRouteChildren: postsPostsRouteChildren = {
postsPostsDetailRoute: postsPostsDetailRoute,
}
-const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(
- postsPostsRouteChildren,
-)
+const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren(postsPostsRouteChildren)
interface ClassicHelloRouteRouteChildren {
ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute
@@ -323,8 +283,7 @@ const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = {
ClassicHelloIndexRoute: ClassicHelloIndexRoute,
}
-const ClassicHelloRouteRouteWithChildren =
- ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
+const ClassicHelloRouteRouteWithChildren = ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren)
const rootRouteChildren: RootRouteChildren = {
homeRoute: homeRoute,
diff --git a/e2e/vue-start/website/src/routeTree.gen.ts b/e2e/vue-start/website/src/routeTree.gen.ts
index 0909725a4b..c5facba9b1 100644
--- a/e2e/vue-start/website/src/routeTree.gen.ts
+++ b/e2e/vue-start/website/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
@@ -44,36 +42,31 @@ const ProjectVersionDocsIndexRoute = ProjectVersionDocsIndexRouteImport.update({
path: '/$project/$version/docs/',
getParentRoute: () => rootRouteImport,
} as any)
-const LibraryProjectVersionIndexRoute =
- LibraryProjectVersionIndexRouteImport.update({
- id: '/$version/',
- path: '/$version/',
- getParentRoute: () => LibraryProjectRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkRoute =
- ProjectVersionDocsFrameworkFrameworkRouteImport.update({
- id: '/$project/$version/docs/framework/$framework',
- path: '/$project/$version/docs/framework/$framework',
- getParentRoute: () => rootRouteImport,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkIndexRoute =
- ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkSplatRoute =
- ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({
- id: '/$',
- path: '/$',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
-const ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute =
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({
- id: '/examples/$',
- path: '/examples/$',
- getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
- } as any)
+const LibraryProjectVersionIndexRoute = LibraryProjectVersionIndexRouteImport.update({
+ id: '/$version/',
+ path: '/$version/',
+ getParentRoute: () => LibraryProjectRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkRoute = ProjectVersionDocsFrameworkFrameworkRouteImport.update({
+ id: '/$project/$version/docs/framework/$framework',
+ path: '/$project/$version/docs/framework/$framework',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkIndexRoute = ProjectVersionDocsFrameworkFrameworkIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkSplatRoute = ProjectVersionDocsFrameworkFrameworkSplatRouteImport.update({
+ id: '/$',
+ path: '/$',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
+const ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute = ProjectVersionDocsFrameworkFrameworkExamplesSplatRouteImport.update({
+ id: '/examples/$',
+ path: '/examples/$',
+ getParentRoute: () => ProjectVersionDocsFrameworkFrameworkRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof LibraryIndexRoute
@@ -110,37 +103,10 @@ export interface FileRoutesById {
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths:
- | '/'
- | '/$project'
- | '/$project/'
- | '/$project/$version/docs/'
- | '/$project/$version/'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/'
- | '/$project/$version/docs/framework/$framework/examples/$'
+ fullPaths: '/' | '/$project' | '/$project/' | '/$project/$version/docs/' | '/$project/$version/' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/' | '/$project/$version/docs/framework/$framework/examples/$'
fileRoutesByTo: FileRoutesByTo
- to:
- | '/$project'
- | '/'
- | '/$project/$version/docs'
- | '/$project/$version'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/examples/$'
- id:
- | '__root__'
- | '/_library'
- | '/_library/$project'
- | '/$project/'
- | '/_library/'
- | '/$project/$version/docs/'
- | '/_library/$project/$version/'
- | '/$project/$version/docs/framework/$framework'
- | '/$project/$version/docs/framework/$framework/$'
- | '/$project/$version/docs/framework/$framework/'
- | '/$project/$version/docs/framework/$framework/examples/$'
+ to: '/$project' | '/' | '/$project/$version/docs' | '/$project/$version' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/examples/$'
+ id: '__root__' | '/_library' | '/_library/$project' | '/$project/' | '/_library/' | '/$project/$version/docs/' | '/_library/$project/$version/' | '/$project/$version/docs/framework/$framework' | '/$project/$version/docs/framework/$framework/$' | '/$project/$version/docs/framework/$framework/' | '/$project/$version/docs/framework/$framework/examples/$'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
@@ -233,9 +199,7 @@ const LibraryProjectRouteChildren: LibraryProjectRouteChildren = {
LibraryProjectVersionIndexRoute: LibraryProjectVersionIndexRoute,
}
-const LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(
- LibraryProjectRouteChildren,
-)
+const LibraryProjectRouteWithChildren = LibraryProjectRoute._addFileChildren(LibraryProjectRouteChildren)
interface LibraryRouteChildren {
LibraryProjectRoute: typeof LibraryProjectRouteWithChildren
@@ -247,8 +211,7 @@ const LibraryRouteChildren: LibraryRouteChildren = {
LibraryIndexRoute: LibraryIndexRoute,
}
-const LibraryRouteWithChildren =
- LibraryRoute._addFileChildren(LibraryRouteChildren)
+const LibraryRouteWithChildren = LibraryRoute._addFileChildren(LibraryRouteChildren)
interface ProjectVersionDocsFrameworkFrameworkRouteChildren {
ProjectVersionDocsFrameworkFrameworkSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkSplatRoute
@@ -256,27 +219,19 @@ interface ProjectVersionDocsFrameworkFrameworkRouteChildren {
ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: typeof ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute
}
-const ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren =
- {
- ProjectVersionDocsFrameworkFrameworkSplatRoute:
- ProjectVersionDocsFrameworkFrameworkSplatRoute,
- ProjectVersionDocsFrameworkFrameworkIndexRoute:
- ProjectVersionDocsFrameworkFrameworkIndexRoute,
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute:
- ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,
- }
+const ProjectVersionDocsFrameworkFrameworkRouteChildren: ProjectVersionDocsFrameworkFrameworkRouteChildren = {
+ ProjectVersionDocsFrameworkFrameworkSplatRoute: ProjectVersionDocsFrameworkFrameworkSplatRoute,
+ ProjectVersionDocsFrameworkFrameworkIndexRoute: ProjectVersionDocsFrameworkFrameworkIndexRoute,
+ ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute: ProjectVersionDocsFrameworkFrameworkExamplesSplatRoute,
+}
-const ProjectVersionDocsFrameworkFrameworkRouteWithChildren =
- ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(
- ProjectVersionDocsFrameworkFrameworkRouteChildren,
- )
+const ProjectVersionDocsFrameworkFrameworkRouteWithChildren = ProjectVersionDocsFrameworkFrameworkRoute._addFileChildren(ProjectVersionDocsFrameworkFrameworkRouteChildren)
const rootRouteChildren: RootRouteChildren = {
LibraryRoute: LibraryRouteWithChildren,
ProjectIndexRoute: ProjectIndexRoute,
ProjectVersionDocsIndexRoute: ProjectVersionDocsIndexRoute,
- ProjectVersionDocsFrameworkFrameworkRoute:
- ProjectVersionDocsFrameworkFrameworkRouteWithChildren,
+ ProjectVersionDocsFrameworkFrameworkRoute: ProjectVersionDocsFrameworkFrameworkRouteWithChildren,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
diff --git a/examples/react/authenticated-routes-firebase/package.json b/examples/react/authenticated-routes-firebase/package.json
index 1efa172047..e26dadccca 100644
--- a/examples/react/authenticated-routes-firebase/package.json
+++ b/examples/react/authenticated-routes-firebase/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"firebase": "^11.4.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/authenticated-routes/package.json b/examples/react/authenticated-routes/package.json
index 6af48f1d34..c745010274 100644
--- a/examples/react/authenticated-routes/package.json
+++ b/examples/react/authenticated-routes/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-default-search-params/package.json b/examples/react/basic-default-search-params/package.json
index 96c68fecd4..fcdb8b4b4a 100644
--- a/examples/react/basic-default-search-params/package.json
+++ b/examples/react/basic-default-search-params/package.json
@@ -12,7 +12,7 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-devtools-panel/package.json b/examples/react/basic-devtools-panel/package.json
index ccae95d73f..50b4568b7f 100644
--- a/examples/react/basic-devtools-panel/package.json
+++ b/examples/react/basic-devtools-panel/package.json
@@ -13,7 +13,7 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.67.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-file-based/package.json b/examples/react/basic-file-based/package.json
index 9c3cacada1..2e1319ed1e 100644
--- a/examples/react/basic-file-based/package.json
+++ b/examples/react/basic-file-based/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-non-nested-devtools/package.json b/examples/react/basic-non-nested-devtools/package.json
index 32e856ebcf..7c3d6c6f79 100644
--- a/examples/react/basic-non-nested-devtools/package.json
+++ b/examples/react/basic-non-nested-devtools/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-react-query-file-based/package.json b/examples/react/basic-react-query-file-based/package.json
index d01a02872e..0b834a7cf0 100644
--- a/examples/react/basic-react-query-file-based/package.json
+++ b/examples/react/basic-react-query-file-based/package.json
@@ -13,8 +13,8 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-react-query/package.json b/examples/react/basic-react-query/package.json
index edab96afac..beab9937e5 100644
--- a/examples/react/basic-react-query/package.json
+++ b/examples/react/basic-react-query/package.json
@@ -13,7 +13,7 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/basic-ssr-file-based/package.json b/examples/react/basic-ssr-file-based/package.json
index 3222c33e19..814b809d95 100644
--- a/examples/react/basic-ssr-file-based/package.json
+++ b/examples/react/basic-ssr-file-based/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"compression": "^1.8.0",
"express": "^5.2.1",
"get-port": "^7.1.0",
@@ -21,7 +21,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@types/express": "^5.0.6",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.1",
diff --git a/examples/react/basic-ssr-streaming-file-based/package.json b/examples/react/basic-ssr-streaming-file-based/package.json
index c3c87c8d88..7d105304e8 100644
--- a/examples/react/basic-ssr-streaming-file-based/package.json
+++ b/examples/react/basic-ssr-streaming-file-based/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"compression": "^1.8.0",
"express": "^5.2.1",
"get-port": "^7.1.0",
@@ -21,7 +21,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@types/express": "^5.0.6",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.1",
diff --git a/examples/react/basic-virtual-file-based/package.json b/examples/react/basic-virtual-file-based/package.json
index 84d326435c..1d24108ccd 100644
--- a/examples/react/basic-virtual-file-based/package.json
+++ b/examples/react/basic-virtual-file-based/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/virtual-file-routes": "^1.162.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/basic-virtual-inside-file-based/package.json b/examples/react/basic-virtual-inside-file-based/package.json
index c04cb6012e..ae26a2f457 100644
--- a/examples/react/basic-virtual-inside-file-based/package.json
+++ b/examples/react/basic-virtual-inside-file-based/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/virtual-file-routes": "^1.162.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/basic/package.json b/examples/react/basic/package.json
index 2c09a3dfdf..9806952f41 100644
--- a/examples/react/basic/package.json
+++ b/examples/react/basic/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/deferred-data/package.json b/examples/react/deferred-data/package.json
index 99afb661ee..271f2ca9dc 100644
--- a/examples/react/deferred-data/package.json
+++ b/examples/react/deferred-data/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/i18n-paraglide/package.json b/examples/react/i18n-paraglide/package.json
index 88140e8911..38f434614e 100644
--- a/examples/react/i18n-paraglide/package.json
+++ b/examples/react/i18n-paraglide/package.json
@@ -12,7 +12,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"tailwindcss": "^4.2.2"
diff --git a/examples/react/kitchen-sink-file-based/package.json b/examples/react/kitchen-sink-file-based/package.json
index e02defb3ce..8f35a00067 100644
--- a/examples/react/kitchen-sink-file-based/package.json
+++ b/examples/react/kitchen-sink-file-based/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"immer": "^10.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/kitchen-sink-react-query-file-based/package.json b/examples/react/kitchen-sink-react-query-file-based/package.json
index e3dd032ac2..fa553f179c 100644
--- a/examples/react/kitchen-sink-react-query-file-based/package.json
+++ b/examples/react/kitchen-sink-react-query-file-based/package.json
@@ -13,8 +13,8 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"immer": "^10.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/kitchen-sink-react-query/package.json b/examples/react/kitchen-sink-react-query/package.json
index 14d0dc8e86..ff1e16ff1e 100644
--- a/examples/react/kitchen-sink-react-query/package.json
+++ b/examples/react/kitchen-sink-react-query/package.json
@@ -13,7 +13,7 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"immer": "^10.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/kitchen-sink/package.json b/examples/react/kitchen-sink/package.json
index f738efc37e..bda799ad80 100644
--- a/examples/react/kitchen-sink/package.json
+++ b/examples/react/kitchen-sink/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"immer": "^10.1.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/large-file-based/package.json b/examples/react/large-file-based/package.json
index 23d469d120..a73d0412f0 100644
--- a/examples/react/large-file-based/package.json
+++ b/examples/react/large-file-based/package.json
@@ -14,8 +14,8 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/location-masking/package.json b/examples/react/location-masking/package.json
index fe005c0d2f..6b3a179cd2 100644
--- a/examples/react/location-masking/package.json
+++ b/examples/react/location-masking/package.json
@@ -13,7 +13,7 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/navigation-blocking/package.json b/examples/react/navigation-blocking/package.json
index a7677dfd51..d96b3266d9 100644
--- a/examples/react/navigation-blocking/package.json
+++ b/examples/react/navigation-blocking/package.json
@@ -12,7 +12,7 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/quickstart-esbuild-file-based/package.json b/examples/react/quickstart-esbuild-file-based/package.json
index d855694fec..f89c60f6fe 100644
--- a/examples/react/quickstart-esbuild-file-based/package.json
+++ b/examples/react/quickstart-esbuild-file-based/package.json
@@ -10,8 +10,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/quickstart-file-based/package.json b/examples/react/quickstart-file-based/package.json
index 976ec838d1..8143d3396e 100644
--- a/examples/react/quickstart-file-based/package.json
+++ b/examples/react/quickstart-file-based/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/quickstart-rspack-file-based/package.json b/examples/react/quickstart-rspack-file-based/package.json
index 824998f428..70d63eb170 100644
--- a/examples/react/quickstart-rspack-file-based/package.json
+++ b/examples/react/quickstart-rspack-file-based/package.json
@@ -10,16 +10,16 @@
"dependencies": {
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"postcss": "^8.5.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "^4.2.2"
},
"devDependencies": {
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-react": "^2.0.0",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@typescript/native": "npm:typescript@^7.0.2",
diff --git a/examples/react/quickstart-webpack-file-based/package.json b/examples/react/quickstart-webpack-file-based/package.json
index baa14b89dd..4182467a5a 100644
--- a/examples/react/quickstart-webpack-file-based/package.json
+++ b/examples/react/quickstart-webpack-file-based/package.json
@@ -8,13 +8,13 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@swc/core": "^1.15.33",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"html-webpack-plugin": "^5.6.3",
diff --git a/examples/react/quickstart/package.json b/examples/react/quickstart/package.json
index b6db476ea8..56cbfca20f 100644
--- a/examples/react/quickstart/package.json
+++ b/examples/react/quickstart/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "^4.2.2"
diff --git a/examples/react/router-monorepo-react-query/package.json b/examples/react/router-monorepo-react-query/package.json
index b158eeda56..ca69d9cc9e 100644
--- a/examples/react/router-monorepo-react-query/package.json
+++ b/examples/react/router-monorepo-react-query/package.json
@@ -13,8 +13,8 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1"
diff --git a/examples/react/router-monorepo-react-query/packages/app/package.json b/examples/react/router-monorepo-react-query/packages/app/package.json
index f0994165c2..59b68d58f0 100644
--- a/examples/react/router-monorepo-react-query/packages/app/package.json
+++ b/examples/react/router-monorepo-react-query/packages/app/package.json
@@ -16,7 +16,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
diff --git a/examples/react/router-monorepo-react-query/packages/router/package.json b/examples/react/router-monorepo-react-query/packages/router/package.json
index 1397db14b5..d7233b4b38 100644
--- a/examples/react/router-monorepo-react-query/packages/router/package.json
+++ b/examples/react/router-monorepo-react-query/packages/router/package.json
@@ -12,7 +12,7 @@
"@tanstack/history": "^1.162.5",
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/router-monorepo-simple-lazy/package.json b/examples/react/router-monorepo-simple-lazy/package.json
index e044d86681..a81c27cf47 100644
--- a/examples/react/router-monorepo-simple-lazy/package.json
+++ b/examples/react/router-monorepo-simple-lazy/package.json
@@ -9,8 +9,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1"
diff --git a/examples/react/router-monorepo-simple-lazy/packages/app/package.json b/examples/react/router-monorepo-simple-lazy/packages/app/package.json
index cfc7a94942..48d2ae7206 100644
--- a/examples/react/router-monorepo-simple-lazy/packages/app/package.json
+++ b/examples/react/router-monorepo-simple-lazy/packages/app/package.json
@@ -15,7 +15,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
diff --git a/examples/react/router-monorepo-simple-lazy/packages/router/package.json b/examples/react/router-monorepo-simple-lazy/packages/router/package.json
index afd4702b5d..7351c9fd5e 100644
--- a/examples/react/router-monorepo-simple-lazy/packages/router/package.json
+++ b/examples/react/router-monorepo-simple-lazy/packages/router/package.json
@@ -10,7 +10,7 @@
"dependencies": {
"@tanstack/history": "^1.162.5",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/router-monorepo-simple/package.json b/examples/react/router-monorepo-simple/package.json
index 800d948c81..1e804b9979 100644
--- a/examples/react/router-monorepo-simple/package.json
+++ b/examples/react/router-monorepo-simple/package.json
@@ -9,8 +9,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1"
diff --git a/examples/react/router-monorepo-simple/packages/app/package.json b/examples/react/router-monorepo-simple/packages/app/package.json
index a06431ef86..30f39f4a52 100644
--- a/examples/react/router-monorepo-simple/packages/app/package.json
+++ b/examples/react/router-monorepo-simple/packages/app/package.json
@@ -15,7 +15,7 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
diff --git a/examples/react/router-monorepo-simple/packages/router/package.json b/examples/react/router-monorepo-simple/packages/router/package.json
index 391b72e610..41181cd378 100644
--- a/examples/react/router-monorepo-simple/packages/router/package.json
+++ b/examples/react/router-monorepo-simple/packages/router/package.json
@@ -10,7 +10,7 @@
"dependencies": {
"@tanstack/history": "^1.162.5",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/router-monorepo-simple/packages/router/src/routeTree.gen.ts b/examples/react/router-monorepo-simple/packages/router/src/routeTree.gen.ts
index a4ed448d2f..5668e3be9c 100644
--- a/examples/react/router-monorepo-simple/packages/router/src/routeTree.gen.ts
+++ b/examples/react/router-monorepo-simple/packages/router/src/routeTree.gen.ts
@@ -1,7 +1,5 @@
/* eslint-disable */
-
// @ts-nocheck
-
// noinspection JSUnusedGlobalSymbols
// This file was automatically generated by TanStack Router.
diff --git a/examples/react/scroll-restoration/package.json b/examples/react/scroll-restoration/package.json
index 704ff13838..5d513bf905 100644
--- a/examples/react/scroll-restoration/package.json
+++ b/examples/react/scroll-restoration/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-virtual": "^3.13.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/search-validator-adapters/package.json b/examples/react/search-validator-adapters/package.json
index 35e041e825..607e6cfa83 100644
--- a/examples/react/search-validator-adapters/package.json
+++ b/examples/react/search-validator-adapters/package.json
@@ -14,8 +14,8 @@
"@tanstack/arktype-adapter": "^1.167.0",
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/valibot-adapter": "^1.167.0",
"@tanstack/zod-adapter": "^1.167.0",
"arktype": "^2.1.7",
diff --git a/examples/react/start-bare/package.json b/examples/react/start-bare/package.json
index 4ab9aff272..d626662971 100644
--- a/examples/react/start-bare/package.json
+++ b/examples/react/start-bare/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zod": "^4.4.3"
diff --git a/examples/react/start-basic-auth/package.json b/examples/react/start-basic-auth/package.json
index 9ab89bdac9..8b8e981580 100644
--- a/examples/react/start-basic-auth/package.json
+++ b/examples/react/start-basic-auth/package.json
@@ -15,8 +15,8 @@
"@prisma/adapter-libsql": "^7.0.0",
"@prisma/client": "^7.0.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"iron-session": "^9.0.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/start-basic-authjs/package.json b/examples/react/start-basic-authjs/package.json
index e9fa789ea6..775c90162f 100644
--- a/examples/react/start-basic-authjs/package.json
+++ b/examples/react/start-basic-authjs/package.json
@@ -12,8 +12,8 @@
"dependencies": {
"@auth/core": "^0.41.1",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"start-authjs": "^1.0.0",
diff --git a/examples/react/start-basic-cloudflare/package.json b/examples/react/start-basic-cloudflare/package.json
index 2108922446..8d82161bd0 100644
--- a/examples/react/start-basic-cloudflare/package.json
+++ b/examples/react/start-basic-cloudflare/package.json
@@ -13,8 +13,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
diff --git a/examples/react/start-basic-react-query/package.json b/examples/react/start-basic-react-query/package.json
index 9d819d4390..de2c3157d7 100644
--- a/examples/react/start-basic-react-query/package.json
+++ b/examples/react/start-basic-react-query/package.json
@@ -14,9 +14,9 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-router-ssr-query": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/start-basic-rsbuild/package.json b/examples/react/start-basic-rsbuild/package.json
index bea4ba26ef..99a9b74281 100644
--- a/examples/react/start-basic-rsbuild/package.json
+++ b/examples/react/start-basic-rsbuild/package.json
@@ -11,15 +11,15 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.2.3",
"react-dom": "^19.2.3",
"tailwind-merge": "^3.6.0",
"zod": "^4.4.3"
},
"devDependencies": {
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.0.11",
"@rsbuild/plugin-react": "^2.0.0",
"@rsbuild/plugin-tailwindcss": "^2.0.3",
"@types/node": "25.0.9",
diff --git a/examples/react/start-basic-static/package.json b/examples/react/start-basic-static/package.json
index 58d573ca36..52e55fe896 100644
--- a/examples/react/start-basic-static/package.json
+++ b/examples/react/start-basic-static/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"@tanstack/start-static-server-functions": "^1.167.44",
"@vitejs/plugin-react": "^6.0.1",
"react": "^19.0.0",
diff --git a/examples/react/start-basic/package.json b/examples/react/start-basic/package.json
index 46df8e4650..30addc113c 100644
--- a/examples/react/start-basic/package.json
+++ b/examples/react/start-basic/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwind-merge": "^3.6.0",
diff --git a/examples/react/start-bun/package.json b/examples/react/start-bun/package.json
index 24f7113912..8f5d271585 100644
--- a/examples/react/start-bun/package.json
+++ b/examples/react/start-bun/package.json
@@ -16,10 +16,10 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-devtools": "^0.7.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-router-ssr-query": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-start": "^1.169.4",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.1.1",
"react-dom": "^19.1.1",
"tailwindcss": "^4.2.2"
diff --git a/examples/react/start-clerk-basic/package.json b/examples/react/start-clerk-basic/package.json
index 022300e159..02540717f4 100644
--- a/examples/react/start-clerk-basic/package.json
+++ b/examples/react/start-clerk-basic/package.json
@@ -12,8 +12,8 @@
"dependencies": {
"@clerk/tanstack-react-start": "^0.27.14",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"@vitejs/plugin-react": "^6.0.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/start-convex-trellaux/package.json b/examples/react/start-convex-trellaux/package.json
index 3452f910d0..1773d38290 100644
--- a/examples/react/start-convex-trellaux/package.json
+++ b/examples/react/start-convex-trellaux/package.json
@@ -16,9 +16,9 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-router-ssr-query": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-start": "^1.169.4",
"concurrently": "^8.2.2",
"convex": "^1.19.0",
"ky": "^1.7.4",
diff --git a/examples/react/start-counter/package.json b/examples/react/start-counter/package.json
index 8f4673143e..be09023859 100644
--- a/examples/react/start-counter/package.json
+++ b/examples/react/start-counter/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
diff --git a/examples/react/start-i18n-paraglide/package.json b/examples/react/start-i18n-paraglide/package.json
index 074f714d5c..dcc538dcc1 100644
--- a/examples/react/start-i18n-paraglide/package.json
+++ b/examples/react/start-i18n-paraglide/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tanstack/react-devtools": "^0.7.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.1.1",
"react-dom": "^19.1.1"
},
diff --git a/examples/react/start-large/package.json b/examples/react/start-large/package.json
index f9f86b81d1..c1fce5e419 100644
--- a/examples/react/start-large/package.json
+++ b/examples/react/start-large/package.json
@@ -14,8 +14,8 @@
"dependencies": {
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/start-material-ui/package.json b/examples/react/start-material-ui/package.json
index 1647e95f20..b8fb8208d4 100644
--- a/examples/react/start-material-ui/package.json
+++ b/examples/react/start-material-ui/package.json
@@ -16,8 +16,8 @@
"@fontsource-variable/roboto": "5.2.5",
"@mui/material": "6.4.7",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zod": "^4.4.3"
diff --git a/examples/react/start-next-migration/README.md b/examples/react/start-next-migration/README.md
index 03bb53244e..5b80b006b3 100644
--- a/examples/react/start-next-migration/README.md
+++ b/examples/react/start-next-migration/README.md
@@ -6,7 +6,7 @@ The private page saves one article in an encrypted session cookie. This keeps th
## Run
-Use Node 24 or newer and pnpm 12. From the repository root:
+Use Node 24 or newer and pnpm 11. From the repository root:
```sh
pnpm install
diff --git a/examples/react/start-next-migration/package.json b/examples/react/start-next-migration/package.json
index 0c2a2a9563..6aed1b9896 100644
--- a/examples/react/start-next-migration/package.json
+++ b/examples/react/start-next-migration/package.json
@@ -13,7 +13,7 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-start": "^1.169.4",
"iron-session": "^9.0.1",
"next": "16.3.4",
"react": "^19.2.3",
diff --git a/examples/react/start-rscs/package.json b/examples/react/start-rscs/package.json
index 00c88681d7..4b8337086e 100644
--- a/examples/react/start-rscs/package.json
+++ b/examples/react/start-rscs/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"dexie": "^4.0.10",
"react": "^19.2.0",
"react-dom": "^19.2.0",
@@ -26,7 +26,7 @@
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"@vitejs/plugin-react": "^6.0.1",
- "@vitejs/plugin-rsc": "^0.5.39",
+ "@vitejs/plugin-rsc": "^0.5.37",
"nitro": "^3.0.260903-beta",
"tailwindcss": "^4.1.18",
"typescript": "^5.7.2",
diff --git a/examples/react/start-streaming-data-from-server-functions/package.json b/examples/react/start-streaming-data-from-server-functions/package.json
index 762bbff733..f74dfc467a 100644
--- a/examples/react/start-streaming-data-from-server-functions/package.json
+++ b/examples/react/start-streaming-data-from-server-functions/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"zod": "^4.4.3"
diff --git a/examples/react/start-supabase-basic/package.json b/examples/react/start-supabase-basic/package.json
index 0bf4b2c246..8a25cf4c76 100644
--- a/examples/react/start-supabase-basic/package.json
+++ b/examples/react/start-supabase-basic/package.json
@@ -16,8 +16,8 @@
"@supabase/ssr": "^0.5.2",
"@supabase/supabase-js": "^2.48.1",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1"
diff --git a/examples/react/start-tailwind-v4/package.json b/examples/react/start-tailwind-v4/package.json
index b58fbe4ff0..6603630a2e 100644
--- a/examples/react/start-tailwind-v4/package.json
+++ b/examples/react/start-tailwind-v4/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwind-merge": "^3.6.0",
diff --git a/examples/react/start-trellaux/package.json b/examples/react/start-trellaux/package.json
index 7755d227fc..d95a37423a 100644
--- a/examples/react/start-trellaux/package.json
+++ b/examples/react/start-trellaux/package.json
@@ -13,9 +13,9 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"@tanstack/react-router-ssr-query": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-start": "^1.169.4",
"ky": "^1.7.4",
"msw": "^2.7.0",
"react": "^19.0.0",
diff --git a/examples/react/start-workos/package.json b/examples/react/start-workos/package.json
index 0ab7e89c2d..6985faff7c 100644
--- a/examples/react/start-workos/package.json
+++ b/examples/react/start-workos/package.json
@@ -15,8 +15,8 @@
"dependencies": {
"@radix-ui/themes": "^3.3.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/react-start": "^1.169.6",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/react-start": "^1.169.4",
"@workos/authkit-tanstack-react-start": "^0.5.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
diff --git a/examples/react/view-transitions/package.json b/examples/react/view-transitions/package.json
index 0be3c60e8f..6f55140395 100644
--- a/examples/react/view-transitions/package.json
+++ b/examples/react/view-transitions/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "^0.5.1",
diff --git a/examples/react/with-framer-motion/package.json b/examples/react/with-framer-motion/package.json
index c606070dfb..423335b6f1 100644
--- a/examples/react/with-framer-motion/package.json
+++ b/examples/react/with-framer-motion/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
+ "@tanstack/react-router-devtools": "^1.167.2",
"framer-motion": "^11.18.2",
"react": "^19.0.0",
"react-dom": "^19.0.0",
diff --git a/examples/react/with-trpc-react-query/package.json b/examples/react/with-trpc-react-query/package.json
index 11df7bf03b..be8372f948 100644
--- a/examples/react/with-trpc-react-query/package.json
+++ b/examples/react/with-trpc-react-query/package.json
@@ -14,8 +14,8 @@
"@tanstack/react-query": "^5.102.0",
"@tanstack/react-query-devtools": "^5.90.0",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@trpc/client": "^11.4.3",
"@trpc/server": "^11.4.3",
"@trpc/tanstack-react-query": "^11.4.3",
diff --git a/examples/react/with-trpc/package.json b/examples/react/with-trpc/package.json
index 5612419cae..689ce67fd6 100644
--- a/examples/react/with-trpc/package.json
+++ b/examples/react/with-trpc/package.json
@@ -12,8 +12,8 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/react-router": "^1.170.46",
- "@tanstack/react-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/react-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@trpc/client": "^11.4.3",
"@trpc/server": "^11.4.3",
"express": "^5.2.1",
diff --git a/examples/solid/authenticated-routes-firebase/package.json b/examples/solid/authenticated-routes-firebase/package.json
index 110b4d2621..d9a532f1ac 100644
--- a/examples/solid/authenticated-routes-firebase/package.json
+++ b/examples/solid/authenticated-routes-firebase/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"firebase": "^11.4.0",
"redaxios": "^0.5.1",
"simple-icons": "^14.9.0",
diff --git a/examples/solid/authenticated-routes/package.json b/examples/solid/authenticated-routes/package.json
index ea7d05c902..011f592c9b 100644
--- a/examples/solid/authenticated-routes/package.json
+++ b/examples/solid/authenticated-routes/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
diff --git a/examples/solid/basic-default-search-params/package.json b/examples/solid/basic-default-search-params/package.json
index 830df7b9cf..e1a89b241e 100644
--- a/examples/solid/basic-default-search-params/package.json
+++ b/examples/solid/basic-default-search-params/package.json
@@ -12,7 +12,7 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
diff --git a/examples/solid/basic-devtools-panel/package.json b/examples/solid/basic-devtools-panel/package.json
index e7d608f5fe..5b696bb768 100644
--- a/examples/solid/basic-devtools-panel/package.json
+++ b/examples/solid/basic-devtools-panel/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
diff --git a/examples/solid/basic-file-based/package.json b/examples/solid/basic-file-based/package.json
index 867118382e..d13c9ad688 100644
--- a/examples/solid/basic-file-based/package.json
+++ b/examples/solid/basic-file-based/package.json
@@ -11,14 +11,14 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
"zod": "^4.4.3"
},
"devDependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/examples/solid/basic-non-nested-devtools/package.json b/examples/solid/basic-non-nested-devtools/package.json
index c8e00ee43e..1088c3c9f4 100644
--- a/examples/solid/basic-non-nested-devtools/package.json
+++ b/examples/solid/basic-non-nested-devtools/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
diff --git a/examples/solid/basic-solid-query-file-based/package.json b/examples/solid/basic-solid-query-file-based/package.json
index fdb5f05f52..ad7f1b2482 100644
--- a/examples/solid/basic-solid-query-file-based/package.json
+++ b/examples/solid/basic-solid-query-file-based/package.json
@@ -14,14 +14,14 @@
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-query-devtools": "^5.90.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
"zod": "^4.4.3"
},
"devDependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/examples/solid/basic-solid-query/package.json b/examples/solid/basic-solid-query/package.json
index 7b132b11a1..a49fe786bd 100644
--- a/examples/solid/basic-solid-query/package.json
+++ b/examples/solid/basic-solid-query/package.json
@@ -13,13 +13,13 @@
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-query-devtools": "^5.90.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
},
"devDependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/examples/solid/basic-ssr-file-based/package.json b/examples/solid/basic-ssr-file-based/package.json
index e3699970a9..1a3f120894 100644
--- a/examples/solid/basic-ssr-file-based/package.json
+++ b/examples/solid/basic-ssr-file-based/package.json
@@ -12,7 +12,7 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"compression": "^1.8.0",
"express": "^5.2.1",
"get-port": "^7.1.0",
@@ -20,7 +20,7 @@
"solid-js": "^1.9.10"
},
"devDependencies": {
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@types/express": "^5.0.6",
"vite-plugin-solid": "^2.11.11",
"@typescript/native": "npm:typescript@^7.0.2",
diff --git a/examples/solid/basic-ssr-streaming-file-based/package.json b/examples/solid/basic-ssr-streaming-file-based/package.json
index 92367442fc..a5f56f06af 100644
--- a/examples/solid/basic-ssr-streaming-file-based/package.json
+++ b/examples/solid/basic-ssr-streaming-file-based/package.json
@@ -13,7 +13,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"compression": "^1.8.0",
"express": "^5.2.1",
"get-port": "^7.1.0",
@@ -24,7 +24,7 @@
"zod": "^4.4.3"
},
"devDependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@types/express": "^5.0.6",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
diff --git a/examples/solid/basic-virtual-file-based/package.json b/examples/solid/basic-virtual-file-based/package.json
index 801b452192..75c05b3f62 100644
--- a/examples/solid/basic-virtual-file-based/package.json
+++ b/examples/solid/basic-virtual-file-based/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@tanstack/virtual-file-routes": "^1.162.0",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/basic-virtual-inside-file-based/package.json b/examples/solid/basic-virtual-inside-file-based/package.json
index a9cc6360a5..8a37fc55d2 100644
--- a/examples/solid/basic-virtual-inside-file-based/package.json
+++ b/examples/solid/basic-virtual-inside-file-based/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@tanstack/virtual-file-routes": "^1.162.0",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/basic/package.json b/examples/solid/basic/package.json
index 95ec804011..c3c95f36f2 100644
--- a/examples/solid/basic/package.json
+++ b/examples/solid/basic/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
diff --git a/examples/solid/deferred-data/package.json b/examples/solid/deferred-data/package.json
index 56114afd04..b232469dc6 100644
--- a/examples/solid/deferred-data/package.json
+++ b/examples/solid/deferred-data/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
diff --git a/examples/solid/i18n-paraglide/package.json b/examples/solid/i18n-paraglide/package.json
index 6493a3c7c8..8fdc14eacf 100644
--- a/examples/solid/i18n-paraglide/package.json
+++ b/examples/solid/i18n-paraglide/package.json
@@ -12,7 +12,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
},
diff --git a/examples/solid/kitchen-sink-file-based/package.json b/examples/solid/kitchen-sink-file-based/package.json
index 8cd73e38ff..973fb46035 100644
--- a/examples/solid/kitchen-sink-file-based/package.json
+++ b/examples/solid/kitchen-sink-file-based/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"immer": "^10.1.1",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
@@ -19,7 +19,7 @@
"zod": "^4.4.3"
},
"devDependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/examples/solid/kitchen-sink-solid-query-file-based/package.json b/examples/solid/kitchen-sink-solid-query-file-based/package.json
index 25a1c29953..88047c13c5 100644
--- a/examples/solid/kitchen-sink-solid-query-file-based/package.json
+++ b/examples/solid/kitchen-sink-solid-query-file-based/package.json
@@ -10,11 +10,11 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-query-devtools": "^5.90.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"immer": "^10.1.1",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/kitchen-sink-solid-query/package.json b/examples/solid/kitchen-sink-solid-query/package.json
index 7a7dc81025..fba006a731 100644
--- a/examples/solid/kitchen-sink-solid-query/package.json
+++ b/examples/solid/kitchen-sink-solid-query/package.json
@@ -13,7 +13,7 @@
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-query-devtools": "^5.90.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"immer": "^10.1.1",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/kitchen-sink/package.json b/examples/solid/kitchen-sink/package.json
index 08ad918a60..43b3398dae 100644
--- a/examples/solid/kitchen-sink/package.json
+++ b/examples/solid/kitchen-sink/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"immer": "^10.1.1",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/large-file-based/package.json b/examples/solid/large-file-based/package.json
index cd758ab704..865c546ff9 100644
--- a/examples/solid/large-file-based/package.json
+++ b/examples/solid/large-file-based/package.json
@@ -12,10 +12,10 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
diff --git a/examples/solid/location-masking/package.json b/examples/solid/location-masking/package.json
index 7d2fbb6756..70575bba7f 100644
--- a/examples/solid/location-masking/package.json
+++ b/examples/solid/location-masking/package.json
@@ -12,7 +12,7 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1",
"tailwindcss": "^4.2.2"
diff --git a/examples/solid/navigation-blocking/package.json b/examples/solid/navigation-blocking/package.json
index 2338d32305..dc313e141f 100644
--- a/examples/solid/navigation-blocking/package.json
+++ b/examples/solid/navigation-blocking/package.json
@@ -12,7 +12,7 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1",
"tailwindcss": "^4.2.2"
diff --git a/examples/solid/quickstart-esbuild-file-based/package.json b/examples/solid/quickstart-esbuild-file-based/package.json
index 9bcc9a08d0..046914f727 100644
--- a/examples/solid/quickstart-esbuild-file-based/package.json
+++ b/examples/solid/quickstart-esbuild-file-based/package.json
@@ -9,9 +9,9 @@
"start": "dev"
},
"dependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
diff --git a/examples/solid/quickstart-file-based/package.json b/examples/solid/quickstart-file-based/package.json
index 920154566d..260f842631 100644
--- a/examples/solid/quickstart-file-based/package.json
+++ b/examples/solid/quickstart-file-based/package.json
@@ -11,14 +11,14 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
"zod": "^4.4.3"
},
"devDependencies": {
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/examples/solid/quickstart-rspack-file-based/package.json b/examples/solid/quickstart-rspack-file-based/package.json
index 2d9c886ac3..fbe8bb80f1 100644
--- a/examples/solid/quickstart-rspack-file-based/package.json
+++ b/examples/solid/quickstart-rspack-file-based/package.json
@@ -10,16 +10,16 @@
"dependencies": {
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"postcss": "^8.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
},
"devDependencies": {
- "@rsbuild/core": "^2.3.1",
+ "@rsbuild/core": "^2.1.0",
"@rsbuild/plugin-babel": "^1.1.2",
- "@rsbuild/plugin-solid": "^1.1.1",
- "@tanstack/router-plugin": "^1.169.0",
+ "@rsbuild/plugin-solid": "^1.2.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2"
}
diff --git a/examples/solid/quickstart-webpack-file-based/package.json b/examples/solid/quickstart-webpack-file-based/package.json
index 16167be207..3cc07a94a2 100644
--- a/examples/solid/quickstart-webpack-file-based/package.json
+++ b/examples/solid/quickstart-webpack-file-based/package.json
@@ -8,14 +8,14 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
},
"devDependencies": {
"@babel/core": "^7.28.5",
"@babel/preset-typescript": "^7.27.1",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"babel-loader": "^10.0.0",
"babel-preset-solid": "^1.9.10",
"css-loader": "^7.1.2",
diff --git a/examples/solid/quickstart/package.json b/examples/solid/quickstart/package.json
index 454382e8cc..d506268f5d 100644
--- a/examples/solid/quickstart/package.json
+++ b/examples/solid/quickstart/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
},
diff --git a/examples/solid/router-monorepo-simple-lazy/package.json b/examples/solid/router-monorepo-simple-lazy/package.json
index 1d60ab2765..06d266a496 100644
--- a/examples/solid/router-monorepo-simple-lazy/package.json
+++ b/examples/solid/router-monorepo-simple-lazy/package.json
@@ -9,8 +9,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1"
},
diff --git a/examples/solid/router-monorepo-simple-lazy/packages/app/package.json b/examples/solid/router-monorepo-simple-lazy/packages/app/package.json
index a2e018fa96..976a2ad861 100644
--- a/examples/solid/router-monorepo-simple-lazy/packages/app/package.json
+++ b/examples/solid/router-monorepo-simple-lazy/packages/app/package.json
@@ -20,7 +20,7 @@
"@vitejs/plugin-react": "^6.0.1",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"tailwindcss": "^4.2.2",
"vite": "^8.0.14",
"vite-plugin-dts": "^4.5.4",
diff --git a/examples/solid/router-monorepo-simple-lazy/packages/router/package.json b/examples/solid/router-monorepo-simple-lazy/packages/router/package.json
index 0672c42931..af8222f005 100644
--- a/examples/solid/router-monorepo-simple-lazy/packages/router/package.json
+++ b/examples/solid/router-monorepo-simple-lazy/packages/router/package.json
@@ -10,7 +10,7 @@
"dependencies": {
"@tanstack/history": "^1.162.5",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"redaxios": "^0.5.1",
"zod": "^4.4.3",
"solid-js": "^1.9.10"
diff --git a/examples/solid/router-monorepo-simple/package.json b/examples/solid/router-monorepo-simple/package.json
index 3770256692..2ce67a1a5f 100644
--- a/examples/solid/router-monorepo-simple/package.json
+++ b/examples/solid/router-monorepo-simple/package.json
@@ -9,8 +9,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1"
},
diff --git a/examples/solid/router-monorepo-simple/packages/app/package.json b/examples/solid/router-monorepo-simple/packages/app/package.json
index 61234ac455..b10a4109b5 100644
--- a/examples/solid/router-monorepo-simple/packages/app/package.json
+++ b/examples/solid/router-monorepo-simple/packages/app/package.json
@@ -17,7 +17,7 @@
"vite-plugin-solid": "^2.11.11",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"vite": "^8.0.14",
"tailwindcss": "^4.2.2",
"vite-plugin-dts": "^4.5.4",
diff --git a/examples/solid/router-monorepo-simple/packages/router/package.json b/examples/solid/router-monorepo-simple/packages/router/package.json
index ca08511d3e..efb23a7d7e 100644
--- a/examples/solid/router-monorepo-simple/packages/router/package.json
+++ b/examples/solid/router-monorepo-simple/packages/router/package.json
@@ -10,7 +10,7 @@
"dependencies": {
"@tanstack/history": "^1.162.5",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"redaxios": "^0.5.1",
"zod": "^4.4.3",
"solid-js": "^1.9.10"
diff --git a/examples/solid/router-monorepo-solid-query/package.json b/examples/solid/router-monorepo-solid-query/package.json
index 3d9fd2e2d0..813d3ebbb0 100644
--- a/examples/solid/router-monorepo-solid-query/package.json
+++ b/examples/solid/router-monorepo-solid-query/package.json
@@ -13,8 +13,8 @@
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-query-devtools": "^5.90.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1"
},
diff --git a/examples/solid/router-monorepo-solid-query/packages/app/package.json b/examples/solid/router-monorepo-solid-query/packages/app/package.json
index 76bb059de5..80f711e201 100644
--- a/examples/solid/router-monorepo-solid-query/packages/app/package.json
+++ b/examples/solid/router-monorepo-solid-query/packages/app/package.json
@@ -18,7 +18,7 @@
"vite-plugin-solid": "^2.11.11",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"tailwindcss": "^4.2.2",
"vite": "^8.0.14",
"vite-plugin-dts": "^4.5.4",
diff --git a/examples/solid/router-monorepo-solid-query/packages/router/package.json b/examples/solid/router-monorepo-solid-query/packages/router/package.json
index 93943a1df8..ff918732c8 100644
--- a/examples/solid/router-monorepo-solid-query/packages/router/package.json
+++ b/examples/solid/router-monorepo-solid-query/packages/router/package.json
@@ -11,7 +11,7 @@
"@tanstack/history": "^1.162.5",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@router-solid-mono-solid-query/post-query": "workspace:*",
"redaxios": "^0.5.1",
"zod": "^4.4.3",
diff --git a/examples/solid/scroll-restoration/package.json b/examples/solid/scroll-restoration/package.json
index eaa5a5aaea..7601594ed7 100644
--- a/examples/solid/scroll-restoration/package.json
+++ b/examples/solid/scroll-restoration/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@tanstack/solid-virtual": "^3.13.0",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
diff --git a/examples/solid/search-validator-adapters/package.json b/examples/solid/search-validator-adapters/package.json
index 59991edb36..f31c64e344 100644
--- a/examples/solid/search-validator-adapters/package.json
+++ b/examples/solid/search-validator-adapters/package.json
@@ -14,8 +14,8 @@
"@tanstack/arktype-adapter": "^1.167.0",
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/valibot-adapter": "^1.167.0",
"@tanstack/zod-adapter": "^1.167.0",
"arktype": "^2.1.7",
diff --git a/examples/solid/start-basic-auth/package.json b/examples/solid/start-basic-auth/package.json
index d686fdf616..df6b080935 100644
--- a/examples/solid/start-basic-auth/package.json
+++ b/examples/solid/start-basic-auth/package.json
@@ -15,8 +15,8 @@
"@prisma/adapter-libsql": "^7.0.0",
"@prisma/client": "^7.0.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"iron-session": "^9.0.1",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/start-basic-authjs/package.json b/examples/solid/start-basic-authjs/package.json
index 2c910663bd..5e5b381897 100644
--- a/examples/solid/start-basic-authjs/package.json
+++ b/examples/solid/start-basic-authjs/package.json
@@ -12,8 +12,8 @@
"dependencies": {
"@auth/core": "^0.41.1",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10",
"start-authjs": "^1.0.0",
"tailwind-merge": "^3.6.0"
diff --git a/examples/solid/start-basic-cloudflare/package.json b/examples/solid/start-basic-cloudflare/package.json
index 7ece143f61..7606c9d415 100644
--- a/examples/solid/start-basic-cloudflare/package.json
+++ b/examples/solid/start-basic-cloudflare/package.json
@@ -13,8 +13,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10"
},
"devDependencies": {
diff --git a/examples/solid/start-basic-netlify/package.json b/examples/solid/start-basic-netlify/package.json
index 69299cdb79..8a82148171 100644
--- a/examples/solid/start-basic-netlify/package.json
+++ b/examples/solid/start-basic-netlify/package.json
@@ -10,8 +10,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10"
},
"devDependencies": {
diff --git a/examples/solid/start-basic-nitro/package.json b/examples/solid/start-basic-nitro/package.json
index 2c0dc7dad6..3c8b986f8c 100644
--- a/examples/solid/start-basic-nitro/package.json
+++ b/examples/solid/start-basic-nitro/package.json
@@ -10,8 +10,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10"
},
"devDependencies": {
diff --git a/examples/solid/start-basic-solid-query/package.json b/examples/solid/start-basic-solid-query/package.json
index ddbb7d8764..c59a56bb85 100644
--- a/examples/solid/start-basic-solid-query/package.json
+++ b/examples/solid/start-basic-solid-query/package.json
@@ -13,9 +13,9 @@
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-query-devtools": "^5.90.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@tanstack/solid-router-ssr-query": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-start": "^1.169.4",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwind-merge": "^3.6.0"
diff --git a/examples/solid/start-basic-static/package.json b/examples/solid/start-basic-static/package.json
index 8b639da68a..93a129e547 100644
--- a/examples/solid/start-basic-static/package.json
+++ b/examples/solid/start-basic-static/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"@tanstack/start-static-server-functions": "^1.167.44",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
diff --git a/examples/solid/start-basic/package.json b/examples/solid/start-basic/package.json
index 758815b669..f9b164b601 100644
--- a/examples/solid/start-basic/package.json
+++ b/examples/solid/start-basic/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwind-merge": "^3.6.0"
diff --git a/examples/solid/start-bun/package.json b/examples/solid/start-bun/package.json
index d1ad9a9563..1c089e294a 100644
--- a/examples/solid/start-bun/package.json
+++ b/examples/solid/start-bun/package.json
@@ -16,10 +16,10 @@
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-devtools": "^0.7.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@tanstack/solid-router-ssr-query": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/solid-start": "^1.169.4",
+ "@tanstack/router-plugin": "^1.168.48",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2"
},
diff --git a/examples/solid/start-convex-better-auth/package.json b/examples/solid/start-convex-better-auth/package.json
index ea13a1c1e3..6779381b06 100644
--- a/examples/solid/start-convex-better-auth/package.json
+++ b/examples/solid/start-convex-better-auth/package.json
@@ -14,8 +14,8 @@
"@convex-dev/better-auth": "^0.9.7",
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"better-auth": "^1.6.19",
"clsx": "^2.1.1",
"convex": "^1.28.2",
diff --git a/examples/solid/start-counter/package.json b/examples/solid/start-counter/package.json
index 8b49c516bd..50f3c58a57 100644
--- a/examples/solid/start-counter/package.json
+++ b/examples/solid/start-counter/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwind-merge": "^3.6.0",
diff --git a/examples/solid/start-i18n-paraglide/package.json b/examples/solid/start-i18n-paraglide/package.json
index 076c9b41dc..0cd0761b2f 100644
--- a/examples/solid/start-i18n-paraglide/package.json
+++ b/examples/solid/start-i18n-paraglide/package.json
@@ -11,8 +11,8 @@
"dependencies": {
"@tanstack/solid-devtools": "^0.7.0",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10"
},
"devDependencies": {
diff --git a/examples/solid/start-large/package.json b/examples/solid/start-large/package.json
index 83f3589cc2..4f22baef4d 100644
--- a/examples/solid/start-large/package.json
+++ b/examples/solid/start-large/package.json
@@ -14,8 +14,8 @@
"dependencies": {
"@tanstack/solid-query": "^5.90.9",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwind-merge": "^3.6.0",
diff --git a/examples/solid/start-streaming-data-from-server-functions/package.json b/examples/solid/start-streaming-data-from-server-functions/package.json
index 83e0719b39..6ed27d1d01 100644
--- a/examples/solid/start-streaming-data-from-server-functions/package.json
+++ b/examples/solid/start-streaming-data-from-server-functions/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10",
"zod": "^4.4.3"
},
diff --git a/examples/solid/start-supabase-basic/package.json b/examples/solid/start-supabase-basic/package.json
index 81ab5cd63c..7fe4cc89ca 100644
--- a/examples/solid/start-supabase-basic/package.json
+++ b/examples/solid/start-supabase-basic/package.json
@@ -15,8 +15,8 @@
"@supabase/ssr": "^0.5.2",
"@supabase/supabase-js": "^2.48.1",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.9",
"redaxios": "^0.5.1"
},
diff --git a/examples/solid/start-tailwind-v4/package.json b/examples/solid/start-tailwind-v4/package.json
index 94db6ac790..fbad440ffe 100644
--- a/examples/solid/start-tailwind-v4/package.json
+++ b/examples/solid/start-tailwind-v4/package.json
@@ -11,8 +11,8 @@
},
"dependencies": {
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
- "@tanstack/solid-start": "^1.169.6",
+ "@tanstack/solid-router-devtools": "^1.167.2",
+ "@tanstack/solid-start": "^1.169.4",
"solid-js": "^1.9.10",
"tailwind-merge": "^3.6.0",
"zod": "^4.4.3"
diff --git a/examples/solid/view-transitions/package.json b/examples/solid/view-transitions/package.json
index 2acb2432bf..197e5af2da 100644
--- a/examples/solid/view-transitions/package.json
+++ b/examples/solid/view-transitions/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"tailwindcss": "^4.2.2",
diff --git a/examples/solid/with-framer-motion/package.json b/examples/solid/with-framer-motion/package.json
index 449d8a3927..93862c5988 100644
--- a/examples/solid/with-framer-motion/package.json
+++ b/examples/solid/with-framer-motion/package.json
@@ -11,7 +11,7 @@
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"solid-js": "^1.9.10",
"solid-motionone": "^1.0.4",
diff --git a/examples/solid/with-trpc/package.json b/examples/solid/with-trpc/package.json
index 46d33436db..67de3f02e4 100644
--- a/examples/solid/with-trpc/package.json
+++ b/examples/solid/with-trpc/package.json
@@ -11,9 +11,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/solid-router": "^1.170.43",
- "@tanstack/solid-router-devtools": "^1.167.3",
+ "@tanstack/solid-router-devtools": "^1.167.2",
"@trpc/client": "^11.4.3",
"@trpc/server": "^11.4.3",
"express": "^5.2.1",
diff --git a/examples/vue/basic-file-based-jsx/package.json b/examples/vue/basic-file-based-jsx/package.json
index 9cc36a6991..d03a2f5000 100644
--- a/examples/vue/basic-file-based-jsx/package.json
+++ b/examples/vue/basic-file-based-jsx/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/vue-router": "^1.170.42",
- "@tanstack/vue-router-devtools": "^1.167.3",
+ "@tanstack/vue-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"tailwindcss": "^4.2.2",
"vue": "^3.5.16",
diff --git a/examples/vue/basic-file-based-jsx/src/routeTree.gen.ts b/examples/vue/basic-file-based-jsx/src/routeTree.gen.ts
index 5922c5f7b1..3922025c82 100644
--- a/examples/vue/basic-file-based-jsx/src/routeTree.gen.ts
+++ b/examples/vue/basic-file-based-jsx/src/routeTree.gen.ts
@@ -364,7 +364,7 @@ declare module '@tanstack/vue-router' {
'/(group)/_layout': {
id: '/(group)/_layout'
path: ''
- fullPath: '/'
+ fullPath: ''
preLoaderRoute: typeof groupLayoutRouteImport
parentRoute: typeof rootRouteImport
}
diff --git a/examples/vue/basic-file-based-sfc/package.json b/examples/vue/basic-file-based-sfc/package.json
index 87ab2c332b..4e7b234af3 100644
--- a/examples/vue/basic-file-based-sfc/package.json
+++ b/examples/vue/basic-file-based-sfc/package.json
@@ -10,9 +10,9 @@
},
"dependencies": {
"@tailwindcss/vite": "^4.2.2",
- "@tanstack/router-plugin": "^1.169.0",
+ "@tanstack/router-plugin": "^1.168.48",
"@tanstack/vue-router": "^1.170.42",
- "@tanstack/vue-router-devtools": "^1.167.3",
+ "@tanstack/vue-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"tailwindcss": "^4.2.2",
"vue": "^3.5.16",
diff --git a/examples/vue/basic-file-based-sfc/src/routeTree.gen.ts b/examples/vue/basic-file-based-sfc/src/routeTree.gen.ts
index 0bfdddab3d..09d62b0706 100644
--- a/examples/vue/basic-file-based-sfc/src/routeTree.gen.ts
+++ b/examples/vue/basic-file-based-sfc/src/routeTree.gen.ts
@@ -454,7 +454,7 @@ declare module '@tanstack/vue-router' {
'/(group)/_layout': {
id: '/(group)/_layout'
path: ''
- fullPath: '/'
+ fullPath: ''
preLoaderRoute: typeof groupLayoutRouteImport
parentRoute: typeof rootRouteImport
}
diff --git a/examples/vue/basic/package.json b/examples/vue/basic/package.json
index af74afff3a..39b20a108b 100644
--- a/examples/vue/basic/package.json
+++ b/examples/vue/basic/package.json
@@ -10,7 +10,7 @@
},
"dependencies": {
"@tanstack/vue-router": "^1.170.42",
- "@tanstack/vue-router-devtools": "^1.167.3",
+ "@tanstack/vue-router-devtools": "^1.167.2",
"redaxios": "^0.5.1",
"vue": "^3.5.13",
"tailwindcss": "4.1.18"
diff --git a/nx.json b/nx.json
index b7df8b2c09..08008c703f 100644
--- a/nx.json
+++ b/nx.json
@@ -62,12 +62,34 @@
"dependsOn": ["^build"],
"inputs": [
"default",
+ "!{projectRoot}/tests/integration/**/*",
"^production",
"{workspaceRoot}/eslint.config.js",
"dependentTaskOutputs"
],
"outputs": ["{projectRoot}/coverage"]
},
+ "test:integration": {
+ "cache": true,
+ "dependsOn": ["^build"],
+ "inputs": [
+ "default",
+ "^production",
+ "{workspaceRoot}/eslint.config.js",
+ "dependentTaskOutputs"
+ ],
+ "outputs": ["{projectRoot}/coverage"]
+ },
+ "test:integration:smoke": {
+ "cache": true,
+ "dependsOn": ["^build"],
+ "inputs": [
+ "default",
+ "^production",
+ "{workspaceRoot}/eslint.config.js",
+ "dependentTaskOutputs"
+ ]
+ },
"test:e2e": {
"cache": true,
"dependsOn": ["^build", "test:e2e--*"],
@@ -152,6 +174,18 @@
},
"test:e2e*": {
"parallelism": false
+ },
+ "test:noncompiler": {
+ "cache": true,
+ "dependsOn": ["^build"],
+ "inputs": [
+ "default",
+ "!{projectRoot}/tests/integration/**/*",
+ "^production",
+ "{workspaceRoot}/eslint.config.js",
+ "dependentTaskOutputs"
+ ],
+ "outputs": ["{projectRoot}/coverage"]
}
},
"plugins": [
diff --git a/package.json b/package.json
index 3ef11b1969..46da009733 100644
--- a/package.json
+++ b/package.json
@@ -5,19 +5,20 @@
"type": "git",
"url": "git+https://github.com/TanStack/router.git"
},
- "packageManager": "pnpm@12.18.0",
+ "packageManager": "pnpm@11.21.0",
"engines": {
- "pnpm": ">=12.18.0"
+ "pnpm": ">=11.21.0"
},
"type": "module",
"scripts": {
"cleanNodeModules": "pnpm -r exec rm -rf node_modules",
"clean": "pnpm --filter \"./packages/**\" run clean",
"test": "pnpm run test:ci",
- "test:pr": "nx affected --targets=test:eslint,test:unit,test:integration,test:e2e,test:types,test:build,build",
- "test:ci": "nx run-many --targets=test:eslint,test:unit,test:integration,test:e2e,test:types,test:build,build",
+ "test:pr": "nx affected --targets=test:eslint,test:unit,test:integration,test:noncompiler,test:e2e,test:types,test:build,build",
+ "test:ci": "nx run-many --targets=test:eslint,test:unit,test:integration,test:noncompiler,test:e2e,test:types,test:build,build",
"test:eslint": "nx affected --target=test:eslint --exclude=examples/**,e2e/**",
"test:unit": "nx affected --target=test:unit --exclude=examples/**,e2e/**",
+ "test:integration": "nx affected --target=test:integration --exclude=examples/**,e2e/**",
"test:unit:dev": "pnpm run test:unit && nx watch --all -- pnpm run test:unit",
"test:build": "nx affected --target=test:build --exclude=examples/**",
"test:types": "nx affected --target=test:types --exclude=examples/**",
@@ -55,7 +56,8 @@
"ts:symbol-references": "node scripts/ts-symbol-references.mjs",
"vite-ecosystem-ci:build": "nx run-many --targets=build --projects=@tanstack/router-plugin,@tanstack/start-plugin-core,@tanstack/react-start,@tanstack/react-start-client,@tanstack/react-start-server --skipRemoteCache",
"vite-ecosystem-ci:before-test": "pnpm exec playwright install chromium",
- "vite-ecosystem-ci:test": "nx run-many --targets=test:unit --projects=@tanstack/router-plugin,@tanstack/start-plugin-core,@tanstack/react-start-client --skipRemoteCache && nx run-many --target=test:e2e --projects=tanstack-router-e2e-react-basic-file-based,tanstack-router-e2e-react-basic-file-based-code-splitting,tanstack-react-start-e2e-basic,tanstack-vue-start-e2e-basic,tanstack-solid-start-e2e-basic --skipRemoteCache"
+ "vite-ecosystem-ci:test": "nx run-many --targets=test:unit,test:integration,test:noncompiler --projects=@tanstack/router-plugin,@tanstack/start-plugin-core,@tanstack/react-start-client --skipRemoteCache && nx run-many --target=test:e2e --projects=tanstack-router-e2e-react-basic-file-based,tanstack-router-e2e-react-basic-file-based-code-splitting,tanstack-react-start-e2e-basic,tanstack-vue-start-e2e-basic,tanstack-solid-start-e2e-basic --skipRemoteCache",
+ "test:noncompiler": "nx affected --target=test:noncompiler --exclude=examples/**,e2e/**"
},
"nx": {
"includedScripts": [
diff --git a/packages/AGENTS.md b/packages/AGENTS.md
index 0c63c3a15c..6bd99ddc38 100644
--- a/packages/AGENTS.md
+++ b/packages/AGENTS.md
@@ -1,6 +1,6 @@
# Packages
-- Route generation/code splitting live in `router-generator`/`router-plugin`; Start build transforms live in `start-plugin-core`.
+- Route generation/code splitting live in `router-generator`/`router-plugin`; Start build transforms live in `start-plugin-core`. Both compilers are planners on the shared compiler core in `router-utils/src/compiler` ([README](router-utils/src/compiler/README.md)).
## Router bindings
diff --git a/packages/compiler-test-utils/AGENTS.md b/packages/compiler-test-utils/AGENTS.md
new file mode 100644
index 0000000000..5314968376
--- /dev/null
+++ b/packages/compiler-test-utils/AGENTS.md
@@ -0,0 +1,95 @@
+# Compiler test harness
+
+Shared by the compiler test suites of router-generator, router-plugin, start-plugin-core, react-start-rsc and this
+package. What the suite is and how to read it: [oracle/README.md](oracle/README.md). The contract the tests cite:
+[oracle/SPEC.md](oracle/SPEC.md).
+
+## Hard rules
+
+- Real tools only: real Vite, Rsbuild, Rspack and webpack builds and dev servers, the framework's own plugin, the
+ real HMR client and renderer. Never copy a tool's logic into a test.
+- Reach a compiler only through public entry points: the plugins and options a user configures. No compiler
+ internals, module ids, queries, generated names, printed code or chunk layout.
+- Client code runs in a real browser (`runClient`, `runInPage`, `openPage`); server code in Node, inside real requests
+ through Start's server entry. No jsdom, no fake `window` or `import.meta.hot`.
+- No tests of the helpers' internals; this package's own tests are controls of the harness.
+- Tests never write into the repository. Apps live in the run's temp dir (`./app-directory`); checked-in fixtures run
+ on a copy (router-generator `copyFixture`).
+- Diagnostics are checked by severity, file and position only, never by wording.
+- Edits settle on their outcome within one bound, never on counts of events, compiles or updates.
+
+## Helpers
+
+- `./plugin-host` (`createPluginHost`): the public Vite plugins on a real Vite dev server (server code through the
+ environment's module runner, client code in the browser) and `vite build`.
+- `./rsbuild-plugin-host` (`createRsbuildPluginHost`): the same through Rsbuild's JavaScript API.
+- `./build-harness`: real builds (Vite, Rsbuild, Rspack, webpack), with provenance of emitted modules and the
+ dangling-name check (SPEC G8).
+- `./dev-server`, `./rsbuild-dev-server`: dev servers on a temp app with `edit`/`settle`; `closeViteServer`.
+- `./browser`: Chromium pages; `runInPage` (bounded run pages, a fresh document per run), `openPage`.
+- `./hmr-sync` (`settlePage`): whether a page reloaded or updated in place, told by the page.
+- `./outcome` (`waitForOutcome`): wait for an edit's outcome within one bound.
+- `./diagnostic-channel`, `./diagnostics` (`expectDiagnostic`, `expectNoProblems`): every reporting channel merged;
+ checks by severity, file and position.
+- `./importers` (`importerSource`, `loadMarker`, `expectNotLoaded`): real importers and load markers.
+- `./free-names`, `./known-globals`: a module's free names (Yuku), minus the environment's globals.
+- `./global-trap`: trap a page's dev-only globals (SPEC G7).
+- `./source-maps`: map assertions through `@jridgewell/trace-mapping`.
+- `./determinism`: compare builds across roots and orders (SPEC G4).
+- `./dead-code-shapes`: the dependency shapes every removal runs through (SPEC G16); inputs, no judging logic.
+- `./app-directory` (`createAppDirectory`, `servedDirectories`): temp app directories that resolve like the package.
+- `./run-directory` (Vitest `globalSetup`): the run's temp dir, removed when the run ends.
+- `./test-scope` (`currentTest`, `onTestFinished`) with `./test-scope-setup` (`setupFiles`): per-test resources in
+ concurrent files.
+- `./pins` (`runPins`) with `./pins-setup` (`setupFiles`): `COMPILER_TESTS_PINS=run` runs every known-bug pin as an
+ ordinary test; the shared reporter lists the pins that passed.
+- `./workspace-packages`: link built `@tanstack/*` packages into test apps (not declared, to avoid Nx cycles).
+- `./run-node`: run built output in a child Node.
+
+Package hosts build on these: router-plugin `tests/route-app.ts` (`loadRoute`), start-plugin-core
+`tests/start-host.ts` (`useStartHost`). Start apps use `tanstackStart()` of the built framework package
+(`tests/start-plugins.ts`), entries only through `client.entry`/`server.entry`.
+
+## Running
+
+```sh
+CI=1 NX_DAEMON=false pnpm nx run @tanstack/router-plugin:test:unit --outputStyle=stream --skipRemoteCache -- tests/code-splitter-scope.test.ts -t "unlike computed keys"
+```
+
+- The whole oracle (this package's tests, the harness controls, are not part of it): the `nx run-many --parallel=1`
+ command of [oracle/README.md](oracle/README.md).
+- Always through Nx, one command at a time. A file path is a substring filter.
+- 4 workers by default (`maxWorkers` in each `vite.config.ts`).
+- No `|` inside `-t`; run one command per filter.
+- `--skip-nx-cache` only for measurements.
+- Slow tier: at most two `test:integration` runs on the machine at once:
+ `until [ "$(pgrep -fc '[v]itest --project integration')" -lt 2 ]; do sleep 30; done`.
+- Tiers: `test:unit` (in process, the inner loop); `test:integration` (`tests/integration/`: real builds, dev servers,
+ browser pages; `tests/integration/pages/` is the `integration-pages` project). `integration` projects keep modules
+ across files (`isolate: false`): a file leaves nothing behind but what the harness owns.
+
+## Budgets
+
+`test-budgets.json`: per package and tier, a target and a hard limit at 4 workers; 15 s per slow-tier file; 10 s from
+edit to result for one fast-tier file. `src/budget-reporter.ts` reports after every run. To enforce, run a whole tier
+on a quiet machine (1-minute load below 4, no other test run):
+
+```sh
+COMPILER_TEST_BUDGETS=strict CI=1 NX_DAEMON=false pnpm nx run :test:integration --outputStyle=stream --skipRemoteCache --skip-nx-cache
+```
+
+A run with a failed test or file is not a measurement. A tier over budget is fixed (shared hosts, bounded pages,
+moving page tests to `integration-pages`), not re-budgeted or sharded.
+
+## Setup facts
+
+- Framework packages and tools are test-only devDependencies (`solid-js`, `vite-plugin-solid`, `@rsbuild/plugin-react`,
+ `@rsbuild/plugin-solid` ≥ 1.2.2, `@vitejs/plugin-react`, `@vitejs/plugin-vue`, `miniflare`, …).
+- The integration targets build `@tanstack/react-start` first (linked at test time).
+- `@tanstack/compiler-vite-versions` (private, test-only) holds the other Vite majors the router plugin supports as
+ aliased packages (`vite6`, `vite7`) for router-plugin's `integration/vite-versions.test.ts`. They live in their own
+ package because each ships a `vite` binary that would shadow the workspace's in a package that builds with Vite.
+- Harness servers listen on `127.0.0.1` and never pass port 0 to Vite or Rsbuild (Rsbuild runs in middleware mode on
+ the harness's own server).
+- The Rsbuild hosts stay silent (`logLevel` and `dev.client.logLevel` `silent`); read output through the diagnostic
+ channel.
diff --git a/packages/compiler-test-utils/eslint.config.js b/packages/compiler-test-utils/eslint.config.js
new file mode 100644
index 0000000000..8ce6ad05fc
--- /dev/null
+++ b/packages/compiler-test-utils/eslint.config.js
@@ -0,0 +1,5 @@
+// @ts-check
+
+import rootConfig from '../../eslint.config.js'
+
+export default [...rootConfig]
diff --git a/packages/compiler-test-utils/oracle/KNOWN-BUGS.md b/packages/compiler-test-utils/oracle/KNOWN-BUGS.md
new file mode 100644
index 0000000000..3e681171e8
--- /dev/null
+++ b/packages/compiler-test-utils/oracle/KNOWN-BUGS.md
@@ -0,0 +1,777 @@
+# Known bugs of today's compilers
+
+Each bug is pinned by `.fails` tests that assert the correct outcome and accept any correct fix. When your compiler
+fixes a bug, its pins fail with "Expect test to fail": remove the `.fails` and keep the test.
+
+One entry per root cause: the bug, the SPEC clause, the pins (`file` and test names; paths under `packages/`; `$name`,
+`%s` and `${…}` are table-row placeholders), and what a fix must achieve. The test comment (`Bug:`, `Impact:`) has the
+details. "Cause" files name the implementation the pin was written against (the Babel-based compilers); a rewrite may
+have no such file.
+
+Totals: 381 pin sites in 106 test files (a table test counts once; Vitest counts each row).
+
+Pins whose input picks a name today's compiler generates (S6) flip with a compiler that generates other names. The
+adaptive pins next to them, which read the names a compiler actually generates, are the real check.
+
+## Shared causes (several jobs)
+
+**S1. JSX pragmas are not kept effective.** Code the compilers insert lands above a file's leading pragma (Oxc reads
+leading pragmas only); a non-leading pragma becomes leading in a chunk; dead-code elimination does not count a
+classic pragma as a use of its factory, so the factory import is dropped. SPEC J2.16, G12. Fix: every emitted module
+compiles its JSX under the runtime the untouched file has, and keeps the factory it needs. 13 pins:
+
+- `router-plugin/tests/code-splitter-pragmas.test.ts`: "keeps a @jsxImportSource written after the imports as
+ ineffective as in the untouched file (leading-pragma project)"; "keeps the pragma in effect in every module that
+ contains JSX"; "in the route module, when the code calling the factory is split".
+- `router-plugin/tests/integration/code-splitter-pragmas.test.ts`: "means in the split route what it means in the
+ untouched route (Vite: Oxc ignores it)".
+- `router-plugin/tests/integration/pages/known-bugs-code-splitter-bindings.test.ts`: "a split component renders
+ through the factory of a classic JSX pragma"; "a split component renders through $name"; "a factory the route
+ module creates and the loader reads is created once for the split component ($name)".
+- `router-plugin/tests/integration/pages/known-bugs-code-splitter-shapes.test.ts`: "a module without JSX does not
+ import the classic factory ($name)".
+- `start-plugin-core/tests/start-compiler-jsx-pragma.test.ts`: "inserted server function imports stay below the
+ @jsxImportSource pragma: %s"; "client: the parent keeps selecting the pragma JSX runtime when the import it sits on
+ $name".
+- `start-plugin-core/tests/known-bugs-start-compiler.test.ts`: "client: the factory of a classic JSX pragma stays
+ imported"; "ssr: a module with a classic JSX runtime pragma keeps its React import".
+- `start-plugin-core/tests/integration/pages/known-bugs-hydrate-module-level.test.ts`: "client: a module with a
+ classic JSX pragma renders through its factory".
+
+**S2. Dead-code elimination keeps what only types or non-reads mention, and never removes some declaration kinds.** The
+Babel-based compilers' babel-dead-code-elimination counted `typeof x` type queries, TypeScript-only positions (enum
+members, overload and constructor parameters) and a local of a function's own name as reads, and never removed classes,
+enums, namespaces, overloaded functions or redeclared `var`s. Server-only imports then stay on the client (and
+client-only imports on the server). SPEC J4.12, J4.11, J2.5, G16. Fix: code only server code (or only types) reads is
+gone from the client, with its imports, and code only client-only code reads is gone from the server. 10 pins:
+
+- `start-plugin-core/tests/known-bugs-start-compiler.test.ts`: "client: $name does not load its server-only import";
+ "client: a server-only import last mentioned by a type alias is not loaded with verbatimModuleSyntax"; "client: a
+ validator schema that a type alias reads with typeof is not loaded"; "ssr: a declaration a client-only fn reads and
+ a type alias reads with typeof is not loaded"; "ssr: a class only a client-only fn uses does not load its
+ client-only import".
+- `start-plugin-core/tests/integration/known-bugs-start-compiler.test.ts`: "client: the server-only module of a class
+ only server code uses is not bundled"; "client: a server-only module a type mentions is not bundled with
+ verbatimModuleSyntax".
+- `start-plugin-core/tests/integration/start-build-user-code.test.ts`: "the decorated class only a server fn handler
+ uses is not in the client bundle".
+- `start-plugin-core/tests/createServerFn/caller-dead-code.test.ts`: "when client code uses its name in $name";
+ "callers drop a handler-only function that declares a local of its own name".
+
+**S3. The printer drops required parentheses** (`@babel/generator` in the Babel-based compilers): `count as number++`,
+`a as any ? -x : y`, ` .props` do not parse. SPEC G12. Fix: printed code parses and means the same. 5 pins:
+
+- `router-plugin/tests/integration/pages/known-bugs-code-splitter-bindings.test.ts`: "an asserted update operand keeps
+ its parentheses in a split component"; "an asserted conditional test keeps its parentheses in a split component";
+ "a JSX element read as an object keeps its parentheses in the route module".
+- `start-plugin-core/tests/start-compiler-preserves-user-code.test.ts`: "keeps the parentheses of asserted update
+ operands"; "keeps the parentheses of an asserted conditional test".
+
+**S4. Source maps are lost on webpack and Rspack.** unplugin's webpack and Rspack transform loaders (the former
+integration layer) drop the map a plugin returns when no earlier loader passed one in. SPEC G6. Fix: a throw in a
+split chunk maps to the route file's line (and column). 4 pins:
+
+- `router-plugin/tests/integration/build-source-maps.test.ts`: "a throw in a split component maps to its line in the
+ route file ($name)"; "a throw in $name maps to its line and column in the route file".
+- `router-plugin/tests/integration/dev-source-maps.test.ts`: "the route module and every module derived from it map a
+ throw to its line in the route file".
+- `start-plugin-core/tests/integration/start-build-source-maps.test.ts`: "rsbuild build: client: a throw in a split
+ route component maps to its line in the route file ($name)".
+
+**S5. A type-only import re-exported as `export { Settings }` loses its import** (valid TypeScript without
+`verbatimModuleSyntax`), so the TypeScript transform can no longer erase the export. SPEC G1, §2.1. Fix: the module
+still compiles and the type export is erased. 2 pins:
+
+- `router-plugin/tests/integration/pages/known-bugs-code-splitter-bindings.test.ts`: "a type-only import re-exported
+ as `export { Settings }` is erased (%s)".
+- `start-plugin-core/tests/known-bugs-start-compiler.test.ts`: "client and SSR: a type-only import re-exported as
+ `export { Settings }` is erased (%s)".
+
+**S6. Generated names collide with user bindings.** SPEC G15, §5.1. Fix: no generated name shadows or redeclares a
+user binding. 8 pins:
+
+- `router-plugin/tests/integration/pages/known-bugs-code-splitter-shapes.test.ts`: "a route file binding named $name
+ keeps its value"; "route file bindings named like what the compiled modules introduce keep their values"
+ (adaptive).
+- `router-plugin/tests/known-bugs-route-hmr.test.ts`: "a user binding named hot ($name) does not collide with the
+ injected HMR code".
+- `router-plugin/tests/known-bugs-route-hmr-bindings.test.ts`: "a route file importing a binding named Map renders
+ with route HMR".
+- `start-plugin-core/tests/known-bugs-start-compiler.test.ts`: "a user binding named %s does not collide with
+ generated code"; "a server fn named opts runs on the server"; "no name the compiler introduces collides with a user
+ binding or a server fn of that name" (adaptive).
+- `start-plugin-core/tests/integration/pages/known-bugs-hydrate-module-level.test.ts`: "client: module-level $name,
+ named like the generated bindings, do not collide".
+
+**S7. Dead-code elimination removes the const half of a class and const cycle.** When only removed code used a class
+whose static field reads a const that points back to the class (`const registry = { make: () => new Repo() }; class
+Repo { static registry = registry }`), babel-dead-code-elimination (Babel-based compilers) takes the pair for one
+removable cycle and deletes the const, but it never removes a class (S2), so the class stays and its static field
+reads a deleted name. SPEC G16, G1. Fix: both halves go together, or both stay; the module loads. 2 pins, one cell per
+removal:
+
+- `start-plugin-core/tests/start-compiler-dead-code-shapes.test.ts`: "takes with it what only it uses through a class
+ and a const that read each other" (server fn handler, `createServerOnlyFn`, isomorphic `.server()` on the client;
+ `createClientOnlyFn`, isomorphic `.client()` on the server: `ReferenceError` when the module loads there).
+- `router-plugin/tests/integration/pages/code-splitter-dead-code-shapes.test.ts`: the same name (a split component and
+ a `deleteNodes` server handler: the route module throws when it loads).
+
+## J1 Route file upkeep (30 pins)
+
+- **A `(group).tsx` route file is reported relative to the routes directory** (neither absolute nor project-relative).
+ SPEC §2.2, §5.7. `router-generator/tests/deny-route-group-config.test.ts`: "a (group).tsx route file is reported by
+ name or routes correctly: $name". Fix: name the file unambiguously, or route it.
+- **A running generator loses child routes when their layout file is deleted.** SPEC J1.10, J1.4.
+ `router-generator/tests/generator-dev.test.ts`: "deleting a layout route keeps its child routes in the route tree".
+ Fix: a watch run gives the tree a fresh run gives.
+- **A deleted route tree is never written again** (the next run fails with ENOENT). SPEC J1.10.
+ `router-generator/tests/generator-dev.test.ts`: "a deleted route tree is written again on its delete event"; "after
+ the route tree is deleted, adding a route writes the route tree". Fix: regenerate the tree.
+- **Edits of the `virtualRouteConfig` file and of `__virtual.ts` files are ignored** (the event's absolute path is
+ compared with the configured relative path; the config comes from jiti's cache; Rsbuild never sees the file).
+ SPEC J1.10. `router-generator/tests/generator-dev.test.ts`: "editing the virtualRouteConfig file updates the route
+ tree"; `router-plugin/tests/integration/dev-server-generator-watching.test.ts` and
+ `router-plugin/tests/integration/rsbuild-dev-server-generator-watching.test.ts`: "an edit of the virtual route config
+ file changes the live routes"; "an edit of a \_\_virtual.ts file changes the live routes". Fix: reload the config and
+ regenerate on each such edit.
+- **An event that arrives while a run checks no-op events is dropped.** SPEC J1.10.
+ `router-generator/tests/generator-dev.test.ts`: "a route created while an update event that changed nothing is
+ checked joins the route tree". Fix: no delivered event is lost.
+- **An empty `.ts` route file is scaffolded with JSX, then parsed as TypeScript** and the run fails. SPEC J1.3.
+ `router-generator/tests/generator-options.test.ts`: "an empty .ts route file is scaffolded, and the other routes
+ still generate". Fix: a valid scaffold, and the other routes generate.
+- **`importRoutesUsingAbsolutePaths` is not applied to lazy route imports.** SPEC J1.4.
+ `router-generator/tests/generator-options.test.ts`: "importRoutesUsingAbsolutePaths imports the lazy route files by
+ absolute paths too".
+- **`tmpDir` on another filesystem fails every write with EXDEV.** SPEC J1.16.
+ `router-generator/tests/generator-options.test.ts`: "with tmpDir on another filesystem, the route file and the route
+ tree are replaced atomically" (skipped without a writable `/dev/shm`). Fix: rename a temp file written beside the
+ destination.
+- **A layout in a route-group directory is typed `fullPath: ''`**, while the router gives it `/`. SPEC J1.13.
+ `router-generator/tests/integration/fixture-types-physical.test.ts`: "the "%s" route tree types its routes like the
+ router"; `router-generator/tests/integration/route-types.test.ts`: "the layout route of a route group directory has
+ the full path of the router in the types".
+- **The generator recognises `createFileRoute` by name, not by binding.** An aliased import is missed; an app's own
+ `createFileRoute` is rebound to the router package. SPEC G15, J1.1. `router-generator/tests/known-bugs.test.ts`: "a
+ moved route with an aliased import of the constructor gets the id of its new path"; "a moved route importing
+ createFileRoute from a module of the app stays a valid module"; `router-generator/tests/route-file-upkeep.test.ts`:
+ "a createFileRoute $name keeps its meaning: the file is left as it is, or reported". Fix: follow the import.
+- **A pathless layout present only as a lazy file or a Vue piece loses its directory path.** SPEC J1.8.
+ `router-generator/tests/real-router.test.ts`: "a pathless layout with only a lazy route file keeps its directory
+ path"; `router-generator/tests/route-paths.test.ts`: "a pathless layout with only $name under a path keeps the path
+ in the URLs of its children".
+- **A childless pathless layout gives "Conflicting configuration paths".** SPEC J1.15.
+ `router-generator/tests/route-paths.test.ts`: "a pathless layout without child routes yet ($name) next to the index
+ route is added to the route tree".
+- **A pathless layout under a lazy-only route attaches to the next real ancestor.** SPEC J1.14.
+ `router-generator/tests/route-paths.test.ts`: "a pathless layout in a directory under a route with only a lazy
+ route file nests under that route".
+- **File paths and ids are written into quoted strings unescaped** (an apostrophe breaks the tree). SPEC J1.6.
+ `router-generator/tests/route-paths.test.ts`: "a route file name with an apostrophe gets a route with it in its
+ URL".
+- **Routes whose paths differ only in non-identifier characters or case get the same variable.** SPEC J1.6.
+ `router-generator/tests/route-paths.test.ts`: "routes $ids get their own routes".
+- **A piece next to a directory route (`posts/route.component.vue`) makes its own route `/posts/route`.** SPEC J1.4.
+ `router-generator/tests/route-pieces.test.ts`: "a component piece of a directory route (route.component.vue) is the
+ component of the route".
+- **`.lazy.vue` is wired as a lazy route, and an empty one is scaffolded with TypeScript.** SPEC J1.17, J1.3.
+ `router-generator/tests/route-pieces.test.ts`: "a .lazy.vue route file is the lazily loaded component of the
+ route"; "an empty .lazy.vue route file is not filled with TypeScript route code".
+- **With pieces on the root route only, the tree calls `lazyRouteComponent` without importing it.** SPEC G1, J1.4.
+ `router-generator/tests/route-pieces.test.ts`: "pieces of the root route only are lazy components of their default
+ export".
+- **Rsbuild: a route file created under a `physical()` mount outside the routes directory is never seen.** SPEC
+ J1.10. `router-plugin/tests/integration/known-bugs-rsbuild-generator-physical.test.ts`: "a route file created under a
+ physical() mount outside the routes directory reaches the live routes".
+- **Rsbuild: a route file the generator cannot parse is left out of the bundle, so its fix is never seen.** SPEC
+ J1.10, G5. `router-plugin/tests/integration/known-bugs-rsbuild-generator.test.ts`: "a created route file the
+ generator cannot parse is reported, and fixing it adds the route".
+
+## J2 Route code splitting (108 pins: 90 below, 18 in S1, S3–S7)
+
+Router-plugin paths below are under `router-plugin/tests/`; `pages/` means `integration/pages/`.
+
+- **Imported route options are not read** (only an object literal of the route file is): nothing is split or
+ deleted, silently. SPEC J2.8, J2.14. `code-splitter-imported-options.test.ts`: "are split, or reported once naming
+ the route file"; "lose the options of deleteNodes and what only they import, or are reported once naming the route
+ file". (Start's client build: J2.14 section.)
+- **A JSX tag starting with `_`, `$` or a non-ASCII lowercase letter is taken for an intrinsic element.** SPEC J2.4.
+ `code-splitter-jsx.test.ts`: "gives separate loader and component chunks the one JSX component %s".
+- **The esbuild adapter never runs the generator in a build**, so nothing is split and nothing refuses. SPEC J2.18.
+ `integration/build-harness.test.ts`: "router plugin with esbuild loads a split component lazily and renders it, or
+ refuses the build (%s)".
+- **An already-lazy option value is wrapped again** and suspends after preload. SPEC §6 OQ13.
+ `integration/code-splitter-router.test.ts`: "renders without a new request or a pending fallback once the router
+ preloaded it".
+- **Default-exported declarations shared by options are duplicated** ("Duplicate declaration"). SPEC J2.4.
+ `integration/code-splitter-runtime.test.ts`: "preserves executable route contracts with shared named-default
+ declarations"; `pages/known-bugs-code-splitter-bindings.test.ts`: "a split option renders the default-exported
+ component other modules import"; "a default-exported function the loader and the split component call works on one
+ state".
+- **Split chunks keep exports of the route file their option does not use.** SPEC J2.5.
+ `integration/known-bugs-code-splitter-page-code.test.ts`: "$name loads with its chunk"; "${exportedSharedByOptions.name}
+ loads with its chunk"; "${unreadExport.name} is not in its chunk"; `pages/known-bugs-code-splitter-shapes.test.ts`: "a
+ split chunk holds only what its option needs, not the other exports of the route file"; "split chunks do not
+ re-export or declare the re-exports and default class of the route file". Fix: a chunk carries only what its group
+ needs.
+- **Split chunks copy exported declarations they read instead of importing them** (two instances), or miss an
+ export written as `X as any`. SPEC J2.4. `integration/known-bugs-code-splitter-ssr-builds.test.ts`: "the split
+ component and other modules share an exported $name"; `integration/known-bugs-code-splitter-client-builds.test.ts`:
+ "an exported errorComponent written as `PostErrorComponent as any` is one instance in the client (vite build)";
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "an exported errorComponent written as `%s` is the instance its
+ importers get". Fix: one instance for importers and chunks.
+- **Bindings that read `Route` are never shared**, so chunks copy them. SPEC J2.4.
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "an exported function that reads Route is the one the split
+ component calls"; "a destructuring whose sibling reads Route keeps one cache for the loader and the component".
+- **A split component reading `Route` declared with `const` and exported later (`export { Route }`) recreates the
+ route.** SPEC J2.4. `pages/known-bugs-code-splitter-bindings.test.ts`: "a split component reads the route the route
+ module exports through export { Route }".
+- **Root routes are never split.** SPEC J2.7 (goal). `integration/known-bugs-code-splitter-page-code.test.ts`: "a root
+ route's %s loads lazily".
+- **A component declared by a destructuring is not split, or the build throws.** SPEC J2.8, J2.9.
+ `integration/known-bugs-code-splitter-page-code.test.ts`: "${destructured.name} load with their chunk or are
+ reported"; `integration/known-bugs-code-splitter-client-builds.test.ts`: "a component declared by an array
+ destructuring of a call shared with the errorComponent is split or reported";
+ `pages/known-bugs-code-splitter-shapes.test.ts`: "a component declared by an array destructuring of a call shared
+ with the errorComponent renders".
+- **The split compiler accepts a fixed list of value shapes** ("Unexpected splitNode type": object-form loaders,
+ classes, casts, `satisfies`, member/logical/tagged-template/class expressions; a call is printed and re-parsed
+ without JSX or TypeScript). SPEC J2.8, J2.9. `integration/known-bugs-code-splitter-ssr-builds.test.ts`: "a split
+ loader in object form with $name loads route data"; "a split loader in object form passed by reference loads route
+ data"; `pages/known-bugs-code-splitter-server.test.ts`: "a class component declared in the route file renders
+ (exported: $exported)"; "a class component and the imports of its static fields leave the route module";
+ `pages/known-bugs-code-splitter-shapes.test.ts`: "a component is split with $name"; "an option written as $name is
+ split and works"; "a component written as $name is split and renders"; `pages/known-bugs-code-splitter.test.ts`: "the
+ handler of a split loader in object form with $name loads lazily"; "a split loader in object form keeps $name
+ working, created once". Fix: split any valid value, or keep it unsplit and warn.
+- **Top-level statements that write a moved binding stay behind** (`Page.displayName = …` throws). SPEC J2.12, G3.
+ `integration/known-bugs-code-splitter-property-write.test.ts`: "a component the route file writes a property of
+ loads with its chunk and renders the property ($hint)"; `pages/known-bugs-code-splitter.test.ts`: "top-level writes
+ to $name stay with the binding they write".
+- **A split binding's declaration or import is deleted from the route module although other code still reads it.**
+ SPEC J2.12. `pages/known-bugs-code-splitter-server.test.ts`: "a split component that $name reads renders from both";
+ "a split component renders through a function $name"; "a component read by a split and an unsplit option renders
+ from both"; "an unsplit option that reads the split component with typeof sees a function"; "a split component that
+ a top-level call reads renders from both"; "an imported split component that head() reads renders, and head() reads
+ it"; "an imported split errorComponent that an exported component renders works for an importer"; "an imported
+ pendingComponent split by custom groupings renders, and an unsplit option renders it";
+ `integration/known-bugs-code-splitter-ssr-builds.test.ts`: "an imported split component that head() reads renders,
+ and head() reads it (%s build)"; `integration/known-bugs-code-splitter-client-builds.test.ts`: "a split component that
+ an unused object names renders (vite)"; `pages/known-bugs-code-splitter-bindings.test.ts`: "a split component renders
+ the exported component of another option that reads Route ($name)".
+- **Export lists and aliases of a moved declaration are left without it** ("Export 'load' is not defined"). SPEC
+ J2.12, J3.3. `pages/known-bugs-code-splitter-bindings.test.ts`: "a split loader exported through an export list keeps
+ working"; `known-bugs-dev-server.test.ts`: "keep a $name component exported as the route option value";
+ `integration/known-bugs-route-hmr-components.test.ts`: "vite: a split component exported by an export list renders,
+ and an edit shows in place"; `known-bugs-route-hmr.test.ts`: "a component exported by an export list renders for a
+ module importing it and as the route component" (the last two count under J3).
+- **The user's own `import './Page'` is removed with the split component's import.** SPEC G3, J2.12.
+ `pages/known-bugs-code-splitter-server.test.ts`: "a side-effect import of the split component's module runs when the
+ route module loads".
+- **`deleteNodes` removes only options written as `key: value`**: methods, spreads, computed keys and options in a cast
+ or `satisfies` keep their server code on the client. SPEC J2.14, J4.12.
+ `pages/known-bugs-code-splitter-server.test.ts`: "a server-only option written as a method is removed with its
+ imports (%s)"; "a server-only option given through $name is removed, or the route is refused"; "a server-only option
+ of options wrapped in `%s` is removed with its imports"; `integration/known-bugs-code-splitter-client-output.test.ts`:
+ "a client build has no server code of an `ssr()` method (vite)"; "a client build has no server code of options
+ wrapped in `%s` (vite)". (Start: J2.14 section.)
+- **A local function named `createFileRoute` is treated as the router's.** SPEC G15.
+ `pages/known-bugs-code-splitter-server.test.ts`: "a local factory shadowing createFileRoute in a route file keeps
+ its own semantics".
+- **Only `createFileRoute(` by that name and without a type argument is recognised**; nothing is reported. SPEC J2.1,
+ J2.8. `pages/known-bugs-code-splitter-shapes.test.ts`: "a component is split when createFileRoute is imported under
+ an alias"; "a component is split when createFileRoute has a type argument".
+- **Route options returned by a call are neither split nor reported.** SPEC J2.8.
+ `pages/known-bugs-code-splitter-shapes.test.ts`: "route options returned by a call are split or reported".
+- **Options inside a route factory are split as if module-level** (closures over parameters break). SPEC J2.10.
+ `pages/code-splitter-plugin-pipeline-routes.test.ts`: "a route built from $name renders what the factory was given,
+ split or reported".
+- **Two file routes in one module share chunk names**, so one renders the other's component. SPEC J2.11.
+ `pages/known-bugs-code-splitter-shapes.test.ts`: "each of two file routes of one module renders its own component,
+ or the module is reported".
+- **A symlinked route file is never compiled** (looked up by the scanned path, resolved by its real path). SPEC J2.1,
+ J4.12, G11. `integration/known-bugs-code-splitter-client-output.test.ts`: "a client build of a symlinked route file
+ has no server handler code (%s)".
+- **Dev-only code follows the process `NODE_ENV`, not the bundler's mode.** SPEC G7, J3.7.
+ `integration/known-bugs-code-splitter-client-output.test.ts`: "a production client bundle logs no development
+ warning in the page when NODE_ENV is unset (%s)"; `integration/build-production.test.ts` and
+ `integration/build-production-webpack-unsplit.test.ts`: "a production %s client bundle without code splitting has no
+ dev-only code" (these two count under J3).
+- **Chunk ids paste the absolute file path into a URL and a quoted string** (`#`, `'` and the split marker text in a
+ directory name break builds). SPEC G1, G11. `integration/known-bugs-code-splitter-ssr-builds.test.ts`: "an app in a
+ directory with # in its name builds and preloads a split component"; "an app in a directory whose name contains what
+ split module ids contain builds and preloads a split component"; "an app in a directory with ' in its name builds and
+ preloads a split component".
+- **A `let` reassigned in another module becomes a read-only import.** SPEC J2.4, G1.
+ `integration/known-bugs-code-splitter-ssr-builds.test.ts`: "a let $name stays writable and the split component reads
+ its value".
+- **Shared bindings are computed by the route-module transform and stored per file**; chunks served first read stale
+ state. SPEC G4, J2.13. `integration/known-bugs-dev-server.test.ts`: "a page loading the modules of the route file
+ before the route module renders the edited route after $name".
+- **Ambient declarations (`declare const`, a var merged with an interface, a global) are treated as module bindings.**
+ SPEC G1, J2.12. `pages/code-splitter-imports-exports.test.ts`: "reads an ambient var merged with an interface from
+ the environment in a shared declaration, with verbatimModuleSyntax"; `pages/known-bugs-code-splitter.test.ts`: "an
+ ambient declare const read by the loader and the split component stays a global";
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "a component read from $name renders".
+- **The shared-binding analysis misses readers** (method options, computed keys, nested `var`s, enums, namespaces,
+ class static initialisers), so state is created twice. SPEC J2.4, G3.
+ `pages/code-splitter-module-state-bindings.test.ts`: "$name"; `pages/known-bugs-code-splitter-bindings.test.ts`:
+ "module state a method option shares with a split option is created once"; `pages/known-bugs-code-splitter.test.ts`:
+ "a binding read by a computed-key option and a split option is created once"; "a binding declared by $name and read
+ by the loader and the split component is initialized once"; "module state that the reference module keeps for $name
+ is initialized once".
+- **Chunks keep unreferenced top-level statements** (side effects run twice; `export *` repeated). SPEC G3, J2.5.
+ `pages/known-bugs-code-splitter.test.ts`: "an unreferenced top-level side effect ($name) runs once, with the route
+ module"; "split chunks do not re-export a module-level export \*, which importers of the route file still get".
+- **A declaration only an exported type alias reads loses its initializer.** SPEC G3.
+ `pages/known-bugs-code-splitter.test.ts`: "the initializers of $name run when the route module loads"; "the
+ initializer of a declaration only an exported type alias reads runs when a route module compiled for HMR loads".
+- **Code only the split component needs stays when something looks like a read** (a type of the same name, an
+ overload signature, a second `var`, an unused renderer). SPEC J2.5. `pages/known-bugs-code-splitter.test.ts`: "a split
+ component and its imports leave the route module next to $name".
+- **A value import only types read is copied into every chunk.** SPEC J2.5.
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "split chunks do not import what only $name reads".
+- **`codeSplitGroupings` in a module-level constant is refused.** SPEC J2.2.
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "groupings declared in a module-level constant are honoured".
+- **The not-split warning is printed only when the splitter changed the module.** SPEC J2.8.
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "an exported component ($name) that is the only split candidate is
+ split or reported as not code-split".
+- **Decorators after `export` and parameter decorators do not parse.** SPEC §2.1, G1.
+ `pages/known-bugs-code-splitter-bindings.test.ts`: "a decorator after `export` compiles"; "a class with a parameter
+ decorator that the split component uses compiles into parseable modules".
+- **A namespace is copied into a chunk without its body.** SPEC G1. `pages/known-bugs-code-splitter-bindings.test.ts`:
+ "a namespace the split component reads keeps its body".
+- **A route module's CSS import loads on every page**: the code splitter keeps the bare import in the route module,
+ which the route tree imports eagerly (in dev the CSS is injected once the client runs; a build merges it into the
+ entry's CSS). SPEC J2.22. `start-plugin-core/tests/integration/known-bugs-route-css.test.ts` (Vite) and
+ `known-bugs-route-css-rsbuild.test.ts` (Rsbuild), rows of `route-css-cases.ts`: "the CSS of the /${name} route
+ applies only once the route matches" (the five `shows-*` rows; dev and build). Fix: the CSS loads when its route
+ matches.
+- **Rsbuild: a route's manifest entry lists the chunks and CSS of a sibling route** when the routes share a module in
+ a chunk of its own: Start's Rsbuild manifest counts a chunk as available when any one of the importing chunk's groups
+ has it, not every one, so the shared chunk depends on each route's copy of the module it imports (#8780). SPEC J2.22.
+ `start-plugin-core/tests/integration/known-bugs-route-css-rsbuild.test.ts`, rows of `route-css-cases.ts`: "the CSS
+ of the /${name} route applies only once the route matches" (`shares-module-a`, `shares-module-c`; dev and build;
+ Vite passes). Cause: `computeStaticDependencyChunks`, `start-plugin-core/src/rsbuild/normalized-client-build.ts`.
+ Fix: the page of a route links only the CSS of the chunks that route loads.
+- **Vite dev: the maps of the split and shared modules name the route file with the splitter's query**
+ (`index.tsx?tsr-split=component`), so a debugger sees another file than the route file. SPEC G6.
+ `integration/dev-source-maps.test.ts`: "a throw in $name maps to its line in the route file, which its module names
+ as its source". Fix: every module derived from the route file names the route file itself as its source.
+- **Overload signatures of a shared function stay next to its import**, and the TypeScript transform drops the import.
+ SPEC G1, J2.12. `pages/known-bugs-code-splitter-bindings.test.ts`: "an overloaded function the route module and a
+ split loader share keeps working"; `known-bugs-dev-server.test.ts`: "keep exported overloads and their aliases that
+ unsplit and split options call".
+
+## J2.14/J2.15 Start's router wiring (12 pins)
+
+Paths under `start-plugin-core/tests/integration/`.
+
+- **Rsbuild does not prune server-only routes from the client route tree.** SPEC J2.15.
+ `known-bugs-route-options.test.ts`: "a route with only server handlers is not in the client route tree" (two
+ tables); `start-build-manifest.test.ts`: "the client route tree is the SSR route tree without the server-only
+ subtree"; `start-compose-server-only-routes.test.ts`: "the client route tree leaves out the server-only subtree";
+ "client-side navigation to a server-only route finds nothing".
+- **The generator records only plain option keys**, so a route with server handlers and computed, method or spread
+ client options is pruned. SPEC J1.9, J2.15. `known-bugs-route-options.test.ts`: "a route with server handlers and these
+ options is in the client route tree"; `start-compose-server-only-routes.test.ts`: "the client route tree keeps the
+ page whose component is spread in"; "client-side navigation reaches the page whose component is spread in". Fix:
+ never prune because a key was missed.
+- **Options in a cast skip `deleteNodes`** (see J2). `known-bugs-route-options.test.ts`: "the server handler code of
+ the route is not in the client bundle".
+- **Imported route options keep `server.handlers` on the client** (see J2). `start-compose-imported-options.test.ts`:
+ "the client build never ships the server handlers of imported route options silently".
+- **The client route tree module is matched by `new RegExp()`, unescaped.** SPEC J2.15, G11.
+ `start-compose-project-path.test.ts`: "the client route tree leaves out the server-only route"; "the client gets the
+ file, not the client route tree".
+
+## J3 Route HMR (29 pins: 23 below, 2 in S6, 4 in J2)
+
+Paths under `router-plugin/tests/` unless given.
+
+- **Inline components that are not plain functions** (`memo`, `forwardRef`, method shorthand, `as`/`satisfies`), and
+ components inside a route helper function, **are not registered for React Refresh**, so edits do not show. SPEC J3.2,
+ J3.3. `integration/known-bugs-route-hmr-components.test.ts`: "vite: an edit of an inline component written as $name
+ shows in place (autoCodeSplitting: $pluginOptions.autoCodeSplitting)"; `integration/known-bugs-route-hmr.test.ts`:
+ "%s: an edit of a route a helper function creates shows its new component, reloading only when the file is reported
+ (autoCodeSplitting: false)".
+- **Lowercase components break under React HMR** (renamed in a chunk, renamed in the route module after the code
+ splitter chose the shared bindings, not registered, or hoisted out of order). SPEC J3.2, J2.4, G1. `integration/known-bugs-route-hmr-components.test.ts`: "vite: an edit of a split component declared
+ lowercase as $name shows in place"; "vite: a lowercase function component that is also the unsplit pendingComponent
+ renders, and an edit shows in place"; `integration/known-bugs-route-hmr-removals.test.ts`: "vite: an inline pending
+ component hoisted before a renamed lowercase component renders it"; `known-bugs-route-hmr.test.ts`: "a lowercase
+ function component split into two chunks renders with the module state they share"; "a lowercase function component
+ shared with the loader renders with the module state it shares"; "a lowercase function component that is also the
+ unsplit pendingComponent renders as both"; "a destructured binding that the loader, the split component and the
+ unsplit pendingComponent share works and is created once"; "a lowercase component created by a call that the loader, the
+ split component and the unsplit pendingComponent share is created once".
+- **A removed split option's module stays in Vite's graph and is compiled as CommonJS.** SPEC J2.13, J3.3.
+ `integration/known-bugs-route-hmr-removals.test.ts`: "vite: an edit that removes a split option the page loaded
+ applies in place without errors".
+- **Route HMR keeps the previous component for React Refresh to patch**, also without a Refresh runtime and after a
+ rename. SPEC J3.3. `integration/known-bugs-route-hmr-removals.test.ts`: "rsbuild without React Refresh: an edit of the
+ route component shows in place (autoCodeSplitting: %s)"; `integration/known-bugs-route-hmr.test.ts`: "renaming the
+ route component shows the renamed component in place (autoCodeSplitting: %s)".
+- **The HMR code reads the route through the identifier `Route`.** SPEC J3.1.
+ `integration/known-bugs-route-hmr-removals.test.ts`: "a route exported under another local name is hot-updated in
+ place".
+- **Solid and Vue split components get a new lazy component on every update.** SPEC J3.2.
+ `integration/known-bugs-route-hmr.test.ts`: "$bundler: an edit of a split $target route shows in place, keeping the
+ split component".
+- **Vite: the accept call is on an alias (`const hot = import.meta.hot`)**, so the module is no HMR boundary and the
+ page reloads. SPEC J3.1, G10. `integration/known-bugs-route-hmr.test.ts`: "vite: an edit of an unsplit Vue route shows
+ in place"; "vite: an edit of a React .ts route module shows its new loader data in place (autoCodeSplitting: %s)";
+ "vite: an edit of a route component in an app without @vitejs/plugin-react shows in place (autoCodeSplitting: %s)".
+- **Rsbuild: an unsplit Solid route keeps rendering the old component**, the root route too (always unsplit). SPEC
+ J3.3, J3.5. `integration/known-bugs-route-hmr.test.ts`: "rsbuild: an edit of an unsplit Solid route shows its new
+ component in place"; "rsbuild: an edit of a Solid root route shows its new component in place (autoCodeSplitting:
+ %s)".
+- **Rsbuild: an edit of a split loader only never reaches the page** (the route module did not change). SPEC J3.3.
+ `integration/known-bugs-route-hmr.test.ts`: "rsbuild: an edit of a split loader (codeSplitGroupings: %s) shows its
+ data in place".
+- **With options in a variable, the HMR transform declares the component binding after the object that reads it.**
+ SPEC G1. `known-bugs-route-hmr.test.ts`: "route options in a variable ($name) evaluate to a route with a component".
+- **Rsbuild: a route module's first server fn breaks the hot update of its loaded component chunk** when Rspack's
+ `splitChunks` puts the modules the chunk gained into a new async chunk: the re-executed module requires them before
+ anything loads that chunk. Upstream, Rspack's HMR runtime (see "Upstream issues"); a plain Rsbuild app fails the
+ same way. SPEC J3.3, G10. `start-plugin-core/tests/integration/rsbuild/first-server-fn-import.test.ts`: "an edit
+ that adds a server fn to the component shows its result on the open page".
+
+## J4 Start environment separation (86 pins: 66 below, 20 in S1–S7)
+
+Paths under `start-plugin-core/tests/` unless noted.
+
+- **A `.validator()` link on a stored builder, or wrapped in `as`/`satisfies`, is not stripped from the client**
+ (the chain walk stops at the identifier). SPEC J4.1, J4.8, J4.12. `createServerFn/caller-dead-code.test.ts`: "when
+ the validator link is wrapped in a $name expression"; "when the validator link is on a builder stored in a variable
+ ($name)"; `integration/start-build-env-separation.test.ts`: "$construct: its server code is not in the client bundle,
+ and runs in the SSR build"; `start-compiler-factories.test.ts`: "the client strips a validator link$middleware wrapped
+ in $name"; "the client strips a validator link of a builder stored in a variable".
+- **An isomorphic fn whose link is stored, wrapped or passed through a helper loses that implementation.** SPEC J4.9.
+ `integration/start-build-env-separation.test.ts`: "an isomorphic fn whose $name is stored in a variable runs its
+ implementation in each build"; `start-compiler-factories.test.ts`: "each output keeps its implementation of an
+ isomorphic fn whose $name is stored in a variable"; "each output keeps its implementation of an isomorphic fn with a
+ wrapped chain link: %s"; `known-bugs-start-compiler.test.ts`: "each output keeps its implementation of an isomorphic
+ fn whose chain passes through a helper function".
+- **A factory callee wrapped in `as any` is not resolved.** SPEC J4.5. `start-compiler-factories.test.ts`: "each output
+ keeps its implementation of $shape with the callee in $name".
+- **Builders are traced through identifiers and member expressions only**: namespace members, a re-exported Start
+ namespace, a builder returned by a call or passed through a helper, `wrap(wrap(...))`, a library function creating
+ server fns. SPEC J4.5, J4.12. `known-bugs-start-compiler.test.ts`: "client builds compile a builder read from a
+ namespace import"; "client builds compile factories of a re-exported Start namespace"; "client builds compile a
+ builder returned by a function of $name"; "client builds compile a server fn whose builder passes through a helper
+ function"; `createServerFn/declaration-sites.test.ts`: "with %s imported, a server fn wrapped in two calls works like
+ an unwrapped one"; `integration/known-bugs-start-compiler.test.ts`: "a server fn created by a library function: the
+ handler is not in the client bundle, or the build fails clearly". Fix: the client has no server code, or the build
+ fails at the call.
+- **The bundler plugins choose modules by their text** (a factory name, `.handler(`, `` block is parsed as TSX** (the parser is chosen from the id without its query).
+ SPEC §2.1. `integration/known-bugs-start-compiler-vue-sfc.test.ts`: "build: a server fn in a `,
+ ...app('import.meta.hot'),
+ },
+ })
+ const page = await openPage(server.url!, {
+ registerCleanup: onTestFinished,
+ })
+ await page.waitForText('text v1 other v1')
+ expect(page.loads()).toBe(1)
+
+ await server.write({ 'text.js': `export const text = 'text v2'\n` })
+ await page.waitForText('text v2 other v1')
+ expect(page.loads()).toBe(1)
+
+ await server.write({ 'other.js': `export const other = 'other v2'\n` })
+ await page.waitForText('text v2 other v2')
+ await expect.poll(() => page.loads()).toBe(2)
+ },
+ timeout,
+)
+
+test(
+ 'rsbuild: the page shows an accepted update in place, and reloads for one nothing accepts',
+ async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ browser: true,
+ entry: 'main.js',
+ config: { html: { mountId: 'app' } },
+ files: app('import.meta.webpackHot'),
+ })
+ const page = await openPage(server.url!, {
+ registerCleanup: onTestFinished,
+ })
+ await page.waitForText('text v1 other v1')
+ expect(page.loads()).toBe(1)
+
+ await server.edit({ 'text.js': `export const text = 'text v2'\n` })
+ await page.waitForText('text v2 other v1')
+ expect(page.loads()).toBe(1)
+
+ await server.edit({ 'other.js': `export const other = 'other v2'\n` })
+ await page.waitForText('text v2 other v2')
+ await expect.poll(() => page.loads()).toBe(2)
+ },
+ timeout,
+)
+
+// The page's console has only the app's output. The harness reads Rsbuild's
+// logger without raising `logLevel`, to which Rsbuild ties the HMR client's
+// log level by default: at `warn`, the client prints each compile's
+// warnings (and its failed connection attempts) in the page.
+test(
+ 'rsbuild: Rsbuild’s HMR client prints nothing in the page',
+ async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ browser: true,
+ entry: 'main.js',
+ config: { html: { mountId: 'app' } },
+ files: app('import.meta.webpackHot'),
+ plugins: [
+ {
+ name: 'compile-warner',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ compiler.hooks.thisCompilation.tap(
+ 'compile-warner',
+ (compilation) => {
+ compilation.warnings.push(
+ new compiler.webpack.WebpackError(
+ 'MARK_COMPILE_WARNING',
+ ),
+ )
+ },
+ )
+ },
+ })
+ })
+ },
+ },
+ ],
+ })
+ const page = await openPage(server.url!, {
+ registerCleanup: onTestFinished,
+ })
+ await page.waitForText('text v1 other v1')
+ // The client applied an update in place: it was connected, and got the
+ // first compile's warnings before
+ await server.edit({ 'text.js': `export const text = 'text v2'\n` })
+ await page.waitForText('text v2 other v1')
+ expect(page.loads()).toBe(1)
+ expect(page.console).toEqual([])
+ expect(page.errors).toEqual([])
+ // The harness's channel has the warning
+ expect(
+ server.diagnostics.some(({ text }) =>
+ text.includes('MARK_COMPILE_WARNING'),
+ ),
+ ).toBe(true)
+ },
+ timeout,
+)
+
+test('a page given its document shows it at its URL, and an init script runs before the page’s own code, on every load', async () => {
+ // No server listens there: the document is the one given.
+ const url = 'http://127.0.0.1:9/page'
+ const page = await openPage(url, {
+ registerCleanup: onTestFinished,
+ initScript: `window.initRan = (window.initRan ?? 0) + 1`,
+ html: `
`,
+ })
+ expect(await page.text('#app')).toBe(`MARK_DOCUMENT ${url}`)
+ expect(await page.page.evaluate('window.appSaw')).toBe(1)
+ await page.page.reload()
+ expect(await page.page.evaluate('[window.appSaw, window.initRan]')).toEqual([
+ 1, 1,
+ ])
+})
+
+// The run pages serve every run of a test process, so a
+// script that never settles must fail its run within the bound and leave
+// its page (or a new one) to the next run.
+test('a run whose script never settles fails within its bound, and the next run gets a page', async () => {
+ const started = Date.now()
+ await expect(
+ runInPage({
+ pageUrl: 'about:blank',
+ script: 'await new Promise(() => {})',
+ timeout: 1000,
+ }),
+ ).rejects.toThrow(/did not settle within 1000 ms/)
+ expect(Date.now() - started).toBeLessThan(10_000)
+ expect(
+ (await runInPage({ pageUrl: 'about:blank', script: 'return 1 + 1' }))
+ .result,
+ ).toBe(2)
+})
+
+// What a test process opens in its browser is bounded (Chromium fails
+// requests under too many pages), and runs of concurrent tests do not share
+// a document.
+test('concurrent runs each hold a page of their own, at most runPageLimit at once, each on a fresh document', async () => {
+ let active = 0
+ let most = 0
+ const server = createServer((request, response) => {
+ if (request.url === '/page') {
+ response.setHeader('content-type', 'text/html')
+ response.end('page
')
+ return
+ }
+ active++
+ most = Math.max(most, active)
+ setTimeout(() => {
+ active--
+ response.end('held')
+ }, 300)
+ })
+ await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve))
+ onTestFinished(
+ () => new Promise((resolve) => server.close(() => resolve())),
+ )
+ const url = `http://127.0.0.1:${(server.address() as AddressInfo).port}/`
+ const runs = await Promise.all(
+ Array.from({ length: runPageLimit + 2 }, (_, index) =>
+ runInPage<{ earlier: unknown; held: string }>({
+ pageUrl: `${url}page`,
+ script: `const earlier = window.__earlierRun ?? null
+window.__earlierRun = ${index}
+// (a URL of its own: the browser's HTTP cache makes requests of the same
+// URL wait for each other)
+return { earlier, held: await (await fetch('/hold?run=${index}')).text() }`,
+ }),
+ ),
+ )
+ expect(runs.map((run) => run.result)).toEqual(
+ runs.map(() => ({ earlier: null, held: 'held' })),
+ )
+ expect(most).toBeGreaterThan(1)
+ expect(most).toBeLessThanOrEqual(runPageLimit)
+})
+
+// A run returns once its page left the run's document, so what the dev
+// server sends next (a full reload after the test's edit) reaches no page a
+// later run gets. When the page left only after the run returned, such a
+// reload, started while the page was on its way to `about:blank`, outlived
+// that navigation and interrupted the next run's navigation (under load).
+test('a run returns once its page left the run’s document: a message the dev server sends next reaches no page', async () => {
+ let answers = 0
+ const host = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ client: true,
+ plugins: [
+ {
+ name: 'control:answers',
+ configureServer(server) {
+ server.middlewares.use('/__answer', (_request, response) => {
+ answers++
+ response.end()
+ })
+ },
+ },
+ ],
+ files: {
+ 'main.js': `export const value = 'MARK_VALUE'
+import.meta.hot.on('control:probe', () => {
+ navigator.sendBeacon('/__answer')
+})
+`,
+ },
+ })
+ for (let round = 0; round < 5; round++) {
+ const run = await host.runClient('/main.js', 'return module.value')
+ expect(run.result).toBe('MARK_VALUE')
+ host.dev.vite.environments.client.hot.send({
+ type: 'custom',
+ event: 'control:probe',
+ })
+ // A page still on the run's document gets the message within a moment
+ await new Promise((resolve) => setTimeout(resolve, 300))
+ expect(answers).toBe(0)
+ // and a full reload sent then reaches no later run
+ host.dev.vite.environments.client.hot.send({ type: 'full-reload' })
+ const later = await host.runClient<{ value: string; loads: number }>(
+ '/main.js',
+ `await new Promise((resolve) => setTimeout(resolve, 200))
+return { value: module.value, loads: performance.getEntriesByType('navigation').length }`,
+ )
+ expect(later.result).toEqual({ value: 'MARK_VALUE', loads: 1 })
+ }
+})
+
+test('openPage keeps at most openPageLimit pages open: one more waits until one closes', async () => {
+ const pages = await Promise.all(
+ Array.from({ length: openPageLimit }, () =>
+ openPage('about:blank', { registerCleanup: onTestFinished }),
+ ),
+ )
+ let opened = false
+ const next = openPage('about:blank', { registerCleanup: onTestFinished })
+ void next.then(() => {
+ opened = true
+ })
+ await new Promise((resolve) => setTimeout(resolve, 500))
+ expect(opened).toBe(false)
+ await pages[0]!.close()
+ await next
+ expect(opened).toBe(true)
+})
diff --git a/packages/compiler-test-utils/tests/integration/budget-reporter.test.ts b/packages/compiler-test-utils/tests/integration/budget-reporter.test.ts
new file mode 100644
index 0000000000..d4c927c7db
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/budget-reporter.test.ts
@@ -0,0 +1,153 @@
+/**
+ * Controls of the budget reporter (budget-reporter.ts) on real Vitest runs
+ * (the Vitest CLI in a child process, on a fixture package that has this
+ * package's budgets): a run in which a test file failed to load is not a
+ * measurement, so strict mode fails it as invalid and report-only mode says
+ * its times are not a measurement; a run whose files all pass is a
+ * measurement.
+ */
+import { execFile } from 'node:child_process'
+import { mkdtemp, rm, writeFile } from 'node:fs/promises'
+import { createRequire } from 'node:module'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, test } from 'vitest'
+import type { TestContext } from 'vitest'
+
+const reporter = path.join(
+ path.dirname(fileURLToPath(import.meta.url)),
+ '../../src/budget-reporter.ts',
+)
+const vitestCli = path.join(
+ path.dirname(createRequire(import.meta.url).resolve('vitest/package.json')),
+ 'vitest.mjs',
+)
+
+const passingFile = `test('passes', () => {})\n`
+// A file that fails to load, like a test importing a helper that is missing
+const brokenFile = `import './missing-helper.js'\n\ntest('never runs', () => {})\n`
+
+/**
+ * Runs a whole tier (every file of the fixture) at the budgets' worker count
+ * with the Vitest CLI; resolves with its exit code and output. `context`
+ * is the calling test's: a concurrent test's cleanup must be its own (the
+ * global `onTestFinished` may register it on another running test, which
+ * then removes the fixture while this run reads it).
+ */
+async function runTier(
+ context: Pick,
+ files: Record,
+ budgets: 'strict' | 'report-only',
+ projectName = 'unit',
+) {
+ const root = await mkdtemp(path.join(tmpdir(), 'budget-reporter-'))
+ context.onTestFinished(() => rm(root, { recursive: true, force: true }))
+ await writeFile(
+ path.join(root, 'package.json'),
+ JSON.stringify({ name: '@tanstack/compiler-test-utils', type: 'module' }),
+ )
+ await writeFile(
+ path.join(root, 'vitest.config.mjs'),
+ `export default { test: { name: ${JSON.stringify(projectName)}, globals: true, watch: false, reporters: ['default', ${JSON.stringify(reporter)}] } }\n`,
+ )
+ for (const [name, code] of Object.entries(files)) {
+ await writeFile(path.join(root, name), code)
+ }
+ // The child is a Vitest run of its own, not a worker of this one
+ const env = Object.fromEntries(
+ Object.entries(process.env).filter(([key]) => !key.startsWith('VITEST')),
+ )
+ delete env.COMPILER_TEST_BUDGETS
+ if (budgets === 'strict') {
+ env.COMPILER_TEST_BUDGETS = 'strict'
+ }
+ env.NO_COLOR = '1'
+ delete env.FORCE_COLOR
+ return new Promise<{ exitCode: number; output: string }>((resolve) => {
+ execFile(
+ process.execPath,
+ [vitestCli, 'run', '--root', root, '--maxWorkers=4'],
+ { cwd: root, env, timeout: 25_000 },
+ (error, stdout, stderr) => {
+ resolve({
+ exitCode: error ? ((error.code as number | undefined) ?? 1) : 0,
+ output: `${stdout}\n${stderr}`,
+ })
+ },
+ )
+ })
+}
+
+test.concurrent(
+ 'strict mode fails a run in which a test file failed to load, as an invalid measurement',
+ async (context) => {
+ const { exitCode, output } = await runTier(
+ context,
+ { 'passing.test.js': passingFile, 'broken.test.js': brokenFile },
+ 'strict',
+ )
+ expect(output).toContain('Test budget (strict')
+ expect(output).toMatch(
+ /Test budget \(strict\): not a valid measurement \(test files failed: broken\.test\.js\)/,
+ )
+ expect(output).not.toContain('Test budget (strict): passed')
+ expect(exitCode).toBe(1)
+ },
+ 30_000,
+)
+
+test.concurrent(
+ 'report-only mode says the times of such a run are not a measurement',
+ async (context) => {
+ const { output } = await runTier(
+ context,
+ { 'passing.test.js': passingFile, 'broken.test.js': brokenFile },
+ 'report-only',
+ )
+ expect(output).toContain('Test budget (report only')
+ expect(output).toMatch(
+ /not a measurement \(test files failed: broken\.test\.js\)/,
+ )
+ },
+ 30_000,
+)
+
+test.concurrent(
+ 'a run whose files all pass is a measurement',
+ async (context) => {
+ const { output } = await runTier(
+ context,
+ { 'passing.test.js': passingFile },
+ 'strict',
+ )
+ // The reporter ran and judged the time (pass or over a limit: the time
+ // depends on the machine), without calling the run invalid
+ expect(output).toContain('Test budget (strict')
+ expect(output).toContain('@tanstack/compiler-test-utils unit:')
+ expect(output).not.toContain('not a valid measurement')
+ },
+ 30_000,
+)
+
+test('a project named integration-* (e.g. integration-pages) is the slow tier', async (context) => {
+ const { output } = await runTier(
+ context,
+ { 'pages.test.js': passingFile },
+ 'report-only',
+ 'integration-pages',
+ )
+ expect(output).toContain('@tanstack/compiler-test-utils integration:')
+ expect(output).not.toContain('@tanstack/compiler-test-utils unit:')
+}, 30_000)
+
+test('noncompiler coverage does not consume compiler acceptance budgets', async (context) => {
+ const { exitCode, output } = await runTier(
+ context,
+ { 'runtime.test.js': passingFile },
+ 'strict',
+ 'noncompiler',
+ )
+ expect(exitCode).toBe(0)
+ expect(output).not.toContain('Test budget (strict')
+}, 30_000)
diff --git a/packages/compiler-test-utils/tests/integration/build-harness.test.ts b/packages/compiler-test-utils/tests/integration/build-harness.test.ts
new file mode 100644
index 0000000000..b57594d398
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/build-harness.test.ts
@@ -0,0 +1,572 @@
+/**
+ * Control tests of the real-build harness (build-harness.ts): for each
+ * bundler, the harness reports eager and lazy placement correctly, `run()`
+ * executes SSR output in Node and client output in a real browser, and
+ * side-effect hints reach the bundler.
+ */
+import { existsSync } from 'node:fs'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, onTestFinished, test } from 'vitest'
+import {
+ bundleApp as bundleAppIn,
+ bundlers,
+ createApp,
+ describeBuild,
+ originalFrameOf,
+} from '../../src/build-harness'
+import { findDiagnostics } from '../../src/diagnostics'
+import type {
+ BundleOptions,
+ BundlerPlugins,
+ Placement,
+} from '../../src/build-harness'
+
+const timeout = 60_000
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+/** Builds a one-off app (`bundleApp`) in this directory, without a plugin. */
+function bundleApp(
+ options: Omit & { plugins?: BundlerPlugins },
+) {
+ return bundleAppIn({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ ...options,
+ })
+}
+
+/**
+ * The entry imports `./eager` statically and `./lazy` on demand, and never
+ * uses the `unused` export of `./eager`.
+ */
+const dynamicImportApp = {
+ 'entry.ts': `import { eager } from './eager'
+export const value = eager()
+export async function load() {
+ const { lazy } = await import('./lazy')
+ return lazy()
+}
+`,
+ 'eager.ts': `export function eager() {
+ return 'MARK_EAGER'
+}
+export function unused() {
+ return 'MARK_UNUSED'
+}
+`,
+ 'lazy.ts': `export function lazy() {
+ return 'MARK_LAZY'
+}
+`,
+}
+
+describe.each(bundlers)('%s', (bundler) => {
+ test.each(['ssr', 'client'] as const)(
+ 'reports static imports as eager and dynamic imports as lazy, and runs the output (%s)',
+ async (env) => {
+ const app = await bundleApp({ bundler, env, files: dynamicImportApp })
+ expect(app.eager).toContain(app.entry.fileName)
+ expect(app.lazy).not.toHaveLength(0)
+ expect({
+ eager: app.where('MARK_EAGER'),
+ lazy: app.where('MARK_LAZY'),
+ unused: app.where('MARK_UNUSED'),
+ }).toEqual({ eager: 'eager', lazy: 'lazy', unused: 'nowhere' })
+ const lazyChunk = app.locate('MARK_LAZY').lazy[0]
+ expect(
+ app.chunks.some((chunk) => chunk.dynamicImports.includes(lazyChunk!)),
+ ).toBe(true)
+
+ const run = await app.run(`console.log('ran')
+return [entry.value, await entry.load()]`)
+ expect(run.result).toEqual(['MARK_EAGER', 'MARK_LAZY'])
+ expect(run.logs).toEqual(['ran'])
+ expect(run.html).toBe(
+ env === 'client' ? '
' : undefined,
+ )
+ },
+ timeout,
+ )
+
+ test('emits source maps naming the source files', async () => {
+ const app = await bundleApp({
+ bundler,
+ files: dynamicImportApp,
+ sourcemap: true,
+ })
+ const lazyChunk = app.chunks.find(
+ (chunk) => chunk.fileName === app.locate('MARK_LAZY').lazy[0],
+ )
+ expect(
+ lazyChunk?.map?.sources.map((source) => path.basename(source)),
+ ).toContain('lazy.ts')
+ })
+
+ test('maps a frame of an error stack through the source map of its chunk', async () => {
+ const app = await bundleApp({
+ bundler,
+ files: {
+ 'entry.ts': `export async function load() {
+ const { fail } = await import('./failing')
+ return fail()
+}
+`,
+ // The TypeScript-only lines before the throw shift it: a map that
+ // skips the TypeScript transform points at the wrong line.
+ 'failing.ts': `interface Failure {
+ message: string
+ code: number
+}
+type Reason = Failure['message']
+export function fail(reason: Reason = 'MARK_FAIL'): string {
+ // MARK_FAIL throws on line 8
+ throw new Error(reason)
+}
+`,
+ },
+ sourcemap: true,
+ })
+ const { result } = await app.run(
+ `try { await entry.load() } catch (error) { return error.stack }`,
+ )
+ const frame = originalFrameOf(app, result as string)
+ expect(frame && { file: frame.file, line: frame.line }).toEqual({
+ file: 'failing.ts',
+ line: 8,
+ })
+ })
+
+ // `(value: T) => value` and `input` only parse as TypeScript
+ // without JSX, which is how every bundler reads a `.ts` file.
+ test('compiles the TypeScript-only syntax of a .ts module', async () => {
+ const app = await bundleApp({
+ bundler,
+ files: {
+ 'entry.ts': `const identity = (value: T): T => value
+export function read(input: unknown) {
+ return identity(input + 1)
+}
+`,
+ },
+ })
+ expect((await app.run('return entry.read(1)')).result).toBe(2)
+ })
+
+ test('builds an app with a symlinked module', async () => {
+ const app = await bundleApp({
+ bundler,
+ files: {
+ 'entry.ts': `export { linked } from './linked'\n`,
+ 'real/linked.ts': `export const linked = 'MARK_LINKED'\n`,
+ },
+ symlinks: { 'linked.ts': 'real/linked.ts' },
+ })
+ expect((await app.run('return entry.linked')).result).toBe('MARK_LINKED')
+ })
+
+ test('reports a build error through the bundler', async () => {
+ await expect(
+ bundleApp({
+ bundler,
+ files: { 'entry.ts': `import { missing } from './missing'\nmissing()` },
+ }),
+ ).rejects.toMatchObject({
+ name: 'BuildError',
+ bundler,
+ errors: expect.arrayContaining([
+ expect.stringMatching(/resolve ["']\.\/missing["']/),
+ ]),
+ })
+ })
+})
+
+/**
+ * A plugin of `bundler` that warns through the bundler's own reporting
+ * (`MARK_PLUGIN_WARNING`) and, except esbuild's, prints a warning and an
+ * error on the console while the build runs; the build succeeds. (esbuild
+ * calls plugins from callbacks of its long-lived service, and the harness
+ * does not attribute their console output to the build reliably: in this
+ * file's run it reached no build. A known limit of the capture, which
+ * router-plugin's console control leaves out for esbuild too.)
+ */
+const reportingPlugins: BundlerPlugins = {
+ vite: () => ({
+ name: 'reports',
+ buildStart(this: { warn: (message: string) => void }) {
+ this.warn('MARK_PLUGIN_WARNING')
+ console.warn('MARK_CONSOLE_WARNING')
+ console.error('MARK_CONSOLE_ERROR')
+ },
+ }),
+ esbuild: () => ({
+ name: 'reports',
+ setup(build: {
+ onStart: (callback: () => { warnings: Array<{ text: string }> }) => void
+ }) {
+ build.onStart(() => {
+ return { warnings: [{ text: 'MARK_PLUGIN_WARNING' }] }
+ })
+ },
+ }),
+ ...Object.fromEntries(
+ (['webpack', 'rspack'] as const).map((bundler) => [
+ bundler,
+ () => ({
+ apply(compiler: {
+ hooks: {
+ thisCompilation: {
+ tap: (
+ name: string,
+ callback: (compilation: { warnings: Array }) => void,
+ ) => void
+ }
+ }
+ }) {
+ compiler.hooks.thisCompilation.tap('reports', (compilation) => {
+ compilation.warnings.push(new Error('MARK_PLUGIN_WARNING'))
+ console.warn('MARK_CONSOLE_WARNING')
+ console.error('MARK_CONSOLE_ERROR')
+ })
+ },
+ }),
+ ]),
+ ),
+}
+
+/** The markers of `diagnostics`, sorted. */
+const markersOf = (diagnostics: Array<{ text: string }>) =>
+ diagnostics.flatMap(({ text }) => text.match(/MARK_\w+/g) ?? []).sort()
+
+// Severity is part of a report (SPEC §5.7: a clause that says "warn" and
+// allows no refusal asks for a warning): the result keeps it on both
+// channels, as a dev server's channel does.
+test.each(bundlers)(
+ '%s: the reports of a build that succeeds keep their severity',
+ async (bundler) => {
+ const app = await bundleApp({
+ bundler,
+ files: { 'entry.ts': `export const value = 1\n` },
+ plugins: reportingPlugins,
+ })
+ expect(app.warnings).toContainEqual(
+ expect.objectContaining({
+ severity: 'warning',
+ text: expect.stringContaining('MARK_PLUGIN_WARNING'),
+ }),
+ )
+ const printsToConsole = bundler !== 'esbuild'
+ if (printsToConsole) {
+ expect(app.consoleMessages).toEqual(
+ expect.arrayContaining([
+ expect.objectContaining({
+ severity: 'warning',
+ text: expect.stringContaining('MARK_CONSOLE_WARNING'),
+ }),
+ expect.objectContaining({
+ severity: 'error',
+ text: expect.stringContaining('MARK_CONSOLE_ERROR'),
+ }),
+ ]),
+ )
+ }
+ const reported = [...app.warnings, ...app.consoleMessages]
+ expect({
+ warning: markersOf(findDiagnostics(reported, { severity: 'warning' })),
+ error: markersOf(findDiagnostics(reported, { severity: 'error' })),
+ }).toEqual(
+ printsToConsole
+ ? {
+ warning: ['MARK_CONSOLE_WARNING', 'MARK_PLUGIN_WARNING'],
+ error: ['MARK_CONSOLE_ERROR'],
+ }
+ : { warning: ['MARK_PLUGIN_WARNING'], error: [] },
+ )
+ },
+ timeout,
+)
+
+// Vite's logger: an error logged by a build that does not fail is a report
+// of that build, an error, not a warning.
+test('vite: an error logged by a build that succeeds is reported as an error', async () => {
+ const app = await bundleApp({
+ bundler: 'vite',
+ files: { 'entry.ts': `export const value = 1\n` },
+ plugins: {
+ vite: () => ({
+ name: 'logs-an-error',
+ configResolved(config: { logger: { error: (text: string) => void } }) {
+ config.logger.error('MARK_LOGGED_ERROR')
+ },
+ }),
+ },
+ })
+ expect(
+ findDiagnostics(app.warnings, { severity: 'error' }).map(
+ ({ text }) => text,
+ ),
+ ).toEqual([expect.stringContaining('MARK_LOGGED_ERROR')])
+})
+
+// Like `vite build`, which minifies client builds but not SSR builds.
+test('a Vite production build minifies the client, not SSR', async () => {
+ const files = {
+ 'entry.ts': `export function read() {
+ const keepThisLocalName = { value: 'MARK_LOCAL' }
+ keepThisLocalName.value += '!'
+ return keepThisLocalName.value
+}
+`,
+ }
+ const ssr = await bundleApp({ bundler: 'vite', env: 'ssr', files })
+ const client = await bundleApp({ bundler: 'vite', env: 'client', files })
+ expect([
+ ssr.where('keepThisLocalName'),
+ client.where('keepThisLocalName'),
+ ]).toEqual(['eager', 'nowhere'])
+ expect((await ssr.run('return entry.read()')).result).toBe('MARK_LOCAL!')
+})
+
+test('NODE_ENV is the mode during a build, or unset with nodeEnv: null', async () => {
+ const seen: Record = {}
+ for (const nodeEnv of [undefined, null] as const) {
+ await bundleAppIn({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ bundler: 'vite',
+ files: { 'entry.ts': `export const value = 1\n` },
+ nodeEnv,
+ plugins: {
+ vite: () => {
+ seen[String(nodeEnv)] = process.env.NODE_ENV
+ return { name: 'record-node-env' }
+ },
+ },
+ })
+ }
+ expect(seen).toEqual({ undefined: 'production', null: undefined })
+})
+
+test.each(['webpack', 'rspack'] as const)(
+ '%s: rebuildAfter describes the output of the rebuild after the edit',
+ async (bundler) => {
+ const app = await bundleApp({
+ bundler,
+ files: { 'entry.ts': `export const value = 'v1'\n` },
+ rebuildAfter: { 'entry.ts': `export const value = 'v2'\n` },
+ })
+ expect((await app.run('return entry.value')).result).toBe('v2')
+ },
+ timeout,
+)
+
+describe('side-effect hints', () => {
+ /** `./effects` is imported for an export the entry never uses. */
+ const unusedModuleApp = {
+ 'entry.ts': `import { used } from './lib'
+export const value = used()
+`,
+ 'lib.ts': `export { used } from './used'
+export { unused } from './effects'
+`,
+ 'used.ts': `export function used() {
+ return 'used'
+}
+`,
+ 'effects.ts': `;(globalThis as any).effects = ['MARK_EFFECT']
+export function unused() {
+ return 'unused'
+}
+`,
+ }
+
+ test.each(bundlers)(
+ '"sideEffects": false in package.json drops a module whose exports are unused (%s)',
+ async (bundler) => {
+ const placements: Record = {}
+ for (const sideEffects of [undefined, false]) {
+ const app = await bundleApp({
+ bundler,
+ files: unusedModuleApp,
+ sideEffects,
+ })
+ placements[String(sideEffects)] = app.where('MARK_EFFECT')
+ }
+ expect(placements).toEqual({ undefined: 'eager', false: 'nowhere' })
+ },
+ timeout,
+ )
+
+ /**
+ * Unused bindings initialised by calls to a side-effectful function, with
+ * and without purity annotations.
+ */
+ const annotatedCallsApp = {
+ 'entry.ts': `import { used } from './lib'
+export const value = used()
+`,
+ 'lib.ts': `function record(label: string) {
+ ;(globalThis as any).recorded = [...((globalThis as any).recorded ?? []), label]
+ return label
+}
+/* #__NO_SIDE_EFFECTS__ */
+function recordAnnotated(label: string) {
+ ;(globalThis as any).recorded = [...((globalThis as any).recorded ?? []), label]
+ return label
+}
+export function used() {
+ return 'used'
+}
+export const plain = record('MARK_PLAIN')
+export const pure = /* @__PURE__ */ record('MARK_PURE')
+export const noSideEffects = recordAnnotated('MARK_NO_SIDE_EFFECTS')
+`,
+ }
+
+ // What each bundler drops in a production build. webpack and Rspack drop
+ // unused code inside a kept module only when minifying.
+ test.each(bundlers)(
+ '/* @__PURE__ */ and #__NO_SIDE_EFFECTS__ let an unused call be dropped (%s)',
+ async (bundler) => {
+ const app = await bundleApp({ bundler, files: annotatedCallsApp })
+ expect({
+ plain: app.where('MARK_PLAIN'),
+ pure: app.where('MARK_PURE'),
+ noSideEffects: app.where('MARK_NO_SIDE_EFFECTS'),
+ }).toEqual({ plain: 'eager', pure: 'nowhere', noSideEffects: 'nowhere' })
+ },
+ timeout,
+ )
+})
+
+describe('client runs in the browser', () => {
+ /** Describes classic script chunks written to an app's `dist`. */
+ async function classicBuild(files: Record) {
+ const app = await createApp({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: Object.fromEntries(
+ Object.entries(files).map(([file, code]) => [`dist/${file}`, code]),
+ ),
+ })
+ return describeBuild({
+ bundler: 'rspack',
+ env: 'client',
+ mode: 'development',
+ esModules: false,
+ root: app.root,
+ outDir: path.join(app.root, 'dist'),
+ chunks: [
+ {
+ fileName: 'static/index.js',
+ isEntry: true,
+ imports: ['static/vendor.js'],
+ dynamicImports: [],
+ },
+ {
+ fileName: 'static/vendor.js',
+ isEntry: false,
+ imports: ['static/index.js'],
+ dynamicImports: [],
+ },
+ ],
+ warnings: [],
+ consoleMessages: [],
+ duration: 0,
+ dispose: app.dispose,
+ entryGlobal: '__entry',
+ })
+ }
+
+ test('a classic script entry loads with the chunks of its group, and the page is /', async () => {
+ const build = await classicBuild({
+ 'static/vendor.js': `var vendorValue = 'MARK_VENDOR'\n`,
+ 'static/index.js': `globalThis.__entry = { read: () => [vendorValue, this === window, location.pathname] }\n`,
+ })
+ expect((await build.run('return entry.read()')).result).toEqual([
+ 'MARK_VENDOR',
+ true,
+ '/',
+ ])
+ })
+
+ test('an error the page does not catch fails the run', async () => {
+ const build = await classicBuild({
+ 'static/vendor.js': '',
+ 'static/index.js': `globalThis.__entry = {}
+setTimeout(() => { throw new Error('MARK_UNCAUGHT') })
+`,
+ })
+ await expect(
+ build.run('await new Promise((resolve) => setTimeout(resolve, 50))'),
+ ).rejects.toThrow(/MARK_UNCAUGHT/)
+ })
+})
+
+describe('registerCleanup', () => {
+ test('receives the dispose() that removes the app directory', async () => {
+ const cleanups: Array<() => Promise> = []
+ const app = await createApp({
+ dir: testsDir,
+ files: { 'entry.ts': `export const value = 1\n` },
+ registerCleanup: (cleanup) => cleanups.push(cleanup),
+ })
+ expect(cleanups).toEqual([app.dispose])
+ expect(existsSync(app.root)).toBe(true)
+ await cleanups[0]!()
+ expect(existsSync(app.root)).toBe(false)
+ })
+
+ test('without it, the app stays until dispose()', async () => {
+ const app = await createApp({
+ dir: testsDir,
+ files: { 'entry.ts': `export const value = 1\n` },
+ })
+ try {
+ expect(existsSync(app.root)).toBe(true)
+ } finally {
+ await app.dispose()
+ }
+ expect(existsSync(app.root)).toBe(false)
+ })
+})
+
+test.each(['webpack', 'rspack'] as const)(
+ '%s: concurrent native loaders keep console messages in their own builds',
+ async (bundler) => {
+ const build = () =>
+ bundleApp({
+ files: {
+ 'entry.js': 'export const value = 1',
+ 'warning-loader.cjs': `module.exports = function(code) { console.warn(this.resourcePath + ' MARK_LOADER_WARNING'); return code }`,
+ },
+ bundler,
+ env: 'ssr',
+ entry: 'entry.js',
+ configure(options) {
+ const rules = (options.module as { rules: Array }).rules
+ rules.push({
+ test: /\.js$/,
+ loader: path.join(String(options.context), 'warning-loader.cjs'),
+ })
+ },
+ })
+ const [first, second] = await Promise.all([build(), build()])
+ for (const [app, other] of [
+ [first, second],
+ [second, first],
+ ] as const) {
+ expect(
+ app.consoleMessages.some(
+ ({ text }) =>
+ text.includes(app.root) && text.includes('MARK_LOADER_WARNING'),
+ ),
+ ).toBe(true)
+ expect(
+ app.consoleMessages.some(({ text }) => text.includes(other.root)),
+ ).toBe(false)
+ }
+ },
+ timeout,
+)
diff --git a/packages/compiler-test-utils/tests/integration/global-trap.test.ts b/packages/compiler-test-utils/tests/integration/global-trap.test.ts
new file mode 100644
index 0000000000..096aae17a5
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/global-trap.test.ts
@@ -0,0 +1,97 @@
+/**
+ * Control tests of the global trap (global-trap.ts) in a real Chromium page:
+ * every way page code touches a trapped global is recorded. The former
+ * traps (accessors alone) did not record own-property probes
+ * (`hasOwnProperty`, `Object.hasOwn`, ...); an `in` probe cannot be
+ * recorded in a browser, so the code it guards is (it runs, as the
+ * accessor makes the probe true).
+ */
+import { expect, onTestFinished, test } from 'vitest'
+import { openPage } from '../../src/browser'
+import { globalTrapSource } from '../../src/global-trap'
+
+const timeout = 30_000
+
+/** A page whose init script traps `$Trapped$` (`window.touches()`). */
+async function trappedPage() {
+ return openPage('http://trap.invalid/', {
+ registerCleanup: onTestFinished,
+ html: '
',
+ initScript: `Object.defineProperty(window, 'touches', {
+ value: ${globalTrapSource({ names: '["$Trapped$"]' })},
+})`,
+ })
+}
+
+test.each([
+ ['a read', `window.$Trapped$`, ['read $Trapped$']],
+ ['a write', `window.$Trapped$ = 1`, ['write $Trapped$']],
+ [
+ 'code an `in` probe guards',
+ `if ('$Trapped$' in window) { window.$Trapped$?.() }`,
+ ['read $Trapped$'],
+ ],
+ ['`typeof` of the bare name', `typeof $Trapped$`, ['read $Trapped$']],
+ ['a call of the bare name', `$Trapped$()`, ['read $Trapped$']],
+ ['hasOwnProperty', `window.hasOwnProperty('$Trapped$')`, ['probe $Trapped$']],
+ [
+ 'Object.prototype.hasOwnProperty.call',
+ `Object.prototype.hasOwnProperty.call(globalThis, '$Trapped$')`,
+ ['probe $Trapped$'],
+ ],
+ ['Object.hasOwn', `Object.hasOwn(window, '$Trapped$')`, ['probe $Trapped$']],
+ [
+ 'propertyIsEnumerable',
+ `window.propertyIsEnumerable('$Trapped$')`,
+ ['probe $Trapped$'],
+ ],
+ [
+ 'getOwnPropertyDescriptor',
+ `Object.getOwnPropertyDescriptor(window, '$Trapped$')`,
+ ['probe $Trapped$'],
+ ],
+ ['Reflect.has', `Reflect.has(window, '$Trapped$')`, ['probe $Trapped$']],
+ [
+ 'a definition',
+ `Object.defineProperty(window, '$Trapped$', { value: 1, configurable: true })`,
+ ['define $Trapped$', 'redefined $Trapped$'],
+ ],
+ ['a deletion', `delete window.$Trapped$`, ['redefined $Trapped$']],
+])(
+ '%s is recorded',
+ async (_, code, expected) => {
+ const page = await trappedPage()
+ const touched = await page.page.evaluate(`(() => {
+ try { ${code} } catch {}
+ return window.touches()
+})()`)
+ expect(touched).toEqual(expected)
+ },
+ timeout,
+)
+
+test(
+ 'other names, other objects and the probes of other names record nothing',
+ async () => {
+ const page = await trappedPage()
+ const seen = await page.page.evaluate(`(() => {
+ window.other = 1
+ const element = document.getElementById('app')
+ element.expando = 2
+ const plain = { $Trapped$: 3 }
+ return {
+ values: [
+ window.other,
+ element.expando,
+ Object.hasOwn(window, 'other'),
+ window.hasOwnProperty('other'),
+ Object.hasOwn(plain, '$Trapped$'),
+ Object.getOwnPropertyDescriptor(plain, '$Trapped$').value,
+ ],
+ touched: window.touches(),
+ }
+})()`)
+ expect(seen).toEqual({ values: [1, 2, true, true, true, 3], touched: [] })
+ },
+ timeout,
+)
diff --git a/packages/compiler-test-utils/tests/integration/hmr-sync.test.ts b/packages/compiler-test-utils/tests/integration/hmr-sync.test.ts
new file mode 100644
index 0000000000..b8a4687a78
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/hmr-sync.test.ts
@@ -0,0 +1,153 @@
+/**
+ * Control tests of `settlePage` (hmr-sync.ts) on the Vite dev-server harness
+ * in `browser` mode: once it resolves, the page has handled every message
+ * the server sent before it. An update a module accepts has been applied
+ * (the page shows it at once, without waiting), and an update nothing
+ * accepts has reloaded the page (its load count tells), whether the page's
+ * code imports the sync module or the page imports it on every load
+ * (`hmrSyncInitScript`); and an update whose accept callback invalidates it
+ * (as a refresh runtime does when it cannot apply one) has had the reload
+ * that the page's `invalidate()` asked the server for, also when what the
+ * page sends reaches the server late.
+ */
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import { openPage } from '../../src/browser'
+import { createDevServer } from '../../src/dev-server'
+import {
+ hmrSyncInitScript,
+ hmrSyncModule,
+ settlePage,
+ trackRequests,
+} from '../../src/hmr-sync'
+
+const timeout = 60_000
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+/**
+ * An entry that shows the texts of `text.js` and `other.js` and applies
+ * updates of `text.js` itself; nothing accepts the updates of `other.js`.
+ * With `sync`, it imports the sync module itself.
+ */
+const app = (sync: boolean) => ({
+ 'index.html': `
`,
+ 'hmr-sync.ts': hmrSyncModule,
+ 'main.js': `${sync ? `import './hmr-sync.ts'\n` : ''}import { text } from './text.js'
+import { other } from './other.js'
+const show = (value) => {
+ document.getElementById('app').textContent = value + ' ' + other
+}
+show(text)
+import.meta.hot.accept('./text.js', (updated) => show(updated.text))
+`,
+ 'text.js': `export const text = 'text v1'\n`,
+ 'other.js': `export const other = 'other v1'\n`,
+})
+
+test.for([
+ { name: 'the app imports the sync module', sync: true },
+ { name: 'the page imports it on every load', sync: false },
+])(
+ 'once settled, an accepted update shows in place and one nothing accepts has reloaded the page ($name)',
+ { timeout },
+ async ({ sync }) => {
+ const server = await createDevServer({
+ dir: testsDir,
+ prefix: '.hmr-sync-',
+ registerCleanup: onTestFinished,
+ browser: true,
+ files: app(sync),
+ // The edited modules come late (a slow transform): the page handles
+ // the update, or loads again, a while after the server sent it
+ plugins: [
+ {
+ name: 'slow-edited-modules',
+ async transform(code, id) {
+ if (/(text|other)\.js$/.test(id) && code.includes('v2')) {
+ await new Promise((resolve) => setTimeout(resolve, 500))
+ }
+ return null
+ },
+ },
+ ],
+ })
+ const page = await openPage(server.url!, {
+ registerCleanup: onTestFinished,
+ ...(sync ? {} : { initScript: hmrSyncInitScript('/hmr-sync.ts') }),
+ })
+ const inFlight = trackRequests(page)
+ await page.waitForText('text v1 other v1')
+ await settlePage(server, page, inFlight)
+
+ await server.edit({ 'text.js': `export const text = 'text v2'\n` })
+ await settlePage(server, page, inFlight)
+ expect({ text: await page.text('#app'), loads: page.loads() }).toEqual({
+ text: 'text v2 other v1',
+ loads: 1,
+ })
+
+ await server.edit({ 'other.js': `export const other = 'other v2'\n` })
+ await settlePage(server, page, inFlight)
+ expect({ text: await page.text('#app'), loads: page.loads() }).toEqual({
+ text: 'text v2 other v2',
+ loads: 2,
+ })
+ },
+)
+
+test(
+ 'once settled, an update whose accept callback invalidates it has reloaded the page, also when the page reaches the server late',
+ { timeout },
+ async () => {
+ const server = await createDevServer({
+ dir: testsDir,
+ prefix: '.hmr-sync-',
+ registerCleanup: onTestFinished,
+ browser: true,
+ files: {
+ 'index.html': `
`,
+ 'hmr-sync.ts': hmrSyncModule,
+ // A module that accepts its own update, then gives up on it (Vite
+ // propagates the update to its importer, which accepts nothing: a
+ // full reload)
+ 'main.js': `import './hmr-sync.ts'
+import { text } from './text.js'
+document.getElementById('app').textContent = text
+`,
+ 'text.js': `export const text = 'text v1'
+import.meta.hot.accept(() => import.meta.hot.invalidate('cannot apply'))
+`,
+ },
+ })
+ const page = await openPage('about:blank', {
+ registerCleanup: onTestFinished,
+ })
+ // What the page sends over its HMR WebSocket reaches the server 400 ms
+ // late (a busy server or a slow link); what the server sends is not held
+ await page.page.context().routeWebSocket(/./, (ws) => {
+ const upstream = ws.connectToServer()
+ ws.onMessage((message) => {
+ setTimeout(() => upstream.send(message), 400)
+ })
+ upstream.onMessage((message) => ws.send(message))
+ })
+ await page.page.goto(server.url!)
+ const inFlight = trackRequests(page)
+ await page.waitForText('text v1')
+ await settlePage(server, page, inFlight)
+ const loads = page.loads()
+
+ await server.edit({
+ 'text.js': `export const text = 'text v2'
+import.meta.hot.accept(() => import.meta.hot.invalidate('cannot apply'))
+`,
+ })
+ await settlePage(server, page, inFlight)
+ expect({
+ text: await page.text('#app'),
+ reloads: page.loads() - loads,
+ }).toEqual({ text: 'text v2', reloads: 1 })
+ },
+)
diff --git a/packages/compiler-test-utils/tests/integration/native-hook-capture.test.ts b/packages/compiler-test-utils/tests/integration/native-hook-capture.test.ts
new file mode 100644
index 0000000000..8771dfab90
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/native-hook-capture.test.ts
@@ -0,0 +1,299 @@
+/**
+ * Controls of the console capture (`console-hook.ts`) for output printed
+ * from native bundler callbacks: Rolldown calls a Vite build's plugin hooks,
+ * and Rspack its compiler and compilation hooks, from native code, where
+ * Node's async context is not propagated. What a compiler prints there is
+ * a diagnostic like any other (SPEC §5.7: the channel is free), so:
+ * - the hosts' and the build environment's merged channels receive it, and
+ * a "nothing reported" check sees it;
+ * - with two apps at once, each channel receives what names its app, and
+ * output naming neither reaches both, marked `shared` (the owner is
+ * unknown), never silently.
+ */
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { createBuilder } from 'vite'
+import { expect, onTestFinished, test } from 'vitest'
+import { createApp, withBuildEnvironment } from '../../src/build-harness'
+import { expectNoProblems } from '../../src/diagnostic-channel'
+import { createPluginHost } from '../../src/plugin-host'
+import { createRsbuildPluginHost } from '../../src/rsbuild-plugin-host'
+import type { ChannelDiagnostic } from '../../src/diagnostic-channel'
+import type { RsbuildPlugin, Rspack } from '@rsbuild/core'
+import type { Plugin } from 'vite'
+
+const timeout = 60_000
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+const marked = (texts: Array) =>
+ texts.filter((text) => text.includes('MARK_NATIVE'))
+
+/** Warns through the console from a module hook and a bundle hook. */
+function consoleWarner(): Plugin {
+ return {
+ name: 'console-warner',
+ transform(_code, id) {
+ if (id.includes('/src/')) {
+ console.warn(`MARK_NATIVE transform ${path.basename(id)}`)
+ }
+ return null
+ },
+ generateBundle() {
+ console.warn('MARK_NATIVE generateBundle')
+ },
+ }
+}
+
+const viteFiles = {
+ 'index.html': `
`,
+ 'src/main.ts': `export const value = 1\n`,
+}
+
+test(
+ 'vite build: console output of Rolldown-called hooks is in the build diagnostics',
+ async () => {
+ const app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: viteFiles,
+ plugins: [consoleWarner()],
+ serve: false,
+ })
+ const build = await app.build()
+ // "Nothing reported" sees build-time output
+ expect(() => expectNoProblems(build.diagnostics)).toThrow(/MARK_NATIVE/)
+ expect(marked(build.diagnostics.map(({ text }) => text))).toEqual(
+ expect.arrayContaining([
+ 'MARK_NATIVE transform main.ts',
+ 'MARK_NATIVE generateBundle',
+ ]),
+ )
+ // One build at a time: its owner is known
+ expect(build.diagnostics.filter(({ shared }) => shared)).toEqual([])
+ },
+ timeout,
+)
+
+test(
+ 'withBuildEnvironment: a Vite build’s console output and default-logger warnings are in its messages',
+ async () => {
+ const app = await createApp({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: viteFiles,
+ })
+ const messages: Array = []
+ await withBuildEnvironment('production', messages, async () => {
+ const builder = await createBuilder({
+ root: app.root,
+ configFile: false,
+ logLevel: 'warn',
+ plugins: [
+ consoleWarner(),
+ {
+ name: 'context-warner',
+ transform(_code, id) {
+ if (id.includes('/src/')) {
+ this.warn(`MARK_NATIVE this.warn ${path.basename(id)}`)
+ }
+ return null
+ },
+ } satisfies Plugin,
+ ],
+ })
+ await builder.buildApp()
+ })
+ const reported = marked(messages.map(({ text }) => text))
+ expect(reported).toEqual(
+ expect.arrayContaining([
+ 'MARK_NATIVE transform main.ts',
+ 'MARK_NATIVE generateBundle',
+ ]),
+ )
+ expect(
+ reported.some((text) => text.includes('MARK_NATIVE this.warn main.ts')),
+ ).toBe(true)
+ },
+ timeout,
+)
+
+/** Warns through the console from Rspack compilation and compiler hooks. */
+function rspackWarner(): RsbuildPlugin {
+ return {
+ name: 'rspack-warner',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ compiler.hooks.thisCompilation.tap(
+ 'rspack-warner',
+ (compilation) => {
+ compilation.hooks.processAssets.tap(
+ { name: 'rspack-warner', stage: 0 },
+ () => {
+ console.warn('MARK_NATIVE processAssets')
+ },
+ )
+ },
+ )
+ compiler.hooks.done.tap('rspack-warner', () => {
+ console.warn('MARK_NATIVE done')
+ })
+ },
+ })
+ })
+ },
+ }
+}
+
+test.each(['dev', 'build'] as const)(
+ 'rsbuild %s: console output of Rspack compiler and compilation hooks is in the diagnostics',
+ async (mode) => {
+ const host = await createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': 'export const value = 1\n' },
+ serve: mode === 'dev',
+ plugins: [rspackWarner()],
+ })
+ const diagnostics =
+ mode === 'dev' ? host.diagnostics : (await host.build()).diagnostics
+ // "Nothing reported" sees build-time output
+ expect(() => expectNoProblems(diagnostics)).toThrow(/MARK_NATIVE/)
+ expect(marked(diagnostics.map(({ text }) => text))).toEqual(
+ expect.arrayContaining(['MARK_NATIVE processAssets', 'MARK_NATIVE done']),
+ )
+ expect(diagnostics.filter(({ shared }) => shared)).toEqual([])
+ },
+ timeout,
+)
+
+/** Resolves once `count` callers wait on it: work that overlaps for sure. */
+function barrier(count: number) {
+ let arrived = 0
+ let release!: () => void
+ const all = new Promise((resolve) => {
+ release = resolve
+ })
+ return () => {
+ arrived++
+ if (arrived === count) {
+ release()
+ }
+ return all
+ }
+}
+
+/**
+ * Two apps at once (`start` builds or serves one and returns its root and
+ * diagnostics): each channel has the native-callback output naming its own
+ * app and none naming the other's; output naming neither reaches both,
+ * marked `shared`.
+ */
+async function expectSeparated(
+ start: (
+ meet: () => Promise,
+ ) => Promise<{ root: string; diagnostics: Array }>,
+) {
+ const meet = barrier(2)
+ const apps = await Promise.all([start(meet), start(meet)])
+ for (const [app, other] of [
+ [apps[0], apps[1]],
+ [apps[1], apps[0]],
+ ] as const) {
+ const texts = app.diagnostics.map(({ text }) => text)
+ expect(texts.some((text) => text.includes(`MARK_OWNED ${app.root}`))).toBe(
+ true,
+ )
+ expect(texts.some((text) => text.includes(other.root))).toBe(false)
+ const unowned = app.diagnostics.filter(({ text }) =>
+ text.includes('MARK_UNOWNED'),
+ )
+ expect(unowned.length).toBeGreaterThan(0)
+ expect(unowned.every(({ shared }) => shared)).toBe(true)
+ expect(
+ app.diagnostics.filter(
+ ({ text, shared }) => shared && !text.includes('MARK_UNOWNED'),
+ ),
+ ).toEqual([])
+ }
+}
+
+test(
+ 'vite build: concurrent builds keep native-hook output naming their app, and share output naming neither',
+ async () => {
+ await expectSeparated(async (meet) => {
+ let root = ''
+ const app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: viteFiles,
+ serve: false,
+ plugins: [
+ {
+ name: 'owned-warner',
+ configResolved(config) {
+ root = config.root
+ },
+ async generateBundle() {
+ await meet()
+ console.warn(`MARK_OWNED ${root}/src/main.ts`)
+ console.warn('MARK_UNOWNED generateBundle')
+ },
+ } satisfies Plugin,
+ ],
+ })
+ return { root: app.root, diagnostics: (await app.build()).diagnostics }
+ })
+ },
+ timeout,
+)
+
+test.each(['dev', 'build'] as const)(
+ 'rsbuild %s: concurrent apps keep native-hook output naming their app, and share output naming neither',
+ async (mode) => {
+ await expectSeparated(async (meet) => {
+ const host = await createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': 'export const value = 1\n' },
+ serve: mode === 'dev',
+ plugins: [
+ {
+ name: 'owned-warner',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ compiler.hooks.thisCompilation.tap(
+ 'owned-warner',
+ (compilation) => {
+ compilation.hooks.processAssets.tapPromise(
+ { name: 'owned-warner', stage: 0 },
+ async () => {
+ await meet()
+ console.warn(
+ `MARK_OWNED ${compiler.context}/src/entry.ts`,
+ )
+ console.warn('MARK_UNOWNED processAssets')
+ },
+ )
+ },
+ )
+ },
+ })
+ })
+ },
+ },
+ ],
+ })
+ return {
+ root: host.root,
+ diagnostics:
+ mode === 'dev' ? host.diagnostics : (await host.build()).diagnostics,
+ }
+ })
+ },
+ timeout,
+)
diff --git a/packages/compiler-test-utils/tests/integration/oracles.test.ts b/packages/compiler-test-utils/tests/integration/oracles.test.ts
new file mode 100644
index 0000000000..3498d2d780
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/oracles.test.ts
@@ -0,0 +1,104 @@
+/**
+ * The diagnostic and source-map oracles on real bundler output: every
+ * bundler's build error for a broken module names the file and its line
+ * (whatever the bundler's format), and a throw executed in a built,
+ * source-mapped chunk resolves through its stack to the line of the throw.
+ */
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { describe, expect, onTestFinished, test } from 'vitest'
+import { bundleApp as bundleAppIn, bundlers } from '../../src/build-harness'
+import {
+ captureThrow,
+ expectDiagnostic,
+ mentionsFile,
+} from '../../src/diagnostics'
+import { traceStack } from '../../src/source-maps'
+import type { BundleOptions } from '../../src/build-harness'
+
+const timeout = 60_000
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+function bundleApp(options: Omit) {
+ return bundleAppIn({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ ...options,
+ })
+}
+
+// One unexpected token, so every parser reports the same position: line 2,
+// column 26 (1-based), the `*`.
+const broken = `export const ok = 1
+export const value = 1 + * 2
+export const after = 3
+`
+
+const failing = `interface Failure {
+ message: string
+}
+type Reason = Failure['message']
+export function fail(reason: Reason = 'MARK_FAIL'): string {
+ throw new Error(reason)
+}
+`
+
+describe.each(bundlers)('%s', (bundler) => {
+ test(
+ 'a build error names the broken file and its line',
+ async () => {
+ const diagnostics = await captureThrow(() =>
+ bundleApp({
+ bundler,
+ files: {
+ 'entry.ts': `export { value } from './src/broken'\n`,
+ 'src/broken.ts': broken,
+ },
+ }),
+ )
+ expectDiagnostic(diagnostics, {
+ severity: 'error',
+ file: 'src/broken.ts',
+ position: { line: 2, column: 26 },
+ })
+ },
+ timeout,
+ )
+
+ test(
+ 'a throw in a built chunk resolves through its stack to the line of the throw',
+ async () => {
+ const app = await bundleApp({
+ bundler,
+ files: {
+ 'entry.ts': `export async function load() {
+ const { fail } = await import('./src/failing')
+ return fail()
+}
+`,
+ 'src/failing.ts': failing,
+ },
+ sourcemap: true,
+ })
+ const { result: stack } = await app.run(
+ `try { await entry.load() } catch (error) { return error.stack }`,
+ )
+ expect(stack).toContain('MARK_FAIL')
+ const frames = traceStack(stack as string, (location) => {
+ const file = location.startsWith('file:')
+ ? fileURLToPath(location)
+ : location
+ return app.chunks.find(
+ (chunk) => path.join(app.outDir, chunk.fileName) === file,
+ )?.map as never
+ })
+ const resolved = frames.find((frame) => frame.original)
+ expect(resolved?.original?.line).toBe(6)
+ expect(mentionsFile(resolved!.original!.source, 'src/failing.ts')).toBe(
+ true,
+ )
+ },
+ timeout,
+ )
+})
diff --git a/packages/compiler-test-utils/tests/integration/plugin-host.test.ts b/packages/compiler-test-utils/tests/integration/plugin-host.test.ts
new file mode 100644
index 0000000000..e6a60f26aa
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/plugin-host.test.ts
@@ -0,0 +1,232 @@
+/**
+ * Controls of the public in-process plugin host (plugin-host.ts), slow
+ * tier: client code runs in the shared Chromium page with the real Vite
+ * client (a real hot context, real ES module linking), and `vite build`
+ * runs the same public plugins, with each environment's chunks and the
+ * build's merged diagnostics.
+ */
+import diagnosticsChannel from 'node:diagnostics_channel'
+import { appendFile } from 'node:fs/promises'
+import net from 'node:net'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import { expectDiagnostic } from '../../src/diagnostics'
+import { HostBuildError, createPluginHost } from '../../src/plugin-host'
+import type { Plugin } from 'vite'
+
+const timeout = 60_000
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+/** Rewrites `__MARK__` in the app's modules; warns through `this.warn`. */
+const userPlugin: Plugin = {
+ name: 'user-plugin',
+ transform(code, id) {
+ if (!id.includes('/src/') || !code.includes('__MARK__')) {
+ return null
+ }
+ this.warn(`rewrote a marker in ${id}`)
+ return code.replaceAll('__MARK__', 'MARKED')
+ },
+}
+
+const files = {
+ 'index.html': `
`,
+ 'src/main.ts': `import { label } from './label'
+export const render = () => {
+ document.getElementById('root')!.textContent = label
+ return document.body.innerHTML
+}
+render()
+export const hot = () => ({
+ hot: typeof import.meta.hot,
+ data: typeof import.meta.hot?.data,
+})
+`,
+ 'src/label.ts': `export const label = '__MARK__ label'\n`,
+ 'src/missing.ts': `import { absent } from './label'
+export const read = () => absent
+`,
+}
+
+test(
+ 'client code runs in the shared page: rendered by the module, with the real hot context, and a missing import throws',
+ async () => {
+ const app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [userPlugin],
+ client: true,
+ })
+ const started = performance.now()
+ const rendered = await app.runClient(
+ '/src/main.ts',
+ 'return module.render().trim()',
+ )
+ const first = performance.now() - started
+ expect(rendered.result).toBe('MARKED label
')
+ expect(rendered.errors).toEqual([])
+
+ // The real Vite client: `import.meta.hot` with its `data`
+ const again = performance.now()
+ expect(
+ (await app.runClient('/src/main.ts', 'return module.hot()')).result,
+ ).toEqual({ hot: 'object', data: 'object' })
+ const second = performance.now() - again
+
+ await expect(app.runClient('/src/missing.ts')).rejects.toThrow(
+ /does not provide an export named 'absent'/,
+ )
+ // The page is reused: a later run costs a page load, not a browser
+ // (the dev server's channel records the test's console too)
+ if (process.env.PLUGIN_HOST_TIMINGS) {
+ await appendFile(
+ process.env.PLUGIN_HOST_TIMINGS,
+ `page runs: first ${first.toFixed(0)} ms, next ${second.toFixed(0)} ms\n`,
+ )
+ }
+ },
+ timeout,
+)
+
+// Vite keeps a full reload sent while no client is
+// connected and hands it to the next client that connects. Between two
+// `runClient` runs no page is connected, so the next run's page would
+// reload under its run; a client host keeps an idle HMR client connected
+// instead. The probe connects as the next page's Vite client would, and
+// reads everything the server sends it up to a marker sent after it
+// connected (a held message is sent right after `connected`, before it).
+test(
+ 'a full reload sent while no page runs is not handed to the next page that connects',
+ async () => {
+ const app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [],
+ client: true,
+ })
+ // No page of this host is open (as between two runs once the shared page
+ // moved on to another host or app): an edit's full reload now
+ app.dev.vite.ws.send({ type: 'full-reload', path: '*' })
+
+ const url = new URL(app.dev.url!)
+ url.protocol = 'ws:'
+ url.searchParams.set('token', app.dev.vite.config.webSocketToken)
+ const probe = new WebSocket(url, 'vite-hmr')
+ onTestFinished(() => probe.close())
+ const received: Array<{ type: string; event?: string }> = []
+ await new Promise((resolve, reject) => {
+ probe.addEventListener('error', () => reject(new Error('no connection')))
+ probe.addEventListener('message', (event) => {
+ const message = JSON.parse(String(event.data))
+ received.push(message)
+ if (message.type === 'connected') {
+ app.dev.vite.ws.send({ type: 'custom', event: 'probe:end' })
+ }
+ if (message.event === 'probe:end') {
+ resolve()
+ }
+ })
+ })
+ expect(received.map(({ type }) => type)).toEqual(['connected', 'custom'])
+ },
+ timeout,
+)
+
+// Under heavy load, a test worker's event loop can stay
+// blocked (other tests' synchronous work) right when the idle HMR client
+// connects at host start. A client of this process must still reach the
+// server: Node's address-family selection gives a connection attempt
+// `getDefaultAutoSelectFamilyAttemptTimeout()` on the event loop's clock,
+// so a client of a name with two addresses, of which the server listens on
+// one, abandoned the connection the kernel had made and was refused at the
+// other ("no HMR connection"). The block runs once each attempt's timer is
+// set, as a busy worker's would.
+test(
+ 'a client host starts while the event loop is blocked past the attempt timeout of address-family selection',
+ async () => {
+ const blockFor = net.getDefaultAutoSelectFamilyAttemptTimeout() + 300
+ const attempts: Array = []
+ const onSocket = (message: unknown) => {
+ const { socket } = message as { socket: net.Socket }
+ socket.once('connectionAttempt', (address: string, port: number) => {
+ attempts.push(`${address}:${port}`)
+ queueMicrotask(() => {
+ const end = performance.now() + blockFor
+ while (performance.now() < end) {
+ // a worker busy with synchronous work
+ }
+ })
+ })
+ }
+ diagnosticsChannel.subscribe('net.client.socket', onSocket)
+ let app
+ try {
+ app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [],
+ client: true,
+ })
+ } finally {
+ diagnosticsChannel.unsubscribe('net.client.socket', onSocket)
+ }
+ // The idle client went through the blocked attempt, to the server
+ const port = new URL(app.dev.url!).port
+ expect(attempts.some((attempt) => attempt.endsWith(`:${port}`))).toBe(true)
+ },
+ timeout,
+)
+
+test(
+ 'vite build runs the same public plugins; chunks, describe() and diagnostics',
+ async () => {
+ const app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [userPlugin],
+ serve: false,
+ })
+ const build = await app.build()
+ const client = build.environments.client!
+ expect(client.chunks.some((chunk) => chunk.code.includes('MARKED'))).toBe(
+ true,
+ )
+ // The plugin's warning, through Vite's logger, in the merged channel
+ expectDiagnostic(build.diagnostics, {
+ severity: 'warning',
+ file: 'src/label.ts',
+ root: app.root,
+ })
+ const described = await build.describe('client')
+ expect(described.where('MARKED')).toBe('eager')
+ },
+ timeout,
+)
+
+test(
+ 'a failed build rejects with its error and what it reported',
+ async () => {
+ const app = await createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { ...files, 'src/label.ts': `export const label = (` },
+ plugins: [userPlugin],
+ serve: false,
+ })
+ const error = await app.build().catch((thrown: unknown) => thrown)
+ expect(error).toBeInstanceOf(HostBuildError)
+ expectDiagnostic(error, {
+ severity: 'error',
+ file: 'src/label.ts',
+ root: app.root,
+ position: { line: 1 },
+ })
+ },
+ timeout,
+)
diff --git a/packages/compiler-test-utils/tests/integration/rsbuild-dev-server.test.ts b/packages/compiler-test-utils/tests/integration/rsbuild-dev-server.test.ts
new file mode 100644
index 0000000000..0c8d519794
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/rsbuild-dev-server.test.ts
@@ -0,0 +1,588 @@
+/**
+ * Control tests of the Rsbuild dev-server harness (rsbuild-dev-server.ts):
+ * `edit()` waits for the rebuild of the edited modules, `settle()` for the
+ * compiles of every write (plugins' included), and `outputs()` returns what
+ * the environment emits afterwards.
+ */
+import { watch } from 'node:fs'
+import { readFile, stat, writeFile } from 'node:fs/promises'
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import { createRsbuildDevServer } from '../../src/rsbuild-dev-server'
+import type { RsbuildPlugin, Rspack } from '@rsbuild/core'
+import type { FSWatcher } from 'node:fs'
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+test('rebuilds the edited module and emits the edit', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ })
+ const joined = async () => Object.values(await server.outputs()).join('\n')
+ expect(await joined()).toContain('MARK_V1')
+
+ await server.edit({ 'src/leaf.ts': `export const leaf = 'MARK_V2'\n` })
+
+ expect(server.rebuilt).toContain('src/leaf.ts')
+ expect(await joined()).toContain('MARK_V2')
+ expect(await joined()).not.toContain('MARK_V1')
+}, 30_000)
+
+// The watcher may start the compile of an edit before its writes finish
+// (on a loaded machine, before the harness even sees the write done): the
+// wait must still end with that compile, which started after the module's
+// write. Here a large file nothing imports, which the test accepts no
+// compile for, keeps the writes going after the module's.
+test('a compile that starts before the writes of the edit finish ends the wait', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ })
+
+ await server.edit(
+ {
+ 'src/leaf.ts': `export const leaf = 'MARK_V2'\n`,
+ 'notes/large.txt': 'x'.repeat(64 * 1024 * 1024),
+ },
+ { accept: (relative) => relative === 'notes/large.txt' },
+ )
+
+ expect(server.rebuilt).toContain('src/leaf.ts')
+ expect(Object.values(await server.outputs()).join('\n')).toContain('MARK_V2')
+}, 30_000)
+
+// `stop()` ends the server and its watcher but keeps the app, so a test can
+// edit it afterwards; `close()` removes it.
+test('stop() stops the server and keeps the app until close()', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ })
+ await server.stop()
+ const leaf = path.join(server.root, 'src/leaf.ts')
+ await writeFile(leaf, `export const leaf = 'MARK_V2'\n`)
+ expect(await readFile(leaf, 'utf8')).toContain('MARK_V2')
+ await server.close()
+ await expect(readFile(leaf, 'utf8')).rejects.toThrow()
+}, 30_000)
+
+// Rsbuild's default: each compile after an edit emits hot-update chunks with
+// the edited modules, which a connected browser applies.
+test.each([true, false])(
+ 'hmr: %s, an edit emits hot-update chunks with the edit only with hmr, and outputs() leaves them out',
+ async (hmr) => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ hmr,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ })
+
+ await server.edit({ 'src/leaf.ts': `export const leaf = 'MARK_V2'\n` })
+
+ const updates = Object.values(await server.hotUpdates()).join('\n')
+ expect(updates.includes('MARK_V2')).toBe(hmr)
+ const outputs = await server.outputs()
+ expect(
+ Object.keys(outputs).filter((file) => file.includes('hot-update')),
+ ).toEqual([])
+ expect(Object.values(outputs).join('\n')).toContain('MARK_V2')
+ },
+ 30_000,
+)
+
+test('a compile a plugin makes fail rejects the wait with its error, without waiting for the timeout', async () => {
+ let compile = 0
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ compileTimeout: 20_000,
+ files: { 'src/entry.ts': `console.log('MARK_V1')\n` },
+ plugins: [
+ {
+ name: 'fails-the-second-compile',
+ setup(api) {
+ api.processAssets({ stage: 'summarize' }, () => {
+ compile++
+ if (compile === 2) {
+ throw new Error('MARK_PLUGIN_FAILURE')
+ }
+ })
+ },
+ },
+ ],
+ })
+ const started = Date.now()
+ await expect(
+ server.edit({ 'src/entry.ts': `console.log('MARK_V2')\n` }),
+ ).rejects.toThrow(/Rsbuild failed to compile[\s\S]*MARK_PLUGIN_FAILURE/)
+ expect(Date.now() - started).toBeLessThan(10_000)
+}, 30_000)
+
+/**
+ * A plugin like a route generator: at the start of each compile, it writes
+ * `src/generated.ts` from `src/source.ts` (`rewrite`: with new contents each
+ * time, a plugin that never settles).
+ */
+function generator(rewrite = false): RsbuildPlugin {
+ let count = 0
+ return {
+ name: 'generator',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ compiler.hooks.watchRun.tapPromise('generator', async () => {
+ const root = compiler.context
+ const source = await readFile(
+ path.join(root, 'src/source.ts'),
+ 'utf8',
+ )
+ const version = /'(V\d)'/.exec(source)![1]
+ const code = rewrite
+ ? `export const generated = ${++count}\n`
+ : `export const generated = 'MARK_GENERATED_${version}'\n`
+ const file = path.join(root, 'src/generated.ts')
+ if ((await readFile(file, 'utf8')) !== code) {
+ await writeFile(file, code)
+ }
+ })
+ },
+ })
+ })
+ },
+ }
+}
+
+const generatedApp = {
+ 'src/entry.ts': `import { generated } from './generated'
+import { source } from './source'
+console.log(generated, source)
+`,
+ 'src/source.ts': `export const source = 'V1'\n`,
+ 'src/generated.ts': `export const generated = 'MARK_GENERATED_V1'\n`,
+}
+
+test('settle() waits for the compiles of the files a plugin writes in a compile', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: generatedApp,
+ plugins: [generator()],
+ })
+ await server.write({ 'src/source.ts': `export const source = 'V2'\n` })
+ await server.settle()
+
+ const outputs = Object.values(await server.outputs()).join('\n')
+ expect(outputs).toContain('MARK_GENERATED_V2')
+ expect(outputs).not.toContain('MARK_GENERATED_V1')
+}, 30_000)
+
+test('settle() waits for a compile that started after each written file, unless accept() takes it', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': `console.log('MARK_V1')\n` },
+ })
+ await server.write({ 'notes.txt': 'unread' })
+ await expect(server.settle({ timeout: 1_000 })).rejects.toThrow(
+ /no compile started after the write of notes\.txt/,
+ )
+ await server.settle({ accept: (relative) => relative === 'notes.txt' })
+
+ await server.write({ 'src/lazy.ts': `export const lazy = 'MARK_LAZY'\n` })
+ await server.write({
+ 'src/entry.ts': `import('./lazy').then(console.log)\n`,
+ })
+ await server.settle()
+ expect(Object.values(await server.outputs()).join('\n')).toContain(
+ 'MARK_LAZY',
+ )
+}, 30_000)
+
+test('settle() rejects at its bound while a plugin writes a file the compiles read on each compile', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: generatedApp,
+ plugins: [generator(true)],
+ })
+ await server.write({ 'src/source.ts': `export const source = 'V2'\n` })
+ await expect(server.settle({ timeout: 3_000 })).rejects.toThrow(
+ /did not settle within 3000 ms/,
+ )
+}, 30_000)
+
+// A plugin may watch an original source itself and hand
+// Rspack a module built from it, so the source is in no compile's
+// dependencies. The edit's outcome is still awaited: the plugin's own
+// watcher invalidates the compiler, and the compile that follows the write
+// ends the wait. (The old wait required every written file to be a
+// dependency of the compile and timed out here.)
+test('edit() and settle() wait for the compile a plugin-owned watcher starts', async () => {
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { text } from './virtual'\nconsole.log(text)\n`,
+ 'src/virtual.ts': `export const text = 'placeholder'\n`,
+ 'content/source.txt': 'MARK_SOURCE_V1',
+ // Reads the original source without registering it as a dependency
+ 'loader.cjs': `const { readFileSync } = require('node:fs')
+const path = require('node:path')
+module.exports = function () {
+ const source = readFileSync(path.join(this.rootContext, 'content/source.txt'), 'utf8')
+ return 'export const text = ' + JSON.stringify(source) + '\\n'
+}
+`,
+ },
+ plugins: [ownWatcher()],
+ })
+ const joined = async () => Object.values(await server.outputs()).join('\n')
+ expect(await joined()).toContain('MARK_SOURCE_V1')
+
+ await server.edit({ 'content/source.txt': 'MARK_SOURCE_V2' })
+ expect(await joined()).toContain('MARK_SOURCE_V2')
+
+ await server.write({ 'content/source.txt': 'MARK_SOURCE_V3' })
+ await server.settle()
+ expect(await joined()).toContain('MARK_SOURCE_V3')
+}, 30_000)
+
+/**
+ * Builds `src/virtual.ts` from `content/source.txt` (`loader.cjs`) and
+ * watches that source with a watcher of its own: on each change of it, it
+ * invalidates the compiler with the module it builds from it.
+ */
+function ownWatcher(): RsbuildPlugin {
+ return {
+ name: 'own-watcher',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.module.rules = [
+ ...(config.module.rules ?? []),
+ {
+ test: /virtual\.ts$/,
+ use: [{ loader: path.join(api.context.rootPath, 'loader.cjs') }],
+ },
+ ]
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ let watcher: FSWatcher | undefined
+ compiler.hooks.afterDone.tap('own-watcher', () => {
+ // The plugin tells Rspack which module of its own changed
+ watcher ??= watch(path.join(compiler.context, 'content'), () =>
+ compiler.watching?.invalidateWithChangesAndRemovals(
+ new Set([path.join(compiler.context, 'src/virtual.ts')]),
+ ),
+ )
+ })
+ compiler.hooks.watchClose.tap('own-watcher', () => watcher?.close())
+ },
+ })
+ })
+ },
+ }
+}
+
+// A plugin that reports a problem once (Start's import protection with
+// `log: 'once'`) reports it in the first compile that sees it; a dev server
+// compiles again on its own, so the diagnostics of every compile are kept.
+test('diagnostics keeps the reports of every compile; errors and warnings hold the last compile', async () => {
+ let compile = 0
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': `console.log('MARK_V1')\n` },
+ plugins: [
+ {
+ name: 'reports-once',
+ setup(api) {
+ api.processAssets({ stage: 'report' }, ({ compilation }) => {
+ compile++
+ if (compile === 1) {
+ compilation.warnings.push(
+ new Error('MARK_WARNING_FIRST') as never,
+ )
+ compilation.errors.push(new Error('MARK_ERROR_FIRST') as never)
+ }
+ })
+ },
+ },
+ ],
+ })
+ const texts = (diagnostics: Array<{ severity: string; text: string }>) =>
+ diagnostics.map(({ severity, text }) => `${severity}: ${text}`)
+ expect(texts(server.diagnostics)).toEqual([
+ expect.stringMatching(/^error: [\s\S]*MARK_ERROR_FIRST/),
+ expect.stringMatching(/^warning: [\s\S]*MARK_WARNING_FIRST/),
+ ])
+
+ const since = server.diagnostics.length
+ await server.edit({ 'src/entry.ts': `console.log('MARK_V2')\n` })
+
+ expect(server.errors).toEqual([])
+ expect(server.warnings).toEqual([])
+ expect(texts(server.diagnostics).slice(0, 2)).toEqual([
+ expect.stringMatching(/^error: [\s\S]*MARK_ERROR_FIRST/),
+ expect.stringMatching(/^warning: [\s\S]*MARK_WARNING_FIRST/),
+ ])
+ expect(server.diagnostics.slice(since)).toEqual([])
+}, 30_000)
+
+/** An environment compiler, with the app files its last compile read. */
+interface Captured {
+ compiler: Rspack.Compiler
+ read: Array
+}
+
+/**
+ * A plugin that gives the test the environment compilers and, from each
+ * compile's `done`, the app files (relative to `root`) it read.
+ */
+function captureCompilers(into: Array, root: string): RsbuildPlugin {
+ return {
+ name: 'capture-compilers',
+ setup(api) {
+ api.onAfterCreateCompiler(({ compiler }) => {
+ for (const environmentCompiler of 'compilers' in compiler
+ ? compiler.compilers
+ : [compiler]) {
+ const captured: Captured = { compiler: environmentCompiler, read: [] }
+ into.push(captured)
+ environmentCompiler.hooks.done.tap(
+ 'capture-compilers',
+ ({ compilation }) => {
+ captured.read = [...compilation.fileDependencies]
+ .filter((file) => file.startsWith(root + path.sep))
+ .map((file) => path.relative(root, file))
+ },
+ )
+ }
+ })
+ },
+ }
+}
+
+/**
+ * What a captured compiler's watcher knows (watchpack's time entries,
+ * through Rspack's public `watching.watcher` and `watchFileSystem.watcher`).
+ */
+function watchedBy({ compiler, read }: Captured) {
+ const attached = !!(compiler as { watching?: { watcher?: unknown } }).watching
+ ?.watcher
+ const watcher = (
+ compiler.watchFileSystem as
+ | { watcher?: { getTimeInfoEntries: () => Map } }
+ | undefined
+ )?.watcher
+ return {
+ name: compiler.name,
+ attached,
+ known: new Set(watcher ? watcher.getTimeInfoEntries().keys() : []),
+ read,
+ }
+}
+
+// Rspack attaches its watcher on the tick after the first compile, and
+// watchpack then scans the app's directories; a file deleted before that is
+// never reported (oracle/KNOWN-BUGS.md, "Upstream issues"). The start
+// resolves only once the watcher knows every app file the compile read.
+test('the start resolves once the watcher knows every app file the compile read', async () => {
+ const compilers: Array = []
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ plugins: ({ root }) => [captureCompilers(compilers, root)],
+ })
+ const client = watchedBy(compilers[0]!)
+ expect(client.attached).toBe(true)
+ expect(client.read).toEqual(
+ expect.arrayContaining(['src/entry.ts', 'src/leaf.ts']),
+ )
+ for (const file of client.read) {
+ expect(client.known.has(path.join(server.root, file))).toBe(true)
+ }
+}, 30_000)
+
+// One compiler may watch for another: Rspack's RSC coordinator makes the
+// server compiler watch the client compiler's files and ignores everything
+// in the client's own watcher. The start must still resolve, with every
+// file known to a watcher, when a compiler's watcher ignores everything.
+test('the start resolves with a compiler whose watcher ignores every file, while another watches them', async () => {
+ const compilers: Array = []
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ compileTimeout: 10_000,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ config: {
+ environments: { web: {}, node: { output: { target: 'node' } } },
+ },
+ plugins: ({ root }) => [
+ captureCompilers(compilers, root),
+ {
+ name: 'ignore-all-in-node',
+ setup(api) {
+ api.modifyRspackConfig((config, { environment }) => {
+ if (environment.name === 'node') {
+ config.watchOptions = {
+ ...config.watchOptions,
+ ignored: () => true,
+ }
+ }
+ })
+ },
+ },
+ ],
+ })
+ const watched = compilers.map(watchedBy)
+ const node = watched.find((w) => w.name === 'node')!
+ const web = watched.find((w) => w.name === 'web')!
+ expect(watched.map((w) => w.attached)).toEqual([true, true])
+ expect(node.known.size).toBe(0)
+ expect(node.read).toEqual(
+ expect.arrayContaining(['src/entry.ts', 'src/leaf.ts']),
+ )
+ for (const file of node.read) {
+ expect(web.known.has(path.join(server.root, file))).toBe(true)
+ }
+}, 30_000)
+
+// A user starts the dev server on files that are already on disk. Files
+// written a moment before the first compile fall within the accuracy
+// watchpack allows for modification times (up to 2 s), so its first scan
+// would report them changed and Rspack would start a second compile by
+// itself, during a test's first edit.
+test("the app's initial files predate the first compile beyond the watcher's accuracy", async () => {
+ let firstCompile: number | undefined
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ plugins: [
+ {
+ name: 'first-compile',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ compiler.hooks.watchRun.tap('first-compile', () => {
+ firstCompile ??= Date.now()
+ })
+ },
+ })
+ })
+ },
+ },
+ ],
+ })
+ expect(firstCompile).toBeDefined()
+ for (const file of ['package.json', 'src/entry.ts', 'src/leaf.ts']) {
+ const { mtimeMs } = await stat(path.join(server.root, file))
+ expect(mtimeMs + 2000, file).toBeLessThan(firstCompile!)
+ }
+}, 30_000)
+
+// A compile that started before an edit's write does not compile it, even
+// if it names the edited file (here for an earlier change of it): `edit()`
+// waits for a compile that started once the file held the edit. A plugin
+// holds that earlier compile in `watchRun` until the edit began.
+test('a compile that started before the write of an edit does not end its wait', async () => {
+ let hold: { held: () => void; release: Promise } | undefined
+ /** The contents of `src/leaf.ts` when each compile started; then `done`. */
+ const compiles: Array<{ leaf: string; done: boolean }> = []
+ const server = await createRsbuildDevServer({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: {
+ 'src/entry.ts': `import { leaf } from './leaf'\nconsole.log(leaf)\n`,
+ 'src/leaf.ts': `export const leaf = 'MARK_V1'\n`,
+ },
+ plugins: [
+ {
+ name: 'holds-a-compile',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ const leaf = path.join(compiler.context, 'src/leaf.ts')
+ compiler.hooks.watchRun.tapPromise(
+ { name: 'holds-a-compile', stage: -2000 },
+ async () => {
+ const current = hold
+ hold = undefined
+ compiles.push({
+ leaf: await readFile(leaf, 'utf8'),
+ done: false,
+ })
+ if (current) {
+ current.held()
+ await current.release
+ }
+ },
+ )
+ compiler.hooks.done.tap('holds-a-compile', () => {
+ compiles.at(-1)!.done = true
+ })
+ },
+ })
+ })
+ },
+ },
+ ],
+ })
+ let release = () => {}
+ const held = new Promise((resolve) => {
+ hold = {
+ held: resolve,
+ release: new Promise((resolveRelease) => {
+ release = resolveRelease
+ }),
+ }
+ })
+ // A change of the file the watcher reports: a compile naming it starts
+ // and waits in `watchRun`
+ await writeFile(
+ path.join(server.root, 'src/leaf.ts'),
+ `export const leaf = 'MARK_V2'\n`,
+ )
+ await held
+ const editing = server.edit({
+ 'src/leaf.ts': `export const leaf = 'MARK_V3'\n`,
+ })
+ release()
+ await editing
+
+ expect(
+ compiles.some(({ leaf, done }) => leaf.includes('MARK_V3') && done),
+ ).toBe(true)
+ expect(Object.values(await server.outputs()).join('\n')).toContain('MARK_V3')
+}, 30_000)
diff --git a/packages/compiler-test-utils/tests/integration/rsbuild-plugin-host.test.ts b/packages/compiler-test-utils/tests/integration/rsbuild-plugin-host.test.ts
new file mode 100644
index 0000000000..3f0790ea13
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/rsbuild-plugin-host.test.ts
@@ -0,0 +1,279 @@
+/**
+ * Controls of the Rsbuild plugin host (rsbuild-plugin-host.ts): the public
+ * Rsbuild plugins run through Rsbuild's JavaScript API in process. Server
+ * code loads through Rsbuild's own `loadBundle`, client code runs in the
+ * shared Chromium page, edits settle on their outcome, the production build
+ * returns each environment's output with its dangling-name evidence, and a
+ * plugin's console warning lands in the same channel as the compilation's
+ * and Rsbuild's logger's, each compilation report once.
+ */
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import { describeBuild } from '../../src/build-harness'
+import { problems } from '../../src/diagnostic-channel'
+import { expectDiagnostic } from '../../src/diagnostics'
+import {
+ RsbuildHostBuildError,
+ createRsbuildPluginHost,
+} from '../../src/rsbuild-plugin-host'
+import type { RsbuildPlugin, Rspack } from '@rsbuild/core'
+
+const timeout = 60_000
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+/** Rewrites `__MARK__` (a loader of its own) and warns through the console. */
+function userPlugin(): RsbuildPlugin {
+ return {
+ name: 'user-plugin',
+ setup(api) {
+ api.transform({ test: /\.ts$/ }, ({ code, resourcePath }) => {
+ if (!code.includes('__MARK__')) {
+ return code
+ }
+ console.warn(`[user-plugin] rewrote a marker in ${resourcePath}`)
+ return code.replaceAll('__MARK__', 'MARKED')
+ })
+ },
+ }
+}
+
+const files = {
+ 'src/entry.ts': `import { label } from './label'
+const shown = document.createElement('div')
+shown.id = 'shown'
+shown.textContent = label
+document.body.append(shown)
+`,
+ 'src/server.ts': `import { label } from './label'
+export const read = () => label
+`,
+ 'src/label.ts': `export const label = '__MARK__ v1'\n`,
+}
+
+const environments = {
+ web: { source: { entry: { index: './src/entry.ts' } } },
+ node: {
+ source: { entry: { index: './src/server.ts' } },
+ // CommonJS: Rsbuild's `loadBundle` runs an ES module bundle only with
+ // Node's `--experimental-vm-modules`
+ output: { target: 'node' as const, module: false },
+ },
+}
+
+test(
+ 'dev: server code through loadBundle, client code in the page, an edit, merged diagnostics',
+ async () => {
+ const host = await createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [userPlugin()],
+ config: { environments },
+ client: true,
+ })
+ const server = await host.loadServer<{ read: () => string }>('node')
+ expect(server.read()).toBe('MARKED v1')
+ expect(
+ (
+ await host.runClient(
+ `return document.getElementById('shown').textContent`,
+ )
+ ).result,
+ ).toBe('MARKED v1')
+ // The plugin warned through the console: the server's channel has it
+ expectDiagnostic(host.diagnostics, {
+ severity: 'warning',
+ file: 'src/label.ts',
+ root: host.root,
+ })
+
+ await host.edit({ 'src/label.ts': `export const label = '__MARK__ v2'\n` })
+ expect((await host.loadServer<{ read: () => string }>('node')).read()).toBe(
+ 'MARKED v2',
+ )
+ },
+ timeout,
+)
+
+test(
+ 'build: each environment output, and the production client evidence for the dangling-name check',
+ async () => {
+ const host = await createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [userPlugin()],
+ config: { environments },
+ serve: false,
+ })
+ const build = await host.build()
+ expect(Object.keys(build.environments).sort()).toEqual(['node', 'web'])
+ expect(Object.values(build.environments.web!.files).join('\n')).toContain(
+ 'MARKED v1',
+ )
+ expect(build.parsedModules.web!.modules.size).toBeGreaterThan(0)
+ expectDiagnostic(build.diagnostics, {
+ severity: 'warning',
+ file: 'src/label.ts',
+ root: host.root,
+ })
+ // The output passes the dangling-name check with that evidence
+ const web = build.environments.web!
+ const entry = Object.keys(web.files).find((file) => file.includes('index'))!
+ await describeBuild({
+ bundler: 'rspack',
+ env: 'client',
+ mode: 'production',
+ esModules: false,
+ root: host.root,
+ outDir: web.distPath,
+ chunks: [
+ { fileName: entry, isEntry: true, imports: [], dynamicImports: [] },
+ ],
+ parsedModules: build.parsedModules.web,
+ warnings: [],
+ consoleMessages: [],
+ duration: 0,
+ dispose: async () => {},
+ })
+ },
+ timeout,
+)
+
+test.each(['dev', 'build'] as const)(
+ 'the %s host records warnings through Rsbuild’s logger',
+ async (mode) => {
+ const host = await createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': 'export const value = 1' },
+ serve: mode === 'dev',
+ plugins: [
+ {
+ name: 'logger-control',
+ setup(api) {
+ api.onBeforeEnvironmentCompile(() => {
+ api.logger.warn('src/entry.ts: logger control warning')
+ })
+ },
+ },
+ ],
+ })
+ const diagnostics =
+ mode === 'dev' ? host.diagnostics : (await host.build()).diagnostics
+ expectDiagnostic(diagnostics, {
+ severity: 'warning',
+ file: 'src/entry.ts',
+ })
+ },
+ timeout,
+)
+
+test(
+ 'concurrent Rsbuild apps retain their own native-loader diagnostics',
+ async () => {
+ const start = () =>
+ createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': "export const value = '__MARK__'" },
+ plugins: [userPlugin()],
+ })
+ const [first, second] = await Promise.all([start(), start()])
+ await Promise.all([
+ first.edit({ 'src/entry.ts': "export const value = '__MARK__ edited'" }),
+ second.edit({ 'src/entry.ts': "export const value = '__MARK__ edited'" }),
+ ])
+ for (const [app, other] of [
+ [first, second],
+ [second, first],
+ ] as const) {
+ expectDiagnostic(app.diagnostics, {
+ severity: 'warning',
+ file: 'src/entry.ts',
+ root: app.root,
+ })
+ expect(
+ app.diagnostics.some(({ text }) => text.includes(other.root)),
+ ).toBe(false)
+ }
+ },
+ timeout,
+)
+
+/**
+ * Adds a compilation warning or error naming the entry (`processAssets`),
+ * as a compiler reporting through the compilation does.
+ */
+function compilationReporter(severity: 'warning' | 'error'): RsbuildPlugin {
+ return {
+ name: 'compilation-reporter',
+ setup(api) {
+ api.modifyRspackConfig((config) => {
+ config.plugins.push({
+ apply(compiler: Rspack.Compiler) {
+ compiler.hooks.thisCompilation.tap(
+ 'compilation-reporter',
+ (compilation) => {
+ compilation.hooks.processAssets.tap(
+ { name: 'compilation-reporter', stage: 0 },
+ () => {
+ const report = new compiler.webpack.WebpackError(
+ `MARK_COMPILATION ${severity}: ${path.join(compiler.context, 'src/entry.ts')} is reported`,
+ )
+ if (severity === 'error') {
+ compilation.errors.push(report)
+ } else {
+ compilation.warnings.push(report)
+ }
+ },
+ )
+ },
+ )
+ },
+ })
+ })
+ },
+ }
+}
+
+// Rsbuild's logger prints each compile's report again (and a status line
+// for a compile that failed); the channel records the report once, from
+// the compilation.
+test.each([
+ ['dev', 'warning'],
+ ['dev', 'error'],
+ ['build', 'warning'],
+ ['build', 'error'],
+] as const)(
+ 'the %s host records a compilation %s once',
+ async (mode, severity) => {
+ const host = await createRsbuildPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files: { 'src/entry.ts': 'export const value = 1' },
+ serve: mode === 'dev',
+ plugins: [compilationReporter(severity)],
+ })
+ const diagnostics =
+ mode === 'dev'
+ ? host.diagnostics
+ : await host.build().then(
+ (build) => build.diagnostics,
+ (error: unknown) => {
+ expect(error).toBeInstanceOf(RsbuildHostBuildError)
+ return (error as RsbuildHostBuildError).diagnostics
+ },
+ )
+ expectDiagnostic(diagnostics, {
+ severity,
+ file: 'src/entry.ts',
+ root: host.root,
+ times: 1,
+ })
+ expect(problems(diagnostics)).toHaveLength(1)
+ },
+ timeout,
+)
diff --git a/packages/compiler-test-utils/tests/integration/run-node.test.ts b/packages/compiler-test-utils/tests/integration/run-node.test.ts
new file mode 100644
index 0000000000..d9ab5834f4
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/run-node.test.ts
@@ -0,0 +1,110 @@
+/**
+ * Control tests of run-node.ts: a program run in a child Node process gives
+ * its output, fails fast past its timeout, and never outlives the process
+ * that started it (a test worker killed on a timeout must not leave it
+ * spinning).
+ */
+import { spawn } from 'node:child_process'
+import { mkdtemp, readFile, rm } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import { fileURLToPath, pathToFileURL } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import { runNodeProgram } from '../../src/run-node'
+
+const runNodeModule = pathToFileURL(
+ path.join(
+ path.dirname(fileURLToPath(import.meta.url)),
+ '../../src/run-node.ts',
+ ),
+).href
+
+/** Whether a process is running. */
+function isRunning(pid: number) {
+ try {
+ process.kill(pid, 0)
+ return true
+ } catch {
+ return false
+ }
+}
+
+/** Polls `read` every 50 ms until it returns a value, for `within` ms. */
+async function poll(
+ read: () => Promise,
+ what: string,
+ within = 10_000,
+): Promise {
+ const deadline = Date.now() + within
+ for (;;) {
+ const value = await read()
+ if (value !== undefined) {
+ return value
+ }
+ if (Date.now() > deadline) {
+ throw new Error(`${what} within ${within} ms`)
+ }
+ await new Promise((resolve) => setTimeout(resolve, 50))
+ }
+}
+
+test('gives the output of the program', async () => {
+ const { stdout } = await runNodeProgram(`process.stdout.write(String(6 * 7))`)
+ expect(stdout).toBe('42')
+})
+
+test('a program that runs past its timeout is killed, and the run says so', async () => {
+ const started = Date.now()
+ await expect(
+ runNodeProgram(`while (true) {}`, { timeout: 500 }),
+ ).rejects.toThrow('the program did not finish within 500 ms')
+ expect(Date.now() - started).toBeLessThan(10_000)
+}, 20_000)
+
+test('a program stuck in a synchronous loop dies with the process that started it', async () => {
+ const dir = await mkdtemp(path.join(tmpdir(), 'run-node-'))
+ const pidFile = path.join(dir, 'pid')
+ const program = `import { writeFileSync } from 'node:fs'
+writeFileSync(${JSON.stringify(pidFile)}, String(process.pid))
+while (true) {}
+`
+ // The process that starts the program, killed like a test worker on a
+ // timeout (SIGKILL: no exit handler runs)
+ const starter = spawn(
+ process.execPath,
+ [
+ '--input-type=module',
+ '--eval',
+ `import { runNodeProgram } from ${JSON.stringify(runNodeModule)}
+runNodeProgram(${JSON.stringify(program)}, { timeout: 120_000 }).catch(() => {})
+`,
+ ],
+ { stdio: 'ignore' },
+ )
+ onTestFinished(async () => {
+ starter.kill('SIGKILL')
+ await rm(dir, { recursive: true, force: true })
+ })
+ const pid = await poll(
+ () =>
+ readFile(pidFile, 'utf8').then(
+ (text) => (text ? Number(text) : undefined),
+ () => undefined,
+ ),
+ 'the program did not start',
+ )
+ onTestFinished(() => {
+ if (isRunning(pid)) {
+ process.kill(pid, 'SIGKILL')
+ }
+ })
+ expect(isRunning(pid)).toBe(true)
+
+ starter.kill('SIGKILL')
+
+ await poll(
+ () => Promise.resolve(isRunning(pid) ? undefined : true),
+ 'the program still runs after the process that started it was killed',
+ )
+ expect(isRunning(pid)).toBe(false)
+}, 30_000)
diff --git a/packages/compiler-test-utils/tests/integration/workspace-packages.test.ts b/packages/compiler-test-utils/tests/integration/workspace-packages.test.ts
new file mode 100644
index 0000000000..66110b1c4c
--- /dev/null
+++ b/packages/compiler-test-utils/tests/integration/workspace-packages.test.ts
@@ -0,0 +1,49 @@
+/**
+ * Control tests of workspace-packages.ts: a test app gets a built workspace
+ * package through a link in its `node_modules`, and asking for a package
+ * that is no workspace package fails with its name.
+ */
+import { mkdtemp, rm, writeFile } from 'node:fs/promises'
+import { tmpdir } from 'node:os'
+import path from 'node:path'
+import { pathToFileURL } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import {
+ linkWorkspacePackages,
+ workspacePackage,
+ workspacePackageLinks,
+} from '../../src/workspace-packages'
+
+// `@tanstack/history` is built by this project's `test:integration` target
+// (package.json `nx.targets`); nothing in this package depends on it.
+const name = '@tanstack/history'
+
+test('a workspace package is its directory under packages/, with its build', () => {
+ const root = workspacePackage(name)
+ expect(path.basename(root)).toBe('history')
+ expect(workspacePackageLinks([name])).toEqual({
+ [`node_modules/${name}`]: root,
+ })
+})
+
+test('a name that is no workspace package is refused by name', () => {
+ expect(() => workspacePackage('@tanstack/no-such-package')).toThrow(
+ '@tanstack/no-such-package',
+ )
+})
+
+test('an app resolves a linked workspace package like an installed one', async () => {
+ const root = await mkdtemp(path.join(tmpdir(), 'workspace-packages-'))
+ onTestFinished(() => rm(root, { recursive: true, force: true }))
+ await linkWorkspacePackages(root, [name])
+ await writeFile(
+ path.join(root, 'main.mjs'),
+ `import { createMemoryHistory } from '${name}'
+export const location = createMemoryHistory({ initialEntries: ['/linked'] }).location.pathname
+`,
+ )
+ const { location } = (await import(
+ /* @vite-ignore */ pathToFileURL(path.join(root, 'main.mjs')).href
+ )) as { location: string }
+ expect(location).toBe('/linked')
+})
diff --git a/packages/compiler-test-utils/tests/outcome.test.ts b/packages/compiler-test-utils/tests/outcome.test.ts
new file mode 100644
index 0000000000..2062026cfb
--- /dev/null
+++ b/packages/compiler-test-utils/tests/outcome.test.ts
@@ -0,0 +1,130 @@
+/**
+ * Controls of the edit completion by outcome (outcome.ts): the wait
+ * ends once the outcome holds with the hosts quiet, however many steps the
+ * edit took and however late after the first one it shows; it fails at
+ * its one bound, or at once on a problem. The old page wait failed a
+ * correct two-phase update 500 ms after the first applied update.
+ */
+import { describe, expect, test } from 'vitest'
+import { waitForOutcome } from '../src/outcome'
+
+const sleep = (ms: number) =>
+ new Promise((resolve) => setTimeout(resolve, ms))
+
+describe('waitForOutcome', () => {
+ test('a two-phase update whose outcome shows late (after 600 ms) completes', async () => {
+ let shows = false
+ // First phase: something applied, nothing to see yet; second phase
+ // shows the edit
+ setTimeout(() => {
+ shows = true
+ }, 600)
+ await waitForOutcome({
+ timeout: 5_000,
+ applied: () => shows,
+ describe: () => 'two phases',
+ })
+ expect(shows).toBe(true)
+ })
+
+ test('waits while the hosts have work in flight, even once the outcome shows', async () => {
+ let inFlight = 3
+ const quietChecks: Array = []
+ await waitForOutcome({
+ timeout: 5_000,
+ applied: () => true,
+ quiet: () => {
+ quietChecks.push(inFlight)
+ if (inFlight > 0) {
+ inFlight--
+ return false
+ }
+ return true
+ },
+ describe: () => 'in flight',
+ })
+ expect(inFlight).toBe(0)
+ // Quiet twice in a row ends it
+ expect(quietChecks.slice(-2)).toEqual([0, 0])
+ })
+
+ test('an outcome that flips back before the second check is not settled', async () => {
+ const seen: Array = []
+ let calls = 0
+ await waitForOutcome({
+ timeout: 5_000,
+ applied: () => {
+ calls++
+ // true, then false once (a reload blanks the page), then true
+ const value = calls !== 2
+ seen.push(value)
+ return value
+ },
+ describe: () => 'flip',
+ })
+ expect(seen).toContain(false)
+ })
+
+ test('fails at its one bound with what it saw', async () => {
+ await expect(
+ waitForOutcome({
+ timeout: 200,
+ applied: () => false,
+ describe: () => 'the page shows "v1"',
+ }),
+ ).rejects.toThrow(/within 200 ms\n.*the page shows "v1"/)
+ })
+
+ test('failWhenQuietFor: hosts quiet without the outcome end the wait after that long, not at the bound', async () => {
+ const started = Date.now()
+ await expect(
+ waitForOutcome({
+ timeout: 10_000,
+ failWhenQuietFor: 300,
+ applied: () => false,
+ quiet: () => true,
+ describe: () => 'the page shows "v1"',
+ }),
+ ).rejects.toThrow(
+ /final state without its outcome.*300 ms\n.*the page shows "v1"/s,
+ )
+ const elapsed = Date.now() - started
+ expect(elapsed).toBeGreaterThanOrEqual(300)
+ expect(elapsed).toBeLessThan(5_000)
+ })
+
+ test('failWhenQuietFor: work in flight restarts the quiet time; an outcome that shows then completes', async () => {
+ const started = Date.now()
+ let checks = 0
+ await waitForOutcome({
+ timeout: 10_000,
+ failWhenQuietFor: 300,
+ // Quiet, but busy again every 200 ms (each step of a slow edit), until
+ // the outcome shows after 1 s
+ quiet: () => {
+ checks++
+ return (Date.now() - started) % 200 > 60
+ },
+ applied: () => Date.now() - started > 1_000,
+ describe: () => 'steps',
+ })
+ expect(Date.now() - started).toBeGreaterThan(1_000)
+ expect(checks).toBeGreaterThan(5)
+ })
+
+ test('a problem ends the wait at once', async () => {
+ const started = Date.now()
+ await expect(
+ waitForOutcome({
+ timeout: 5_000,
+ applied: async () => {
+ await sleep(5)
+ return false
+ },
+ problems: () => ['Uncaught ReferenceError: x is not defined'],
+ describe: () => 'problem',
+ }),
+ ).rejects.toThrow(/the edit failed: Uncaught ReferenceError/)
+ expect(Date.now() - started).toBeLessThan(1_000)
+ })
+})
diff --git a/packages/compiler-test-utils/tests/plugin-host.test.ts b/packages/compiler-test-utils/tests/plugin-host.test.ts
new file mode 100644
index 0000000000..9d32300334
--- /dev/null
+++ b/packages/compiler-test-utils/tests/plugin-host.test.ts
@@ -0,0 +1,145 @@
+/**
+ * Controls of the public in-process plugin host (plugin-host.ts), fast
+ * tier: the plugins a user configures run in a real Vite dev server
+ * (middleware mode) on an app on disk, and the host hands the test what a
+ * user gets, by resolved module, not by spelling:
+ * - server code evaluates through the environment's module runner; a module
+ * reached through different specifiers (relative, root-absolute, through a
+ * plugin's virtual module) is one instance;
+ * - an edit settles and the next evaluation sees it;
+ * - what a plugin reports on any channel is in `diagnostics`.
+ * The plugins here stand for any public plugin: nothing in the host knows
+ * them (no hook placement, id or query).
+ */
+import path from 'node:path'
+import { fileURLToPath } from 'node:url'
+import { expect, onTestFinished, test } from 'vitest'
+import { expectNoProblems, problems } from '../src/diagnostic-channel'
+import { expectDiagnostic } from '../src/diagnostics'
+import { createPluginHost } from '../src/plugin-host'
+import type { Plugin } from 'vite'
+
+const testsDir = path.dirname(fileURLToPath(import.meta.url))
+
+/**
+ * A plugin as a user configures one: serves `virtual:counter` (a module
+ * that re-exports the app's counter through a root-absolute specifier) and
+ * rewrites `__MARK__` in the app's modules.
+ */
+function userPlugin(options: { warn?: 'console' | 'context' } = {}): Plugin {
+ return {
+ name: 'user-plugin',
+ resolveId(id) {
+ return id === 'virtual:counter' ? '\0virtual:counter' : null
+ },
+ load(id) {
+ return id === '\0virtual:counter'
+ ? `export { count, increment } from '/src/counter.ts'\n`
+ : null
+ },
+ transform(code, id) {
+ if (!id.includes('/src/') || !code.includes('__MARK__')) {
+ return null
+ }
+ if (options.warn === 'console') {
+ console.warn(`[user-plugin] rewrote a marker in ${id}`)
+ } else if (options.warn === 'context') {
+ this.warn(`rewrote a marker in ${id}`)
+ }
+ return code.replaceAll('__MARK__', 'MARKED')
+ },
+ }
+}
+
+const files = {
+ 'src/counter.ts': `export let count = 0
+export const increment = () => ++count
+`,
+ 'src/server.ts': `import { increment } from './counter'
+import { count, increment as viaVirtual } from 'virtual:counter'
+import { count as viaRoot } from '/src/counter.ts'
+export const marker = '__MARK__'
+export const run = () => {
+ increment()
+ viaVirtual()
+ return { count, viaRoot }
+}
+`,
+}
+
+async function host(warn?: 'console' | 'context') {
+ return createPluginHost({
+ dir: testsDir,
+ registerCleanup: onTestFinished,
+ files,
+ plugins: [userPlugin({ warn })],
+ })
+}
+
+test('server code runs through the module runner; a module is one instance whatever the specifier', async () => {
+ const app = await host()
+ const server = await app.importServer('/src/server.ts')
+ expect(server.marker).toBe('MARKED')
+ // Two increments through two spellings, read through a third: one module
+ expect(server.run()).toEqual({ count: 2, viaRoot: 2 })
+ expect(await app.transform('/src/server.ts', 'ssr')).toContain('MARKED')
+})
+
+test('an edit settles; the next evaluation runs the edited module', async () => {
+ const app = await host()
+ expect((await app.importServer('/src/server.ts')).marker).toBe('MARKED')
+ await app.edit({
+ 'src/server.ts': `export const marker = 'edited __MARK__'\n`,
+ })
+ expect((await app.importServer('/src/server.ts')).marker).toBe(
+ 'edited MARKED',
+ )
+})
+
+test.each(['console', 'context'] as const)(
+ 'a plugin warning through %s is in the merged diagnostics',
+ async (warn) => {
+ const app = await host(warn)
+ const since = app.diagnostics.length
+ await app.importServer('/src/server.ts')
+ const reported = app.diagnostics.slice(since)
+ expectDiagnostic(problems(reported), {
+ severity: 'warning',
+ file: 'src/server.ts',
+ root: app.root,
+ })
+ expect(() => expectNoProblems(reported)).toThrow()
+ // The dev server's text log reads the same channels
+ expect(app.dev.logs.some((log) => log.includes('rewrote a marker'))).toBe(
+ true,
+ )
+ },
+)
+
+test('nothing reported: a quiet plugin leaves no problem on any channel', async () => {
+ const app = await host()
+ await app.importServer('/src/server.ts')
+ expectNoProblems(app.diagnostics)
+})
+
+test('two live apps keep console diagnostics scoped to their own work', async () => {
+ const [first, second] = await Promise.all([host('console'), host('console')])
+ await Promise.all([
+ first.importServer('/src/server.ts'),
+ second.importServer('/src/server.ts'),
+ ])
+ for (const [app, other] of [
+ [first, second],
+ [second, first],
+ ]) {
+ expectDiagnostic(app!.diagnostics, {
+ severity: 'warning',
+ file: 'src/server.ts',
+ root: app!.root,
+ times: 1,
+ })
+ expect(
+ app!.diagnostics.some(({ text }) => text.includes(other!.root)),
+ ).toBe(false)
+ }
+})
diff --git a/packages/compiler-test-utils/tests/source-maps.test.ts b/packages/compiler-test-utils/tests/source-maps.test.ts
new file mode 100644
index 0000000000..aa51a758fa
--- /dev/null
+++ b/packages/compiler-test-utils/tests/source-maps.test.ts
@@ -0,0 +1,188 @@
+/**
+ * Controls of the source-map helpers (source-maps.ts) on maps real
+ * transforms emit (Oxc through Vite, esbuild): positions resolve through
+ * `@jridgewell/trace-mapping`, executed throws resolve through their
+ * stack, tokens are found by parsing whatever the printing, and CRLF
+ * sources count lines like editors.
+ */
+import vm from 'node:vm'
+import * as esbuild from 'esbuild'
+import { transformWithOxc } from 'vite'
+import { describe, expect, test } from 'vitest'
+import {
+ expectMapsTo,
+ findNodes,
+ inlineSourceMap,
+ offsetAt,
+ originalPositionOf,
+ originalPositions,
+ positionAt,
+ tokenOffsets,
+ traceStack,
+} from '../src/source-maps'
+
+// TypeScript-only lines before the throw shift it: a map that skips the
+// type erasure points at the wrong line.
+const source = `interface Failure {
+ message: string
+}
+type Reason = Failure['message']
+export function fail(reason: Reason = 'MARK_FAIL'): string {
+ throw new Error(reason)
+}
+`
+const throwLine = 6
+
+describe('positions', () => {
+ test('positionAt and offsetAt count every JavaScript line terminator', () => {
+ const code = 'a\r\nb\rc\u2028d\u2029e\nf'
+ expect(positionAt(code, code.indexOf('e'))).toEqual({ line: 5, column: 0 })
+ expect(positionAt(code, code.indexOf('f'))).toEqual({ line: 6, column: 0 })
+ for (const char of 'abcdef') {
+ const offset = code.indexOf(char)
+ expect(offsetAt(code, positionAt(code, offset))).toBe(offset)
+ }
+ })
+
+ test('tokens are found by parsing, whatever the quotes or spacing', () => {
+ const code = `const a = "box"; const b = 'box'; const c = \`box\`; box(); throw a`
+ expect(tokenOffsets(code, { string: 'box' })).toHaveLength(3)
+ expect(tokenOffsets(code, { identifier: 'box' })).toEqual([
+ code.indexOf('box()'),
+ ])
+ expect(tokenOffsets(code, { throw: true })).toEqual([code.indexOf('throw')])
+ expect(
+ findNodes(code, (node) => node.type === 'CallExpression'),
+ ).toHaveLength(1)
+ })
+})
+
+describe.each([
+ {
+ name: 'Oxc (Vite)',
+ transform: async (code: string, file: string) => {
+ const result = await transformWithOxc(code, file, {
+ lang: 'ts',
+ sourcemap: true,
+ })
+ return { code: result.code, map: result.map! }
+ },
+ },
+ {
+ name: 'esbuild',
+ transform: async (code: string, file: string) => {
+ const result = await esbuild.transform(code, {
+ loader: 'ts',
+ format: 'cjs',
+ sourcefile: file,
+ sourcemap: 'external',
+ })
+ return { code: result.code, map: JSON.parse(result.map) }
+ },
+ },
+])('$name maps', ({ transform }) => {
+ test('a generated token resolves to the original line and column', async () => {
+ const { code, map } = await transform(source, '/app/src/fail.ts')
+ const generated = positionAt(code, tokenOffsets(code, { throw: true })[0]!)
+ const original = expectMapsTo(map, generated, {
+ file: 'src/fail.ts',
+ root: '/app',
+ line: throwLine,
+ column: positionAt(source, tokenOffsets(source, { throw: true })[0]!)
+ .column,
+ })
+ expect(original.source).toContain('fail.ts')
+ expect(
+ originalPositions(map).some((position) => position.line === throwLine),
+ ).toBe(true)
+ })
+
+ test('an executed throw resolves through its stack', async () => {
+ const { code, map } = await transform(
+ `${source}fail()\n`,
+ '/app/src/fail.ts',
+ )
+ const location = '/generated/fail.js'
+ let stack = ''
+ try {
+ vm.runInThisContext(
+ `(function (exports, module) {${code.replace(/^export /gm, '')}\n})({}, {})`,
+ { filename: location },
+ )
+ } catch (error) {
+ stack = (error as Error).stack!
+ }
+ expect(stack).toContain('MARK_FAIL')
+ const frames = traceStack(stack, (file) =>
+ file === location ? map : undefined,
+ )
+ expect(frames[0]).toMatchObject({
+ location,
+ original: { line: throwLine },
+ })
+ expect(frames[0]!.original!.source).toContain('fail.ts')
+ })
+
+ test('a wrong line or file fails', async () => {
+ const { code, map } = await transform(source, '/app/src/fail.ts')
+ const generated = positionAt(code, tokenOffsets(code, { throw: true })[0]!)
+ expect(() =>
+ expectMapsTo(map, generated, { file: 'src/fail.ts', line: 1 }),
+ ).toThrow()
+ expect(() =>
+ expectMapsTo(map, generated, { file: 'src/other.ts', line: throwLine }),
+ ).toThrow()
+ })
+})
+
+// A dev server names a module's source relative to the module (`fail.ts`
+// for `/src/fail.ts`): the source map specification resolves it against
+// the map's URL. The name alone does not name `src/fail.ts` (SPEC §5.7).
+test('a source relative to its module names the file once resolved against the module', async () => {
+ const { code, map } = await transformWithOxc(source, '/app/src/fail.ts', {
+ lang: 'ts',
+ sourcemap: true,
+ })
+ const relative = { ...map!, sources: ['fail.ts'] }
+ const generated = positionAt(code, tokenOffsets(code, { throw: true })[0]!)
+ const expected = { file: 'src/fail.ts', root: '/app', line: throwLine }
+ expectMapsTo(relative, generated, {
+ ...expected,
+ mapUrl: '/app/src/fail.ts?v=1',
+ })
+ expectMapsTo(relative, generated, {
+ ...expected,
+ mapUrl: 'file:///app/src/fail.ts',
+ })
+ expect(() => expectMapsTo(relative, generated, expected)).toThrow()
+ expect(() =>
+ expectMapsTo(relative, generated, {
+ ...expected,
+ mapUrl: '/app/lib/fail.js',
+ }),
+ ).toThrow()
+})
+
+test('a CRLF source maps to the lines an editor shows', async () => {
+ const crlf = source.replaceAll('\n', '\r\n')
+ const { code, map } = await transformWithOxc(crlf, '/app/src/fail.ts', {
+ lang: 'ts',
+ sourcemap: true,
+ })
+ const generated = positionAt(code, tokenOffsets(code, { throw: true })[0]!)
+ expectMapsTo(map!, generated, { file: 'src/fail.ts', line: throwLine })
+})
+
+test('inlineSourceMap reads a data URL map, and nothing else', async () => {
+ const { code, map } = await transformWithOxc(source, '/app/src/fail.ts', {
+ lang: 'ts',
+ sourcemap: true,
+ })
+ const inline = `${code}\n//# sourceMappingURL=data:application/json;base64,${Buffer.from(JSON.stringify(map)).toString('base64')}\n`
+ expect(inlineSourceMap(inline)).toEqual(JSON.parse(JSON.stringify(map)))
+ expect(inlineSourceMap(code)).toBeUndefined()
+ const generated = positionAt(code, tokenOffsets(code, { throw: true })[0]!)
+ expect(originalPositionOf(inlineSourceMap(inline)!, generated)?.line).toBe(
+ throwLine,
+ )
+})
diff --git a/packages/compiler-test-utils/tsconfig.json b/packages/compiler-test-utils/tsconfig.json
new file mode 100644
index 0000000000..843889b7fd
--- /dev/null
+++ b/packages/compiler-test-utils/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../../tsconfig.json",
+ "include": ["src", "tests", "vite.config.ts"],
+ "compilerOptions": {
+ "target": "esnext",
+ "types": ["node"]
+ }
+}
diff --git a/packages/compiler-test-utils/vite.config.ts b/packages/compiler-test-utils/vite.config.ts
new file mode 100644
index 0000000000..4aef98b495
--- /dev/null
+++ b/packages/compiler-test-utils/vite.config.ts
@@ -0,0 +1,51 @@
+import path from 'node:path'
+import os from 'node:os'
+import { configDefaults, defineConfig } from 'vitest/config'
+import packageJson from './package.json'
+
+// Under Vitest: Node's compile cache for the test workers and the child
+// Node runs they start (the harness passes this environment on). No outcome
+// change; less time compiling the bundlers, jsdom and the built apps again.
+if (process.env.VITEST) {
+ process.env.NODE_COMPILE_CACHE ??= path.join(
+ os.tmpdir(),
+ 'node-compile-cache',
+ )
+}
+
+export default defineConfig({
+ test: {
+ name: packageJson.name,
+ dir: './tests',
+ watch: false,
+ // At most 4 test processes per Vitest run: each
+ // runs real bundlers, dev servers and its own browser, and Nx runs several
+ // packages' tiers at once. More workers add swap and load flakes, not
+ // speed. `--maxWorkers` on the command line still overrides it.
+ maxWorkers: 4,
+ reporters: ['default', '@tanstack/compiler-test-utils/budget-reporter'],
+ globalSetup: ['./src/run-directory.ts'],
+ projects: [
+ {
+ // Fast tier (`test:unit`): in process; a Vite dev server in
+ // middleware mode is allowed.
+ extends: true,
+ test: {
+ name: 'unit',
+ exclude: [...configDefaults.exclude, 'integration/**'],
+ },
+ },
+ {
+ // Slow tier (`test:integration`): the harness self-tests that run
+ // real builds, Rsbuild dev servers, child Node runs and browsers.
+ extends: true,
+ test: {
+ name: 'integration',
+ include: ['integration/**/*.test.ts'],
+ testTimeout: 30_000,
+ hookTimeout: 30_000,
+ },
+ },
+ ],
+ },
+})
diff --git a/packages/compiler-vite-versions/index.d.ts b/packages/compiler-vite-versions/index.d.ts
new file mode 100644
index 0000000000..d2f8d8dce0
--- /dev/null
+++ b/packages/compiler-vite-versions/index.d.ts
@@ -0,0 +1,12 @@
+export interface ViteLike {
+ build: (config: Record) => Promise
+ createServer: (config: Record) => Promise<{
+ listen: () => Promise
+ close: () => Promise
+ resolvedUrls: { local: Array } | null
+ }>
+}
+export const viteVersions: Array<{
+ major: number
+ load: () => Promise
+}>
diff --git a/packages/compiler-vite-versions/index.js b/packages/compiler-vite-versions/index.js
new file mode 100644
index 0000000000..86566c4c9a
--- /dev/null
+++ b/packages/compiler-vite-versions/index.js
@@ -0,0 +1,10 @@
+/**
+ * The Vite majors the router plugin's peer range admits besides the
+ * workspace's, each loaded on demand (`vite6`, `vite7`: aliased packages of
+ * this test-only package). Vite 5's latest release fails the workspace's
+ * trust policy (no-downgrade) and is not installable.
+ */
+export const viteVersions = [
+ { major: 6, load: () => import('vite6') },
+ { major: 7, load: () => import('vite7') },
+]
diff --git a/packages/compiler-vite-versions/package.json b/packages/compiler-vite-versions/package.json
new file mode 100644
index 0000000000..e6fce3b612
--- /dev/null
+++ b/packages/compiler-vite-versions/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "@tanstack/compiler-vite-versions",
+ "private": true,
+ "version": "0.0.0",
+ "description": "Test-only: the Vite majors the router plugin's peer range admits, as aliased packages for the plugin's version smoke tests. A package of its own so that their `vite` binaries never shadow the workspace's in a package that builds with Vite.",
+ "type": "module",
+ "exports": {
+ ".": "./index.js"
+ },
+ "dependencies": {
+ "vite6": "npm:vite@^6.0.0",
+ "vite7": "npm:vite@^7.0.0"
+ }
+}
diff --git a/packages/react-router-devtools/CHANGELOG.md b/packages/react-router-devtools/CHANGELOG.md
index f74de5f187..963524b66d 100644
--- a/packages/react-router-devtools/CHANGELOG.md
+++ b/packages/react-router-devtools/CHANGELOG.md
@@ -1,12 +1,5 @@
# @tanstack/react-router-devtools
-## 1.167.3
-
-### Patch Changes
-
-- Updated dependencies [[`bbf9b75`](https://github.com/TanStack/router/commit/bbf9b75808d8eee497a6dd1663f0cf08426512e0)]:
- - @tanstack/router-devtools-core@1.168.3
-
## 1.167.2
### Patch Changes
diff --git a/packages/react-router-devtools/package.json b/packages/react-router-devtools/package.json
index 969371a6a6..fd750b4c2b 100644
--- a/packages/react-router-devtools/package.json
+++ b/packages/react-router-devtools/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-router-devtools",
- "version": "1.167.3",
+ "version": "1.167.2",
"description": "Modern and scalable routing for React applications",
"author": "Tanner Linsley",
"license": "MIT",
diff --git a/packages/react-router/package.json b/packages/react-router/package.json
index 9a61d5af25..faa2abc529 100644
--- a/packages/react-router/package.json
+++ b/packages/react-router/package.json
@@ -81,6 +81,16 @@
"default": "./dist/cjs/ssr/client.cjs"
}
},
+ "./hmr": {
+ "import": {
+ "types": "./dist/esm/hmr.d.ts",
+ "default": "./dist/esm/hmr.js"
+ },
+ "require": {
+ "types": "./dist/cjs/hmr.d.cts",
+ "default": "./dist/cjs/hmr.cjs"
+ }
+ },
"./package.json": "./package.json"
},
"sideEffects": false,
diff --git a/packages/react-router/src/hmr.ts b/packages/react-router/src/hmr.ts
new file mode 100644
index 0000000000..619c99852a
--- /dev/null
+++ b/packages/react-router/src/hmr.ts
@@ -0,0 +1,104 @@
+import { applyRouteChunkHmr, applyRouteHmr } from '@tanstack/router-core/hmr'
+import { isServer } from '@tanstack/router-core/isServer'
+import type {
+ AnyRoute,
+ RouteHmrAdapter,
+ RouteHmrMeta,
+} from '@tanstack/router-core'
+
+// Provided by the webpack/Rspack React Refresh plugins (ProvidePlugin).
+declare const __react_refresh_utils__:
+ | { enqueueUpdate: (callback?: () => void) => void }
+ | undefined
+
+// Globals of the Vite (plugin-react) and webpack/Rspack refresh runtimes.
+type RefreshWindow = Window & {
+ __getReactRefreshIgnoredExports?: (ctx: { id: string }) => Array
+ __registerBeforePerformReactRefresh?: unknown
+ __reactRefreshInjected?: boolean
+}
+
+let ignoredExportsById: Map> | undefined
+
+function refreshActive() {
+ const w = window as RefreshWindow
+ return (
+ typeof w.__registerBeforePerformReactRefresh === 'function' ||
+ typeof __react_refresh_utils__ !== 'undefined' ||
+ w.__reactRefreshInjected === true
+ )
+}
+
+// A kept component is patched by React Refresh. On webpack/Rspack the route
+// module is never a refresh boundary, so ask the runtime to run.
+function kept() {
+ if (typeof __react_refresh_utils__ !== 'undefined') {
+ __react_refresh_utils__.enqueueUpdate(() => {})
+ }
+ return true
+}
+
+const adapter: RouteHmrAdapter = {
+ keep: (next, held) =>
+ refreshActive() &&
+ next?.$$tsrRefreshId !== undefined &&
+ next.$$tsrRefreshId === held?.$$tsrRefreshId &&
+ kept(),
+ keepUnsplit: (_next, _held, sameName) =>
+ sameName && refreshActive() && kept(),
+}
+
+/**
+ * Dev-only route HMR entry point called by the router plugin's output at the
+ * top level of every evaluation of a route module.
+ *
+ * Called only by compiler output; not a public API.
+ */
+export function __tsrRouteHmr(
+ routeId: string,
+ Route: AnyRoute,
+ meta: RouteHmrMeta,
+): void {
+ if (process.env.NODE_ENV !== 'production') {
+ if (isServer ?? typeof window === 'undefined') {
+ return
+ }
+ const refreshExports = meta.refreshExports
+ if (refreshExports) {
+ // plugin-react asks for the ignored exports of a module by its id. Every
+ // export but the anchor is ignored, which keeps the module a boundary.
+ let byId = ignoredExportsById
+ if (!byId) {
+ const w = window as RefreshWindow
+ const ids = (byId = ignoredExportsById = new Map())
+ const previous = w.__getReactRefreshIgnoredExports
+ w.__getReactRefreshIgnoredExports = (ctx) => {
+ const ignored = previous?.(ctx) ?? []
+ const own = ids.get(ctx.id)
+ return own ? [...ignored, ...own] : ignored
+ }
+ }
+ byId.set(
+ refreshExports.id,
+ refreshExports.exports.filter((name) => name !== refreshExports.anchor),
+ )
+ }
+ applyRouteHmr(routeId, Route, meta, adapter)
+ }
+}
+
+/**
+ * Dev-only entry point called by the router plugin's output at the top level
+ * of every evaluation of a split chunk of a route module on webpack-style
+ * hosts (the chunk accepts its own hot updates).
+ *
+ * Called only by compiler output; not a public API.
+ */
+export function __tsrRouteChunkHmr(routeId: string, chunk: string): void {
+ if (process.env.NODE_ENV !== 'production') {
+ if (isServer ?? typeof window === 'undefined') {
+ return
+ }
+ applyRouteChunkHmr(routeId, chunk)
+ }
+}
diff --git a/packages/react-router/src/lazyRouteComponent.tsx b/packages/react-router/src/lazyRouteComponent.tsx
index a7b58c4499..391d171d3f 100644
--- a/packages/react-router/src/lazyRouteComponent.tsx
+++ b/packages/react-router/src/lazyRouteComponent.tsx
@@ -2,8 +2,14 @@ import * as React from 'react'
import { isModuleNotFoundError } from '@tanstack/router-core'
import { isServer } from '@tanstack/router-core/isServer'
import { reactUse } from './utils'
+import type { LazyRouteComponentHot } from '@tanstack/router-core'
import type { AsyncRouteComponent } from './route'
+type ReactLazyRouteComponentHot = LazyRouteComponentHot & {
+ subscribe: (listener: () => void) => () => void
+ getVersion: () => number
+}
+
/**
* Wrap a dynamic import to create a route component that supports
* `.preload()` and friendly reload-on-module-missing behavior.
@@ -29,8 +35,15 @@ export function lazyRouteComponent<
const load = () => {
if (!loadPromise) {
error = undefined
- loadPromise = importer()
- .then((res) => {
+ const promise = (loadPromise = importer()
+ .then((res): any => {
+ // A hot update replaced this load: settle with the newer one.
+ if (
+ process.env.NODE_ENV !== 'production' &&
+ loadPromise !== promise
+ ) {
+ return loadPromise
+ }
// Resolved clients have no preload work; SSR can reuse the import.
if (!(isServer ?? typeof window === 'undefined')) {
loadPromise = undefined
@@ -38,18 +51,39 @@ export function lazyRouteComponent<
}
comp = res[exportName ?? 'default']
})
- .catch((err) => {
+ .catch((err): any => {
+ if (
+ process.env.NODE_ENV !== 'production' &&
+ loadPromise !== promise
+ ) {
+ return loadPromise
+ }
loadPromise = undefined
// We don't want an error thrown from preload in this case, because
// there's nothing we want to do about module not found during preload.
// Record the error, the rest is handled during the render path.
error = err
- })
+ }))
}
return loadPromise
}
const lazyComp = function Lazy(props: any) {
+ if (process.env.NODE_ENV !== 'production') {
+ const hot: ReactLazyRouteComponentHot | undefined = (lazyComp as any)
+ .__tsrHot
+ if (hot) {
+ // The slot exists on the client only and never changes, so the hook
+ // order is stable. A hot swap re-renders through this subscription.
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ React.useSyncExternalStore(
+ hot.subscribe,
+ hot.getVersion,
+ hot.getVersion,
+ )
+ }
+ }
+
if (error) {
// A missing module can mean that a newer deployment replaced the URL.
// Reload only for the error that is still current at render time, so a
@@ -83,5 +117,65 @@ export function lazyRouteComponent<
;(lazyComp as any).preload = load
+ if (
+ process.env.NODE_ENV !== 'production' &&
+ !(isServer ?? typeof window === 'undefined')
+ ) {
+ let version = 0
+ const listeners = new Set<() => void>()
+ const rerender = () => {
+ version++
+ listeners.forEach((listener) => listener())
+ }
+ const hot: ReactLazyRouteComponentHot = {
+ get importer() {
+ return importer
+ },
+ get exportName() {
+ return exportName as string | undefined
+ },
+ subscribe: (listener) => {
+ listeners.add(listener)
+ return () => listeners.delete(listener)
+ },
+ getVersion: () => version,
+ update: (nextImporter, nextExportName, keep) => {
+ importer = nextImporter as () => Promise
+ exportName = nextExportName as TKey | undefined
+ if (comp === undefined && loadPromise === undefined && !error) {
+ // Never loaded: the next render loads through the new importer.
+ return
+ }
+ const promise: Promise = nextImporter().then(
+ (res) => {
+ if (loadPromise !== promise) {
+ return loadPromise
+ }
+ loadPromise = undefined
+ const next = res[nextExportName ?? 'default']
+ // Keep: the refresh runtime patches the held component in place.
+ if (comp === undefined || !keep(next, comp)) {
+ comp = next
+ error = undefined
+ rerender()
+ }
+ return undefined
+ },
+ (err) => {
+ if (loadPromise !== promise) {
+ return loadPromise
+ }
+ loadPromise = undefined
+ error = err
+ rerender()
+ return undefined
+ },
+ )
+ loadPromise = promise
+ },
+ }
+ ;(lazyComp as any).__tsrHot = hot
+ }
+
return lazyComp as any
}
diff --git a/packages/react-router/tests/route-hmr.test.tsx b/packages/react-router/tests/route-hmr.test.tsx
new file mode 100644
index 0000000000..ad5da41ddd
--- /dev/null
+++ b/packages/react-router/tests/route-hmr.test.tsx
@@ -0,0 +1,466 @@
+import * as React from 'react'
+import { afterEach, describe, expect, test, vi } from 'vitest'
+import { act, cleanup, fireEvent, render, screen } from '@testing-library/react'
+import { createControlledPromise } from '@tanstack/router-core'
+import {
+ RouterProvider,
+ createMemoryHistory,
+ createRootRoute,
+ createRoute,
+ createRouter,
+ lazyRouteComponent,
+} from '../src'
+import { __tsrRouteHmr } from '../src/hmr'
+import type { AnyRoute, RouteHmrMeta } from '@tanstack/router-core'
+
+// Each test uses its own route id: route HMR remembers routes by id for the
+// lifetime of the page, as it does in a real dev session.
+let nextRouteId = 0
+
+afterEach(() => {
+ cleanup()
+ vi.unstubAllGlobals()
+ delete (window as any).__registerBeforePerformReactRefresh
+ delete (window as any).__getReactRefreshIgnoredExports
+})
+
+type Module = Record
+
+function Counter({ label }: { label: string }) {
+ const [count, setCount] = React.useState(0)
+ return (
+ setCount(count + 1)}>
+ {label} {count}
+
+ )
+}
+
+function makeComponent(label: string) {
+ return function Page() {
+ return
+ }
+}
+
+/**
+ * Sets up an app whose `/page` route module can be evaluated again, the way
+ * the compiler's dev-only block evaluates it on every hot update.
+ */
+function setup(
+ firstOptions: () => Record,
+ firstMeta: RouteHmrMeta = {},
+) {
+ const path = `/page${nextRouteId++}`
+ const rootRoute = createRootRoute()
+ const evaluate = (options: Record, meta: RouteHmrMeta = {}) => {
+ const Route = createRoute({
+ getParentRoute: () => rootRoute,
+ path,
+ ...options,
+ } as any)
+ __tsrRouteHmr(path, Route, meta)
+ return Route
+ }
+ const route = evaluate(firstOptions(), firstMeta)
+ const router = createRouter({
+ routeTree: rootRoute.addChildren([route]),
+ history: createMemoryHistory({ initialEntries: [path] }),
+ })
+ return { path, route, router, evaluate }
+}
+
+async function click(text: RegExp) {
+ await act(async () => {
+ fireEvent.click(await screen.findByRole('button', { name: text }))
+ })
+}
+
+describe('route HMR (React)', () => {
+ test('a hot update replaces the loader, keeps generated options and shows the new data', async () => {
+ const firstLoader = vi.fn(() => 'data v1')
+ const { route, router, evaluate, path } = setup(() => ({
+ loader: firstLoader,
+ component: function Page() {
+ return {route.useLoaderData()}
+ },
+ }))
+ render( )
+ expect(await screen.findByText('data v1')).toBeInTheDocument()
+
+ const secondLoader = vi.fn(() => 'data v2')
+ const next = evaluate({
+ loader: secondLoader,
+ component: route.options.component,
+ })
+ expect(await screen.findByText('data v2')).toBeInTheDocument()
+
+ const live = (router.routesById as Record)[path]!
+ expect(live).toBe(route)
+ expect(live.options.loader).toBe(secondLoader)
+ expect((live.options as any).path).toBe(path)
+ expect(next.options).toBe(live.options)
+ expect(next.id).toBe(live.id)
+ expect(firstLoader).toHaveBeenCalledTimes(1)
+ expect(secondLoader).toHaveBeenCalled()
+ })
+
+ test('an unsplit component is swapped without a refresh runtime', async () => {
+ const { router, evaluate } = setup(
+ () => ({ component: makeComponent('v1') }),
+ { unsplit: { component: 'Page' } },
+ )
+ render( )
+ await click(/v1 0/)
+
+ evaluate(
+ { component: makeComponent('v2') },
+ { unsplit: { component: 'Page' } },
+ )
+ expect(
+ await screen.findByRole('button', { name: 'v2 0' }),
+ ).toBeInTheDocument()
+ })
+
+ test('an unsplit component with the same binding is kept for React Refresh', async () => {
+ ;(window as any).__registerBeforePerformReactRefresh = () => {}
+ const first = makeComponent('v1')
+ const { router, evaluate, path } = setup(() => ({ component: first }), {
+ unsplit: { component: 'Page' },
+ })
+ render( )
+ await click(/v1 0/)
+
+ evaluate(
+ { component: makeComponent('v2') },
+ { unsplit: { component: 'Page' } },
+ )
+ expect(
+ (router.routesById as Record)[path]!.options.component,
+ ).toBe(first)
+ // The refresh runtime (absent here) patches the kept component in place.
+ expect(
+ await screen.findByRole('button', { name: 'v1 1' }),
+ ).toBeInTheDocument()
+ })
+
+ test('a renamed unsplit component is swapped even with React Refresh', async () => {
+ ;(window as any).__registerBeforePerformReactRefresh = () => {}
+ const { router, evaluate } = setup(
+ () => ({ component: makeComponent('v1') }),
+ { unsplit: { component: 'Page' } },
+ )
+ render( )
+
+ evaluate(
+ { component: makeComponent('v2') },
+ { unsplit: { component: 'Renamed' } },
+ )
+ expect(
+ await screen.findByRole('button', { name: 'v2 0' }),
+ ).toBeInTheDocument()
+ })
+
+ test('a kept unsplit component asks the webpack/Rspack refresh runtime to run', async () => {
+ const enqueueUpdate = vi.fn()
+ vi.stubGlobal('__react_refresh_utils__', { enqueueUpdate })
+ const first = makeComponent('v1')
+ const { router, evaluate, path } = setup(() => ({ component: first }), {
+ unsplit: { component: 'Page' },
+ })
+ render( )
+ await screen.findByRole('button', { name: 'v1 0' })
+
+ evaluate(
+ { component: makeComponent('v2') },
+ { unsplit: { component: 'Page' } },
+ )
+ expect(
+ (router.routesById as Record)[path]!.options.component,
+ ).toBe(first)
+ expect(enqueueUpdate).toHaveBeenCalledOnce()
+ })
+
+ test('the live lazy wrapper is kept, re-imports, and swaps to a new component', async () => {
+ const firstImporter = vi.fn(
+ (): Promise =>
+ Promise.resolve({
+ component: makeComponent('v1'),
+ }),
+ )
+ const { router, evaluate, path } = setup(() => ({
+ component: lazyRouteComponent(firstImporter, 'component'),
+ }))
+ const wrapper = (router.routesById as Record)[path]!
+ .options.component
+ render( )
+ await click(/v1 0/)
+
+ const secondImporter = vi.fn(
+ (): Promise =>
+ Promise.resolve({
+ component: makeComponent('v2'),
+ }),
+ )
+ const next = evaluate({
+ component: lazyRouteComponent(secondImporter, 'component'),
+ })
+ expect(
+ (router.routesById as Record)[path]!.options.component,
+ ).toBe(wrapper)
+ expect(next.options.component).toBe(wrapper)
+ expect(
+ await screen.findByRole('button', { name: 'v2 0' }),
+ ).toBeInTheDocument()
+ expect(secondImporter).toHaveBeenCalledOnce()
+ })
+
+ test('the held split component is kept when the loaded export has the same refresh id', async () => {
+ ;(window as any).__registerBeforePerformReactRefresh = () => {}
+ const marked = (label: string, id: string) =>
+ Object.assign(makeComponent(label), { $$tsrRefreshId: id })
+ const { router, evaluate } = setup(() => ({
+ component: lazyRouteComponent(
+ (): Promise =>
+ Promise.resolve({
+ component: marked('v1', '/page?tsr-split=component Split'),
+ }),
+ 'component',
+ ),
+ }))
+ render( )
+ await click(/v1 0/)
+
+ const sameId = vi.fn(
+ (): Promise =>
+ Promise.resolve({
+ component: marked('v2', '/page?tsr-split=component Split'),
+ }),
+ )
+ evaluate({ component: lazyRouteComponent(sameId, 'component') })
+ await act(() => sameId.mock.results[0]!.value)
+ expect(sameId).toHaveBeenCalledOnce()
+ // Kept: React Refresh patches the held component, its state survives.
+ expect(screen.getByRole('button', { name: 'v1 1' })).toBeInTheDocument()
+
+ // A grouping change gives another chunk id: a new family, so swap.
+ evaluate({
+ component: lazyRouteComponent(
+ (): Promise =>
+ Promise.resolve({
+ component: marked('v3', '/page?tsr-split=component---loader Split'),
+ }),
+ 'component',
+ ),
+ })
+ expect(
+ await screen.findByRole('button', { name: 'v3 0' }),
+ ).toBeInTheDocument()
+ })
+
+ test('a marked split component is swapped when no refresh runtime runs', async () => {
+ const marked = (label: string) =>
+ Object.assign(makeComponent(label), { $$tsrRefreshId: 'chunk Split' })
+ const { router, evaluate } = setup(() => ({
+ component: lazyRouteComponent(
+ (): Promise => Promise.resolve({ component: marked('v1') }),
+ 'component',
+ ),
+ }))
+ render( )
+ await screen.findByRole('button', { name: 'v1 0' })
+
+ evaluate({
+ component: lazyRouteComponent(
+ (): Promise => Promise.resolve({ component: marked('v2') }),
+ 'component',
+ ),
+ })
+ expect(
+ await screen.findByRole('button', { name: 'v2 0' }),
+ ).toBeInTheDocument()
+ })
+
+ test('only the newest import decides what a hot-updated wrapper renders', async () => {
+ const { router, evaluate } = setup(() => ({
+ component: lazyRouteComponent(
+ (): Promise =>
+ Promise.resolve({ component: makeComponent('v1') }),
+ 'component',
+ ),
+ }))
+ render( )
+ await screen.findByRole('button', { name: 'v1 0' })
+
+ const second = createControlledPromise()
+ const third = createControlledPromise()
+ evaluate({ component: lazyRouteComponent(() => second, 'component') })
+ evaluate({ component: lazyRouteComponent(() => third, 'component') })
+
+ third.resolve({ component: makeComponent('v3') })
+ await act(() => third)
+ expect(
+ await screen.findByRole('button', { name: 'v3 0' }),
+ ).toBeInTheDocument()
+
+ second.resolve({ component: makeComponent('v2') })
+ await act(() => second)
+ expect(screen.getByRole('button', { name: 'v3 0' })).toBeInTheDocument()
+ expect(screen.queryByRole('button', { name: /v2/ })).not.toBeInTheDocument()
+ })
+
+ test('a first load that a hot update replaced settles with the newer component', async () => {
+ const first = createControlledPromise()
+ const second = createControlledPromise()
+ const wrapper = lazyRouteComponent(() => first, 'component')
+ const { router, evaluate } = setup(() => ({ component: wrapper }))
+ const preload = wrapper.preload!()
+ evaluate({ component: lazyRouteComponent(() => second, 'component') })
+
+ first.resolve({ component: makeComponent('v1') })
+ second.resolve({ component: makeComponent('v2') })
+ await preload
+ render( )
+ expect(
+ await screen.findByRole('button', { name: 'v2 0' }),
+ ).toBeInTheDocument()
+ })
+
+ test('a wrapper that never loaded only takes the new importer', async () => {
+ const firstImporter = vi.fn(
+ (): Promise =>
+ Promise.resolve({
+ component: makeComponent('v1'),
+ }),
+ )
+ const { evaluate, router, path } = setup(() => ({
+ component: lazyRouteComponent(firstImporter, 'component'),
+ }))
+ const wrapper = (router.routesById as Record)[path]!
+ .options.component
+ const secondImporter = vi.fn(
+ (): Promise =>
+ Promise.resolve({
+ component: makeComponent('v2'),
+ }),
+ )
+ evaluate({ component: lazyRouteComponent(secondImporter, 'component') })
+ expect(
+ (router.routesById as Record)[path]!.options.component,
+ ).toBe(wrapper)
+
+ render( )
+ expect(
+ await screen.findByRole('button', { name: 'v2 0' }),
+ ).toBeInTheDocument()
+ expect(firstImporter).not.toHaveBeenCalled()
+ expect(secondImporter).toHaveBeenCalledOnce()
+ })
+
+ test('Vite bundled dev: a chunk the page never loaded is imported through the first importer', async () => {
+ // Rolldown's dev runtime throws this from an HMR patch's `import()` of a
+ // chunk the page never loaded.
+ class MissingFactoryError extends Error {}
+ const firstImporter = vi.fn(
+ (): Promise =>
+ Promise.resolve({ component: makeComponent('v1') }),
+ )
+ const wrapper = lazyRouteComponent(firstImporter, 'component')
+ const { router, evaluate } = setup(() => ({ component: wrapper }))
+ const patchImporter = vi.fn((): Promise => {
+ throw new MissingFactoryError(
+ 'No factory registered for module src/routes/page.tsx?tsr-split=component',
+ )
+ })
+ // Two saves while the route is not shown, then a preload in flight
+ // (a pending navigation) during a third save.
+ evaluate({ component: lazyRouteComponent(patchImporter, 'component') })
+ evaluate({ component: lazyRouteComponent(patchImporter, 'component') })
+ const preload = wrapper.preload!()
+ evaluate({ component: lazyRouteComponent(patchImporter, 'component') })
+ await preload
+
+ render( )
+ expect(
+ await screen.findByRole('button', { name: 'v1 0' }),
+ ).toBeInTheDocument()
+ // Every import through the patch fell back to the first importer.
+ expect(patchImporter).toHaveBeenCalled()
+ expect(firstImporter).toHaveBeenCalledTimes(patchImporter.mock.calls.length)
+ const firstImporterCalls = firstImporter.mock.calls.length
+
+ // Any other failure of the new importer is not covered up.
+ evaluate({
+ component: lazyRouteComponent(
+ (): Promise => Promise.reject(new Error('syntax error')),
+ 'component',
+ ),
+ })
+ await act(async () => {})
+ expect(firstImporter).toHaveBeenCalledTimes(firstImporterCalls)
+ expect(screen.queryByRole('button', { name: /v1/ })).not.toBeInTheDocument()
+ })
+
+ test('an update for a route another router holds leaves both routers alone', () => {
+ const firstLoader = () => 'v1'
+ const { router, evaluate, path } = setup(() => ({ loader: firstLoader }))
+ // A second router created later becomes `window.__TSR_ROUTER__`.
+ const otherRoot = createRootRoute()
+ const otherRoute = createRoute({ getParentRoute: () => otherRoot, path })
+ const other = createRouter({
+ routeTree: otherRoot.addChildren([otherRoute]),
+ history: createMemoryHistory({ initialEntries: [path] }),
+ })
+ expect(window.__TSR_ROUTER__).toBe(other)
+
+ expect(() => evaluate({ loader: () => 'v2' })).not.toThrow()
+ expect(
+ (router.routesById as Record)[path]!.options.loader,
+ ).toBe(firstLoader)
+ expect(
+ (other.routesById as Record)[path]!.options.loader,
+ ).toBeUndefined()
+ })
+
+ test('an update for a route id the router does not have does nothing', () => {
+ const { evaluate, router } = setup(() => ({}))
+ const before = router.routesById
+ window.__TSR_ROUTER__ = undefined
+ expect(() => evaluate({ loader: () => 'v2' })).not.toThrow()
+ window.__TSR_ROUTER__ = router
+ expect(router.routesById).toBe(before)
+ })
+
+ test('on the server the helper does nothing and wrappers have no hot slot', () => {
+ const firstLoader = () => 'v1'
+ const { router, evaluate, path } = setup(() => ({ loader: firstLoader }))
+ vi.stubGlobal('window', undefined)
+ const wrapper = lazyRouteComponent(() =>
+ Promise.resolve({ default: () => null }),
+ )
+ expect((wrapper as any).__tsrHot).toBeUndefined()
+ evaluate({ loader: () => 'v2' })
+ vi.unstubAllGlobals()
+ expect(
+ (router.routesById as Record)[path]!.options.loader,
+ ).toBe(firstLoader)
+ })
+
+ test('React + Vite: every export of the route module but the anchor is ignored by plugin-react', () => {
+ const previous = vi.fn(() => ['fromPrevious'])
+ ;(window as any).__getReactRefreshIgnoredExports = previous
+ const meta = {
+ refreshExports: {
+ id: '/src/routes/ignored.tsx',
+ anchor: 'TsrFastRefreshAnchor',
+ exports: ['Route', 'helper', 'TsrFastRefreshAnchor'],
+ },
+ }
+ setup(() => ({}), meta)
+ const getIgnored = (window as any).__getReactRefreshIgnoredExports
+ expect(getIgnored({ id: '/src/routes/ignored.tsx' })).toEqual([
+ 'fromPrevious',
+ 'Route',
+ 'helper',
+ ])
+ expect(getIgnored({ id: '/src/other.tsx' })).toEqual(['fromPrevious'])
+ })
+})
diff --git a/packages/react-router/vite.config.ts b/packages/react-router/vite.config.ts
index 798d9b74e4..f50f8a4d06 100644
--- a/packages/react-router/vite.config.ts
+++ b/packages/react-router/vite.config.ts
@@ -32,6 +32,7 @@ export default mergeConfig(
'./src/index.dev.tsx',
'./src/ssr/client.ts',
'./src/ssr/server.ts',
+ './src/hmr.ts',
],
srcDir: './src',
}),
diff --git a/packages/react-start-client/CHANGELOG.md b/packages/react-start-client/CHANGELOG.md
index 1cb31dea24..df6cf1e7ad 100644
--- a/packages/react-start-client/CHANGELOG.md
+++ b/packages/react-start-client/CHANGELOG.md
@@ -1,11 +1,5 @@
# @tanstack/react-start-client
-## 1.168.45
-
-### Patch Changes
-
-- [#8653](https://github.com/TanStack/router/pull/8653) [`d66a84b`](https://github.com/TanStack/router/commit/d66a84ba0a74ffd03e22b57ccd90796274c96244) - fix: a `visible()` boundary keeps its server HTML when the intersection arrives while React waits to replay the boundary's render
-
## 1.168.44
### Patch Changes
diff --git a/packages/react-start-client/package.json b/packages/react-start-client/package.json
index b919d47b92..7837e0e011 100644
--- a/packages/react-start-client/package.json
+++ b/packages/react-start-client/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-start-client",
- "version": "1.168.45",
+ "version": "1.168.44",
"description": "Modern and scalable routing for React applications",
"author": "Tanner Linsley",
"license": "MIT",
diff --git a/packages/react-start-client/src/hydration/visible.tsx b/packages/react-start-client/src/hydration/visible.tsx
index b295d77462..e274285cb8 100644
--- a/packages/react-start-client/src/hydration/visible.tsx
+++ b/packages/react-start-client/src/hydration/visible.tsx
@@ -26,22 +26,20 @@ function HydrationBoundary(props: {
o?: () => void
children?: React.ReactNode
}) {
- // Above the gate: a replay after `use` suspended can find the gate open and
- // skip `use`, and only `use` leaves the replay's dispatcher, which rejects a
- // hook the first attempt did not reach.
- const { o } = props
+ const { g, o } = props
+
+ if (!g.r) {
+ if (!reactUse) {
+ throw g.p
+ }
+
+ reactUse(g.p)
+ }
+
React.useEffect(() => {
o?.()
}, [o])
- if (!props.g.r) {
- if (!reactUse) {
- throw props.g.p
- }
-
- reactUse(props.g.p)
- }
-
return props.children as React.JSX.Element
}
diff --git a/packages/react-start-client/src/tests/Hydrate.test.tsx b/packages/react-start-client/src/tests/Hydrate.test.tsx
index 0e7abe502a..0d0ce1faad 100644
--- a/packages/react-start-client/src/tests/Hydrate.test.tsx
+++ b/packages/react-start-client/src/tests/Hydrate.test.tsx
@@ -12,14 +12,7 @@ import {
import { afterEach, describe, expect, it, vi } from 'vitest'
import { hydrateIdAttribute } from '@tanstack/start-client-core/hydration/constants'
import { Hydrate } from '../Hydrate'
-import {
- condition,
- idle,
- interaction,
- load,
- never,
- visible,
-} from '../hydration'
+import { condition, idle, interaction, load, never } from '../hydration'
import type { HydrateProps, HydrationPrefetchStrategy } from '../Hydrate'
const InternalHydrate = Hydrate as React.ComponentType<
@@ -680,84 +673,4 @@ describe('Hydrate', () => {
await unmountHydratedRoot(root, container)
}
})
-
- // `visible()` reads its gate's mutable flag during render (`if (!g.r) use(g.p)`).
- // React replays a component that suspended in `use` with its re-render
- // dispatcher, and only `use` switches away from it: when the intersection
- // arrives while React waits to replay, the flag is true, the replay skips
- // `use`, and a hook after it would throw "Update hook called on initial render"
- // (#467 in production). React would then discard the boundary's server HTML.
- // Which task the intersection lands in is the browser's choice, so this runs
- // it in each of the tasks around the boundary's first hydration attempt.
- it('hydrates a visible boundary whichever task the intersection arrives in', async () => {
- const actEnvironment = globalThis as {
- IS_REACT_ACT_ENVIRONMENT?: boolean
- }
- const wasActEnvironment = actEnvironment.IS_REACT_ACT_ENVIRONMENT
- actEnvironment.IS_REACT_ACT_ENVIRONMENT = false
- const nextTask = () => new Promise((resolve) => setImmediate(resolve))
- const app = (onHydrated?: () => void) => (
- fallback
}
- onHydrated={onHydrated}
- >
- child
-
- )
- vi.stubGlobal('window', undefined)
- const html = renderToString(app())
- vi.unstubAllGlobals()
- const failed: Array<{ tasks: number; errors: Array }> = []
- try {
- for (let tasks = 0; tasks < 12; tasks++) {
- vi.stubGlobal(
- 'IntersectionObserver',
- class {
- constructor(private notify: IntersectionObserverCallback) {}
- observe() {
- void (async () => {
- for (let task = 0; task < tasks; task++) {
- await nextTask()
- }
- this.notify(
- [{ isIntersecting: true } as IntersectionObserverEntry],
- this as unknown as IntersectionObserver,
- )
- })()
- }
- disconnect() {}
- },
- )
- const container = document.createElement('div')
- document.body.append(container)
- container.innerHTML = html
- const errors: Array = []
- const hydrated = new Promise((resolve) => {
- const root = hydrateRoot(
- container,
- app(() => {
- resolve()
- setImmediate(() => {
- root.unmount()
- container.remove()
- })
- }),
- {
- onRecoverableError: (error) => {
- errors.push(String((error as Error).cause ?? error))
- },
- },
- )
- })
- await hydrated
- if (errors.length > 0) {
- failed.push({ tasks, errors })
- }
- }
- } finally {
- actEnvironment.IS_REACT_ACT_ENVIRONMENT = wasActEnvironment
- }
- expect(failed).toEqual([])
- })
})
diff --git a/packages/react-start-rsc/AGENTS.md b/packages/react-start-rsc/AGENTS.md
new file mode 100644
index 0000000000..de0712d09d
--- /dev/null
+++ b/packages/react-start-rsc/AGENTS.md
@@ -0,0 +1,5 @@
+# React Start RSC
+
+- Tests run in two tiers. `test:unit` is reserved for fast compiler acceptance (currently empty). `test:noncompiler` runs main's RSC runtime and type tests (57 tests, at main's paths in `tests/`, listed in `tests/noncompiler-tests.json`, unchanged from main) in jsdom; `test:types` and `test:eslint` check `tests/integration/` only, as main does not type-check or lint them. `test:integration` (slow tier) runs `tests/integration/**`: real Start apps with RSC on Vite and Rsbuild dev servers and builds, and real browser pages; its Nx target builds `@tanstack/react-start` first. Run integration, noncompiler, types and eslint before handing back.
+- To run one test file or `-t` filter quickly, the slow-tier load gate and the test budgets: [compiler-test-utils/AGENTS.md](../compiler-test-utils/AGENTS.md).
+- What these tests are, the spec they cite (`J4.12`, `G3`, `§5.7`) and the known bugs: [compiler-test-utils/oracle/README.md](../compiler-test-utils/oracle/README.md).
diff --git a/packages/react-start-rsc/CHANGELOG.md b/packages/react-start-rsc/CHANGELOG.md
index fae6bcabee..4914f0bce0 100644
--- a/packages/react-start-rsc/CHANGELOG.md
+++ b/packages/react-start-rsc/CHANGELOG.md
@@ -1,20 +1,5 @@
# @tanstack/react-start-rsc
-## 0.1.67
-
-### Patch Changes
-
-- Updated dependencies [[`3f22686`](https://github.com/TanStack/router/commit/3f226869e0af211ff7f1de5d7343e43462dbb101), [`559c7de`](https://github.com/TanStack/router/commit/559c7ded6e2a6eeda3f91c80d8c03f4cfeb9a206)]:
- - @tanstack/start-plugin-core@1.171.57
-
-## 0.1.66
-
-### Patch Changes
-
-- Updated dependencies [[`446ce1b`](https://github.com/TanStack/router/commit/446ce1b30650d85f1fc78f2d1ee42712e40b75c6), [`ff157f0`](https://github.com/TanStack/router/commit/ff157f0079982e90d62be7fdeecfb77e4fdcec69), [`01fab5a`](https://github.com/TanStack/router/commit/01fab5a6c8aed70d61d82c64bc344cbac66c240c), [`c5320d7`](https://github.com/TanStack/router/commit/c5320d7ca23eca82d720ac5629d2bad5cf7d9b02), [`545a8d3`](https://github.com/TanStack/router/commit/545a8d3790989ca502153c3292c6b1e8063257f4), [`da8c28c`](https://github.com/TanStack/router/commit/da8c28c498230a5730ce75b2693baeeb3ef68ac1)]:
- - @tanstack/router-utils@1.163.0
- - @tanstack/start-plugin-core@1.171.56
-
## 0.1.65
### Patch Changes
diff --git a/packages/react-start-rsc/package.json b/packages/react-start-rsc/package.json
index 40b1847068..8b1732e5ca 100644
--- a/packages/react-start-rsc/package.json
+++ b/packages/react-start-rsc/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-start-rsc",
- "version": "0.1.67",
+ "version": "0.1.65",
"description": "React Server Components support for TanStack Start",
"author": "Tanner Linsley",
"license": "MIT",
@@ -24,19 +24,58 @@
],
"scripts": {
"clean": "rimraf ./dist && rimraf ./coverage",
- "test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit",
- "test:unit": "vitest",
- "test:unit:dev": "vitest --watch",
- "test:eslint": "eslint ./src",
+ "test": "pnpm test:eslint && pnpm test:types && pnpm test:build && pnpm test:unit && pnpm test:integration && pnpm test:noncompiler",
+ "test:unit": "vitest --project unit --passWithNoTests",
+ "test:unit:dev": "vitest --project unit --watch",
+ "test:integration": "vitest --project integration",
+ "test:eslint": "eslint ./src ./tests/integration",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
- "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js",
- "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js",
- "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js",
- "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js",
- "test:types:ts60": "tsc6",
- "test:types:ts70": "tsc",
+ "test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js && node ../../node_modules/typescript56/lib/tsc.js -p tests",
+ "test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js && node ../../node_modules/typescript57/lib/tsc.js -p tests",
+ "test:types:ts58": "node ../../node_modules/typescript58/lib/tsc.js && node ../../node_modules/typescript58/lib/tsc.js -p tests",
+ "test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js && node ../../node_modules/typescript59/lib/tsc.js -p tests",
+ "test:types:ts60": "tsc6 && tsc6 -p tests",
+ "test:types:ts70": "tsc && tsc -p tests",
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
- "build": "vite build"
+ "build": "vite build",
+ "test:noncompiler": "vitest --project noncompiler"
+ },
+ "nx": {
+ "targets": {
+ "test:unit": {
+ "dependsOn": [
+ "^build",
+ {
+ "projects": [
+ "@tanstack/react-start-client"
+ ],
+ "target": "build"
+ }
+ ]
+ },
+ "test:integration": {
+ "dependsOn": [
+ "^build",
+ {
+ "projects": [
+ "@tanstack/react-start"
+ ],
+ "target": "build"
+ }
+ ]
+ },
+ "test:noncompiler": {
+ "dependsOn": [
+ "^build",
+ {
+ "projects": [
+ "@tanstack/react-start-client"
+ ],
+ "target": "build"
+ }
+ ]
+ }
+ }
},
"type": "module",
"types": "dist/esm/src/index.d.ts",
@@ -69,12 +108,6 @@
"default": "./dist/esm/plugin/vite.js"
}
},
- "./plugin/rscCssTransform": {
- "import": {
- "types": "./dist/esm/src/plugin/rscCssTransform.d.ts",
- "default": "./dist/esm/plugin/rscCssTransform.js"
- }
- },
"./rsbuild/ssr-decode": {
"import": {
"types": "./dist/esm/src/rsbuild/ssr-decode.d.ts",
@@ -107,11 +140,13 @@
"pathe": "catalog:"
},
"devDependencies": {
+ "@rsbuild/plugin-react": "^2.0.0",
"@rspack/core": "2.2.7",
"@testing-library/react": "catalog:",
"@vitejs/plugin-react": "catalog:",
- "@vitejs/plugin-rsc": "^0.5.39",
- "react-server-dom-rspack": "^0.1.1",
+ "@vitejs/plugin-rsc": "^0.5.37",
+ "react-server-dom-rspack": "^0.0.2",
+ "@tanstack/compiler-test-utils": "workspace:*",
"@tanstack/vite-config": "catalog:",
"vitest": "catalog:",
"jsdom": "catalog:",
@@ -127,10 +162,10 @@
},
"peerDependencies": {
"@rspack/core": ">=2.0.0-0",
- "@vitejs/plugin-rsc": ">=0.5.38",
+ "@vitejs/plugin-rsc": ">=0.5.30",
"react": ">=18.0.0 || >=19.0.0",
"react-dom": ">=18.0.0 || >=19.0.0",
- "react-server-dom-rspack": ">=0.1.1"
+ "react-server-dom-rspack": ">=0.0.2"
},
"peerDependenciesMeta": {
"@rspack/core": {
diff --git a/packages/react-start-rsc/src/plugin/rscCssTransform.ts b/packages/react-start-rsc/src/plugin/rscCssTransform.ts
deleted file mode 100644
index 15b882ccd7..0000000000
--- a/packages/react-start-rsc/src/plugin/rscCssTransform.ts
+++ /dev/null
@@ -1,150 +0,0 @@
-import type {
- StartCompilerImportTransform,
- StartCompilerTransformContext,
-} from '@tanstack/start-plugin-core'
-
-const TSS_SERVERFN_SPLIT_PARAM = 'tss-serverfn-split'
-const RSC_CSS_OPTIONS_KEY = '__tanstackStartRscCss'
-
-type BabelTypes = StartCompilerTransformContext['types']
-type BabelExpression = ReturnType<
- StartCompilerTransformContext['parseExpression']
->
-
-type RscCssTransformKind =
- | 'renderServerComponent'
- | 'createCompositeComponent'
- | 'renderToReadableStream'
-
-export function createRscCssCompilerTransforms(opts: {
- loadCssExpression: string
- serverFnProviderOnly?: boolean | undefined
-}): Array {
- let loadCssExpression: BabelExpression | undefined
-
- const getLoadCssExpression = (context: StartCompilerTransformContext) => {
- loadCssExpression ??= context.parseExpression(opts.loadCssExpression)
- return loadCssExpression
- }
-
- return [
- createRscCssCompilerTransform({
- serverFnProviderOnly: opts.serverFnProviderOnly,
- getLoadCssExpression,
- kind: 'renderServerComponent',
- name: 'react-rsc-render-server-component-css',
- }),
- createRscCssCompilerTransform({
- serverFnProviderOnly: opts.serverFnProviderOnly,
- getLoadCssExpression,
- kind: 'createCompositeComponent',
- name: 'react-rsc-create-composite-component-css',
- }),
- createRscCssCompilerTransform({
- serverFnProviderOnly: opts.serverFnProviderOnly,
- getLoadCssExpression,
- kind: 'renderToReadableStream',
- name: 'react-rsc-render-to-readable-stream-css',
- }),
- ]
-}
-
-function createRscCssCompilerTransform(opts: {
- name: string
- kind: RscCssTransformKind
- getLoadCssExpression: (
- context: StartCompilerTransformContext,
- ) => BabelExpression
- serverFnProviderOnly?: boolean | undefined
-}): StartCompilerImportTransform {
- return {
- name: opts.name,
- environment: 'server',
- imports: [
- {
- libName: '@tanstack/react-start/rsc',
- rootExport: opts.kind,
- },
- {
- libName: '@tanstack/react-start-rsc',
- rootExport: opts.kind,
- },
- ],
- detect: new RegExp(`\\b${opts.kind}\\b`),
- transform: (candidates, context) => {
- if (
- opts.serverFnProviderOnly &&
- !context.id.includes(TSS_SERVERFN_SPLIT_PARAM)
- ) {
- return
- }
-
- const t = context.types
- const loadCssExpression = opts.getLoadCssExpression(context)
- const cloneLoadCssExpression = () => t.cloneNode(loadCssExpression)
-
- for (const candidate of candidates) {
- const args = candidate.path.node.arguments
- if (args.length !== 1) continue
-
- if (opts.kind === 'renderToReadableStream') {
- const firstArg = args[0]
- if (!firstArg || !t.isExpression(firstArg)) continue
- if (!isTopLevelJsx(t, firstArg)) continue
-
- args[0] = createCssFragment(
- t,
- firstArg,
- cloneLoadCssExpression(),
- ) as typeof firstArg
- continue
- }
-
- args.push(
- t.objectExpression([
- t.objectProperty(
- t.identifier(RSC_CSS_OPTIONS_KEY),
- cloneLoadCssExpression(),
- ),
- ]),
- )
- }
- },
- }
-}
-
-function isTopLevelJsx(t: BabelTypes, expr: BabelExpression): boolean {
- const unwrapped = unwrapTransparentExpression(t, expr)
- return t.isJSXElement(unwrapped) || t.isJSXFragment(unwrapped)
-}
-
-function unwrapTransparentExpression(
- t: BabelTypes,
- expr: BabelExpression,
-): BabelExpression {
- let current = expr
- while (
- t.isParenthesizedExpression(current) ||
- t.isTSAsExpression(current) ||
- t.isTSSatisfiesExpression(current) ||
- t.isTSTypeAssertion(current) ||
- t.isTSNonNullExpression(current)
- ) {
- current = current.expression
- }
- return current
-}
-
-function createCssFragment(
- t: BabelTypes,
- original: BabelExpression,
- loadCssExpression: BabelExpression,
-) {
- const unwrapped = unwrapTransparentExpression(t, original)
- return t.jsxFragment(t.jsxOpeningFragment(), t.jsxClosingFragment(), [
- t.jsxExpressionContainer(loadCssExpression),
- t.isJSXElement(unwrapped) || t.isJSXFragment(unwrapped)
- ? unwrapped
- : t.jsxExpressionContainer(original),
- ])
-}
diff --git a/packages/react-start-rsc/src/plugin/vite.ts b/packages/react-start-rsc/src/plugin/vite.ts
index 9aa9523c6a..227c2bc50b 100644
--- a/packages/react-start-rsc/src/plugin/vite.ts
+++ b/packages/react-start-rsc/src/plugin/vite.ts
@@ -1,7 +1,6 @@
import { fileURLToPath } from 'node:url'
import path from 'pathe'
import { createVirtualModule } from '@tanstack/start-plugin-core/vite'
-import { createRscCssCompilerTransforms } from './rscCssTransform'
import type {
TanStackStartVitePluginCoreOptions,
ViteRscForwardSsrResolverStrategy,
@@ -27,7 +26,7 @@ export function configureRsc(): {
providerEnvironmentName: TanStackStartVitePluginCoreOptions['providerEnvironmentName']
ssrResolverStrategy: TanStackStartVitePluginCoreOptions['ssrResolverStrategy']
serializationAdapters: TanStackStartVitePluginCoreOptions['serializationAdapters']
- compilerTransforms: TanStackStartVitePluginCoreOptions['compilerTransforms']
+ rsc: NonNullable
} {
const serializationAdapters: TanStackStartVitePluginCoreOptions['serializationAdapters'] =
[
@@ -58,9 +57,7 @@ export function configureRsc(): {
providerEnvironmentName: RSC_ENV_NAME,
ssrResolverStrategy,
serializationAdapters,
- compilerTransforms: createRscCssCompilerTransforms({
- loadCssExpression: 'import.meta.viteRsc.loadCss()',
- }),
+ rsc: { loadCssExpression: 'import.meta.viteRsc.loadCss()' },
}
}
export function reactStartRscVitePlugin(): PluginOption {
diff --git a/packages/react-start-rsc/tests/integration/rsc-app.ts b/packages/react-start-rsc/tests/integration/rsc-app.ts
new file mode 100644
index 0000000000..a5b911935e
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-app.ts
@@ -0,0 +1,614 @@
+/**
+ * Real React Start apps with RSC enabled, for tests of what the RSC CSS
+ * transform and Start's RSC wiring do end to end: a Vite dev server
+ * (`startRscDevServer`) runs the app the way `vite dev` does, with the built
+ * `@tanstack/react-start` (`tanstackStart({ rsc: { enabled: true } })` of its
+ * `plugin/vite` entry, linked into the app's `node_modules`), Vite's own RSC
+ * plugin (`@vitejs/plugin-rsc`, the three environments `client`, `ssr` and
+ * `rsc`) and `@vitejs/plugin-react`. With `browser`, a real page
+ * (`@tanstack/compiler-test-utils/browser`) loads the app over HTTP through
+ * Start's own dev server middleware (SSR), Vite's HMR client and React
+ * Refresh; Vite's own watcher reports the test's file edits (`write()`).
+ *
+ * The temporary apps stand in for apps in this directory
+ * (`@tanstack/compiler-test-utils/app-directory`): their bare imports (`react`,
+ * `@tanstack/react-router`, `@vitejs/plugin-rsc`, ...) resolve to this
+ * package's dependencies, as in an installed app. `@tanstack/react-start`
+ * is not one of them (it depends on this package), so the built workspace
+ * package is linked (`workspacePackageLinks`); the `test:integration` Nx
+ * target depends on its `build`.
+ */
+import { createRequire } from 'node:module'
+import path from 'node:path'
+import { fileURLToPath, pathToFileURL } from 'node:url'
+import react from '@vitejs/plugin-react'
+import rsc from '@vitejs/plugin-rsc'
+import { pluginReact } from '@rsbuild/plugin-react'
+import { openPage } from '@tanstack/compiler-test-utils/browser'
+import { createDevServer } from '@tanstack/compiler-test-utils/dev-server'
+import { createRsbuildDevServer } from '@tanstack/compiler-test-utils/rsbuild-dev-server'
+import {
+ createApp,
+ pluginNames,
+ withBuildEnvironment,
+} from '@tanstack/compiler-test-utils/build-harness'
+import { createBuilder, mergeConfig, preview } from 'vite'
+import { workspacePackageLinks } from '@tanstack/compiler-test-utils/workspace-packages'
+import { onTestFinished } from 'vitest'
+import type { ChannelDiagnostic } from '@tanstack/compiler-test-utils/diagnostic-channel'
+import type { BrowserPage } from '@tanstack/compiler-test-utils/browser'
+import type {
+ DevServer,
+ DevServerOptions,
+} from '@tanstack/compiler-test-utils/dev-server'
+import type {
+ RsbuildDevServer,
+ RsbuildDevServerOptions,
+} from '@tanstack/compiler-test-utils/rsbuild-dev-server'
+
+const harnessDir = path.dirname(fileURLToPath(import.meta.url))
+
+/**
+ * Node's own `import()`, outside Vitest's module runner (as
+ * start-plugin-core's `start-compose-app.ts` uses it): a plugin loaded with
+ * it imports the built server bundle as Node does.
+ */
+const nativeImport = createRequire(import.meta.url)(
+ '../../../compiler-test-utils/src/native-import.cjs',
+) as (specifier: string) => Promise>
+
+/**
+ * Resolve the installed public export with Node, independent of dist
+ * layout; with `native`, loaded by Node itself (`nativeImport`).
+ */
+async function tanstackStartPlugin(
+ bundler: 'vite' | 'rsbuild',
+ native = false,
+): Promise<(options?: Record) => unknown> {
+ const app = await createApp({
+ dir: harnessDir,
+ prefix: '.rsc-plugin-import-',
+ files: {
+ 'plugin.mjs': `export { tanstackStart } from '@tanstack/react-start/plugin/${bundler}'`,
+ },
+ symlinks: workspacePackageLinks(['@tanstack/react-start']),
+ })
+ try {
+ const url = pathToFileURL(path.join(app.root, 'plugin.mjs')).href
+ return (
+ native ? await nativeImport(url) : await import(/* @vite-ignore */ url)
+ ).tanstackStart
+ } finally {
+ await app.dispose()
+ }
+}
+
+/**
+ * The files every app has unless it brings its own: Start's router entry
+ * (the real router over the generated route tree) and a root route that
+ * renders the document with Start's `HeadContent` and `Scripts`, so pages
+ * hydrate and load the client.
+ */
+export const rscAppFiles = {
+ 'src/router.tsx': `import { createRouter } from '@tanstack/react-router'
+import { routeTree } from './routeTree.gen'
+export function getRouter() {
+ return createRouter({ routeTree })
+}
+`,
+ 'src/routes/__root.tsx': `import { HeadContent, Outlet, Scripts, createRootRoute, useHydrated } from '@tanstack/react-router'
+export const Route = createRootRoute({ component: Root })
+function Root() {
+ const hydrated = useHydrated()
+ return (
+
+
+
+
+
+
+ {hydrated ? 'hydrated' : 'hydrating'}
+
+
+
+ )
+}
+`,
+}
+
+export interface RscDevServerOptions extends Omit<
+ DevServerOptions,
+ 'dir' | 'plugins'
+> {
+ /** Start's plugin options (`tanstackStart(options)`), `rsc` enabled. */
+ start?: Record
+}
+
+/**
+ * Starts a Vite dev server on a React Start app with RSC enabled, of
+ * `files` over `rscAppFiles`. Without `browser`, the server runs in
+ * middleware mode (Vite's watcher still reports `write()`s, which
+ * `settle()` waits for); the `rsc` environment is runnable
+ * (`server.import(url, 'rsc')` runs a module in the provider).
+ */
+export async function startRscDevServer(
+ options: RscDevServerOptions,
+): Promise {
+ const { files, start, config, ...devServerOptions } = options
+ const tanstackStart = await tanstackStartPlugin('vite')
+ return createDevServer({
+ dir: harnessDir,
+ prefix: '.rsc-dev-server-',
+ registerCleanup: onTestFinished,
+ ...devServerOptions,
+ files: { ...rscAppFiles, ...files },
+ // An app may also import this package directly (`@tanstack/react-start-rsc`).
+ symlinks: {
+ ...workspacePackageLinks([
+ '@tanstack/react-start',
+ '@tanstack/react-start-rsc',
+ ]),
+ ...devServerOptions.symlinks,
+ },
+ config: mergeConfig(
+ {
+ // Start serves the pages (SSR through its dev middleware), not
+ // Vite's SPA fallback.
+ appType: 'custom',
+ // Pre-bundled up front, as Vite does once a page discovers them
+ // (the dependencies of Start's client RPC and of the Flight decoder,
+ // which the browser imports on the first server function call and
+ // the first decode): a discovery mid-test re-optimises and reloads
+ // the page.
+ optimizeDeps: {
+ include: [
+ '@tanstack/react-router > @tanstack/router-core > seroval',
+ '@tanstack/react-router > @tanstack/router-core > seroval-plugins/web',
+ '@tanstack/react-start > @tanstack/start-server-core > cookie-es',
+ '@vitejs/plugin-rsc/vendor/react-server-dom/client.browser',
+ ],
+ },
+ },
+ config ?? {},
+ ),
+ plugins: [
+ tanstackStart({ ...start, rsc: { enabled: true } }) as never,
+ rsc(),
+ react(),
+ ],
+ })
+}
+
+export interface RscPreviewServer {
+ /** The app root. */
+ root: string
+ /** The URL Start's preview server listens on. */
+ url: string
+ /** What the build logged (warnings and errors). */
+ messages: Array
+}
+
+/**
+ * Builds a React Start app with RSC enabled, of `files` over `rscAppFiles`,
+ * for production as `vite build` does (the `client`, `ssr` and `rsc`
+ * environments, `buildApp()`), and serves the build with `vite preview`
+ * (Start's own preview server runs the built server entry). The test
+ * process runs with `NODE_ENV=production` until the cleanup, as `vite
+ * preview` does, so the server's React matches the client's.
+ */
+export async function startRscPreviewServer(options: {
+ files: Record
+ start?: Record
+ config?: Record
+ registerCleanup?: (cleanup: () => Promise) => void
+}): Promise {
+ const registerCleanup = options.registerCleanup ?? onTestFinished
+ const tanstackStart = await tanstackStartPlugin('vite')
+ const app = await createApp({
+ dir: harnessDir,
+ prefix: '.rsc-preview-server-',
+ registerCleanup,
+ files: { ...rscAppFiles, ...options.files },
+ symlinks: workspacePackageLinks([
+ '@tanstack/react-start',
+ '@tanstack/react-start-rsc',
+ ]),
+ })
+ const config = () =>
+ mergeConfig(
+ {
+ root: app.root,
+ configFile: false,
+ logLevel: 'warn',
+ plugins: [
+ tanstackStart({ ...options.start, rsc: { enabled: true } }),
+ rsc(),
+ react(),
+ ],
+ },
+ options.config ?? {},
+ )
+ const reported: Array = []
+ await withBuildEnvironment('production', reported, async () => {
+ const builder = await createBuilder(config())
+ await builder.buildApp()
+ })
+ const messages = reported.map(({ text }) => text)
+ const nodeEnv = process.env.NODE_ENV
+ process.env.NODE_ENV = 'production'
+ const server = await preview({
+ ...config(),
+ // Vite's default port: the server binds the next free port itself
+ // (`port: 0` makes Vite 8 probe a port and bind it after, which another
+ // process can take meanwhile).
+ preview: { host: '127.0.0.1' },
+ })
+ registerCleanup(async () => {
+ await server.close()
+ process.env.NODE_ENV = nodeEnv
+ })
+ const url = server.resolvedUrls?.local[0]
+ if (!url) {
+ throw new Error('the preview server does not listen')
+ }
+ return { root: app.root, url, messages }
+}
+
+/** What `startRscRsbuildPreviewServer` uses of Rsbuild's JavaScript API. */
+interface RsbuildApi {
+ createRsbuild: (options: {
+ cwd: string
+ rsbuildConfig: Record
+ }) => Promise<{
+ build: () => Promise<{ close: () => Promise }>
+ preview: (options?: { getPortSilently?: boolean }) => Promise<{
+ urls: Array
+ server: { close: () => Promise }
+ }>
+ }>
+}
+
+/**
+ * Rsbuild's JavaScript API: the copy the shared Rsbuild harness runs
+ * (a dependency of `@tanstack/compiler-test-utils`, which this package's
+ * tests do not declare themselves).
+ */
+async function rsbuildApi(): Promise {
+ const harness = createRequire(import.meta.url).resolve(
+ '@tanstack/compiler-test-utils/rsbuild-dev-server',
+ )
+ const rsbuild = createRequire(harness).resolve('@rsbuild/core')
+ return (await import(
+ /* @vite-ignore */ pathToFileURL(rsbuild).href
+ )) as RsbuildApi
+}
+
+/**
+ * Builds a React Start app with RSC enabled, of `files` over `rscAppFiles`,
+ * for production as `rsbuild build` does in the app's directory (the
+ * built `@tanstack/react-start/plugin/rsbuild` and `@rsbuild/plugin-react`,
+ * as for `startRscRsbuildDevServer`), and serves the build as `rsbuild
+ * preview` does (Start's own middleware runs the built server entry). The
+ * test process runs with `NODE_ENV=production` until the cleanup, as for
+ * `startRscPreviewServer`. `errors`: what the build reported as errors.
+ */
+export async function startRscRsbuildPreviewServer(options: {
+ files: Record
+ start?: Record
+ registerCleanup?: (cleanup: () => Promise) => void
+}): Promise }> {
+ const registerCleanup = options.registerCleanup ?? onTestFinished
+ // Loaded by Node: Start's preview middleware imports the built server
+ // bundle, which Node runs, not Vitest's module runner
+ const tanstackStart = await tanstackStartPlugin('rsbuild', true)
+ const { createRsbuild } = await rsbuildApi()
+ const app = await createApp({
+ dir: harnessDir,
+ prefix: '.rsc-rsbuild-preview-server-',
+ registerCleanup,
+ files: { ...rscAppFiles, ...options.files },
+ symlinks: workspacePackageLinks([
+ '@tanstack/react-start',
+ '@tanstack/react-start-rsc',
+ ]),
+ })
+ const reported: Array = []
+ const cwd = process.cwd()
+ const nodeEnv = process.env.NODE_ENV
+ // In the app's directory, as `rsbuild build` and `rsbuild preview` run
+ process.chdir(app.root)
+ try {
+ // The app's `rsbuild.config.ts`, for `rsbuild build` and then for
+ // `rsbuild preview` (each command configures the app anew)
+ const rsbuild = () =>
+ createRsbuild({
+ cwd: app.root,
+ rsbuildConfig: {
+ logLevel: 'silent',
+ plugins: [
+ pluginReact(),
+ tanstackStart({
+ ...options.start,
+ rsc: { enabled: true },
+ }) as never,
+ ],
+ // Start serves the pages, not an HTML template
+ tools: { htmlPlugin: false },
+ server: { host: '127.0.0.1' },
+ // Absolute: Start's preview middleware imports the server build
+ // from the output directory, which it resolves against the
+ // process's working directory when the first request comes
+ output: { distPath: { root: path.join(app.root, 'dist') } },
+ },
+ })
+ await withBuildEnvironment('production', reported, async () => {
+ const built = await (await rsbuild()).build()
+ await built.close()
+ })
+ process.env.NODE_ENV = 'production'
+ const { server, urls } = await (
+ await rsbuild()
+ ).preview({ getPortSilently: true })
+ registerCleanup(async () => {
+ await server.close()
+ process.env.NODE_ENV = nodeEnv
+ })
+ const url = urls[0]
+ if (!url) {
+ throw new Error('the preview server does not listen')
+ }
+ return {
+ root: app.root,
+ url,
+ messages: reported.map(({ text }) => text),
+ errors: reported
+ .filter(({ severity }) => severity === 'error')
+ .map(({ text }) => text),
+ }
+ } finally {
+ process.chdir(cwd)
+ }
+}
+
+export interface RscRsbuildDevServerOptions extends Omit<
+ RsbuildDevServerOptions,
+ 'dir' | 'plugins' | 'entry'
+> {
+ /** Start's plugin options (`tanstackStart(options)`), `rsc` enabled. */
+ start?: Record
+ /**
+ * Runs the server with the app root as the working directory, as
+ * `rsbuild dev` in the app does (default `true`). With `false`, the test
+ * process's directory stays (`rsbuild dev --root ` from elsewhere).
+ */
+ inAppDirectory?: boolean
+}
+
+/**
+ * Starts an Rsbuild dev server on a React Start app with RSC enabled, of
+ * `files` over `rscAppFiles`, with the built `@tanstack/react-start/plugin/
+ * rsbuild` (Start's client and SSR environments, its default entries, the
+ * RSC layer and `react-server-dom-rspack`) and `@rsbuild/plugin-react`, as
+ * an Rsbuild React app lists them (unless `config.plugins` has it, e.g.
+ * with other options). With `browser`, Start's own dev middleware serves
+ * the pages (SSR) and Rsbuild's HMR client runs in the page.
+ */
+export async function startRscRsbuildDevServer(
+ options: RscRsbuildDevServerOptions,
+): Promise {
+ const {
+ files,
+ start,
+ config,
+ inAppDirectory = true,
+ ...devServerOptions
+ } = options
+ const tanstackStart = await tanstackStartPlugin('rsbuild')
+ const cwd = process.cwd()
+ try {
+ return await createRsbuildDevServer({
+ dir: harnessDir,
+ prefix: '.rsc-rsbuild-dev-server-',
+ registerCleanup: onTestFinished,
+ ...devServerOptions,
+ // Start's plugin defines the entries of its environments (the harness
+ // default is overridden by its client entry of the same name).
+ entry: 'src/router.tsx',
+ files: { ...rscAppFiles, ...files },
+ symlinks: {
+ ...workspacePackageLinks([
+ '@tanstack/react-start',
+ '@tanstack/react-start-rsc',
+ ]),
+ ...devServerOptions.symlinks,
+ },
+ config: {
+ ...config,
+ tools: {
+ // Start serves the pages, not an HTML template
+ htmlPlugin: false,
+ ...config?.tools,
+ },
+ },
+ plugins: [
+ ...(pluginNames(config?.plugins).includes('rsbuild:react')
+ ? []
+ : [pluginReact()]),
+ {
+ name: 'rsc-app:working-directory',
+ setup(api) {
+ if (inAppDirectory) {
+ process.chdir(api.context.rootPath)
+ }
+ },
+ },
+ tanstackStart({ ...start, rsc: { enabled: true } }) as never,
+ ],
+ })
+ } finally {
+ process.chdir(cwd)
+ }
+}
+
+/** The HTTP requests of a page in flight, and when that last changed. */
+interface Network {
+ pending: Set
+ changed: number
+}
+
+const networks = new WeakMap()
+
+/**
+ * Opens `pathname` of a dev server with `browser` in a real page, closed
+ * when the current test finishes unless `registerCleanup` says otherwise.
+ * The page's requests from then on are tracked for `settledValue`.
+ */
+export async function openRscPage(
+ server: Pick,
+ pathname: string,
+ options: { registerCleanup?: (cleanup: () => Promise) => void } = {},
+): Promise {
+ if (!server.url) {
+ throw new Error('the dev server does not listen: start it with `browser`')
+ }
+ const page = await openPage(new URL(pathname, server.url).href, {
+ registerCleanup: options.registerCleanup ?? onTestFinished,
+ })
+ const network: Network = { pending: new Set(), changed: Date.now() }
+ page.page.on('request', (request) => {
+ network.pending.add(request)
+ network.changed = Date.now()
+ })
+ const done = (request: unknown) => {
+ if (network.pending.delete(request)) {
+ network.changed = Date.now()
+ }
+ }
+ page.page.on('requestfinished', done)
+ page.page.on('requestfailed', done)
+ networks.set(page, network)
+ return page
+}
+
+/**
+ * Reads `read()` until `accept` takes its value, or until the page's
+ * network has settled (no request in flight for `quiet` ms, default 500)
+ * and one more read still does not: then whatever the page will show
+ * without another request, e.g. a stylesheet that never arrives. Gives up
+ * after `timeout` ms (default 15 000). Gives the last value read; the test
+ * asserts on it. For pages of `openRscPage`.
+ */
+export async function settledValue(
+ page: BrowserPage,
+ read: () => Promise,
+ accept: (value: T) => boolean,
+ { quiet = 500, timeout = 15_000 } = {},
+): Promise {
+ const network = networks.get(page)
+ if (!network) {
+ throw new Error('settledValue needs a page of openRscPage')
+ }
+ const deadline = Date.now() + timeout
+ for (;;) {
+ const settled =
+ network.pending.size === 0 && Date.now() - network.changed >= quiet
+ let value: T | undefined
+ let readable = true
+ try {
+ value = await read()
+ } catch (error) {
+ // The page is (re)loading
+ readable = false
+ if (Date.now() > deadline) {
+ throw error
+ }
+ }
+ if (readable && (accept(value as T) || settled || Date.now() > deadline)) {
+ return value as T
+ }
+ await new Promise((resolve) => setTimeout(resolve, 50))
+ }
+}
+
+/**
+ * Waits until the app hydrated in the page (the root route of `rscAppFiles`
+ * shows it through the router's `useHydrated()`): only then does the page
+ * run the client, e.g. its HMR listeners.
+ */
+export function waitForHydration(page: BrowserPage): Promise {
+ return page.waitForText('hydrated', { selector: '[data-testid=hydrated]' })
+}
+
+/**
+ * Waits until Start's development-only stylesheet of the server-rendered
+ * page (`/@tanstack-start/styles.css`, which prevents a flash of unstyled
+ * content before hydration and which the client removes once it hydrated)
+ * is gone, so that the computed styles come from what the client loaded.
+ */
+export async function devStylesGone(page: BrowserPage): Promise {
+ await page.page.waitForFunction(
+ () =>
+ document.querySelector('link[href*="/@tanstack-start/styles.css"]') ===
+ null,
+ undefined,
+ { timeout: 15_000 },
+ )
+}
+
+/**
+ * The computed value of a CSS `property` of the first element matching
+ * `selector` in the page, as the browser resolves it (colours as
+ * `rgb(r, g, b)`).
+ */
+export function computedStyle(
+ page: BrowserPage,
+ selector: string,
+ property: string,
+): Promise {
+ return page.page
+ .locator(selector)
+ .first()
+ .evaluate(
+ (element, name) => getComputedStyle(element).getPropertyValue(name),
+ property,
+ )
+}
+
+/**
+ * Waits until the computed `property` of `selector` is `expected`, for at
+ * most `timeout` ms (default 15 000): a hot update applies asynchronously.
+ * Throws with the current value, the page's errors and console otherwise.
+ */
+export async function waitForStyle(
+ page: BrowserPage,
+ selector: string,
+ property: string,
+ expected: string,
+ timeout = 15_000,
+): Promise {
+ const deadline = Date.now() + timeout
+ let current = ''
+ for (;;) {
+ try {
+ current = await computedStyle(page, selector, property)
+ } catch {
+ // The page is reloading
+ current = ''
+ }
+ if (current === expected) {
+ return
+ }
+ if (Date.now() > deadline) {
+ throw new Error(
+ [
+ `${selector}'s ${property} did not become ${expected} within ${timeout} ms`,
+ `it is: ${JSON.stringify(current)}`,
+ `page loads: ${page.loads()}`,
+ `errors:\n${page.errors.join('\n') || '(none)'}`,
+ `console:\n${page.console.join('\n') || '(none)'}`,
+ ].join('\n'),
+ )
+ }
+ await new Promise((resolve) => setTimeout(resolve, 50))
+ }
+}
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-app.ts b/packages/react-start-rsc/tests/integration/rsc-css-app.ts
new file mode 100644
index 0000000000..7fa2f43a9e
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-app.ts
@@ -0,0 +1,347 @@
+/**
+ * The RSC CSS suites (SPEC J7) on a Vite dev server (`rsc-app.ts`): a React
+ * Start app whose page shows one section per row. Each row is a module
+ * (`src/rows/.tsx`) with a server function that renders a server
+ * component with an RSC helper; the page's loader calls the server
+ * functions of the rows the page renders, and the page decodes the Flight
+ * stream of the `renderToReadableStream` rows in the browser. A test reads
+ * its row's section: the server component's content and the computed styles
+ * of its CSS.
+ *
+ * Rows do not affect each other: each has its own CSS module (scoped class
+ * names of its own, so a stylesheet one row receives does not style
+ * another's component), its own error boundary, and its loader result is
+ * settled on its own (a server function that throws shows in its section
+ * only).
+ *
+ * Mechanism is free (SPEC §5): how the CSS travels (`loadCss`, envelopes,
+ * link precedence) is never asserted, only that the component is styled.
+ */
+import { afterAll, beforeAll } from 'vitest'
+import {
+ computedStyle,
+ devStylesGone,
+ openRscPage,
+ settledValue,
+ startRscDevServer,
+ waitForHydration,
+} from './rsc-app'
+import type { BrowserPage } from '@tanstack/compiler-test-utils/browser'
+import type { DevServer } from '@tanstack/compiler-test-utils/dev-server'
+
+/** A row's `Card` background (its CSS module). */
+export const CARD_BACKGROUND = 'rgb(254, 243, 199)'
+/** A row's `Badge` background (its CSS module). */
+export const BADGE_BACKGROUND = 'rgb(224, 242, 254)'
+/** `src/global.css` colour (`.plain`). */
+export const GLOBAL_COLOR = 'rgb(1, 2, 3)'
+
+/**
+ * How the page consumes what the row's server function returns:
+ * `renderable` renders it (`renderServerComponent`); `composite` renders it
+ * through `CompositeComponent` with a `children` slot; `flight` decodes the
+ * Flight stream the server function answers with
+ * (`renderToReadableStream`) in the browser, and renders the decoded tree
+ * (or its validated `card` and scalar sibling, for a plain-data model); `value` prints it as JSON.
+ */
+export type Consumer = 'renderable' | 'composite' | 'flight' | 'model' | 'value'
+
+export interface Row {
+ /** Module name (`src/rows/.tsx`) and section of the row. */
+ key: string
+ /** Import declarations of the row's module. */
+ imports: string
+ /** Body of the server function's handler (returns the value). */
+ body: string
+ consumer: Consumer
+ /** Exercise a JavaScript provider module instead of TypeScript. */
+ jsx?: boolean
+ /** Runtime input sent through the real server-function protocol. */
+ input?: boolean
+}
+
+/**
+ * The local server components a row's module uses (`Card`, `Badge`), with
+ * the row's own CSS module. Only those: a component nothing uses would stay
+ * in the client's module with its stylesheet. Local, not exported: Vite's
+ * RSC plugin delivers the CSS of an exported component by itself, so only a
+ * local component shows what Start's transform does.
+ */
+function localComponents(row: Row): string {
+ const card = row.body.includes('Card')
+ const badge = row.body.includes('Badge')
+ if (!card && !badge) {
+ return ''
+ }
+ return `import styles from './${row.key}.module.css'
+${
+ card
+ ? `function Card({ children }${row.jsx ? '' : ': { children?: React.ReactNode }'}) {
+ return MARK_CARD{children}
+}
+`
+ : ''
+}${
+ badge
+ ? `function Badge() {
+ return MARK_BADGE
+}
+`
+ : ''
+ }`
+}
+
+/** The module of a row: `render`, its server function. */
+function rowModule(row: Row): string {
+ return `import { createServerFn } from '@tanstack/react-start'
+${row.imports}${localComponents(row)}
+const flight = (stream${row.jsx ? '' : ': ReadableStream'}, evaluations = 0) =>
+ new Response(stream, { headers: { 'Content-Type': 'text/x-component', 'X-Evaluations': String(evaluations) } })
+export const render = createServerFn().validator((data${row.jsx ? '' : ': unknown'}) => data).handler(async ({ data }) => {
+${row.body}
+})
+`
+}
+
+/** The section of a row in the page. */
+function section(row: Row, index: number): string {
+ const result = `data.r${index}`
+ const content = {
+ renderable: `{(value) => value} `,
+ composite: `{(value) => (
+
+ MARK_SLOT
+
+ )} `,
+ flight: ` `,
+ model: ` `,
+ value: `{(value) => {JSON.stringify(value)} } `,
+ }[row.consumer]
+ return ` `
+}
+
+/**
+ * The page (`/`): the loader calls the server function of every row but
+ * the `flight` ones (which the page calls from the browser), each result
+ * settled on its own.
+ */
+function pageRoute(rows: Array): string {
+ const loaded = rows
+ .map((row, index) => ({ row, index }))
+ .filter(({ row }) => row.consumer !== 'flight' && row.consumer !== 'model')
+ return `import { createFileRoute } from '@tanstack/react-router'
+import { CompositeComponent, createFromFetch } from '@tanstack/react-start/rsc'
+import { Component, Suspense, useEffect, useState } from 'react'
+${rows.map((row, index) => `import { render as render${index} } from '../rows/${row.key}'`).join('\n')}
+${rows.map((row, index) => `const call${index} = () => render${index}(${row.input === undefined ? '' : `{ data: ${row.input} }`})`).join('\n')}
+
+type Result = { value: any } | { error: string }
+const settle = (promise: Promise): Promise =>
+ promise.then(
+ (value) => ({ value }),
+ (error) => ({ error: String(error) }),
+ )
+
+export const Route = createFileRoute('/')({
+ loader: async () => {
+ const [${loaded.map(({ index }) => `r${index}`).join(', ')}] = await Promise.all([
+${loaded.map(({ index }) => ` settle(call${index}()),`).join('\n')}
+ ])
+ return { ${loaded.map(({ index }) => `r${index}`).join(', ')} }
+ },
+ component: Page,
+})
+
+function Failed({ error }: { error: string }) {
+ return ERROR {error}
+}
+
+class Boundary extends Component<{ children: React.ReactNode }, { error?: string }> {
+ state: { error?: string } = {}
+ static getDerivedStateFromError(error: unknown) {
+ return { error: String(error) }
+ }
+ render() {
+ return this.state.error ? : this.props.children
+ }
+}
+
+function Settled({ result, children }: { result: Result; children: (value: any) => React.ReactNode }) {
+ return 'error' in result ? : <>{children(result.value)}>
+}
+
+// One call per row, however often React mounts its section.
+const decoded = new Map>()
+function Flight({ render, model = false }: { render: () => Promise; model?: boolean }) {
+ const [decodedTree, setDecodedTree] = useState<{ value: unknown } | null>(null)
+ const [error, setError] = useState('')
+ const [evaluations, setEvaluations] = useState('')
+ useEffect(() => {
+ let tree = decoded.get(render)
+ if (!tree) {
+ tree = createFromFetch(render().then((response) => {
+ setEvaluations(response.headers.get('X-Evaluations') ?? '')
+ return response
+ }))
+ decoded.set(render, tree)
+ }
+ tree.then((value) => setDecodedTree({ value }), (reason) => setError(String(reason)))
+ }, [])
+ if (error) {
+ return
+ }
+ const tree = decodedTree?.value
+ if (model) {
+ if (!tree || typeof tree !== 'object' || !('card' in tree) || !('label' in tree) || tree.label !== 'MARK_MODEL') {
+ return decodedTree === null ? null :
+ }
+ return <>{tree.label as string} {tree.card as React.ReactNode}>
+ }
+ return <> {tree as React.ReactNode}>
+}
+
+function Page() {
+ const data = Route.useLoaderData()
+ return (
+
+${rows.map(section).join('\n')}
+
+ )
+}
+`
+}
+
+/** Import of `renderToReadableStream` (named, `@tanstack/react-start/rsc`). */
+export const streamImport = `import { renderToReadableStream } from '@tanstack/react-start/rsc'\n`
+/** Import of `renderServerComponent` (named, `@tanstack/react-start/rsc`). */
+export const renderableImport = `import { renderServerComponent } from '@tanstack/react-start/rsc'\n`
+
+export interface RscCssApp {
+ /** The shared dev server. */
+ server: () => DevServer
+ /** The page, once every section shows something and the page hydrated. */
+ page: () => BrowserPage
+ /** The text of a row's section. */
+ text: (row: Row) => Promise
+ /**
+ * The computed `property` of `selector` in a row's section once it is
+ * `expected`, or once the page's network has settled without it (a
+ * stylesheet loads asynchronously; a page whose requests are all done has
+ * every stylesheet it will get). `missing` if the section has no such
+ * element.
+ */
+ style: (
+ row: Row,
+ selector: string,
+ property: string,
+ expected: string,
+ ) => Promise
+ /**
+ * The URLs of the client environment's module of a row and of what it
+ * imports, outside `node_modules` and Vite's own modules.
+ */
+ clientModules: (row: Row) => Promise>
+}
+
+/**
+ * In `beforeAll`: starts the dev server of an app with the page of `rows`
+ * (and `files`) and opens the page; stops both in `afterAll`.
+ */
+export function rscCssApp(options: {
+ rows: Array
+ files?: Record
+ config?: Record
+}): RscCssApp {
+ let server: DevServer | undefined
+ let page: BrowserPage | undefined
+ const cleanups: Array<() => Promise> = []
+ const registerCleanup = (cleanup: () => Promise) => {
+ cleanups.push(cleanup)
+ }
+
+ beforeAll(async () => {
+ server = await startRscDevServer({
+ browser: true,
+ registerCleanup,
+ files: {
+ 'src/global.css': `.plain { color: rgb(1, 2, 3); }\n`,
+ ...options.files,
+ ...Object.fromEntries(
+ options.rows.flatMap((row) => [
+ [`src/rows/${row.key}.${row.jsx ? 'jsx' : 'tsx'}`, rowModule(row)],
+ [
+ `src/rows/${row.key}.module.css`,
+ // The row in the content: Vite's scoped class names hash the
+ // stylesheet's content, not its path.
+ `/* ${row.key} */\n.card { background: #fef3c7; }\n.badge { background: #e0f2fe; }\n`,
+ ],
+ ]),
+ ),
+ 'src/routes/index.tsx': pageRoute(options.rows),
+ },
+ config: options.config,
+ })
+ page = await openRscPage(server, '/', { registerCleanup })
+ await page.page.waitForFunction(
+ () =>
+ [...document.querySelectorAll('section[data-row]')].every(
+ (element) =>
+ element.textContent !== '' ||
+ element.querySelector('[data-flight-ready="true"]') !== null,
+ ),
+ undefined,
+ { timeout: 30_000 },
+ )
+ await waitForHydration(page)
+ await devStylesGone(page)
+ })
+ afterAll(async () => {
+ for (const cleanup of cleanups.reverse()) {
+ await cleanup()
+ }
+ })
+
+ const started = (value: T | undefined): T => {
+ if (!value) {
+ throw new Error('the app did not start')
+ }
+ return value
+ }
+ const inRow = (row: Row, selector = '') =>
+ `section[data-row="${row.key}"] ${selector}`.trim()
+
+ return {
+ server: () => started(server),
+ page: () => started(page),
+ text: async (row) =>
+ (await started(page).page.locator(inRow(row)).textContent()) ?? '',
+ style: async (row, selector, property, expected) => {
+ const current = started(page)
+ return settledValue(
+ current,
+ async () =>
+ (await current.page.locator(inRow(row, selector)).count()) === 0
+ ? 'missing'
+ : computedStyle(current, inRow(row, selector), property),
+ (value) => value === expected,
+ )
+ },
+ clientModules: async (row) =>
+ Object.keys(
+ await started(server).load(
+ `/src/rows/${row.key}.${row.jsx ? 'jsx' : 'tsx'}`,
+ {
+ environment: 'client',
+ skip: /\/node_modules\/|^\/@(vite|react-refresh)\b/,
+ },
+ ),
+ ),
+ }
+}
+
+/** The client module URLs that are stylesheets or `src/plain`. */
+export function stylesheetsOf(urls: Array): Array {
+ return urls.filter((url) => /\.css\b|\/src\/plain/.test(url))
+}
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-diagnostics.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-diagnostics.test.ts
new file mode 100644
index 0000000000..030741d525
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-diagnostics.test.ts
@@ -0,0 +1,50 @@
+import { expect, test } from 'vitest'
+import { expectDiagnostic } from '@tanstack/compiler-test-utils/diagnostics'
+import { startRscDevServer, startRscRsbuildDevServer } from './rsc-app'
+
+const files = {
+ 'src/stream.tsx': `import { createServerFn } from '@tanstack/react-start'
+import { renderToReadableStream } from '@tanstack/react-start/rsc'
+import styles from './stream.module.css'
+function Card() { return MARK_STREAM
}
+export const render = createServerFn().handler(async () => {
+ const node =
+ const args = [node] as const
+ const first = renderToReadableStream(node)
+ const second = renderToReadableStream(...args)
+ await Promise.all([new Response(first).text(), new Response(second).text()])
+ return 'MARK_STREAMS_RENDERED'
+})
+`,
+ 'src/stream.module.css': '.card { color: red }',
+ 'src/routes/index.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { render } from '../stream'
+export const Route = createFileRoute('/')({
+ loader: () => render(),
+ component: () => {Route.useLoaderData()}
,
+})
+`,
+}
+
+// J7.3, G5: the real RSC integration currently skips identifier and
+// spread arguments silently. Two calls in one file require one warning naming the file.
+// G5 requires positions on errors, not on this warning; wording/channel are free.
+for (const bundler of ['vite', 'rsbuild'] as const) {
+ test(`${bundler} dev warns about the CSS limitation once per source file, naming it`, async () => {
+ const server = await (
+ bundler === 'vite' ? startRscDevServer : startRscRsbuildDevServer
+ )({
+ files,
+ browser: true,
+ })
+ const response = await fetch(server.url!)
+ expect(response.ok).toBe(true)
+ expect(await response.text()).toContain('MARK_STREAMS_RENDERED')
+ expectDiagnostic(server.diagnostics, {
+ severity: 'warning',
+ file: 'src/stream.tsx',
+ root: server.root,
+ times: 1,
+ })
+ })
+}
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-hmr-rsbuild.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-hmr-rsbuild.test.ts
new file mode 100644
index 0000000000..bf7204e462
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-hmr-rsbuild.test.ts
@@ -0,0 +1,33 @@
+import { expect, test } from 'vitest'
+import { startRscRsbuildDevServer, waitForStyle } from './rsc-app'
+import { CARD_BACKGROUND, appFiles, rows, show } from './rsc-css-rsbuild-app'
+
+// SPEC J7.5 on Rsbuild: editing a server component's CSS updates the open
+// page's effective styles without a full reload.
+test("Rsbuild: editing a server component's CSS updates the page without a full reload", async () => {
+ const styles = (background: string) =>
+ `.card { background: ${background}; }\n`
+ const server = await startRscRsbuildDevServer({
+ browser: true,
+ files: { ...appFiles, 'src/card.module.css': styles('#fef3c7') },
+ })
+ const page = await show(server, rows[1]!.path)
+ await waitForStyle(
+ page,
+ '[data-testid=card]',
+ 'background-color',
+ CARD_BACKGROUND,
+ 5_000,
+ )
+
+ await server.edit({ 'src/card.module.css': styles('#e0f2fe') })
+ expect(server.errors).toEqual([])
+ await waitForStyle(
+ page,
+ '[data-testid=card]',
+ 'background-color',
+ 'rgb(224, 242, 254)',
+ )
+ expect(page.loads()).toBe(1)
+ expect(page.errors).toEqual([])
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-hmr.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-hmr.test.ts
new file mode 100644
index 0000000000..93ad5c4f5d
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-hmr.test.ts
@@ -0,0 +1,73 @@
+/**
+ * RSC CSS hot updates (SPEC J7.5) on Vite dev (`rsc-app.ts`): editing the
+ * CSS of a server component updates the open page's effective styles, the
+ * last edit wins, and removing a rule or the import removes its effect, all
+ * without a full reload. The Rsbuild counterpart is in
+ * rsc-css-rsbuild.test.ts.
+ */
+import { expect, test } from 'vitest'
+import {
+ openRscPage,
+ startRscDevServer,
+ waitForHydration,
+ waitForStyle,
+} from './rsc-app'
+
+const card = (
+ css: boolean,
+) => `${css ? `import styles from './card.module.css'\n` : ''}
+export function Card() {
+ return MARK_CARD
+}
+`
+const route = `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+import { renderServerComponent } from '@tanstack/react-start/rsc'
+import { Card } from '../card'
+const render = createServerFn().handler(() => renderServerComponent( ))
+export const Route = createFileRoute('/')({
+ loader: () => render(),
+ component: () => {Route.useLoaderData()} ,
+})
+`
+const styles = (background: string) => `.card { background: ${background}; }\n`
+
+test("editing a server component's CSS updates the page without a full reload", async () => {
+ const server = await startRscDevServer({
+ browser: true,
+ files: {
+ 'src/card.module.css': styles('#fef3c7'),
+ 'src/card.tsx': card(true),
+ 'src/routes/index.tsx': route,
+ },
+ })
+ const page = await openRscPage(server, '/')
+ await page.waitForText('MARK_CARD')
+ const background = (expected: string) =>
+ waitForStyle(page, '[data-testid=card]', 'background-color', expected)
+ await background('rgb(254, 243, 199)')
+
+ await waitForHydration(page)
+
+ // A new value
+ await server.write({ 'src/card.module.css': styles('#e0f2fe') })
+ await background('rgb(224, 242, 254)')
+
+ // Twice in a row: the last edit wins, nothing stale stays effective
+ await server.write({ 'src/card.module.css': styles('#fef3c7') })
+ await server.write({ 'src/card.module.css': styles('rgb(1, 2, 3)') })
+ await background('rgb(1, 2, 3)')
+
+ // The rule removed
+ await server.write({ 'src/card.module.css': `.other { color: red; }\n` })
+ await background('rgba(0, 0, 0, 0)')
+
+ // The rule back, then the import removed
+ await server.write({ 'src/card.module.css': styles('#fef3c7') })
+ await background('rgb(254, 243, 199)')
+ await server.write({ 'src/card.tsx': card(false) })
+ await background('rgba(0, 0, 0, 0)')
+
+ expect(page.loads()).toBe(1)
+ expect(page.errors).toEqual([])
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-matrix.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-matrix.test.ts
new file mode 100644
index 0000000000..2affddbd63
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-matrix.test.ts
@@ -0,0 +1,108 @@
+/**
+ * RSC CSS delivery (SPEC J7.2, J7.3) through the real transport on Vite
+ * dev (`rsc-css-app.ts`): every RSC helper through every import form
+ * (named, renamed, namespace) of both module names styles the server
+ * component it renders.
+ */
+import { describe, expect, test } from 'vitest'
+import { CARD_BACKGROUND, rscCssApp, stylesheetsOf } from './rsc-css-app'
+import type { Row } from './rsc-css-app'
+
+const apis = [
+ {
+ api: 'renderServerComponent',
+ consumer: 'renderable' as const,
+ call: (callee: string, node: string) => `return ${callee}(${node})`,
+ },
+ {
+ api: 'createCompositeComponent',
+ consumer: 'composite' as const,
+ call: (callee: string, node: string) =>
+ `return ${callee}((props) => <>{${node}}{props.children}>)`,
+ },
+ {
+ api: 'renderToReadableStream',
+ consumer: 'flight' as const,
+ call: (callee: string, node: string) => `return flight(${callee}(${node}))`,
+ },
+]
+
+const importForms = [
+ {
+ form: 'a named import',
+ key: 'named',
+ declaration: (api: string, from: string) =>
+ `import { ${api} } from '${from}'\n`,
+ callee: (api: string) => api,
+ },
+ {
+ form: 'a renamed import',
+ key: 'renamed',
+ declaration: (api: string, from: string) =>
+ `import { ${api} as rsc } from '${from}'\n`,
+ callee: () => 'rsc',
+ },
+ {
+ form: 'a namespace import',
+ key: 'namespace',
+ declaration: (_api: string, from: string) =>
+ `import * as RSC from '${from}'\n`,
+ callee: (api: string) => `RSC.${api}`,
+ },
+]
+
+const modules = [
+ { from: '@tanstack/react-start/rsc', key: 'start' },
+ { from: '@tanstack/react-start-rsc', key: 'rsc' },
+]
+
+/** Every API through every import form of both module names. */
+const matrix = importForms.flatMap((form) =>
+ modules.flatMap(({ from, key }) =>
+ apis.map((api) => ({
+ ...form,
+ ...api,
+ from,
+ row: {
+ key: `${form.key}-${key}-${api.consumer}`,
+ imports: form.declaration(api.api, from),
+ body: api.call(form.callee(api.api), ' '),
+ consumer: api.consumer,
+ } satisfies Row,
+ })),
+ ),
+)
+
+describe('RSC helpers by import form (Vite dev)', () => {
+ const app = rscCssApp({ rows: matrix.map(({ row }) => row) })
+
+ test.each(matrix)(
+ '$api through $form of $from styles the server component',
+ async ({ row, consumer }) => {
+ expect(
+ await app.style(
+ row,
+ '[data-testid=card]',
+ 'background-color',
+ CARD_BACKGROUND,
+ ),
+ ).toBe(CARD_BACKGROUND)
+ // The server component renders unchanged; a composite's slot renders
+ // after it (J7.4: injection changes nothing else).
+ expect(await app.text(row)).toBe(
+ consumer === 'composite' ? 'MARK_CARDMARK_SLOT' : 'MARK_CARD',
+ )
+ },
+ )
+
+ // J4.12, and the control of the rows above: the client never loads a
+ // stylesheet of a row's module itself (the handler, and so the render
+ // call and the local component, are absent), so a styled section shows
+ // the CSS the RSC payload delivered.
+ test.each(matrix)(
+ "the client's module of $api through $form of $from loads no stylesheet",
+ async ({ row }) => {
+ expect(stylesheetsOf(await app.clientModules(row))).toEqual([])
+ },
+ )
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-app.ts b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-app.ts
new file mode 100644
index 0000000000..27c3faa8f4
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-app.ts
@@ -0,0 +1,257 @@
+import { afterAll, beforeAll, describe, expect, test } from 'vitest'
+import {
+ computedStyle,
+ openRscPage,
+ startRscRsbuildDevServer,
+ startRscRsbuildPreviewServer,
+ waitForHydration,
+ waitForStyle,
+} from './rsc-app'
+import type { RsbuildDevServer } from '@tanstack/compiler-test-utils/rsbuild-dev-server'
+import type { BrowserPage } from '@tanstack/compiler-test-utils/browser'
+
+/** `card.module.css` background. */
+export const CARD_BACKGROUND = 'rgb(254, 243, 199)'
+/** `helperCard.module.css` background. */
+export const HELPER_CARD_BACKGROUND = 'rgb(224, 242, 254)'
+
+/**
+ * A route whose server function renders a local server component with a
+ * CSS module through `api`; `consumer` is how the page renders the result.
+ */
+const route = (
+ path: string,
+ imports: string,
+ body: string,
+ page: string,
+) => `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+${imports}
+import styles from '../card.module.css'
+function Card({ children }: { children?: React.ReactNode }) {
+ return MARK_CARD{children}
+}
+const flight = (stream: ReadableStream) =>
+ new Response(stream, { headers: { 'Content-Type': 'text/x-component' } })
+export const render = createServerFn().handler(async () => {
+${body}
+})
+export const Route = createFileRoute('${path}')({
+${path === '/flight' ? '' : ' loader: () => render(),\n'} component: Page,
+})
+${page}
+`
+
+export const rows = [
+ {
+ api: 'renderToReadableStream',
+ path: '/flight',
+ file: route(
+ '/flight',
+ `import { createFromFetch, renderToReadableStream } from '@tanstack/react-start/rsc'
+import { useEffect, useState } from 'react'`,
+ ` return flight(renderToReadableStream( ))`,
+ `function Page() {
+ const [tree, setTree] = useState(null)
+ useEffect(() => {
+ createFromFetch(render()).then(setTree)
+ }, [])
+ return {tree as React.ReactNode}
+}`,
+ ),
+ },
+ {
+ api: 'renderServerComponent',
+ path: '/renderable',
+ file: route(
+ '/renderable',
+ `import { renderServerComponent } from '@tanstack/react-start/rsc'`,
+ ` return renderServerComponent( )`,
+ `function Page() {
+ return {Route.useLoaderData()}
+}`,
+ ),
+ },
+ {
+ api: 'createCompositeComponent',
+ path: '/composite',
+ file: route(
+ '/composite',
+ `import { CompositeComponent, createCompositeComponent } from '@tanstack/react-start/rsc'`,
+ ` return createCompositeComponent((props) => {props.children} )`,
+ `function Page() {
+ return (
+
+
+ MARK_SLOT
+
+
+ )
+}`,
+ ),
+ },
+]
+
+/**
+ * A route whose server function calls a helper module that renders a local
+ * server component with its own CSS module through `renderServerComponent`.
+ */
+export const helperRow = {
+ path: '/helper',
+ marker: 'MARK_HELPER',
+ files: {
+ 'src/helperCard.module.css': `.card { background: #e0f2fe; }\n`,
+ 'src/renderHelperCard.tsx': `import { renderServerComponent } from '@tanstack/react-start/rsc'
+import styles from './helperCard.module.css'
+function HelperCard() {
+ return MARK_HELPER
+}
+export function renderHelperCard() {
+ return renderServerComponent( )
+}
+`,
+ 'src/routes/helper.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+import { renderHelperCard } from '../renderHelperCard'
+export const render = createServerFn().handler(async () => {
+ return renderHelperCard()
+})
+export const Route = createFileRoute('/helper')({
+ loader: () => render(),
+ component: Page,
+})
+function Page() {
+ return {Route.useLoaderData()}
+}
+`,
+ },
+}
+
+export const appFiles = {
+ 'src/routes/control.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { render as flight } from './flight'
+import { render as renderable } from './renderable'
+import { render as composite } from './composite'
+export const Route = createFileRoute('/control')({ component: Control })
+function Control() {
+ return {[flight, renderable, composite].map((render, index) => caller )}
+}
+`,
+ 'src/card.module.css': `.card { background: #fef3c7; }\n`,
+ ...Object.fromEntries(
+ rows.map((row) => [`src/routes${row.path}.tsx`, row.file]),
+ ),
+ ...helperRow.files,
+}
+
+/** Opens `path` and waits for the server component (`marker`) and hydration. */
+export async function show(
+ server: Pick,
+ path: string,
+ marker = 'MARK_CARD',
+): Promise {
+ const page = await openRscPage(server, path)
+ await page.waitForText(marker)
+ await waitForHydration(page)
+ return page
+}
+
+/**
+ * The rows of rsc-css-rsbuild.test.ts (`dev`: an Rsbuild dev server) and
+ * rsc-css-rsbuild-build.test.ts (`build`: a production build served by
+ * `rsbuild preview`), one file per mode so the two run in parallel.
+ */
+export function describeRscCssRows(mode: 'dev' | 'build') {
+ describe(`RSC CSS through the real transport (Rsbuild ${mode})`, () => {
+ let server: Pick
+ const cleanups: Array<() => Promise> = []
+
+ beforeAll(async () => {
+ const registerCleanup = (cleanup: () => Promise) => {
+ cleanups.push(cleanup)
+ }
+ server =
+ mode === 'dev'
+ ? await startRscRsbuildDevServer({
+ browser: true,
+ registerCleanup,
+ files: appFiles,
+ })
+ : await startRscRsbuildPreviewServer({
+ registerCleanup,
+ files: appFiles,
+ })
+ })
+ afterAll(async () => {
+ for (const cleanup of cleanups.reverse()) {
+ await cleanup()
+ }
+ })
+
+ test('loading only the client callers does not supply the server stylesheet', async () => {
+ const page = await openRscPage(server, '/control')
+ await page.waitForText('caller', { selector: '[data-testid=control]' })
+ await waitForHydration(page)
+ const css = await page.page.evaluate(() =>
+ [...document.styleSheets]
+ .flatMap((sheet) => {
+ try {
+ return [...sheet.cssRules].map((rule) => rule.cssText)
+ } catch {
+ return []
+ }
+ })
+ .join('\n'),
+ )
+ expect(css).not.toMatch(/254, 243, 199|#fef3c7/i)
+ expect(page.errors).toEqual([])
+ })
+
+ test.each(rows)(
+ '$api in a server function module styles the server component',
+ async ({ path }) => {
+ expect(server.errors).toEqual([])
+ const page = await show(server, path)
+ await waitForStyle(
+ page,
+ '[data-testid=card]',
+ 'background-color',
+ CARD_BACKGROUND,
+ 5_000,
+ )
+ expect(
+ await computedStyle(page, '[data-testid=card]', 'background-color'),
+ ).toBe(CARD_BACKGROUND)
+ expect(page.errors).toEqual([])
+ },
+ )
+
+ // Bug: on Rsbuild, the RSC CSS transform only rewrites server function
+ // provider modules (`serverFnProviderOnly: true`, react-start
+ // src/plugin/rsbuild.ts; react-start-rsc src/plugin/rscCssTransform.ts), so
+ // a render call in a helper module that a server function calls gets no CSS.
+ // Impact: the server component renders unstyled; Vite styles it
+ // (rsc-css.test.ts, "two render helpers in one module each carry their
+ // component CSS").
+ // Source: SPEC J7.1, J7.2 (CSS is delivered wherever the render executes).
+ test('a render call in a helper module styles the server component', async () => {
+ expect(server.errors).toEqual([])
+ const page = await show(server, helperRow.path, helperRow.marker)
+ await waitForStyle(
+ page,
+ '[data-testid=helper-card]',
+ 'background-color',
+ HELPER_CARD_BACKGROUND,
+ 5_000,
+ )
+ expect(
+ await computedStyle(
+ page,
+ '[data-testid=helper-card]',
+ 'background-color',
+ ),
+ ).toBe(HELPER_CARD_BACKGROUND)
+ expect(page.errors).toEqual([])
+ })
+ })
+}
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-build.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-build.test.ts
new file mode 100644
index 0000000000..f58b12fe7a
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-build.test.ts
@@ -0,0 +1,9 @@
+/**
+ * The rows of rsc-css-rsbuild.test.ts (RSC CSS delivery, SPEC J7, through
+ * the real transport on Rsbuild) in an Rsbuild production build served by
+ * `rsbuild preview` (`rsc-app.ts`). The rows: `describeRscCssRows`
+ * (rsc-css-rsbuild-app.ts).
+ */
+import { describeRscCssRows } from './rsc-css-rsbuild-app'
+
+describeRscCssRows('build')
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-root.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-root.test.ts
new file mode 100644
index 0000000000..93b2c97d29
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild-root.test.ts
@@ -0,0 +1,23 @@
+import { expect, test } from 'vitest'
+import { startRscRsbuildDevServer } from './rsc-app'
+import { appFiles, rows, show } from './rsc-css-rsbuild-app'
+
+// SPEC J4.16: discovery and wiring use the configured root, not the process
+// working directory.
+// Bug: Start's Rsbuild plugin writes its virtual modules (serialization
+// adapters, RSC decode) under `/node_modules/.virtual`
+// (rsbuild/virtual-modules.ts `virtualPath`, with `resolvedStartConfig.root`
+// still empty at setup), where the app's `@tanstack/react-start` does not
+// resolve when the process runs elsewhere (`rsbuild dev --root ` from
+// a monorepo root).
+// Impact: the dev server (and build) fails with "Module not found".
+test('Rsbuild: the app compiles when the process does not run in the app directory', async () => {
+ const server = await startRscRsbuildDevServer({
+ browser: true,
+ inAppDirectory: false,
+ files: appFiles,
+ })
+ expect(server.errors).toEqual([])
+ const page = await show(server, rows[0]!.path)
+ expect(page.errors).toEqual([])
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-css-rsbuild.test.ts b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild.test.ts
new file mode 100644
index 0000000000..e85cbffd23
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css-rsbuild.test.ts
@@ -0,0 +1,14 @@
+/**
+ * RSC CSS delivery (SPEC J7) through the real transport on Rsbuild: a React
+ * Start app with RSC enabled on an Rsbuild dev server (`rsc-app.ts`, Start's
+ * RSC layer with `react-server-dom-rspack`), whose server functions render
+ * server components with the RSC helpers, and a real page that shows what
+ * the browser makes of the Flight payload, including a render call in a
+ * helper module the server function calls. The Vite counterpart, with the
+ * whole matrix, is rsc-css.test.ts; the production build:
+ * rsc-css-rsbuild-build.test.ts. The rows: `describeRscCssRows`
+ * (rsc-css-rsbuild-app.ts).
+ */
+import { describeRscCssRows } from './rsc-css-rsbuild-app'
+
+describeRscCssRows('dev')
diff --git a/packages/react-start-rsc/tests/integration/rsc-css.test.ts b/packages/react-start-rsc/tests/integration/rsc-css.test.ts
new file mode 100644
index 0000000000..910a6d581c
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-css.test.ts
@@ -0,0 +1,574 @@
+/**
+ * RSC CSS delivery (SPEC J7.2–J7.4) through the real transport on Vite dev
+ * (`rsc-css-app.ts`): argument shapes of the RSC helpers, a render call in a
+ * helper module, undocumented inputs that must not break, look-alikes that
+ * must stay untouched (SPEC G15) and forms that are not recognised but must
+ * still work. The import forms are in rsc-css-matrix.test.ts, CSS edits in
+ * rsc-css-hmr.test.ts.
+ */
+import path from 'node:path'
+import { describe, expect, test } from 'vitest'
+import { expectDiagnostic } from '@tanstack/compiler-test-utils/diagnostics'
+import {
+ BADGE_BACKGROUND,
+ CARD_BACKGROUND,
+ GLOBAL_COLOR,
+ renderableImport,
+ rscCssApp,
+ streamImport,
+ stylesheetsOf,
+} from './rsc-css-app'
+import {
+ computedStyle,
+ openRscPage,
+ settledValue,
+ waitForHydration,
+} from './rsc-app'
+import type { Row } from './rsc-css-app'
+
+const rows = {
+ // Both calls in one helper module deliver CSS.
+ helperA: {
+ key: 'helper-a',
+ imports: `import { renderA } from '../pair'\n`,
+ body: 'return renderA()',
+ consumer: 'renderable',
+ },
+ helperB: {
+ key: 'helper-b',
+ imports: `import { renderB } from '../pair'\n`,
+ body: 'return renderB()',
+ consumer: 'renderable',
+ },
+ // A .jsx provider is an equally supported input.
+ javascript: {
+ key: 'javascript',
+ imports: renderableImport,
+ body: 'return renderServerComponent( )',
+ consumer: 'renderable',
+ jsx: true,
+ },
+ // A fragment root with children from two components.
+ fragmentRenderable: {
+ key: 'fragment-renderable',
+ imports: renderableImport,
+ body: `return renderServerComponent(<> >)`,
+ consumer: 'renderable',
+ },
+ fragmentComposite: {
+ key: 'fragment-composite',
+ imports: `import { createCompositeComponent } from '@tanstack/react-start/rsc'\n`,
+ body: `return createCompositeComponent(() => <> >)`,
+ consumer: 'composite',
+ },
+ fragmentFlight: {
+ key: 'fragment-flight',
+ imports: streamImport,
+ body: `return flight(renderToReadableStream(<> >))`,
+ consumer: 'flight',
+ },
+ // A render call in a helper module the server function calls, with a
+ // global stylesheet.
+ globalCss: {
+ key: 'global-css',
+ imports: `import { renderPlain } from '../plain'\n`,
+ body: `return renderPlain()`,
+ consumer: 'renderable',
+ },
+ parenthesised: {
+ key: 'parenthesised',
+ imports: streamImport,
+ body: `return flight(renderToReadableStream(( )))`,
+ consumer: 'flight',
+ },
+ asserted: {
+ key: 'asserted',
+ imports: streamImport,
+ body: `return flight(renderToReadableStream( as any))`,
+ consumer: 'flight',
+ },
+ identifier: {
+ key: 'identifier',
+ imports: streamImport,
+ body: `const node =
+ return flight(renderToReadableStream(node))`,
+ consumer: 'flight',
+ },
+ spread: {
+ key: 'spread',
+ imports: streamImport,
+ body: `const args = [ ] as const
+ return flight(renderToReadableStream(...args))`,
+ consumer: 'flight',
+ },
+ ternary: {
+ key: 'ternary',
+ imports: streamImport,
+ body: `let evaluations = 0
+ const stream = renderToReadableStream((++evaluations, data) ? : )
+ return flight(stream, evaluations)`,
+ input: true,
+ consumer: 'flight',
+ },
+ logicalAnd: {
+ key: 'logical-and',
+ imports: streamImport,
+ body: `let evaluations = 0
+ const stream = renderToReadableStream((++evaluations, data) && )
+ return flight(stream, evaluations)`,
+ input: true,
+ consumer: 'flight',
+ },
+ ternaryFalse: {
+ key: 'ternary-false',
+ imports: streamImport,
+ body: `let evaluations = 0
+ const stream = renderToReadableStream((++evaluations, data) ? : )
+ return flight(stream, evaluations)`,
+ input: false,
+ consumer: 'flight',
+ },
+ logicalFalse: {
+ key: 'logical-false',
+ imports: streamImport,
+ body: `let evaluations = 0
+ const stream = renderToReadableStream((++evaluations, data) && )
+ return flight(stream, evaluations)`,
+ input: false,
+ consumer: 'flight',
+ },
+ options: {
+ key: 'options',
+ imports: streamImport,
+ body: `function Boom(): never {
+ throw new Error('MARK_BOOM')
+ }
+ let digest = ''
+ const stream = renderToReadableStream( , {
+ onError: (error: Error) => {
+ digest = 'MARK_DIGEST:' + error.message
+ return digest
+ },
+ })
+ const text = await new Response(stream).text()
+ return { digest, streamCarriesDigest: text.includes('MARK_DIGEST') }`,
+ consumer: 'value',
+ },
+ plainModel: {
+ key: 'plain-model',
+ imports: streamImport,
+ body: `return flight(renderToReadableStream({ card: , label: 'MARK_MODEL' }))`,
+ consumer: 'model',
+ },
+ blockComment: {
+ key: 'block-comment',
+ imports: streamImport,
+ body: `return flight(renderToReadableStream(/* the card */ ))`,
+ consumer: 'flight',
+ },
+ lineComment: {
+ key: 'line-comment',
+ imports: streamImport,
+ body: `return flight(renderToReadableStream(
+ // the card
+ ,
+ ))`,
+ consumer: 'flight',
+ },
+ chained: {
+ key: 'chained',
+ imports: renderableImport,
+ body: `return renderServerComponent( ).then((value) => value)`,
+ consumer: 'renderable',
+ },
+ // Look-alikes (SPEC G15): a foreign package's helper of the same name, a
+ // local shadowing the import, and a local shadowing the namespace get
+ // exactly the user's arguments.
+ foreignNamespace: {
+ key: 'foreign-namespace',
+ imports: `import * as RSC from 'other-rsc'\n`,
+ body: `const effects: Array = []
+ return RSC.renderServerComponent(original-child )`,
+ consumer: 'value',
+ },
+ foreignArguments: {
+ key: 'foreign-arguments',
+ imports: `import * as RSC from 'other-rsc'\n`,
+ body: `const effects: Array = []
+ return RSC.renderServerComponent(original-child , (effects.push('first'), 'first'), (effects.push('second'), 2), effects)`,
+ consumer: 'value',
+ },
+ shadowed: {
+ key: 'shadowed',
+ imports: renderableImport,
+ body: `const effects: Array = []
+ const renderServerComponent = (...args) => ({ arity: args.length, label: args[0].props['data-label'], children: args[0].props.children, scalars: args.slice(1, 3), effects: [...effects] })
+ return renderServerComponent(original-child )`,
+ consumer: 'value',
+ },
+ shadowedArguments: {
+ key: 'shadowed-arguments',
+ imports: renderableImport,
+ body: `const effects: Array = []
+ const renderServerComponent = (...args) => ({ arity: args.length, label: args[0].props['data-label'], children: args[0].props.children, scalars: args.slice(1, 3), effects: [...effects] })
+ return renderServerComponent(original-child , (effects.push('first'), 'first'), (effects.push('second'), 2), effects)`,
+ consumer: 'value',
+ },
+ shadowedNamespace: {
+ key: 'shadowed-namespace',
+ imports: `import * as RSC from '@tanstack/react-start/rsc'\n`,
+ body: `const effects: Array = []
+ const RSC = {
+ renderServerComponent: (...args) => ({ arity: args.length, label: args[0].props['data-label'], children: args[0].props.children, scalars: args.slice(1, 3), effects: [...effects] }),
+ }
+ return RSC.renderServerComponent(original-child )`,
+ consumer: 'value',
+ },
+ shadowedNamespaceArguments: {
+ key: 'shadowed-namespace-arguments',
+ imports: `import * as RSC from '@tanstack/react-start/rsc'\n`,
+ body: `const effects: Array = []
+ const RSC = {
+ renderServerComponent: (...args) => ({ arity: args.length, label: args[0].props['data-label'], children: args[0].props.children, scalars: args.slice(1, 3), effects: [...effects] }),
+ }
+ return RSC.renderServerComponent(original-child , (effects.push('first'), 'first'), (effects.push('second'), 2), effects)`,
+ consumer: 'value',
+ },
+ // Not recognised forms (J7.2: variables, wrappers and project re-exports
+ // of the helpers): CSS is not required, but the call must still work.
+ reexported: {
+ key: 'reexported',
+ imports: `import { renderThing } from '../render'\n`,
+ body: `return renderThing( )`,
+ consumer: 'renderable',
+ },
+ wrapper: {
+ key: 'wrapper',
+ imports: `import { wrap } from '../wrap'\n`,
+ body: `return wrap( )`,
+ consumer: 'renderable',
+ },
+ variable: {
+ key: 'variable',
+ imports: renderableImport,
+ body: `const render = renderServerComponent
+ return render( )`,
+ consumer: 'renderable',
+ },
+} satisfies Record
+
+describe.concurrent('RSC CSS through the real transport (Vite dev)', () => {
+ const app = rscCssApp({
+ rows: Object.values(rows),
+ files: {
+ ...Object.fromEntries(
+ ['a', 'b'].map((name) => [
+ `src/routes/pair-${name}.tsx`,
+ `import { createFileRoute } from '@tanstack/react-router'
+import { render } from '../rows/helper-${name}'
+export const Route = createFileRoute('/pair-${name}')({
+ loader: () => render(),
+ component: () => {Route.useLoaderData()} ,
+})
+`,
+ ]),
+ ),
+ 'src/pair.module.css': `.a { background: #fef3c7; } .b { background: #e0f2fe; }\n`,
+ 'src/pair.tsx': `import { renderServerComponent } from '@tanstack/react-start/rsc'
+import styles from './pair.module.css'
+function A() { return MARK_A
}
+function B() { return MARK_B
}
+export function renderA() { return renderServerComponent( ) }
+export function renderB() { return renderServerComponent( ) }
+`,
+ 'src/plain.tsx': `import { renderServerComponent } from '@tanstack/react-start/rsc'
+import './global.css'
+export function renderPlain() {
+ return renderServerComponent(MARK_PLAIN
)
+}
+`,
+ 'src/render.ts': `export { renderServerComponent as renderThing } from '@tanstack/react-start/rsc'\n`,
+ 'src/wrap.tsx': `import { renderServerComponent } from '@tanstack/react-start/rsc'
+export const wrap = (node: React.ReactNode) => renderServerComponent(node)
+`,
+ 'node_modules/other-rsc/package.json': JSON.stringify({
+ name: 'other-rsc',
+ type: 'module',
+ exports: './index.js',
+ }),
+ 'node_modules/other-rsc/index.js': `export const renderServerComponent = (...args) => ({ arity: args.length, label: args[0].props['data-label'], children: args[0].props.children, scalars: args.slice(1, 3), effects: [...args[0].props['data-effects']] })\n`,
+ },
+ // The app's own package (a look-alike row), pre-bundled like the rest.
+ config: { optimizeDeps: { include: ['other-rsc'] } },
+ })
+
+ test('two render helpers in one module each carry their component CSS', async ({
+ onTestFinished,
+ }) => {
+ // Separate browser contexts/results: renderA's stylesheet must not mask
+ // renderB missing its own delivery, even though both helpers share CSS.
+ for (const [name, marker, selector, expected] of [
+ ['a', 'MARK_A', '[data-testid=card]', CARD_BACKGROUND],
+ ['b', 'MARK_B', '[data-testid=badge]', BADGE_BACKGROUND],
+ ] as const) {
+ const page = await openRscPage(app.server(), `/pair-${name}`, {
+ registerCleanup: onTestFinished,
+ })
+ await page.waitForText(marker, { selector: 'main' })
+ await waitForHydration(page)
+ expect(
+ await settledValue(
+ page,
+ () => computedStyle(page, selector, 'background-color'),
+ (value) => value === expected,
+ ),
+ ).toBe(expected)
+ expect(page.errors).toEqual([])
+ }
+ })
+
+ test('a JavaScript provider carries its stylesheet with the RSC payload', async () => {
+ expect(await app.text(rows.javascript)).toBe('MARK_CARD')
+ expect(
+ await app.style(
+ rows.javascript,
+ '[data-testid=card]',
+ 'background-color',
+ CARD_BACKGROUND,
+ ),
+ ).toBe(CARD_BACKGROUND)
+ })
+
+ const cardBackground = (row: Row) =>
+ app.style(row, '[data-testid=card]', 'background-color', CARD_BACKGROUND)
+
+ // A JSX fragment root must get the CSS of every child,
+ // like an element root.
+ test.each([
+ { name: 'renderServerComponent', row: rows.fragmentRenderable },
+ { name: 'createCompositeComponent', row: rows.fragmentComposite },
+ { name: 'renderToReadableStream', row: rows.fragmentFlight },
+ ])('$name with a fragment root styles every child', async ({ row }) => {
+ expect({
+ card: await cardBackground(row),
+ badge: await app.style(
+ row,
+ '[data-testid=badge]',
+ 'background-color',
+ BADGE_BACKGROUND,
+ ),
+ }).toEqual({ card: CARD_BACKGROUND, badge: BADGE_BACKGROUND })
+ })
+
+ test('a render call in a helper module, with a global stylesheet, styles the server component', async () => {
+ expect(
+ await app.style(
+ rows.globalCss,
+ '[data-testid=plain]',
+ 'color',
+ GLOBAL_COLOR,
+ ),
+ ).toBe(GLOBAL_COLOR)
+ })
+
+ test.each([
+ { wrapped: '( )', row: rows.parenthesised },
+ { wrapped: ' as any', row: rows.asserted },
+ ])('renderToReadableStream($wrapped) styles the stream', async ({ row }) => {
+ expect(await cardBackground(row)).toBe(CARD_BACKGROUND)
+ expect(await app.text(row)).toBe('MARK_CARD')
+ })
+
+ // Arguments the transform cannot see the JSX of are left as they are:
+ // the stream still renders (CSS not required; dev warnings below).
+ test.each([
+ { name: 'an identifier', row: rows.identifier },
+ { name: 'a spread', row: rows.spread },
+ ])('renderToReadableStream with $name still renders', async ({ row }) => {
+ expect(await app.text(row)).toBe('MARK_CARD')
+ })
+
+ // Bug: the transform only wraps an argument that is JSX itself, not a
+ // conditional or logical expression whose branches are all JSX, which is
+ // as safe to wrap.
+ // Impact: a stream of a conditionally chosen element has no CSS, so its
+ // styles never arrive.
+ // Source: SPEC J7.3.
+ test.each([
+ { argument: 'flag ? : ', row: rows.ternary },
+ { argument: 'flag && ', row: rows.logicalAnd },
+ ])('renderToReadableStream($argument) styles the stream', async ({ row }) => {
+ expect(await cardBackground(row)).toBe(CARD_BACKGROUND)
+ })
+
+ // Selection/effects are separate from the known missing-CSS goal above:
+ // a false result must never become a card or hide a transport error.
+ test.each([
+ { row: rows.ternary, text: 'MARK_CARD' },
+ { row: rows.ternaryFalse, text: 'MARK_BADGE' },
+ { row: rows.logicalAnd, text: 'MARK_CARD' },
+ { row: rows.logicalFalse, text: '' },
+ ])(
+ 'conditional stream $row.key selects its runtime input and evaluates it once',
+ async ({ row, text }) => {
+ expect(await app.text(row)).toBe(text)
+ const selected = await app
+ .page()
+ .page.locator(
+ `section[data-row="${row.key}"] [data-testid=card], section[data-row="${row.key}"] [data-testid=badge]`,
+ )
+ .evaluateAll((elements) =>
+ elements.map((element) => element.getAttribute('data-testid')),
+ )
+ expect(selected).toEqual(
+ text === 'MARK_CARD'
+ ? ['card']
+ : text === 'MARK_BADGE'
+ ? ['badge']
+ : [],
+ )
+ expect(
+ await app
+ .page()
+ .page.locator(`section[data-row="${row.key}"] [data-evaluations]`)
+ .getAttribute('data-evaluations'),
+ ).toBe('1')
+ },
+ )
+
+ // Bug: the alternate JSX branch has no CSS, just like the consequent
+ // (SPEC J7.3).
+ // Source: react-start-rsc src/plugin/rscCssTransform.ts:93: a conditional
+ // argument is not top-level JSX (`isTopLevelJsx`, 116-119, unwraps only
+ // parentheses and TS wrappers), so the transform skips the call and never
+ // wraps either branch with the CSS fragment (`createCssFragment`).
+ // Impact: choosing false renders the badge without its stylesheet.
+ test('a false ternary stream carries its selected badge CSS', async () => {
+ expect(
+ await app.style(
+ rows.ternaryFalse,
+ '[data-testid=badge]',
+ 'background-color',
+ BADGE_BACKGROUND,
+ ),
+ ).toBe(BADGE_BACKGROUND)
+ })
+
+ // The second `options` argument is undocumented (React Start's public
+ // type is `renderToReadableStream(node)`; `options` is typed only under
+ // the react-server condition). It must not break: the options reach
+ // React's renderer (its `onError` runs and its digest is in the stream).
+ // CSS is not required (SPEC J7.3).
+ test('renderToReadableStream( , options) renders with the options', async () => {
+ expect(JSON.parse(await app.text(rows.options))).toEqual({
+ digest: 'MARK_DIGEST:MARK_BOOM',
+ streamCarriesDigest: true,
+ })
+ })
+
+ // A plain-data model (`{ card: }`) is undocumented too: it must
+ // not break, and the model reaches the client. Neither CSS for its
+ // elements nor a warning is required, nor their absence (SPEC §2.2,
+ // J7.3).
+ test('renderToReadableStream with a plain-data model streams the model', async () => {
+ expect(await app.text(rows.plainModel)).toBe('MARK_MODELMARK_CARD')
+ })
+
+ // Bug: the transform silently skips a `renderToReadableStream` argument it
+ // cannot see the JSX of (a variable, a spread).
+ // Impact: the stream has no CSS, so its styles never arrive, and nothing
+ // tells the developer.
+ // Source: SPEC J7.3: warn in dev only.
+ test.each([
+ { name: 'an identifier', row: rows.identifier },
+ { name: 'a spread', row: rows.spread },
+ ])(
+ 'dev: renderToReadableStream with $name warns, naming the file',
+ ({ row }) => {
+ const server = app.server()
+ expectDiagnostic(server.diagnostics, {
+ severity: 'warning',
+ times: 1,
+ file: path.join('src/rows', `${row.key}.tsx`),
+ root: server.root,
+ })
+ },
+ )
+
+ test.each([
+ { name: 'a foreign namespace', row: rows.foreignNamespace },
+ { name: 'a shadowing local', row: rows.shadowed },
+ { name: 'a local shadowing the namespace', row: rows.shadowedNamespace },
+ {
+ name: 'a foreign namespace with scalar arguments',
+ row: rows.foreignArguments,
+ },
+ {
+ name: 'a shadowing local with scalar arguments',
+ row: rows.shadowedArguments,
+ },
+ {
+ name: 'a shadowed namespace with scalar arguments',
+ row: rows.shadowedNamespaceArguments,
+ },
+ ])(
+ 'a look-alike helper of $name gets exactly the arguments the code passes',
+ async ({ row }) => {
+ const multiple = row.body.includes("effects.push('first')")
+ expect(JSON.parse(await app.text(row))).toEqual({
+ arity: multiple ? 4 : 1,
+ label: 'original',
+ children: 'original-child',
+ scalars: multiple ? ['first', 2] : [],
+ effects: multiple ? ['element', 'first', 'second'] : ['element'],
+ })
+ },
+ )
+
+ test.each([
+ { name: 'a project re-export', row: rows.reexported },
+ { name: 'a project wrapper', row: rows.wrapper },
+ { name: 'a variable', row: rows.variable },
+ ])('renderServerComponent through $name still renders', async ({ row }) => {
+ expect(await app.text(row)).toBe('MARK_CARD')
+ })
+
+ // J4.12, and the control of the rows above: the client never loads a
+ // stylesheet of a row's module itself (the handler, and so the render
+ // call and the local components, are absent), so a styled section shows
+ // the CSS the RSC payload delivered.
+ test.each(Object.values(rows))(
+ "the client's module of row $key loads no stylesheet",
+ async (row) => {
+ expect(stylesheetsOf(await app.clientModules(row))).toEqual([])
+ },
+ )
+
+ describe('known bugs', () => {
+ // Bug: a comment before the JSX argument of `renderToReadableStream` is
+ // moved into the generated CSS fragment, where it becomes JSX text.
+ // Impact: the comment is rendered into the RSC payload as visible text.
+ test.each([
+ { name: 'a block comment', row: rows.blockComment },
+ { name: 'a line comment', row: rows.lineComment },
+ ])(
+ 'renderToReadableStream does not render $name before the JSX argument',
+ async ({ row }) => {
+ expect(await app.text(row)).toBe('MARK_CARD')
+ expect(await cardBackground(row)).toBe(CARD_BACKGROUND)
+ },
+ )
+
+ // Bug: a call whose result is immediately member-called
+ // (`renderServerComponent(...).then()`) is recorded as the inner call of
+ // a method chain and never visited as a candidate itself. The root cause
+ // is shared with the other Start factories (e.g. a
+ // `createServerOnlyFn(...).bind()`); this is its only pin.
+ // Source: start-plugin-core/src/start-compiler/compiler.ts, candidate
+ // detection ("inner call in a chain").
+ // Impact: the server component renders without its CSS.
+ test('renderServerComponent styles the server component when its result is chained', async () => {
+ expect(await cardBackground(rows.chained)).toBe(CARD_BACKGROUND)
+ })
+ })
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-build.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-build.test.ts
new file mode 100644
index 0000000000..40f0965b5e
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-build.test.ts
@@ -0,0 +1,545 @@
+/**
+ * A production build of a React Start app with RSC enabled on Vite
+ * (`rsc-app.ts`: `buildApp()` of the `client`, `ssr` and `rsc`
+ * environments, served by Start's preview server) in a real page: which
+ * entry of a dependency each environment runs (SPEC J4.3, J4.16, J4.12),
+ * env-only fns a server fn handler calls (J4.10), and the CSS of server
+ * components rendered with each RSC helper, in a server fn's module or in a
+ * helper module it calls (SPEC J7.2, J7.3). The dev counterparts are
+ * rsc-start-dev.test.ts and rsc-css-matrix.test.ts.
+ */
+import { readFile, readdir } from 'node:fs/promises'
+import path from 'node:path'
+import { afterAll, beforeAll, describe, expect, test } from 'vitest'
+import {
+ computedStyle,
+ openRscPage,
+ settledValue,
+ startRscPreviewServer,
+ waitForHydration,
+} from './rsc-app'
+import { HELPER_CARD_BACKGROUND, helperRow } from './rsc-css-rsbuild-app'
+import type { BrowserPage } from '@tanstack/compiler-test-utils/browser'
+import type { RscPreviewServer } from './rsc-app'
+
+/** A dependency whose entry differs by export condition. */
+const envMarkerPackage = {
+ 'node_modules/env-marker/package.json': JSON.stringify({
+ name: 'env-marker',
+ type: 'module',
+ exports: {
+ '.': {
+ 'react-server': './react-server.js',
+ browser: './browser.js',
+ default: './default.js',
+ },
+ },
+ }),
+ // Counts its initialisations in the server process.
+ 'node_modules/env-marker/react-server.js': `globalThis.__envMarkerInits = (globalThis.__envMarkerInits ?? 0) + 1
+export const where = () => 'MARK_REACT_SERVER:' + globalThis.__envMarkerInits
+`,
+ 'node_modules/env-marker/browser.js': `export const where = () => 'MARK_BROWSER'\n`,
+ 'node_modules/env-marker/default.js': `export const where = () => 'MARK_DEFAULT'\n`,
+}
+
+/** A module whose server fn renders a local `Card` with `api`. */
+const cssRow = (key: string, imports: string, body: string) => ({
+ [`src/rows/${key}.tsx`]: `import { createServerFn } from '@tanstack/react-start'
+${imports}
+import styles from './${key}.module.css'
+function Card({ children }: { children?: React.ReactNode }) {
+ return MARK_CARD{children}
+}
+export const render = createServerFn().handler(async () => {
+ ${body}
+})
+`,
+ // The row in the content: scoped class names hash the content
+ [`src/rows/${key}.module.css`]: `/* ${key} */\n.card { background: #fef3c7; }\n`,
+})
+
+const CARD_BACKGROUND = 'rgb(254, 243, 199)'
+
+const files = {
+ ...envMarkerPackage,
+ // A server fn that calls a helper module rendering a server component
+ // with its own CSS module (rsc-css-rsbuild-app.ts)
+ ...helperRow.files,
+ 'src/fns.ts': `import { createServerFn } from '@tanstack/react-start'
+import { where } from 'env-marker'
+export const greet = createServerFn().handler(() => where())
+`,
+ 'src/routes/env.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { useState } from 'react'
+import { where } from 'env-marker'
+import { greet } from '../fns'
+export const Route = createFileRoute('/env')({
+ loader: async () => ({ own: where(), provider: await greet() }),
+ component: Page,
+})
+function Page() {
+ const data = Route.useLoaderData()
+ const [called, setCalled] = useState('')
+ const [browser, setBrowser] = useState('')
+ return (
+
+ ssr {data.own} provider {data.provider}
+ called {called}
+ browser {browser}
+ greet().then(setCalled)}>call
+ setBrowser(where())}>where
+
+ )
+}
+`,
+ ...cssRow(
+ 'renderable',
+ `import { renderServerComponent } from '@tanstack/react-start/rsc'`,
+ `return renderServerComponent( )`,
+ ),
+ ...cssRow(
+ 'composite',
+ `import { createCompositeComponent } from '@tanstack/react-start/rsc'`,
+ `return createCompositeComponent((props) => {props.children} )`,
+ ),
+ ...cssRow(
+ 'flight',
+ `import { renderToReadableStream } from '@tanstack/react-start/rsc'`,
+ `return new Response(renderToReadableStream( ), {
+ headers: { 'Content-Type': 'text/x-component' },
+ })`,
+ ),
+ ...cssRow(
+ 'identifier',
+ `import { renderToReadableStream } from '@tanstack/react-start/rsc'`,
+ `const node =
+ return new Response(renderToReadableStream(node), { headers: { 'Content-Type': 'text/x-component' } })`,
+ ),
+ ...cssRow(
+ 'spread',
+ `import { renderToReadableStream } from '@tanstack/react-start/rsc'`,
+ `const args = [ ] as const
+ return new Response(renderToReadableStream(...args), { headers: { 'Content-Type': 'text/x-component' } })`,
+ ),
+ // A route module that defines a server fn next to client-only module
+ // code (`createContext` is not in React's `react-server` build)
+ 'src/routes/context.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+import { createContext, useContext } from 'react'
+const Theme = createContext('MARK_THEME')
+const getData = createServerFn().handler(async () => 'MARK_DATA')
+export const Route = createFileRoute('/context')({
+ loader: () => getData(),
+ component: Page,
+})
+function Page() {
+ const data = Route.useLoaderData()
+ const theme = useContext(Theme)
+ return {theme} {data}
+}
+`,
+ // A server fn whose only importer is a `'use client'` component that a
+ // server component renders.
+ 'src/client-ref/update.ts': `import { createServerFn } from '@tanstack/react-start'
+export const update = createServerFn({ method: 'POST' }).handler(() => 'MARK_UPDATED')
+`,
+ 'src/client-ref/Counter.tsx': `'use client'
+import { useState } from 'react'
+import { update } from './update'
+export function Counter() {
+ const [result, setResult] = useState('')
+ return (
+ update().then(setResult, (error) => setResult('error ' + error))}>
+ counter {result}
+
+ )
+}
+`,
+ 'src/client-ref/page.tsx': `import { createServerFn } from '@tanstack/react-start'
+import { renderServerComponent } from '@tanstack/react-start/rsc'
+import { Counter } from './Counter'
+export const getPage = createServerFn().handler(() => renderServerComponent(server
))
+`,
+ 'src/routes/client-ref.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { getPage } from '../client-ref/page'
+export const Route = createFileRoute('/client-ref')({
+ loader: async () => ({ tree: await getPage() }),
+ component: Page,
+})
+function Page() {
+ const data = Route.useLoaderData()
+ return {data.tree}
+}
+`,
+ // A server fn module whose source names only createServerFn: its handler
+ // calls env-only fns that a project module re-exports under other names.
+ 'src/aliased/env.ts': `export { createServerOnlyFn as makeServerOnly, createClientOnlyFn as makeClientOnly } from '@tanstack/react-start'
+`,
+ 'src/aliased/fns.ts': `import { createServerFn } from '@tanstack/react-start'
+import { makeClientOnly, makeServerOnly } from './env'
+const readSecret = makeServerOnly(() => 'MARK_ALIASED_SERVER_ONLY')
+const readBrowser = makeClientOnly(() => 'MARK_ALIASED_CLIENT_ONLY')
+export const readAliased = createServerFn().handler(() => {
+ let clientOnly = 'threw'
+ try {
+ clientOnly = readBrowser()
+ } catch {}
+ return 'server-only ' + readSecret() + ' client-only ' + clientOnly
+})
+`,
+ 'src/routes/aliased.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { useState } from 'react'
+import { readAliased } from '../aliased/fns'
+export const Route = createFileRoute('/aliased')({
+ loader: () => readAliased(),
+ component: Page,
+})
+function Page() {
+ const [called, setCalled] = useState('')
+ return (
+
+ loaded {Route.useLoaderData()}
+ called {called}
+ readAliased().then(setCalled)}>call
+
+ )
+}
+`,
+ 'src/routes/control.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { render as renderable } from '../rows/renderable'
+import { render as composite } from '../rows/composite'
+import { render as flight } from '../rows/flight'
+export const Route = createFileRoute('/control')({ component: Control })
+function Control() {
+ return {[renderable, composite, flight].map((render, index) => caller )}
+}
+`,
+ 'src/routes/css.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { CompositeComponent, createFromFetch } from '@tanstack/react-start/rsc'
+import { useEffect, useState } from 'react'
+import { render as renderable } from '../rows/renderable'
+import { render as composite } from '../rows/composite'
+import { render as flight } from '../rows/flight'
+import { render as identifier } from '../rows/identifier'
+import { render as spread } from '../rows/spread'
+export const Route = createFileRoute('/css')({
+ loader: async () => ({ renderable: await renderable(), composite: await composite() }),
+ component: Page,
+})
+function Flight({ render = flight }: { render?: typeof flight }) {
+ const [tree, setTree] = useState(null)
+ useEffect(() => {
+ createFromFetch(render()).then(setTree)
+ }, [])
+ return <>{tree as React.ReactNode}>
+}
+function Page() {
+ const data = Route.useLoaderData()
+ return (
+
+
+
+
+
+
+
+ )
+}
+`,
+}
+
+/**
+ * A server fn only server code calls (`internal`, called by `greet`'s
+ * handler) next to one the client references, and a page exposing both
+ * URLs and a caller that sends the real request envelope to a URL.
+ */
+const privateFnFiles = {
+ 'src/private/internal.ts': `import { createServerFn } from '@tanstack/react-start'
+export const internal = createServerFn().handler(() => 'MARK_INTERNAL')
+`,
+ 'src/private/fns.ts': `import { createServerFn } from '@tanstack/react-start'
+import { internal } from './internal'
+export const greet = createServerFn().handler(async () => 'MARK_GREET:' + (await internal()))
+export const urls = createServerFn().handler(() => ({ internal: internal.url }))
+`,
+ 'src/routes/private.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { greet, urls } from '../private/fns'
+export const Route = createFileRoute('/private')({
+ loader: async () => ({ label: await greet(), internalUrl: (await urls()).internal }),
+ component: Page,
+})
+if (typeof window !== 'undefined') {
+ // The public caller supplies the real request envelope; only its URL
+ // changes (no id parsing: the server decides by the id in the URL).
+ ;(window as any).callUrl = async (url: string) => {
+ let outcome: { ok: boolean; value: string } | undefined
+ let error: string | undefined
+ try {
+ const value: unknown = await greet({ fetch: async (_input, init) => {
+ const response = await fetch(url, init)
+ outcome = { ok: response.ok, value: await response.clone().text() }
+ return response
+ } } as any)
+ if (value instanceof Error) { error = String(value) }
+ } catch (thrown) {
+ if (!outcome) { throw thrown }
+ error = String(thrown)
+ }
+ return { ...outcome, error }
+ }
+}
+function Page() {
+ const data = Route.useLoaderData()
+ return (
+
+ label {data.label}
+ {JSON.stringify({ greet: greet.url, internal: data.internalUrl })}
+
+ )
+}
+`,
+}
+
+/** The files of `dir`, recursively. */
+async function filesOf(dir: string): Promise> {
+ const entries = await readdir(dir, { recursive: true, withFileTypes: true })
+ return entries
+ .filter((entry) => entry.isFile())
+ .map((entry) => path.join(entry.parentPath, entry.name))
+}
+
+describe('Vite production build with RSC', () => {
+ let server: RscPreviewServer
+ const cleanups: Array<() => Promise> = []
+
+ beforeAll(async () => {
+ server = await startRscPreviewServer({
+ files: { ...files, ...privateFnFiles },
+ config: {
+ // Bundled into the provider like Start's own packages are: the
+ // `rsc` build otherwise leaves a dependency external, and Node
+ // imports it at run time with its own conditions, not
+ // `react-server` (@vitejs/plugin-rsc, upstream).
+ environments: { rsc: { resolve: { noExternal: ['env-marker'] } } },
+ // Output size is not under test
+ build: { minify: false },
+ },
+ registerCleanup: (cleanup) => {
+ cleanups.push(cleanup)
+ },
+ })
+ })
+ afterAll(async () => {
+ for (const cleanup of cleanups.reverse()) {
+ await cleanup()
+ }
+ })
+
+ const open = async (pathname: string): Promise => {
+ const page = await openRscPage(server, pathname, {
+ registerCleanup: (cleanup) => {
+ cleanups.push(cleanup)
+ },
+ })
+ return page
+ }
+
+ // J4.3, J4.16, J4.12: the provider runs the handler with `react-server`
+ // and initialises the package once, whether SSR or the browser calls it;
+ // SSR's own code gets `default`, the browser `browser`; no client file of
+ // the build has another environment's entry.
+ test('each environment runs its own entry of a dependency; the provider runs the handler', async () => {
+ const page = await open('/env')
+ await page.waitForText('ssr MARK_DEFAULT provider MARK_REACT_SERVER:1', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ await page.page.locator('[data-testid=call]').click()
+ await page.waitForText('called MARK_REACT_SERVER:1', {
+ selector: '[data-testid=called]',
+ })
+ await page.page.locator('[data-testid=where]').click()
+ await page.waitForText('browser MARK_BROWSER', {
+ selector: '[data-testid=browser]',
+ })
+ const client = await Promise.all(
+ (await filesOf(path.join(server.root, 'dist/client'))).map((file) =>
+ readFile(file, 'utf8'),
+ ),
+ )
+ expect({
+ browser: client.some((code) => code.includes('MARK_BROWSER')),
+ server: client.some((code) =>
+ /MARK_REACT_SERVER|MARK_DEFAULT/.test(code),
+ ),
+ }).toEqual({ browser: true, server: false })
+ expect(page.errors).toEqual([])
+ })
+
+ // SPEC J4.1, J4.14: the provider runs what the server fn needs, not the
+ // route module's client-only code beside it.
+ // Source: the react-start/rsc e2e app (rsc-context, Vite).
+ test("a server fn runs in the provider next to its route module's client-only code", async () => {
+ const page = await open('/context')
+ await page.waitForText('MARK_THEME MARK_DATA', {
+ selector: '[data-testid=label]',
+ })
+ expect(page.errors).toEqual([])
+ })
+
+ // SPEC J4.10, J4.12, G11 (the Start compiler composed with the RSC CSS
+ // transform): in the provider, the handler's env-only fns, reached
+ // through renamed re-exports of a module whose source names only
+ // createServerFn, are compiled: the server-only one runs, the client-only
+ // one throws, whether SSR or the browser calls the server fn; the
+ // server-only body is not in any client file.
+ test('a server fn handler compiles env-only fns of renamed re-exports in the provider', async () => {
+ const expected = 'server-only MARK_ALIASED_SERVER_ONLY client-only threw'
+ const page = await open('/aliased')
+ await page.waitForText(`loaded ${expected}`, {
+ selector: '[data-testid=loaded]',
+ })
+ await waitForHydration(page)
+ await page.page.locator('[data-testid=call]').click()
+ await page.waitForText(`called ${expected}`, {
+ selector: '[data-testid=called]',
+ })
+ const client = await Promise.all(
+ (await filesOf(path.join(server.root, 'dist/client'))).map((file) =>
+ readFile(file, 'utf8'),
+ ),
+ )
+ expect(
+ client.some((code) => code.includes('MARK_ALIASED_SERVER_ONLY')),
+ ).toBe(false)
+ expect(page.errors).toEqual([])
+ })
+
+ // SPEC J4.2: a server fn the client references is registered and runs
+ // when called by id, also when its only importer is a `'use client'`
+ // component that reaches the browser through a server component (the
+ // provider builds before the client: it compiles the reach of its
+ // handlers before its build, so its manifest lists the fn; #7943).
+ test("a server fn only a 'use client' component of a server component imports runs when clicked", async () => {
+ const page = await open('/client-ref')
+ await page.page.locator('[data-testid=counter]').waitFor()
+ await waitForHydration(page)
+ await page.page.locator('[data-testid=counter]').click()
+ expect(
+ await settledValue(
+ page,
+ () => page.text('[data-testid=counter]'),
+ (text) => text.includes('MARK_UPDATED'),
+ ),
+ ).toBe('counter MARK_UPDATED')
+ })
+
+ // SPEC J4.2: in a production build only server functions client code
+ // references are callable over HTTP. `internal` is called by `greet`'s
+ // handler only (a server-origin call, which works); a request by its URL
+ // from the browser is refused, while the same request to `greet` answers.
+ // With a separate provider the provider builds before the client, so the
+ // refusal is decided where the HTTP handler runs, after the client built.
+ test('a server function only server code calls is not callable from the browser', async () => {
+ const page = await open('/private')
+ await page.waitForText('label MARK_GREET:MARK_INTERNAL', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ const urls = JSON.parse(await page.text('[data-testid=urls]')) as {
+ greet: string
+ internal: string
+ }
+ expect(typeof urls.internal).toBe('string')
+ const call = (url: string) =>
+ page.page.evaluate(
+ (functionUrl) => (window as any).callUrl(functionUrl),
+ url,
+ ) as Promise<{ ok?: boolean; value?: string; error?: string }>
+ // the same envelope reaches an exposed function, so a malformed request
+ // cannot masquerade as a refusal of `internal`
+ expect(await call(urls.greet)).toMatchObject({
+ ok: true,
+ value: expect.stringContaining('MARK_GREET:MARK_INTERNAL'),
+ })
+ const refused = await call(urls.internal)
+ expect(refused.ok).toBe(false)
+ expect(refused.value ?? '').not.toContain('MARK_INTERNAL')
+ })
+
+ test('loading the client callers without an RSC result supplies no server CSS', async () => {
+ const page = await open('/control')
+ await page.waitForText('caller', { selector: '[data-testid=control]' })
+ await waitForHydration(page)
+ const css = await page.page.evaluate(() =>
+ [...document.styleSheets]
+ .flatMap((sheet) => {
+ try {
+ return [...sheet.cssRules].map((rule) => rule.cssText)
+ } catch {
+ return []
+ }
+ })
+ .join('\n'),
+ )
+ expect(css).not.toMatch(/254, 243, 199|#fef3c7/i)
+ expect(page.errors).toEqual([])
+ })
+
+ test.each(['identifier', 'spread'])(
+ 'production %s stream still renders without development warnings',
+ async (row) => {
+ const page = await open('/css')
+ await page.waitForText('MARK_CARD', {
+ selector: `section[data-row=${row}]`,
+ })
+ await waitForHydration(page)
+ expect(
+ [...server.messages, ...page.console].filter((message) =>
+ /renderToReadableStream/.test(message),
+ ),
+ ).toEqual([])
+ expect(page.errors).toEqual([])
+ },
+ )
+
+ // SPEC J7.1, J7.2: the CSS is delivered wherever the render runs, here in
+ // a helper module the server fn calls (the dev twin: rsc-css.test.ts).
+ test('a render call in a helper module styles the server component', async () => {
+ const page = await open(helperRow.path)
+ const selector = '[data-testid=helper-card]'
+ await page.page.locator(selector).waitFor()
+ await waitForHydration(page)
+ expect(
+ await settledValue(
+ page,
+ () => computedStyle(page, selector, 'background-color'),
+ (value) => value === HELPER_CARD_BACKGROUND,
+ ),
+ ).toBe(HELPER_CARD_BACKGROUND)
+ expect(page.errors).toEqual([])
+ })
+
+ test.each(['renderable', 'composite', 'flight'])(
+ 'the %s row styles its server component',
+ async (row) => {
+ const page = await open('/css')
+ const selector = `section[data-row=${row}] [data-testid=card]`
+ await page.page.locator(selector).waitFor()
+ await waitForHydration(page)
+ expect(
+ await settledValue(
+ page,
+ () => computedStyle(page, selector, 'background-color'),
+ (value) => value === CARD_BACKGROUND,
+ ),
+ ).toBe(CARD_BACKGROUND)
+ expect(page.errors).toEqual([])
+ },
+ )
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-client-module.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-client-module.test.ts
new file mode 100644
index 0000000000..1054761c45
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-client-module.test.ts
@@ -0,0 +1,50 @@
+import { describe, expect, test } from 'vitest'
+import {
+ openRscPage,
+ settledValue,
+ startRscDevServer,
+ waitForHydration,
+} from './rsc-app'
+
+describe('Vite dev: a separate RSC provider', () => {
+ // SPEC J4.2 / #7943: a server function declared in a `'use client'`
+ // module runs on the server when the client calls it.
+ // Bug: the provider module (`?tss-serverfn-split`) keeps the `'use client'`
+ // directive of its source module, so the RSC bundler turns the provider's
+ // exports into client references and the handler is not there to run.
+ // Impact: a server fn co-located with a client component cannot be called.
+ // Source: the compile-level pin in start-plugin-core
+ // tests/known-bugs-start-compiler.test.ts.
+ test("a server function of a 'use client' module runs on the server", async () => {
+ const server = await startRscDevServer({
+ browser: true,
+ files: {
+ 'src/widget.tsx': `'use client'
+import { useState } from 'react'
+import { createServerFn } from '@tanstack/react-start'
+const getData = createServerFn().handler(() => 'MARK_WIDGET_DATA')
+export function Widget() {
+ const [data, setData] = useState('')
+ return getData().then(setData)}>widget {data}
+}
+`,
+ 'src/routes/index.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { Widget } from '../widget'
+export const Route = createFileRoute('/')({ component: () => })
+`,
+ },
+ })
+ const browser = await openRscPage(server, '/')
+ await browser.waitForText('widget')
+ await waitForHydration(browser)
+ await browser.page.locator('[data-testid=widget]').click()
+ // The answer, or what the page shows once its requests are done
+ expect(
+ await settledValue(
+ browser,
+ () => browser.text('[data-testid=widget]'),
+ (text) => text.includes('MARK_WIDGET_DATA'),
+ ),
+ ).toBe('widget MARK_WIDGET_DATA')
+ })
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-dev.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-dev.test.ts
new file mode 100644
index 0000000000..f70685df23
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-dev.test.ts
@@ -0,0 +1,98 @@
+/**
+ * Start with a separate server function provider (SPEC J4.2, J4.3, J4.16):
+ * a React Start app with RSC enabled on a Vite dev server (`rsc-app.ts`),
+ * where the `rsc` environment runs the handlers, SSR forwards its calls to
+ * it, and a real page calls them from the browser. Outcomes only: what the
+ * page shows, what a call by id answers, what the browser loaded. Edits
+ * are in rsc-start-hmr.test.ts.
+ */
+import { describe, expect, test } from 'vitest'
+import { openRscPage, startRscDevServer, waitForHydration } from './rsc-app'
+import { callFromPage, envMarkerPackage } from './rsc-start-page'
+
+describe('Vite dev: a separate RSC provider', () => {
+ // J4.3, J4.16: SSR (the loader during the page render) and a client call
+ // both run the handler in the provider, with its module-resolution
+ // conditions (`react-server`), and the provider initialises the package
+ // once; SSR's own code gets the `default` entry and the browser's the
+ // `browser` entry, and no client script has another environment's entry.
+ test('each environment runs its own entry of a dependency; the provider runs the handler, whether SSR or the browser calls it', async () => {
+ const server = await startRscDevServer({
+ browser: true,
+ config: {
+ // Bundled into the provider like Start's own packages are
+ // (`environments.rsc.resolve.noExternal`): in dev, Vite's module
+ // runner imports an externalised dependency natively, with Node's
+ // conditions, not the environment's.
+ environments: { rsc: { resolve: { noExternal: ['env-marker'] } } },
+ // The page imports it too: pre-bundled up front, as Vite does once
+ // a page discovers it.
+ optimizeDeps: { include: ['env-marker'] },
+ },
+ files: {
+ ...envMarkerPackage,
+ 'src/fns.ts': `import { createServerFn } from '@tanstack/react-start'
+import { where } from 'env-marker'
+export const greet = createServerFn().handler(() => where())
+`,
+ 'src/routes/index.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { useState } from 'react'
+import { where } from 'env-marker'
+import { greet } from '../fns'
+export const Route = createFileRoute('/')({
+ loader: async () => ({ own: where(), provider: await greet() }),
+ component: Page,
+})
+function Page() {
+ const data = Route.useLoaderData()
+ const [called, setCalled] = useState('')
+ const [browser, setBrowser] = useState('')
+ return (
+
+ ssr {data.own} provider {data.provider}
+ called {called}
+ browser {browser}
+ greet().then(setCalled)}>call
+ setBrowser(where())}>where
+
+ )
+}
+`,
+ },
+ })
+ const browser = await openRscPage(server, '/')
+ await browser.waitForText('ssr MARK_DEFAULT provider MARK_REACT_SERVER:1', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(browser)
+ await callFromPage(browser, 'called MARK_REACT_SERVER:1')
+ await browser.page.locator('[data-testid=where]').click()
+ await browser.waitForText('browser MARK_BROWSER', {
+ selector: '[data-testid=browser]',
+ })
+
+ // What the browser loaded as code (not the server fn answers)
+ const scripts = await browser.page.evaluate(() =>
+ performance
+ .getEntriesByType('resource')
+ .filter(
+ (entry) =>
+ !['fetch', 'xmlhttprequest'].includes(
+ (entry as PerformanceResourceTiming).initiatorType,
+ ),
+ )
+ .map((entry) => new URL(entry.name).pathname),
+ )
+ const leaks: Array = []
+ for (const script of scripts) {
+ const { body } = await server.fetch(script)
+ if (/MARK_REACT_SERVER|MARK_DEFAULT/.test(body)) {
+ leaks.push(script)
+ }
+ }
+ // The check covers the dependency's browser entry
+ expect(scripts.some((script) => script.includes('env-marker'))).toBe(true)
+ expect(leaks).toEqual([])
+ expect(browser.errors).toEqual([])
+ })
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-hmr-page.ts b/packages/react-start-rsc/tests/integration/rsc-start-hmr-page.ts
new file mode 100644
index 0000000000..c796987981
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-hmr-page.ts
@@ -0,0 +1,31 @@
+/**
+ * `/`: a server fn whose handler returns `handler`, the loader and the page
+ * calling it, the page's text `text` and a counter (component state). The
+ * call button shows `text` and the answer, so a call from an edited
+ * component is told apart from the answer the kept state shows.
+ */
+export const route = (
+ handler: string,
+ text: string,
+) => `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+import { useState } from 'react'
+const getLabel = createServerFn().handler(() => '${handler}')
+export const Route = createFileRoute('/')({
+ loader: () => getLabel(),
+ component: Page,
+})
+function Page() {
+ const label = Route.useLoaderData()
+ const [called, setCalled] = useState('')
+ const [count, setCount] = useState(0)
+ return (
+
+ ${text} {label}
+ called {called}
+ getLabel().then((answer) => setCalled('${text} ' + answer))}>call
+ setCount(count + 1)}>count {count}
+
+ )
+}
+`
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-hmr-rsbuild.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-hmr-rsbuild.test.ts
new file mode 100644
index 0000000000..3921d08de5
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-hmr-rsbuild.test.ts
@@ -0,0 +1,60 @@
+import { pluginReact } from '@rsbuild/plugin-react'
+import { describe, expect, test } from 'vitest'
+import {
+ openRscPage,
+ startRscRsbuildDevServer,
+ waitForHydration,
+} from './rsc-app'
+import { callFromPage } from './rsc-start-page'
+import { route } from './rsc-start-hmr-page'
+
+describe('Rsbuild dev: edits with a separate RSC provider (SPEC J3.6)', () => {
+ // The Vite test above on Start's Rsbuild RSC layer, with React Refresh
+ // from `@rsbuild/plugin-react`, in the same order in one session: editing
+ // the handler makes the next call run the new code and the client output
+ // never has it; editing the component then hot-updates the page, keeping
+ // its state; no full reload either way, and the server fn still answers.
+ // Source: #7618 (SPEC J3.6).
+ test('a handler edit reaches the next call and a component edit hot-updates, keeping the state, without a full reload', async () => {
+ const server = await startRscRsbuildDevServer({
+ browser: true,
+ hmr: true,
+ config: { plugins: [pluginReact()] },
+ files: { 'src/routes/index.tsx': route('MARK_HANDLER_V1', 'Page v1') },
+ })
+ expect(server.errors).toEqual([])
+ const browser = await openRscPage(server, '/')
+ await browser.waitForText('Page v1 MARK_HANDLER_V1')
+ await waitForHydration(browser)
+ await browser.page.locator('[data-testid=count]').click()
+ await browser.page.locator('[data-testid=count]').click()
+ await browser.waitForText('count 2')
+ await callFromPage(browser, 'called Page v1 MARK_HANDLER_V1')
+
+ // The handler
+ await server.edit({
+ 'src/routes/index.tsx': route('MARK_HANDLER_V2', 'Page v1'),
+ })
+ expect(server.errors).toEqual([])
+ await callFromPage(browser, 'called Page v1 MARK_HANDLER_V2')
+ expect(browser.loads()).toBe(1)
+ // The client's output of the route never has the handler (J4.12)
+ const client = [
+ ...Object.values(await server.outputs('client')),
+ ...Object.values(await server.hotUpdates('client')),
+ ].join('\n')
+ expect(client).not.toContain('MARK_HANDLER_V2')
+
+ // The component
+ await server.edit({
+ 'src/routes/index.tsx': route('MARK_HANDLER_V2', 'Page v2'),
+ })
+ expect(server.errors).toEqual([])
+ await browser.waitForText('Page v2', { selector: '[data-testid=text]' })
+ expect(await browser.text('[data-testid=count]')).toBe('count 2')
+ await callFromPage(browser, 'called Page v2 MARK_HANDLER_V2')
+
+ expect(browser.loads()).toBe(1)
+ expect(browser.errors).toEqual([])
+ })
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-hmr.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-hmr.test.ts
new file mode 100644
index 0000000000..d95248772b
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-hmr.test.ts
@@ -0,0 +1,68 @@
+/**
+ * Edits with a separate server function provider (SPEC J3.6): a
+ * React Start app with RSC enabled on a Vite dev server, or on an Rsbuild
+ * dev server with React Refresh from `@rsbuild/plugin-react` (`rsc-app.ts`),
+ * a route module that also declares the server function its loader and page
+ * call, and a real page. Outcomes only: what the page shows, what the next
+ * call answers, whether the page reloaded. A handler edit that also changes
+ * what the loader shows on Rsbuild is in rsc-start-rsbuild.test.ts.
+ */
+import { describe, expect, test } from 'vitest'
+import { describeHmr } from '@tanstack/compiler-test-utils/dev-server'
+import { openRscPage, startRscDevServer, waitForHydration } from './rsc-app'
+import { callFromPage } from './rsc-start-page'
+import { route } from './rsc-start-hmr-page'
+import type { DevServer } from '@tanstack/compiler-test-utils/dev-server'
+
+/** The HMR messages telling the client to reload the page. */
+const fullReloads = (server: DevServer) =>
+ describeHmr(
+ server.hmr.filter(
+ (message) =>
+ message.environment === 'client' && message.type === 'full-reload',
+ ),
+ )
+
+describe('Vite dev: edits with a separate RSC provider (SPEC J3.6)', () => {
+ // A route module that also declares a server function: editing the
+ // handler makes the next call run the new code; editing the component
+ // hot-updates the page, keeping its state, and the server fn still
+ // answers; no full reload either way (SPEC J3.6, G10).
+ // Source: #7618.
+ test('a handler edit reaches the next call and a component edit hot-updates, without a full reload', async () => {
+ const server = await startRscDevServer({
+ browser: true,
+ files: { 'src/routes/index.tsx': route('MARK_HANDLER_V1', 'Page v1') },
+ })
+ const browser = await openRscPage(server, '/')
+ await browser.waitForText('Page v1 MARK_HANDLER_V1')
+ await waitForHydration(browser)
+ await browser.page.locator('[data-testid=count]').click()
+ await browser.page.locator('[data-testid=count]').click()
+ await browser.waitForText('count 2')
+ await callFromPage(browser, 'called Page v1 MARK_HANDLER_V1')
+
+ // The handler
+ await server.write({
+ 'src/routes/index.tsx': route('MARK_HANDLER_V2', 'Page v1'),
+ })
+ await callFromPage(browser, 'called Page v1 MARK_HANDLER_V2')
+ expect(fullReloads(server)).toEqual([])
+ // The client's module of the route never has the handler (J4.12)
+ expect(
+ await server.transform('/src/routes/index.tsx', 'client'),
+ ).not.toContain('MARK_HANDLER_V2')
+
+ // The component
+ await server.write({
+ 'src/routes/index.tsx': route('MARK_HANDLER_V2', 'Page v2'),
+ })
+ await browser.waitForText('Page v2', { selector: '[data-testid=text]' })
+ expect(await browser.text('[data-testid=count]')).toBe('count 2')
+ await callFromPage(browser, 'called Page v2 MARK_HANDLER_V2')
+
+ expect(browser.loads()).toBe(1)
+ expect(fullReloads(server)).toEqual([])
+ expect(browser.errors).toEqual([])
+ })
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-nested-fns.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-nested-fns.test.ts
new file mode 100644
index 0000000000..cf1e3baddd
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-nested-fns.test.ts
@@ -0,0 +1,172 @@
+/**
+ * A server fn created inside a function (SPEC J4.6) with a separate
+ * provider (Vite's `rsc` environment, Rsbuild's RSC layer): hoisted into the
+ * provider when its chain captures nothing of the enclosing function, so the
+ * function runs in every environment and the handler runs in the provider;
+ * a capture is a positioned compile error in every environment.
+ */
+import { describe, expect, test } from 'vitest'
+import {
+ diagnosticsOf,
+ expectDiagnostic,
+} from '@tanstack/compiler-test-utils/diagnostics'
+import {
+ openRscPage,
+ startRscDevServer,
+ startRscRsbuildDevServer,
+ waitForHydration,
+} from './rsc-app'
+
+/** `make()` creates a server fn whose chain reads module bindings only. */
+const hoistable = `import { createServerFn } from '@tanstack/react-start'
+import { secret } from './secret'
+const METHOD = 'POST'
+export function make() {
+ const fn = createServerFn({ method: METHOD }).handler(async () => secret())
+ return fn
+}
+`
+
+/** Chains capturing a binding of the enclosing function, and where. */
+const capturing = [
+ {
+ name: 'a parameter in the handler',
+ code: `import { createServerFn } from '@tanstack/react-start'
+import { secret } from './secret'
+export function make(id: string) {
+ const fn = createServerFn().handler(async () => secret(id))
+ return fn
+}
+`,
+ at: 'id))',
+ },
+ {
+ name: 'a local const in the handler',
+ code: `import { createServerFn } from '@tanstack/react-start'
+import { secret } from './secret'
+export function make() {
+ const scope = 'a'
+ const fn = createServerFn().handler(async () => secret(scope))
+ return fn
+}
+`,
+ at: 'scope))',
+ },
+ {
+ name: 'a hook result in the handler',
+ code: `import { createServerFn } from '@tanstack/react-start'
+import { useState } from 'react'
+import { secret } from './secret'
+export function Comp() {
+ const [count] = useState('a')
+ const fn = createServerFn().handler(async () => secret(count))
+ return fn
+}
+`,
+ at: 'count))',
+ },
+]
+
+const files = {
+ 'src/secret.ts': `export const secret = (x = 'MARK_NESTED') => x\n`,
+ 'src/fns.ts': hoistable,
+ 'src/routes/index.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { make } from '../fns'
+export const Route = createFileRoute('/')({
+ loader: () => make()(),
+ component: Page,
+})
+function Page() {
+ return loaded {Route.useLoaderData()}
+}
+`,
+}
+
+/** 1-based line and column of `at` in `code`. */
+function positionOf(code: string, at: string) {
+ const offset = code.indexOf(at)
+ expect(offset, `${at} in the source`).toBeGreaterThanOrEqual(0)
+ const before = code.slice(0, offset)
+ const line = before.split('\n').length
+ return { line, column: offset - before.lastIndexOf('\n') }
+}
+
+describe('Vite dev with a separate RSC provider', () => {
+ test('a server fn nested in a function runs in every environment when its chain captures nothing', async () => {
+ const server = await startRscDevServer({ browser: true, files })
+ // the `rsc` environment evaluates the module and the function (the
+ // factory, the options and the stub it reads stay with the chain)
+ const inProvider = await server.import('/src/fns.ts', 'rsc')
+ expect(typeof inProvider.make()).toBe('function')
+ const inSsr = await server.import('/src/fns.ts', 'ssr')
+ expect(typeof inSsr.make()).toBe('function')
+ const page = await openRscPage(server, '/')
+ await page.waitForText('loaded MARK_NESTED', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ expect(page.errors).toEqual([])
+ const client = await server.transform('/src/fns.ts', 'client')
+ expect(client).not.toContain('MARK_NESTED')
+ expect(client).not.toContain('./secret')
+ })
+
+ test.each(capturing)(
+ 'a server fn nested in a function capturing $name is a compile error in every environment',
+ async ({ code, at }) => {
+ const server = await startRscDevServer({
+ files: { ...files, 'src/fns.ts': code },
+ })
+ const position = positionOf(code, at)
+ for (const environment of ['client', 'ssr', 'rsc']) {
+ const mark = server.diagnostics.length
+ const thrown = await server.transform('/src/fns.ts', environment).then(
+ () => undefined,
+ (error: unknown) => error,
+ )
+ expect(thrown, `${environment} serves the module`).toBeDefined()
+ expectDiagnostic(
+ [...diagnosticsOf(thrown), ...server.diagnostics.slice(mark)],
+ {
+ severity: 'error',
+ file: 'src/fns.ts',
+ root: server.root,
+ position,
+ },
+ )
+ }
+ },
+ )
+})
+
+describe('Rsbuild dev with an RSC layer', () => {
+ test('a server fn nested in a function runs when its chain captures nothing, and a capture is a compile error', async () => {
+ const server = await startRscRsbuildDevServer({ browser: true, files })
+ expect(server.errors).toEqual([])
+ const page = await openRscPage(server, '/')
+ await page.waitForText('loaded MARK_NESTED', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ expect(page.errors).toEqual([])
+ const client = Object.values(await server.outputs('client')).join('\n')
+ expect(client).not.toContain('MARK_NESTED')
+
+ for (const { code, at } of capturing) {
+ const mark = server.diagnostics.length
+ const thrown = await server.edit({ 'src/fns.ts': code }).then(
+ () => undefined,
+ (error: unknown) => error,
+ )
+ expectDiagnostic(
+ [...diagnosticsOf(thrown), ...server.diagnostics.slice(mark)],
+ {
+ severity: 'error',
+ file: 'src/fns.ts',
+ root: server.root,
+ position: positionOf(code, at),
+ },
+ )
+ }
+ })
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-page.ts b/packages/react-start-rsc/tests/integration/rsc-start-page.ts
new file mode 100644
index 0000000000..7ccdbd34c8
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-page.ts
@@ -0,0 +1,32 @@
+import type { BrowserPage } from '@tanstack/compiler-test-utils/browser'
+
+/**
+ * A dependency whose entry differs by export condition: the environment a
+ * handler runs in shows in what it imports.
+ */
+export const envMarkerPackage = {
+ 'node_modules/env-marker/package.json': JSON.stringify({
+ name: 'env-marker',
+ type: 'module',
+ exports: {
+ '.': {
+ 'react-server': './react-server.js',
+ browser: './browser.js',
+ default: './default.js',
+ },
+ },
+ }),
+ // Counts its initialisations (all environments of a Vite dev server run
+ // in the test process).
+ 'node_modules/env-marker/react-server.js': `globalThis.__envMarkerInits = (globalThis.__envMarkerInits ?? 0) + 1
+export const where = () => 'MARK_REACT_SERVER:' + globalThis.__envMarkerInits
+`,
+ 'node_modules/env-marker/browser.js': `export const where = () => 'MARK_BROWSER'\n`,
+ 'node_modules/env-marker/default.js': `export const where = () => 'MARK_DEFAULT'\n`,
+}
+
+/** Clicks the page's call button and waits for the answer. */
+export async function callFromPage(browser: BrowserPage, expected: string) {
+ await browser.page.locator('[data-testid=call]').click()
+ await browser.waitForText(expected, { selector: '[data-testid=called]' })
+}
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-rsbuild-build.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-rsbuild-build.test.ts
new file mode 100644
index 0000000000..48c1169a5a
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-rsbuild-build.test.ts
@@ -0,0 +1,150 @@
+/**
+ * A production build of a React Start app with RSC enabled on Rsbuild
+ * (`rsc-app.ts`: `rsbuild build`, served by `rsbuild preview`) in a real
+ * page: a server function only its route's component calls (SPEC J4.1, J2:
+ * the component is split, the server fn's module renders on the server
+ * with its SSR stub). The dev counterpart is rsc-start-rsbuild.test.ts.
+ */
+import { afterAll, beforeAll, expect, test } from 'vitest'
+import {
+ openRscPage,
+ startRscRsbuildPreviewServer,
+ waitForHydration,
+} from './rsc-app'
+import type { RscPreviewServer } from './rsc-app'
+
+/**
+ * A server fn only server code calls (`internal`, called by `greet`'s
+ * handler) next to one the client references, and a page exposing both
+ * URLs and a caller that sends the real request envelope to a URL.
+ */
+const privateFnFiles = {
+ 'src/private/internal.ts': `import { createServerFn } from '@tanstack/react-start'
+export const internal = createServerFn().handler(() => 'MARK_INTERNAL')
+`,
+ 'src/private/fns.ts': `import { createServerFn } from '@tanstack/react-start'
+import { internal } from './internal'
+export const greet = createServerFn().handler(async () => 'MARK_GREET:' + (await internal()))
+export const urls = createServerFn().handler(() => ({ internal: internal.url }))
+`,
+ 'src/routes/private.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { greet, urls } from '../private/fns'
+export const Route = createFileRoute('/private')({
+ loader: async () => ({ label: await greet(), internalUrl: (await urls()).internal }),
+ component: Page,
+})
+if (typeof window !== 'undefined') {
+ // The public caller supplies the real request envelope; only its URL
+ // changes (no id parsing: the server decides by the id in the URL).
+ ;(window as any).callUrl = async (url: string) => {
+ let outcome: { ok: boolean; value: string } | undefined
+ let error: string | undefined
+ try {
+ const value: unknown = await greet({ fetch: async (_input, init) => {
+ const response = await fetch(url, init)
+ outcome = { ok: response.ok, value: await response.clone().text() }
+ return response
+ } } as any)
+ if (value instanceof Error) { error = String(value) }
+ } catch (thrown) {
+ if (!outcome) { throw thrown }
+ error = String(thrown)
+ }
+ return { ...outcome, error }
+ }
+}
+function Page() {
+ const data = Route.useLoaderData()
+ return (
+
+ label {data.label}
+ {JSON.stringify({ greet: greet.url, internal: data.internalUrl })}
+
+ )
+}
+`,
+}
+
+let server: RscPreviewServer & { errors: Array }
+const cleanups: Array<() => Promise> = []
+
+beforeAll(async () => {
+ server = await startRscRsbuildPreviewServer({
+ registerCleanup: (cleanup) => {
+ cleanups.push(cleanup)
+ },
+ files: {
+ ...privateFnFiles,
+ 'src/routes/component-fn.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn, useServerFn } from '@tanstack/react-start'
+import { useState } from 'react'
+const greet = createServerFn().handler(async () => 'MARK_HANDLER')
+export const Route = createFileRoute('/component-fn')({
+ component: Page,
+})
+function Page() {
+ const call = useServerFn(greet)
+ const [called, setCalled] = useState('')
+ return (
+
+ MARK_PAGE
+ called {called}
+ call().then(setCalled)}>call
+
+ )
+}
+`,
+ },
+ })
+})
+afterAll(async () => {
+ for (const cleanup of cleanups.reverse()) {
+ await cleanup()
+ }
+})
+
+// Found by the react-start/rsc e2e app (rsbuild-ssr): the SSR output named
+// the server fn's SSR stub without importing it, so every page failed.
+test("a server fn only its route's component calls renders on the server and answers the browser", async () => {
+ expect(server.errors).toEqual([])
+ const page = await openRscPage(server, '/component-fn')
+ await page.waitForText('MARK_PAGE', { selector: '[data-testid=label]' })
+ await waitForHydration(page)
+ await page.page.locator('[data-testid=call]').click()
+ await page.waitForText('called MARK_HANDLER', {
+ selector: '[data-testid=called]',
+ })
+})
+
+// SPEC J4.2: in a production build only server functions client code
+// references are callable over HTTP. `internal` is called by `greet`'s
+// handler only (a server-origin call, which works); a request by its URL
+// from the browser is refused, while the same request to `greet` answers.
+// With a separate provider the provider builds before the client, so the
+// refusal is decided where the HTTP handler runs, after the client built.
+test('a server function only server code calls is not callable from the browser', async () => {
+ const page = await openRscPage(server, '/private')
+ await page.waitForText('label MARK_GREET:MARK_INTERNAL', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ const urls = JSON.parse(await page.text('[data-testid=urls]')) as {
+ greet: string
+ internal: string
+ }
+ expect(typeof urls.internal).toBe('string')
+ const call = (url: string) =>
+ page.page.evaluate(
+ (functionUrl) => (window as any).callUrl(functionUrl),
+ url,
+ ) as Promise<{ ok?: boolean; value?: string; error?: string }>
+ // the same envelope reaches an exposed function, so a malformed request
+ // cannot masquerade as a refusal of `internal`
+ expect(await call(urls.greet)).toMatchObject({
+ ok: true,
+ value: expect.stringContaining('MARK_GREET:MARK_INTERNAL'),
+ })
+ const refused = await call(urls.internal)
+ expect(refused.ok).toBe(false)
+ expect(refused.value ?? '').not.toContain('MARK_INTERNAL')
+})
diff --git a/packages/react-start-rsc/tests/integration/rsc-start-rsbuild.test.ts b/packages/react-start-rsc/tests/integration/rsc-start-rsbuild.test.ts
new file mode 100644
index 0000000000..994d96bbf9
--- /dev/null
+++ b/packages/react-start-rsc/tests/integration/rsc-start-rsbuild.test.ts
@@ -0,0 +1,173 @@
+/**
+ * Start with RSC on Rsbuild (`rsc-app.ts`: Start's Rsbuild plugin, its RSC
+ * layer and `react-server-dom-rspack`): which entry of a dependency each
+ * environment runs (SPEC J4.3, J4.16), and an edit of a route module that
+ * declares the server function its loader and page call (SPEC J3.6). The
+ * Vite counterparts are rsc-start-dev.test.ts and rsc-start-hmr.test.ts.
+ *
+ * A component edit keeping state (the other half of J3.6, with React
+ * Refresh from `@rsbuild/plugin-react`) is in rsc-start-hmr.test.ts.
+ */
+import { afterAll, beforeAll, describe, expect, test } from 'vitest'
+import {
+ openRscPage,
+ startRscRsbuildDevServer,
+ waitForHydration,
+} from './rsc-app'
+import type { BrowserPage } from '@tanstack/compiler-test-utils/browser'
+import type { RsbuildDevServer } from '@tanstack/compiler-test-utils/rsbuild-dev-server'
+
+/** A dependency whose entry differs by export condition. */
+const envMarkerPackage = {
+ 'node_modules/env-marker/package.json': JSON.stringify({
+ name: 'env-marker',
+ type: 'module',
+ exports: {
+ '.': {
+ 'react-server': './react-server.js',
+ browser: './browser.js',
+ default: './default.js',
+ },
+ },
+ }),
+ // Counts its initialisations in the server process.
+ 'node_modules/env-marker/react-server.js': `globalThis.__envMarkerInits = (globalThis.__envMarkerInits ?? 0) + 1
+export const where = () => 'MARK_REACT_SERVER:' + globalThis.__envMarkerInits
+`,
+ 'node_modules/env-marker/browser.js': `export const where = () => 'MARK_BROWSER'\n`,
+ 'node_modules/env-marker/default.js': `export const where = () => 'MARK_DEFAULT'\n`,
+}
+
+/**
+ * `/edit`: a server fn whose handler returns `MARK_HANDLER_*`, the loader
+ * and the page calling it, and the page's label `MARK_LABEL_*`.
+ */
+const editRoute = (
+ version: string,
+) => `import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+import { useState } from 'react'
+const greet = createServerFn().handler(async () => 'MARK_HANDLER_${version}')
+export const Route = createFileRoute('/edit')({
+ loader: () => greet(),
+ component: Page,
+})
+function Page() {
+ const label = Route.useLoaderData()
+ const [called, setCalled] = useState('')
+ return (
+
+ MARK_LABEL_${version} {label}
+ called {called}
+ greet().then(setCalled)}>call
+
+ )
+}
+`
+
+/** Clicks the page's call button and waits for the answer. */
+async function callFromPage(page: BrowserPage, expected: string) {
+ await page.page.locator('[data-testid=call]').click()
+ await page.waitForText(expected, { selector: '[data-testid=called]' })
+}
+
+describe('Rsbuild dev with RSC', () => {
+ let server: RsbuildDevServer
+ const cleanups: Array<() => Promise> = []
+
+ beforeAll(async () => {
+ server = await startRscRsbuildDevServer({
+ browser: true,
+ registerCleanup: (cleanup) => {
+ cleanups.push(cleanup)
+ },
+ files: {
+ ...envMarkerPackage,
+ 'src/fns.ts': `import { createServerFn } from '@tanstack/react-start'
+import { where } from 'env-marker'
+export const greet = createServerFn().handler(() => where())
+`,
+ 'src/routes/env.tsx': `import { createFileRoute } from '@tanstack/react-router'
+import { useState } from 'react'
+import { where } from 'env-marker'
+import { greet } from '../fns'
+export const Route = createFileRoute('/env')({
+ loader: async () => ({ own: where(), provider: await greet() }),
+ component: Page,
+})
+function Page() {
+ const data = Route.useLoaderData()
+ const [called, setCalled] = useState('')
+ const [browser, setBrowser] = useState('')
+ return (
+
+ ssr {data.own} provider {data.provider}
+ called {called}
+ browser {browser}
+ greet().then(setCalled)}>call
+ setBrowser(where())}>where
+
+ )
+}
+`,
+ 'src/routes/edit.tsx': editRoute('V1'),
+ },
+ })
+ })
+ afterAll(async () => {
+ for (const cleanup of cleanups.reverse()) {
+ await cleanup()
+ }
+ })
+
+ // J4.3, J4.16: the provider runs the handler with `react-server` and
+ // initialises the package once, whether SSR or the browser calls it; SSR's
+ // own code gets `default`, the browser `browser`, and the client output
+ // has no other environment's entry.
+ test('each environment runs its own entry of a dependency; the provider runs the handler', async () => {
+ expect(server.errors).toEqual([])
+ const page = await openRscPage(server, '/env')
+ await page.waitForText('ssr MARK_DEFAULT provider MARK_REACT_SERVER:1', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ await callFromPage(page, 'called MARK_REACT_SERVER:1')
+ await page.page.locator('[data-testid=where]').click()
+ await page.waitForText('browser MARK_BROWSER', {
+ selector: '[data-testid=browser]',
+ })
+ const client = Object.values(await server.outputs('client')).join('\n')
+ expect({
+ browser: client.includes('MARK_BROWSER'),
+ server: /MARK_REACT_SERVER|MARK_DEFAULT/.test(client),
+ }).toEqual({ browser: true, server: false })
+ expect(page.errors).toEqual([])
+ })
+
+ // J3.6 (#7618) on Rsbuild's RSC layer: after an edit of
+ // the handler of a route module's server fn, the page applies the hot
+ // update (its loader runs the new handler) and the next call runs it,
+ // without a full reload; the client's hot update never has the handler.
+ test('a handler edit reaches the loader and the next call, without a full reload', async () => {
+ const page = await openRscPage(server, '/edit')
+ await page.waitForText('MARK_LABEL_V1 MARK_HANDLER_V1', {
+ selector: '[data-testid=label]',
+ })
+ await waitForHydration(page)
+ await callFromPage(page, 'called MARK_HANDLER_V1')
+
+ await server.edit({ 'src/routes/edit.tsx': editRoute('V2') })
+ expect(server.errors).toEqual([])
+ await page.waitForText('MARK_HANDLER_V2', {
+ selector: '[data-testid=label]',
+ })
+ await callFromPage(page, 'called MARK_HANDLER_V2')
+ expect(page.loads()).toBe(1)
+ const update = Object.values(await server.hotUpdates('client')).join('\n')
+ expect({
+ label: update.includes('MARK_LABEL_V2'),
+ handler: update.includes('MARK_HANDLER_V2'),
+ }).toEqual({ label: true, handler: false })
+ expect(page.errors).toEqual([])
+ })
+})
diff --git a/packages/react-start-rsc/tests/noncompiler-tests.json b/packages/react-start-rsc/tests/noncompiler-tests.json
new file mode 100644
index 0000000000..58b94ac648
--- /dev/null
+++ b/packages/react-start-rsc/tests/noncompiler-tests.json
@@ -0,0 +1,10 @@
+[
+ "ClientSlot.test.tsx",
+ "CompositeComponent.types.test-d.tsx",
+ "ReplayableStream.test.ts",
+ "ServerComponent.test.tsx",
+ "SlotContext.test.tsx",
+ "createRscProxy.test.tsx",
+ "createServerComponent.test-d.tsx",
+ "renderServerComponent.types.test-d.tsx"
+]
diff --git a/packages/react-start-rsc/tests/rscCssTransform.test.tsx b/packages/react-start-rsc/tests/rscCssTransform.test.tsx
deleted file mode 100644
index afc4686e94..0000000000
--- a/packages/react-start-rsc/tests/rscCssTransform.test.tsx
+++ /dev/null
@@ -1,215 +0,0 @@
-import { describe, expect, test } from 'vitest'
-import {
- StartCompiler,
- detectKindsInCode,
- getLookupKindsForEnv,
-} from '../../start-plugin-core/src/start-compiler/compiler'
-import { getLookupConfigurationsForEnv } from '../../start-plugin-core/src/start-compiler/config'
-import { createRscCssCompilerTransforms } from '../src/plugin/rscCssTransform'
-import type { StartCompilerImportTransform } from '../../start-plugin-core/src/types'
-
-const TSS_SERVERFN_SPLIT_PARAM = 'tss-serverfn-split'
-
-async function compileWithRscCssTransform(opts: {
- code: string
- id?: string | undefined
- loadCssExpression?: string | undefined
- serverFnProviderOnly?: boolean | undefined
-}) {
- const compilerTransforms = createRscCssCompilerTransforms({
- loadCssExpression:
- opts.loadCssExpression ?? 'import.meta.viteRsc.loadCss()',
- serverFnProviderOnly: opts.serverFnProviderOnly,
- })
-
- const compiler = new StartCompiler({
- env: 'server',
- envName: 'rsc',
- root: '/test',
- framework: 'react',
- providerEnvName: 'rsc',
- mode: 'build',
- lookupKinds: getLookupKindsForEnv('server', { compilerTransforms }),
- lookupConfigurations: getLookupConfigurationsForEnv('server', 'react', {
- compilerTransforms,
- }),
- compilerTransforms,
- getKnownServerFns: () => ({}),
- loadModule: async () => {},
- resolveId: async (id) => id,
- })
-
- const result = await compiler.compile({
- id: opts.id ?? '/test/src/route.tsx',
- code: opts.code,
- detectedKinds: detectKindsInCode(opts.code, 'server', {
- compilerTransforms,
- }),
- })
-
- return result?.code ?? null
-}
-
-describe('RSC CSS compiler transforms', () => {
- test('injects Vite CSS resources into all supported RSC render APIs', async () => {
- const code = await compileWithRscCssTransform({
- code: `
- import {
- createCompositeComponent,
- renderServerComponent,
- renderToReadableStream,
- } from '@tanstack/react-start/rsc'
-
- export const renderable = renderServerComponent( )
- export const composite = createCompositeComponent(() => ({
- Card: ,
- }))
- export const stream = renderToReadableStream( )
- `,
- })
-
- expect(code).toMatchInlineSnapshot(`
- "import { createCompositeComponent, renderServerComponent, renderToReadableStream } from '@tanstack/react-start/rsc';
- export const renderable = renderServerComponent( , {
- __tanstackStartRscCss: import.meta.viteRsc.loadCss()
- });
- export const composite = createCompositeComponent(() => ({
- Card:
- }), {
- __tanstackStartRscCss: import.meta.viteRsc.loadCss()
- });
- export const stream = renderToReadableStream(<>{import.meta.viteRsc.loadCss()} >);"
- `)
- })
-
- test('does not rewrite calls outside the transform constraints', async () => {
- const code = await compileWithRscCssTransform({
- code: `
- import {
- renderServerComponent,
- renderToReadableStream,
- } from '@tanstack/react-start/rsc'
-
- const node =
- export const existingOptions = renderServerComponent( , {
- alreadyConfigured: true,
- })
- export const nonJsxStream = renderToReadableStream(node)
- `,
- })
-
- expect(code).toMatchInlineSnapshot(`
- "import { renderServerComponent, renderToReadableStream } from '@tanstack/react-start/rsc';
- const node = ;
- export const existingOptions = renderServerComponent( , {
- alreadyConfigured: true
- });
- export const nonJsxStream = renderToReadableStream(node);"
- `)
- })
-
- test('honors provider-only transforms for Rsbuild', async () => {
- const source = `
- import { renderServerComponent } from '@tanstack/react-start/rsc'
-
- export const renderable = renderServerComponent( )
- `
-
- const callerCode = await compileWithRscCssTransform({
- code: source,
- loadCssExpression: 'import.meta.rspackRsc.loadCss()',
- serverFnProviderOnly: true,
- })
-
- const providerCode = await compileWithRscCssTransform({
- code: source,
- id: `/test/src/route.tsx?${TSS_SERVERFN_SPLIT_PARAM}`,
- loadCssExpression: 'import.meta.rspackRsc.loadCss()',
- serverFnProviderOnly: true,
- })
-
- expect({ callerCode, providerCode }).toMatchInlineSnapshot(`
- {
- "callerCode": "import { renderServerComponent } from '@tanstack/react-start/rsc';
- export const renderable = renderServerComponent( );",
- "providerCode": "import { renderServerComponent } from '@tanstack/react-start/rsc';
- export const renderable = renderServerComponent( , {
- __tanstackStartRscCss: import.meta.rspackRsc.loadCss()
- });",
- }
- `)
- })
-
- test('detects transform imports without enabling them outside server builds', () => {
- const compilerTransforms: Array =
- createRscCssCompilerTransforms({
- loadCssExpression: 'import.meta.viteRsc.loadCss()',
- })
-
- const code = `
- import { renderServerComponent } from '@tanstack/react-start/rsc'
- export const renderable = renderServerComponent( )
- `
-
- expect(detectKindsInCode(code, 'server', { compilerTransforms }))
- .toMatchInlineSnapshot(`
- Set {
- "External:react-rsc-render-server-component-css",
- }
- `)
- expect(
- detectKindsInCode(code, 'client', { compilerTransforms }),
- ).toMatchInlineSnapshot(`Set {}`)
- })
-
- test('rewrites render APIs imported from @tanstack/react-start-rsc', async () => {
- const code = await compileWithRscCssTransform({
- code: `
- import { renderServerComponent } from '@tanstack/react-start-rsc'
-
- export const renderable = renderServerComponent( )
- `,
- })
-
- expect(code).toContain(
- '__tanstackStartRscCss: import.meta.viteRsc.loadCss()',
- )
- })
-
- test.each([
- { wrapped: '( )', bare: ' ' },
- { wrapped: ' as any', bare: ' ' },
- { wrapped: ' !', bare: ' ' },
- { wrapped: '(<> >) satisfies unknown', bare: '<> >' },
- ])(
- 'streams $wrapped like the bare JSX it wraps',
- async ({ wrapped, bare }) => {
- const compileStream = (element: string) =>
- compileWithRscCssTransform({
- code: `
- import { renderToReadableStream } from '@tanstack/react-start/rsc'
-
- export const stream = renderToReadableStream(${element})
- `,
- })
-
- const bareCode = await compileStream(bare)
- expect(bareCode).toContain('import.meta.viteRsc.loadCss()')
- expect(await compileStream(wrapped)).toBe(bareCode)
- },
- )
-
- test('does not stream JSX that is not the whole argument', async () => {
- const code = await compileWithRscCssTransform({
- code: `
- import { renderToReadableStream } from '@tanstack/react-start/rsc'
-
- export const conditional = renderToReadableStream(flag ? : )
- export const spread = renderToReadableStream(...args)
- `,
- })
-
- expect(code).toContain('renderToReadableStream(...args)')
- expect(code).not.toContain('loadCss')
- })
-})
diff --git a/packages/react-start-rsc/tests/tsconfig.json b/packages/react-start-rsc/tests/tsconfig.json
new file mode 100644
index 0000000000..2d0e6a5f58
--- /dev/null
+++ b/packages/react-start-rsc/tests/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "target": "esnext",
+ "types": ["node"]
+ },
+ "include": ["integration", "../src/**/*.d.ts"]
+}
diff --git a/packages/react-start-rsc/vite.config.ts b/packages/react-start-rsc/vite.config.ts
index c8dfcf917b..a495d6982e 100644
--- a/packages/react-start-rsc/vite.config.ts
+++ b/packages/react-start-rsc/vite.config.ts
@@ -1,8 +1,23 @@
-import { defineConfig, mergeConfig } from 'vitest/config'
+import path from 'node:path'
+import os from 'node:os'
+import { configDefaults, defineConfig, mergeConfig } from 'vitest/config'
import { tanstackViteConfig } from '@tanstack/vite-config'
import react from '@vitejs/plugin-react'
import { copyFilesPlugin } from '@tanstack/router-utils'
import packageJson from './package.json'
+// Main's runtime tests (RSC components, streams, the proxy, and the types of
+// the public API), at main's paths and unchanged: `test:noncompiler` runs
+// them; the compiler projects leave them out. Paths relative to `tests/`.
+import noncompilerTests from './tests/noncompiler-tests.json' with { type: 'json' }
+
+// Under Vitest: Node's compile cache for the test workers. No outcome
+// change; less time compiling the bundlers and the built apps again.
+if (process.env.VITEST) {
+ process.env.NODE_COMPILE_CACHE ??= path.join(
+ os.tmpdir(),
+ 'node-compile-cache',
+ )
+}
const config = defineConfig({
resolve: {
@@ -19,11 +34,62 @@ const config = defineConfig({
}),
],
test: {
- include: ['**/*.{test-d,test,spec}.?(c|m)[jt]s?(x)'],
name: packageJson.name,
watch: false,
- environment: 'jsdom',
- setupFiles: ['./tests/setup.ts'],
+ // At most 4 test processes per Vitest run: each
+ // runs real bundlers, dev servers and its own browser, and Nx runs several
+ // packages' tiers at once. More workers add swap and load flakes, not
+ // speed. `--maxWorkers` on the command line still overrides it.
+ maxWorkers: 4,
+ reporters: ['default', '@tanstack/compiler-test-utils/budget-reporter'],
+ globalSetup: ['@tanstack/compiler-test-utils/run-directory'],
+ setupFiles: ['@tanstack/compiler-test-utils/pins-setup'],
+ projects: [
+ {
+ // Fast compiler acceptance tier; real apps run in integration.
+ // Runtime coverage is selected by test:noncompiler below.
+ extends: true,
+ test: {
+ name: 'unit',
+ include: ['**/*.{test,spec}.?(c|m)[jt]s?(x)'],
+ exclude: [
+ ...configDefaults.exclude,
+ 'tests/integration/**',
+ ...noncompilerTests.map((file) => `tests/${file}`),
+ ],
+ environment: 'jsdom',
+ setupFiles: ['./tests/setup.ts'],
+ },
+ },
+ {
+ extends: true,
+ test: {
+ name: 'noncompiler',
+ dir: './tests',
+ include: noncompilerTests,
+ environment: 'jsdom',
+ setupFiles: ['./tests/setup.ts'],
+ },
+ },
+ {
+ // Slow tier (`test:integration`): real Start apps with RSC on Vite
+ // and Rsbuild dev servers and builds, and real browser pages. Its
+ // Nx target builds `@tanstack/react-start` first.
+ extends: true,
+ test: {
+ name: 'integration',
+ include: ['tests/integration/**/*.test.ts?(x)'],
+ environment: 'node',
+ // The dev servers and their module runners run in the test
+ // process, and `vite dev` runs with `development`: Vitest's `test`
+ // would be baked into the served client code (e.g. the RSC HMR
+ // client is set up under `development` only).
+ env: { NODE_ENV: 'development' },
+ testTimeout: 60_000,
+ hookTimeout: 60_000,
+ },
+ },
+ ],
},
})
@@ -36,7 +102,6 @@ export default mergeConfig(
'./src/index.rsc.ts',
'./src/serialization.client.ts',
'./src/serialization.server.ts',
- './src/plugin/rscCssTransform.ts',
'./src/plugin/vite.ts',
'./src/entry/rsc.tsx',
'./src/rsbuild/ssr-decode.ts',
diff --git a/packages/react-start/CHANGELOG.md b/packages/react-start/CHANGELOG.md
index 9d6432f985..0d58efb4fb 100644
--- a/packages/react-start/CHANGELOG.md
+++ b/packages/react-start/CHANGELOG.md
@@ -1,25 +1,5 @@
# @tanstack/react-start
-## 1.169.6
-
-### Patch Changes
-
-- Updated dependencies [[`3f22686`](https://github.com/TanStack/router/commit/3f226869e0af211ff7f1de5d7343e43462dbb101), [`559c7de`](https://github.com/TanStack/router/commit/559c7ded6e2a6eeda3f91c80d8c03f4cfeb9a206)]:
- - @tanstack/start-plugin-core@1.171.57
- - @tanstack/react-start-rsc@0.1.67
-
-## 1.169.5
-
-### Patch Changes
-
-- [#8863](https://github.com/TanStack/router/pull/8863) [`01fab5a`](https://github.com/TanStack/router/commit/01fab5a6c8aed70d61d82c64bc344cbac66c240c) - The Rsbuild plugin keeps the app's `server.compress` setting instead of always setting it to `false`. Compression stays off by default: a compressed streamed page reaches the browser only once the stream ends. The optional `@rsbuild/core` peer is now `^2.0.5`, the first version whose compression keeps SSR response headers intact.
-
-- Updated dependencies [[`446ce1b`](https://github.com/TanStack/router/commit/446ce1b30650d85f1fc78f2d1ee42712e40b75c6), [`ff157f0`](https://github.com/TanStack/router/commit/ff157f0079982e90d62be7fdeecfb77e4fdcec69), [`01fab5a`](https://github.com/TanStack/router/commit/01fab5a6c8aed70d61d82c64bc344cbac66c240c), [`c5320d7`](https://github.com/TanStack/router/commit/c5320d7ca23eca82d720ac5629d2bad5cf7d9b02), [`545a8d3`](https://github.com/TanStack/router/commit/545a8d3790989ca502153c3292c6b1e8063257f4), [`da8c28c`](https://github.com/TanStack/router/commit/da8c28c498230a5730ce75b2693baeeb3ef68ac1), [`d66a84b`](https://github.com/TanStack/router/commit/d66a84ba0a74ffd03e22b57ccd90796274c96244)]:
- - @tanstack/router-utils@1.163.0
- - @tanstack/start-plugin-core@1.171.56
- - @tanstack/react-start-client@1.168.45
- - @tanstack/react-start-rsc@0.1.66
-
## 1.169.4
### Patch Changes
diff --git a/packages/react-start/package.json b/packages/react-start/package.json
index 6d51a4c6d0..02718a80fb 100644
--- a/packages/react-start/package.json
+++ b/packages/react-start/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/react-start",
- "version": "1.169.6",
+ "version": "1.169.4",
"description": "Modern and scalable routing for React applications",
"author": "Tanner Linsley",
"license": "MIT",
@@ -171,7 +171,7 @@
"pathe": "catalog:"
},
"peerDependencies": {
- "@rsbuild/core": "^2.0.5",
+ "@rsbuild/core": "^2.0.0",
"react": ">=18.0.0 || >=19.0.0",
"react-dom": ">=18.0.0 || >=19.0.0",
"vite": ">=8.0.0"
diff --git a/packages/react-start/src/plugin/rsbuild.ts b/packages/react-start/src/plugin/rsbuild.ts
index 7e0fcbb6c2..f33697228a 100644
--- a/packages/react-start/src/plugin/rsbuild.ts
+++ b/packages/react-start/src/plugin/rsbuild.ts
@@ -2,7 +2,6 @@ import {
RSBUILD_ENVIRONMENT_NAMES,
tanStackStartRsbuild,
} from '@tanstack/start-plugin-core/rsbuild'
-import { createRscCssCompilerTransforms } from '@tanstack/react-start-rsc/plugin/rscCssTransform'
import { reactStartDefaultEntryPaths } from './shared'
import type {
TanStackStartRsbuildInputConfig,
@@ -29,10 +28,7 @@ export function tanstackStart(
providerEnvironmentName: rscConfig.providerEnvironmentName,
ssrIsProvider: false,
serializationAdapters: rscConfig.serializationAdapters,
- compilerTransforms: rscConfig.compilerTransforms,
- serverFnProviderModuleDirectives:
- rscConfig.serverFnProviderModuleDirectives,
- rsc: true,
+ rsc: rscConfig.rsc,
}
}
@@ -51,8 +47,7 @@ export function tanstackStart(
function configureRscRsbuild(): {
providerEnvironmentName: TanStackStartRsbuildPluginCoreOptions['providerEnvironmentName']
serializationAdapters: TanStackStartRsbuildPluginCoreOptions['serializationAdapters']
- compilerTransforms: TanStackStartRsbuildPluginCoreOptions['compilerTransforms']
- serverFnProviderModuleDirectives: TanStackStartRsbuildPluginCoreOptions['serverFnProviderModuleDirectives']
+ rsc: NonNullable
} {
return {
providerEnvironmentName: RSBUILD_ENVIRONMENT_NAMES.server,
@@ -70,10 +65,9 @@ function configureRscRsbuild(): {
},
},
],
- compilerTransforms: createRscCssCompilerTransforms({
+ rsc: {
loadCssExpression: 'import.meta.rspackRsc.loadCss()',
- serverFnProviderOnly: true,
- }),
- serverFnProviderModuleDirectives: ['use server-entry'],
+ providerDirective: 'use server-entry',
+ },
}
}
diff --git a/packages/react-start/src/plugin/vite.ts b/packages/react-start/src/plugin/vite.ts
index 8849f39ea6..a745ce2539 100644
--- a/packages/react-start/src/plugin/vite.ts
+++ b/packages/react-start/src/plugin/vite.ts
@@ -45,7 +45,7 @@ export function tanstackStart(
ssrIsProvider: false,
ssrResolverStrategy: rscConfig.ssrResolverStrategy,
serializationAdapters: rscConfig.serializationAdapters,
- compilerTransforms: rscConfig.compilerTransforms,
+ rsc: rscConfig.rsc,
}
}
return [
diff --git a/packages/router-cli/CHANGELOG.md b/packages/router-cli/CHANGELOG.md
index 67101c3e51..da9aee065c 100644
--- a/packages/router-cli/CHANGELOG.md
+++ b/packages/router-cli/CHANGELOG.md
@@ -1,16 +1,5 @@
# @tanstack/router-cli
-## 1.168.0
-
-### Minor Changes
-
-- [#8855](https://github.com/TanStack/router/pull/8855) [`446ce1b`](https://github.com/TanStack/router/commit/446ce1b30650d85f1fc78f2d1ee42712e40b75c6) - Require Node `^20.19.0 || >=22.12.0` (was `>=20.19`), so the CommonJS builds can load ESM-only dependencies through `require(esm)`. Node 21 and Node 22.0–22.11 do not enable it by default, so they are no longer supported.
-
-### Patch Changes
-
-- Updated dependencies [[`446ce1b`](https://github.com/TanStack/router/commit/446ce1b30650d85f1fc78f2d1ee42712e40b75c6), [`ad5b3b7`](https://github.com/TanStack/router/commit/ad5b3b7a0990eed7351d672ea6695d341108e0d6)]:
- - @tanstack/router-generator@1.168.0
-
## 1.167.46
### Patch Changes
diff --git a/packages/router-cli/package.json b/packages/router-cli/package.json
index 51a729d79b..ba4ceb2534 100644
--- a/packages/router-cli/package.json
+++ b/packages/router-cli/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/router-cli",
- "version": "1.168.0",
+ "version": "1.167.46",
"description": "Modern and scalable routing for React applications",
"author": "Tanner Linsley",
"license": "MIT",
diff --git a/packages/router-cli/src/watch.ts b/packages/router-cli/src/watch.ts
index bf165a374b..afee8ea26d 100644
--- a/packages/router-cli/src/watch.ts
+++ b/packages/router-cli/src/watch.ts
@@ -3,8 +3,9 @@ import {
Generator,
getConfig,
resolveConfigPath,
+ watchRouteFiles,
} from '@tanstack/router-generator'
-import type { FileEventType } from '@tanstack/router-generator'
+import type { RouteFileWatcher } from '@tanstack/router-generator'
export function watch(root: string) {
const configPath = resolveConfigPath({
@@ -12,48 +13,27 @@ export function watch(root: string) {
})
const configWatcher = chokidar.watch(configPath)
- let watcher = new chokidar.FSWatcher({})
+ let watcher: Promise | undefined
- const generatorWatcher = () => {
+ const report = (run: Promise) =>
+ run.catch((err: unknown) => {
+ console.error(err)
+ console.info()
+ })
+
+ const generatorWatcher = async () => {
const config = getConfig()
const generator = new Generator({ config, root })
- watcher.close()
+ const previous = watcher
+ watcher = undefined
+ await (await previous)?.close()
console.info(`TSR: Watching routes (${config.routesDirectory})...`)
- watcher = chokidar.watch(config.routesDirectory)
-
- watcher.on('ready', async () => {
- const handle = async () => {
- try {
- await generator.run()
- } catch (err) {
- console.error(err)
- console.info()
- }
- }
-
- await handle()
-
- watcher.on('all', (event, path) => {
- let type: FileEventType | undefined
- switch (event) {
- case 'add':
- type = 'create'
- break
- case 'change':
- type = 'update'
- break
- case 'unlink':
- type = 'delete'
- break
- }
- if (type) {
- return generator.run({ path, type })
- }
- return generator.run()
- })
- })
+ await report(generator.run())
+ // Every route file event under the routes directory and the
+ // `physical()` mounts, and edits of the virtual route config
+ watcher = watchRouteFiles(generator, (run) => void report(run))
}
configWatcher.on('ready', generatorWatcher)
diff --git a/packages/router-core/package.json b/packages/router-core/package.json
index ed2b794278..49683de73c 100644
--- a/packages/router-core/package.json
+++ b/packages/router-core/package.json
@@ -68,6 +68,26 @@
"default": "./dist/cjs/ssr/client.cjs"
}
},
+ "./tooling": {
+ "import": {
+ "types": "./dist/esm/tooling.d.ts",
+ "default": "./dist/esm/tooling.js"
+ },
+ "require": {
+ "types": "./dist/cjs/tooling.d.cts",
+ "default": "./dist/cjs/tooling.cjs"
+ }
+ },
+ "./hmr": {
+ "import": {
+ "types": "./dist/esm/hmr.d.ts",
+ "default": "./dist/esm/hmr.js"
+ },
+ "require": {
+ "types": "./dist/cjs/hmr.d.cts",
+ "default": "./dist/cjs/hmr.cjs"
+ }
+ },
"./isServer": {
"development": {
"import": {
diff --git a/packages/router-core/src/hmr.ts b/packages/router-core/src/hmr.ts
new file mode 100644
index 0000000000..12957bba2f
--- /dev/null
+++ b/packages/router-core/src/hmr.ts
@@ -0,0 +1,239 @@
+import { isServer } from '@tanstack/router-core/isServer'
+import type { AnyRoute } from './route'
+
+/**
+ * Static facts the compiler's dev-only route HMR block passes for one
+ * evaluation of a route module.
+ *
+ * Called only by compiler output; not a public API.
+ */
+export interface RouteHmrMeta {
+ /** Compile-time binding names of the component options left in the route module. */
+ unsplit?: Record
+ /** React + Vite: the module id plugin-react uses and every export name of the module. */
+ refreshExports?: { id: string; anchor: string; exports: Array }
+}
+
+/**
+ * Decides, per framework, whether a held component is kept because the
+ * framework's refresh runtime patches it in place. Not a public API.
+ */
+export interface RouteHmrAdapter {
+ /** Split component: decided when the re-imported chunk resolves, from the loaded export. */
+ keep: (next: any, held: any) => boolean
+ /** Unsplit component: both values come from the same module in the same round. */
+ keepUnsplit: (next: any, held: any, sameName: boolean) => boolean
+}
+
+/**
+ * Dev-only hot slot of a lazy route component (`lazyRouteComponent(...).__tsrHot`),
+ * present on the client only. Not a public API.
+ */
+export interface LazyRouteComponentHot {
+ readonly importer: () => Promise
+ readonly exportName: string | undefined
+ /**
+ * Re-imports through `importer` when the wrapper has loaded (or is loading),
+ * then keeps the held component if `keep(loaded, held)` says so, or swaps to
+ * the loaded one and re-renders. The newest import is the only one whose
+ * completion counts.
+ */
+ update: (
+ importer: () => Promise,
+ exportName: string | undefined,
+ keep: RouteHmrAdapter['keep'],
+ ) => void
+}
+
+type HotRoute = AnyRoute & {
+ options: Record
+ parentRoute: AnyRoute
+ _path: string
+ _id: string
+ _fullPath: string
+ _to: string
+}
+
+const componentKeys = [
+ 'component',
+ 'shellComponent',
+ 'pendingComponent',
+ 'errorComponent',
+ 'notFoundComponent',
+]
+
+// Generated by the route tree, absent from a freshly evaluated route module.
+const generatedOptionKeys = ['id', 'path', 'getParentRoute']
+
+// Every `Route` each route id evaluated to (a route tree rebuilt after an
+// edit imports the module's current export, so any evaluation can be the
+// router's live route) and the facts of the module that the live route
+// currently reflects. Bounded by the number of routes; the evaluations are
+// held weakly.
+const hotRoutes = new Map<
+ string,
+ { routes: WeakSet; meta: RouteHmrMeta }
+>()
+
+// The importer each held lazy wrapper was created with. Vite bundled dev
+// without lazy compilation (Rolldown) turns a patch's `import()` of a chunk the
+// page never loaded into a lookup that throws `MissingFactoryError`; only the
+// first importer loads that chunk.
+const firstImporters = new WeakMap<
+ LazyRouteComponentHot,
+ LazyRouteComponentHot['importer']
+>()
+
+/**
+ * Applies one evaluation of a route module to the live route of
+ * `window.__TSR_ROUTER__`. The first evaluation only records the route.
+ * Later evaluations update the live route when the router on the page holds
+ * a route this module evaluated to under `routeId` (the first one, or a
+ * later one a rebuilt route tree imported), and do nothing otherwise.
+ *
+ * Not a public API: called by the framework packages' `__tsrRouteHmr`.
+ */
+export function applyRouteHmr(
+ routeId: string,
+ route: AnyRoute,
+ meta: RouteHmrMeta,
+ adapter: RouteHmrAdapter,
+): void {
+ if (process.env.NODE_ENV !== 'production') {
+ if (isServer ?? typeof window === 'undefined') {
+ return
+ }
+ const known = hotRoutes.get(routeId)
+ if (!known) {
+ hotRoutes.set(routeId, { routes: new WeakSet([route]), meta })
+ return
+ }
+ known.routes.add(route)
+ const router = window.__TSR_ROUTER__
+ const current = router?.routesById?.[routeId] as HotRoute | undefined
+ // Another router, or a router without this route: leave it alone.
+ if (!router || !current) {
+ return
+ }
+ // A route tree module that re-executed since the router last read it (a
+ // route added or renamed) holds this module's current export where the
+ // router still holds an older evaluation: its parent's children no
+ // longer include the router's route. Read the tree again first, so the
+ // tree's route is the one updated. The root route has no parent, and a
+ // read starts from the router's own root, so a root is never re-read.
+ const siblings = (current.parentRoute as { children?: unknown } | undefined)
+ ?.children
+ if (siblings && !Object.values(siblings).includes(current)) {
+ router.setRoutes(router.buildRouteTree())
+ }
+ const live = router.routesById[routeId] as HotRoute | undefined
+ if (!live || !known.routes.has(live) || live === route) {
+ return
+ }
+ const next = route as HotRoute
+
+ const liveOptions = live.options
+ const nextOptions: HotRoute['options'] = { ...next.options }
+ if ('shellComponent' in liveOptions === 'shellComponent' in nextOptions) {
+ for (const key of componentKeys) {
+ const held = liveOptions[key]
+ const value = nextOptions[key]
+ if (held === undefined || value === undefined || held === value) {
+ continue
+ }
+ const heldHot: LazyRouteComponentHot | undefined = held.__tsrHot
+ const valueHot: LazyRouteComponentHot | undefined = value.__tsrHot
+ if (heldHot && valueHot) {
+ // Keep the live wrapper; it re-imports and decides keep or swap.
+ const firstImporter = firstImporters.get(heldHot) ?? heldHot.importer
+ firstImporters.set(heldHot, firstImporter)
+ const importer = valueHot.importer
+ const onError = (err: unknown) => {
+ if (
+ err instanceof Error &&
+ err.constructor.name === 'MissingFactoryError'
+ ) {
+ return firstImporter()
+ }
+ throw err
+ }
+ heldHot.update(
+ () => {
+ try {
+ return importer().catch(onError)
+ } catch (err) {
+ return onError(err)
+ }
+ },
+ valueHot.exportName,
+ adapter.keep,
+ )
+ nextOptions[key] = held
+ } else if (
+ !held.__tsrHot &&
+ !valueHot &&
+ adapter.keepUnsplit(
+ value,
+ held,
+ meta.unsplit?.[key] !== undefined &&
+ meta.unsplit[key] === known.meta.unsplit?.[key],
+ )
+ ) {
+ nextOptions[key] = held
+ }
+ }
+ }
+ for (const key of generatedOptionKeys) {
+ if (key in liveOptions) {
+ nextOptions[key] = liveOptions[key]
+ }
+ }
+
+ live.options = nextOptions
+ live.update(nextOptions)
+ router._replaceRouteChunk?.(live, next.lazyFn)
+ router.setRoutes(router.buildRouteTree())
+
+ // routeTree.gen.ts mutates the original export with generated routing
+ // state; mirror it so the fresh export keeps working when imported directly.
+ next.options = live.options
+ next.parentRoute = live.parentRoute
+ next._path = live._path
+ next._id = live._id
+ next._fullPath = live._fullPath
+ next._to = live._to
+
+ known.meta = meta
+ void router._refreshRoute?.()
+ }
+}
+
+// The split chunks of route modules that evaluated so far (`routeId\0chunk`).
+// Bounded by the number of split chunks.
+const hotChunks = new Set()
+
+/**
+ * Applies one evaluation of a split chunk of a route module (webpack-style
+ * hosts): the first evaluation only records the chunk; a later one is a hot
+ * update of the chunk (its own `accept()`), and the route's non-component
+ * options reload through their lazy wrappers once the live route refreshes.
+ *
+ * Not a public API: called by the framework packages' `__tsrRouteChunkHmr`.
+ */
+export function applyRouteChunkHmr(routeId: string, chunk: string): void {
+ if (process.env.NODE_ENV !== 'production') {
+ if (isServer ?? typeof window === 'undefined') {
+ return
+ }
+ const key = `${routeId}\0${chunk}`
+ if (!hotChunks.has(key)) {
+ hotChunks.add(key)
+ return
+ }
+ const router = window.__TSR_ROUTER__
+ if (!router?.routesById?.[routeId]) {
+ return
+ }
+ void router._refreshRoute?.()
+ }
+}
diff --git a/packages/router-core/src/index.ts b/packages/router-core/src/index.ts
index 9206ef60dd..2643a61629 100644
--- a/packages/router-core/src/index.ts
+++ b/packages/router-core/src/index.ts
@@ -426,6 +426,12 @@ export {
parseRedirect,
} from './redirect'
+export type {
+ LazyRouteComponentHot,
+ RouteHmrAdapter,
+ RouteHmrMeta,
+} from './hmr'
+
export type { NotFoundError } from './not-found'
export { isNotFound, notFound } from './not-found'
diff --git a/packages/router-core/src/tooling.ts b/packages/router-core/src/tooling.ts
new file mode 100644
index 0000000000..04391354bf
--- /dev/null
+++ b/packages/router-core/src/tooling.ts
@@ -0,0 +1,11 @@
+/**
+ * The helpers build tooling (the route generator, the Start plugin) needs,
+ * without the router runtime the root entry loads.
+ */
+export { rootRouteId } from './root'
+export { cleanPath, joinPaths, trimPathLeft, trimPathRight } from './path'
+export {
+ getStylesheetHref,
+ resolveManifestAssetLink,
+ resolveManifestCssLink,
+} from './manifest'
diff --git a/packages/router-core/tests/route-chunk-hmr.test.ts b/packages/router-core/tests/route-chunk-hmr.test.ts
new file mode 100644
index 0000000000..3b7fdb75aa
--- /dev/null
+++ b/packages/router-core/tests/route-chunk-hmr.test.ts
@@ -0,0 +1,35 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { applyRouteChunkHmr } from '../src/hmr'
+
+describe('applyRouteChunkHmr (dev-only, webpack-style split chunks)', () => {
+ afterEach(() => {
+ delete (window as any).__TSR_ROUTER__
+ })
+
+ it('records a chunk on its first evaluation and refreshes the live route on a later one', () => {
+ const _refreshRoute = vi.fn(() => Promise.resolve())
+ ;(window as any).__TSR_ROUTER__ = {
+ routesById: { '/posts': {} },
+ _refreshRoute,
+ }
+ applyRouteChunkHmr('/posts', 'loader')
+ expect(_refreshRoute).not.toHaveBeenCalled()
+ // a hot update evaluated the chunk again
+ applyRouteChunkHmr('/posts', 'loader')
+ expect(_refreshRoute).toHaveBeenCalledTimes(1)
+ // another chunk of the same route is its own evaluation count
+ applyRouteChunkHmr('/posts', 'beforeLoad')
+ expect(_refreshRoute).toHaveBeenCalledTimes(1)
+ })
+
+ it('leaves a router that does not hold the route alone', () => {
+ const _refreshRoute = vi.fn(() => Promise.resolve())
+ ;(window as any).__TSR_ROUTER__ = {
+ routesById: { '/': {} },
+ _refreshRoute,
+ }
+ applyRouteChunkHmr('/other', 'loader')
+ applyRouteChunkHmr('/other', 'loader')
+ expect(_refreshRoute).not.toHaveBeenCalled()
+ })
+})
diff --git a/packages/router-core/tests/route-hmr-live-route.test.ts b/packages/router-core/tests/route-hmr-live-route.test.ts
new file mode 100644
index 0000000000..425a3c8c49
--- /dev/null
+++ b/packages/router-core/tests/route-hmr-live-route.test.ts
@@ -0,0 +1,118 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+import { BaseRootRoute, BaseRoute } from '../src'
+import { applyRouteHmr } from '../src/hmr'
+import type { RouteHmrAdapter } from '../src/hmr'
+
+/**
+ * `applyRouteHmr` on a page whose route tree was rebuilt between two edits
+ * of a route module: a route added or renamed regenerates the route tree,
+ * whose module re-evaluates with the route module's current export (the
+ * last evaluation, not the first one the runtime recorded), so the router
+ * holds that later route as the live one. Every later edit must still
+ * update the live route.
+ */
+describe('applyRouteHmr after a route tree rebuild', () => {
+ afterEach(() => {
+ delete (window as any).__TSR_ROUTER__
+ })
+
+ const adapter: RouteHmrAdapter = {
+ keep: () => false,
+ keepUnsplit: () => false,
+ }
+
+ const root = new BaseRootRoute({})
+ /** A fresh evaluation of the route module `/page` whose loader returns `token`. */
+ const evaluate = (token: string) =>
+ new BaseRoute({
+ getParentRoute: () => root,
+ path: '/page',
+ loader: () => token,
+ }) as any
+
+ /**
+ * A router whose `routesById` derives from a route tree (`setRoutes(buildRouteTree())`,
+ * as the router does); `tree.page` is the route the tree module's last
+ * execution imported for `/page`.
+ */
+ const routerOf = (page: any) => {
+ root.addChildren([page])
+ page.parentRoute = root
+ const tree = { page }
+ const router = {
+ routesById: { '/page': page } as Record,
+ buildRouteTree: () => ({ routesById: { '/page': tree.page } }),
+ setRoutes(caches: { routesById: Record }) {
+ this.routesById = caches.routesById
+ },
+ _refreshRoute: vi.fn(() => Promise.resolve()),
+ }
+ ;(window as any).__TSR_ROUTER__ = router
+ return { router, tree }
+ }
+
+ it('updates the route a rebuilt tree holds (a later evaluation than the first)', () => {
+ const first = evaluate('v0')
+ const { router, tree } = routerOf(first)
+ applyRouteHmr('/page', first, {}, adapter)
+
+ // first edit: the first route is live and gets the new loader
+ const second = evaluate('v1')
+ applyRouteHmr('/page', second, {}, adapter)
+ expect(router.routesById['/page']).toBe(first)
+ expect(first.options.loader()).toBe('v1')
+ expect(router._refreshRoute).toHaveBeenCalledTimes(1)
+
+ // the route tree module re-executes (a route added): it imports the
+ // route module's current export, `second`; the router has not read it
+ root.addChildren([second])
+ second.parentRoute = root
+ tree.page = second
+
+ // second edit: the tree's route must get the new loader and be the live one
+ const third = evaluate('v2')
+ applyRouteHmr('/page', third, {}, adapter)
+ expect(router.routesById['/page']).toBe(second)
+ expect(second.options.loader()).toBe('v2')
+ expect(router._refreshRoute).toHaveBeenCalledTimes(2)
+
+ // a third edit without a tree rebuild updates that same route
+ applyRouteHmr('/page', evaluate('v3'), {}, adapter)
+ expect(router.routesById['/page']).toBe(second)
+ expect(second.options.loader()).toBe('v3')
+ })
+
+ it('leaves a route of another evaluation lineage alone', () => {
+ const first = evaluate('v0')
+ const { router, tree } = routerOf(first)
+ applyRouteHmr('/page', first, {}, adapter)
+ // a tree holding a route this module never evaluated to (another router's)
+ const foreign = evaluate('other')
+ root.addChildren([foreign])
+ foreign.parentRoute = root
+ tree.page = foreign
+ applyRouteHmr('/page', evaluate('v1'), {}, adapter)
+ expect(foreign.options.loader()).toBe('other')
+ expect(router._refreshRoute).not.toHaveBeenCalled()
+ })
+
+ it('updates an edited root route, which has no parent', () => {
+ const evaluateRoot = (token: string) =>
+ new BaseRootRoute({ loader: () => token }) as any
+ const first = evaluateRoot('v0')
+ const router = {
+ routesById: { __root__: first } as Record,
+ buildRouteTree: () => ({ routesById: { __root__: first } }),
+ setRoutes(caches: { routesById: Record }) {
+ this.routesById = caches.routesById
+ },
+ _refreshRoute: vi.fn(() => Promise.resolve()),
+ }
+ ;(window as any).__TSR_ROUTER__ = router
+ applyRouteHmr('__root__', first, {}, adapter)
+ applyRouteHmr('__root__', evaluateRoot('v1'), {}, adapter)
+ expect(router.routesById.__root__).toBe(first)
+ expect(first.options.loader()).toBe('v1')
+ expect(router._refreshRoute).toHaveBeenCalledTimes(1)
+ })
+})
diff --git a/packages/router-core/vite.config.ts b/packages/router-core/vite.config.ts
index 97859dda97..f0a32f54cb 100644
--- a/packages/router-core/vite.config.ts
+++ b/packages/router-core/vite.config.ts
@@ -44,6 +44,8 @@ export default mergeConfig(
'./src/index.ts',
'./src/ssr/client.ts',
'./src/ssr/server.ts',
+ './src/hmr.ts',
+ './src/tooling.ts',
'./src/scroll-restoration-script/client.ts',
'./src/scroll-restoration-script/server.ts',
'./src/isServer/server.ts',
diff --git a/packages/router-devtools-core/CHANGELOG.md b/packages/router-devtools-core/CHANGELOG.md
index 63eb2961dd..791c877aa9 100644
--- a/packages/router-devtools-core/CHANGELOG.md
+++ b/packages/router-devtools-core/CHANGELOG.md
@@ -1,11 +1,5 @@
# @tanstack/router-devtools-core
-## 1.168.3
-
-### Patch Changes
-
-- [#8888](https://github.com/TanStack/router/pull/8888) [`bbf9b75`](https://github.com/TanStack/router/commit/bbf9b75808d8eee497a6dd1663f0cf08426512e0) - Fix broken styling of the embedded `TanStackRouterDevtoolsPanel` (including inside shadow DOM) by giving the devtools size tokens a `1rem` fallback when `--tsrd-font-size` is not set.
-
## 1.168.2
### Patch Changes
diff --git a/packages/router-devtools-core/package.json b/packages/router-devtools-core/package.json
index 24db637cc7..722a76e522 100644
--- a/packages/router-devtools-core/package.json
+++ b/packages/router-devtools-core/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/router-devtools-core",
- "version": "1.168.3",
+ "version": "1.168.2",
"description": "Modern and scalable routing for Web applications",
"author": "Tanner Linsley",
"license": "MIT",
diff --git a/packages/router-devtools-core/src/tokens.ts b/packages/router-devtools-core/src/tokens.ts
index 97ed9e4cd9..9d247cf184 100644
--- a/packages/router-devtools-core/src/tokens.ts
+++ b/packages/router-devtools-core/src/tokens.ts
@@ -161,37 +161,37 @@ export const tokens = {
},
font: {
size: {
- '2xs': 'calc(var(--tsrd-font-size, 1rem) * 0.625)',
- xs: 'calc(var(--tsrd-font-size, 1rem) * 0.75)',
- sm: 'calc(var(--tsrd-font-size, 1rem) * 0.875)',
- md: 'var(--tsrd-font-size, 1rem)',
- lg: 'calc(var(--tsrd-font-size, 1rem) * 1.125)',
- xl: 'calc(var(--tsrd-font-size, 1rem) * 1.25)',
- '2xl': 'calc(var(--tsrd-font-size, 1rem) * 1.5)',
- '3xl': 'calc(var(--tsrd-font-size, 1rem) * 1.875)',
- '4xl': 'calc(var(--tsrd-font-size, 1rem) * 2.25)',
- '5xl': 'calc(var(--tsrd-font-size, 1rem) * 3)',
- '6xl': 'calc(var(--tsrd-font-size, 1rem) * 3.75)',
- '7xl': 'calc(var(--tsrd-font-size, 1rem) * 4.5)',
- '8xl': 'calc(var(--tsrd-font-size, 1rem) * 6)',
- '9xl': 'calc(var(--tsrd-font-size, 1rem) * 8)',
+ '2xs': 'calc(var(--tsrd-font-size) * 0.625)',
+ xs: 'calc(var(--tsrd-font-size) * 0.75)',
+ sm: 'calc(var(--tsrd-font-size) * 0.875)',
+ md: 'var(--tsrd-font-size)',
+ lg: 'calc(var(--tsrd-font-size) * 1.125)',
+ xl: 'calc(var(--tsrd-font-size) * 1.25)',
+ '2xl': 'calc(var(--tsrd-font-size) * 1.5)',
+ '3xl': 'calc(var(--tsrd-font-size) * 1.875)',
+ '4xl': 'calc(var(--tsrd-font-size) * 2.25)',
+ '5xl': 'calc(var(--tsrd-font-size) * 3)',
+ '6xl': 'calc(var(--tsrd-font-size) * 3.75)',
+ '7xl': 'calc(var(--tsrd-font-size) * 4.5)',
+ '8xl': 'calc(var(--tsrd-font-size) * 6)',
+ '9xl': 'calc(var(--tsrd-font-size) * 8)',
},
lineHeight: {
- '3xs': 'calc(var(--tsrd-font-size, 1rem) * 0.75)',
- '2xs': 'calc(var(--tsrd-font-size, 1rem) * 0.875)',
- xs: 'calc(var(--tsrd-font-size, 1rem) * 1)',
- sm: 'calc(var(--tsrd-font-size, 1rem) * 1.25)',
- md: 'calc(var(--tsrd-font-size, 1rem) * 1.5)',
- lg: 'calc(var(--tsrd-font-size, 1rem) * 1.75)',
- xl: 'calc(var(--tsrd-font-size, 1rem) * 2)',
- '2xl': 'calc(var(--tsrd-font-size, 1rem) * 2.25)',
- '3xl': 'calc(var(--tsrd-font-size, 1rem) * 2.5)',
- '4xl': 'calc(var(--tsrd-font-size, 1rem) * 2.75)',
- '5xl': 'calc(var(--tsrd-font-size, 1rem) * 3)',
- '6xl': 'calc(var(--tsrd-font-size, 1rem) * 3.25)',
- '7xl': 'calc(var(--tsrd-font-size, 1rem) * 3.5)',
- '8xl': 'calc(var(--tsrd-font-size, 1rem) * 3.75)',
- '9xl': 'calc(var(--tsrd-font-size, 1rem) * 4)',
+ '3xs': 'calc(var(--tsrd-font-size) * 0.75)',
+ '2xs': 'calc(var(--tsrd-font-size) * 0.875)',
+ xs: 'calc(var(--tsrd-font-size) * 1)',
+ sm: 'calc(var(--tsrd-font-size) * 1.25)',
+ md: 'calc(var(--tsrd-font-size) * 1.5)',
+ lg: 'calc(var(--tsrd-font-size) * 1.75)',
+ xl: 'calc(var(--tsrd-font-size) * 2)',
+ '2xl': 'calc(var(--tsrd-font-size) * 2.25)',
+ '3xl': 'calc(var(--tsrd-font-size) * 2.5)',
+ '4xl': 'calc(var(--tsrd-font-size) * 2.75)',
+ '5xl': 'calc(var(--tsrd-font-size) * 3)',
+ '6xl': 'calc(var(--tsrd-font-size) * 3.25)',
+ '7xl': 'calc(var(--tsrd-font-size) * 3.5)',
+ '8xl': 'calc(var(--tsrd-font-size) * 3.75)',
+ '9xl': 'calc(var(--tsrd-font-size) * 4)',
},
weight: {
thin: '100',
@@ -220,55 +220,55 @@ export const tokens = {
border: {
radius: {
none: '0px',
- xs: 'calc(var(--tsrd-font-size, 1rem) * 0.125)',
- sm: 'calc(var(--tsrd-font-size, 1rem) * 0.25)',
- md: 'calc(var(--tsrd-font-size, 1rem) * 0.375)',
- lg: 'calc(var(--tsrd-font-size, 1rem) * 0.5)',
- xl: 'calc(var(--tsrd-font-size, 1rem) * 0.75)',
- '2xl': 'calc(var(--tsrd-font-size, 1rem) * 1)',
- '3xl': 'calc(var(--tsrd-font-size, 1rem) * 1.5)',
+ xs: 'calc(var(--tsrd-font-size) * 0.125)',
+ sm: 'calc(var(--tsrd-font-size) * 0.25)',
+ md: 'calc(var(--tsrd-font-size) * 0.375)',
+ lg: 'calc(var(--tsrd-font-size) * 0.5)',
+ xl: 'calc(var(--tsrd-font-size) * 0.75)',
+ '2xl': 'calc(var(--tsrd-font-size) * 1)',
+ '3xl': 'calc(var(--tsrd-font-size) * 1.5)',
full: '9999px',
},
},
size: {
0: '0px',
- 0.25: 'calc(var(--tsrd-font-size, 1rem) * 0.0625)',
- 0.5: 'calc(var(--tsrd-font-size, 1rem) * 0.125)',
- 1: 'calc(var(--tsrd-font-size, 1rem) * 0.25)',
- 1.5: 'calc(var(--tsrd-font-size, 1rem) * 0.375)',
- 2: 'calc(var(--tsrd-font-size, 1rem) * 0.5)',
- 2.5: 'calc(var(--tsrd-font-size, 1rem) * 0.625)',
- 3: 'calc(var(--tsrd-font-size, 1rem) * 0.75)',
- 3.5: 'calc(var(--tsrd-font-size, 1rem) * 0.875)',
- 4: 'calc(var(--tsrd-font-size, 1rem) * 1)',
- 4.5: 'calc(var(--tsrd-font-size, 1rem) * 1.125)',
- 5: 'calc(var(--tsrd-font-size, 1rem) * 1.25)',
- 5.5: 'calc(var(--tsrd-font-size, 1rem) * 1.375)',
- 6: 'calc(var(--tsrd-font-size, 1rem) * 1.5)',
- 6.5: 'calc(var(--tsrd-font-size, 1rem) * 1.625)',
- 7: 'calc(var(--tsrd-font-size, 1rem) * 1.75)',
- 8: 'calc(var(--tsrd-font-size, 1rem) * 2)',
- 9: 'calc(var(--tsrd-font-size, 1rem) * 2.25)',
- 10: 'calc(var(--tsrd-font-size, 1rem) * 2.5)',
- 11: 'calc(var(--tsrd-font-size, 1rem) * 2.75)',
- 12: 'calc(var(--tsrd-font-size, 1rem) * 3)',
- 14: 'calc(var(--tsrd-font-size, 1rem) * 3.5)',
- 16: 'calc(var(--tsrd-font-size, 1rem) * 4)',
- 20: 'calc(var(--tsrd-font-size, 1rem) * 5)',
- 24: 'calc(var(--tsrd-font-size, 1rem) * 6)',
- 28: 'calc(var(--tsrd-font-size, 1rem) * 7)',
- 32: 'calc(var(--tsrd-font-size, 1rem) * 8)',
- 36: 'calc(var(--tsrd-font-size, 1rem) * 9)',
- 40: 'calc(var(--tsrd-font-size, 1rem) * 10)',
- 44: 'calc(var(--tsrd-font-size, 1rem) * 11)',
- 48: 'calc(var(--tsrd-font-size, 1rem) * 12)',
- 52: 'calc(var(--tsrd-font-size, 1rem) * 13)',
- 56: 'calc(var(--tsrd-font-size, 1rem) * 14)',
- 60: 'calc(var(--tsrd-font-size, 1rem) * 15)',
- 64: 'calc(var(--tsrd-font-size, 1rem) * 16)',
- 72: 'calc(var(--tsrd-font-size, 1rem) * 18)',
- 80: 'calc(var(--tsrd-font-size, 1rem) * 20)',
- 96: 'calc(var(--tsrd-font-size, 1rem) * 24)',
+ 0.25: 'calc(var(--tsrd-font-size) * 0.0625)',
+ 0.5: 'calc(var(--tsrd-font-size) * 0.125)',
+ 1: 'calc(var(--tsrd-font-size) * 0.25)',
+ 1.5: 'calc(var(--tsrd-font-size) * 0.375)',
+ 2: 'calc(var(--tsrd-font-size) * 0.5)',
+ 2.5: 'calc(var(--tsrd-font-size) * 0.625)',
+ 3: 'calc(var(--tsrd-font-size) * 0.75)',
+ 3.5: 'calc(var(--tsrd-font-size) * 0.875)',
+ 4: 'calc(var(--tsrd-font-size) * 1)',
+ 4.5: 'calc(var(--tsrd-font-size) * 1.125)',
+ 5: 'calc(var(--tsrd-font-size) * 1.25)',
+ 5.5: 'calc(var(--tsrd-font-size) * 1.375)',
+ 6: 'calc(var(--tsrd-font-size) * 1.5)',
+ 6.5: 'calc(var(--tsrd-font-size) * 1.625)',
+ 7: 'calc(var(--tsrd-font-size) * 1.75)',
+ 8: 'calc(var(--tsrd-font-size) * 2)',
+ 9: 'calc(var(--tsrd-font-size) * 2.25)',
+ 10: 'calc(var(--tsrd-font-size) * 2.5)',
+ 11: 'calc(var(--tsrd-font-size) * 2.75)',
+ 12: 'calc(var(--tsrd-font-size) * 3)',
+ 14: 'calc(var(--tsrd-font-size) * 3.5)',
+ 16: 'calc(var(--tsrd-font-size) * 4)',
+ 20: 'calc(var(--tsrd-font-size) * 5)',
+ 24: 'calc(var(--tsrd-font-size) * 6)',
+ 28: 'calc(var(--tsrd-font-size) * 7)',
+ 32: 'calc(var(--tsrd-font-size) * 8)',
+ 36: 'calc(var(--tsrd-font-size) * 9)',
+ 40: 'calc(var(--tsrd-font-size) * 10)',
+ 44: 'calc(var(--tsrd-font-size) * 11)',
+ 48: 'calc(var(--tsrd-font-size) * 12)',
+ 52: 'calc(var(--tsrd-font-size) * 13)',
+ 56: 'calc(var(--tsrd-font-size) * 14)',
+ 60: 'calc(var(--tsrd-font-size) * 15)',
+ 64: 'calc(var(--tsrd-font-size) * 16)',
+ 72: 'calc(var(--tsrd-font-size) * 18)',
+ 80: 'calc(var(--tsrd-font-size) * 20)',
+ 96: 'calc(var(--tsrd-font-size) * 24)',
},
shadow: {
xs: (_: string = 'rgb(0 0 0 / 0.1)') =>
diff --git a/packages/router-devtools/CHANGELOG.md b/packages/router-devtools/CHANGELOG.md
index 201d972d6c..3ba014e38f 100644
--- a/packages/router-devtools/CHANGELOG.md
+++ b/packages/router-devtools/CHANGELOG.md
@@ -1,12 +1,5 @@
# @tanstack/router-devtools
-## 1.167.3
-
-### Patch Changes
-
-- Updated dependencies []:
- - @tanstack/react-router-devtools@1.167.3
-
## 1.167.2
### Patch Changes
diff --git a/packages/router-devtools/package.json b/packages/router-devtools/package.json
index 4158b280d7..2aa446dbab 100644
--- a/packages/router-devtools/package.json
+++ b/packages/router-devtools/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/router-devtools",
- "version": "1.167.3",
+ "version": "1.167.2",
"description": "Modern and scalable routing for React applications",
"author": "Tanner Linsley",
"license": "MIT",
diff --git a/packages/router-generator/AGENTS.md b/packages/router-generator/AGENTS.md
index 1cc70bf370..b3899b9652 100644
--- a/packages/router-generator/AGENTS.md
+++ b/packages/router-generator/AGENTS.md
@@ -1,6 +1,10 @@
# Route generator
-- Preserve the existing `safeFileWrite` path: temporary-file rename, modification-time conflict retry, and post-rename stat. Keep unchanged-write suppression and main/shadow cache rotation; these protect concurrent edits, avoid watcher loops, and discard deleted routes.
-- Run the complete `test:unit` target after generator changes. Its runtime phase generates fixture route trees before typechecking their consumers; `test:types` excludes the generator fixtures.
-- Add generation cases under `tests/generator//`. Read [`tests/generator.test.ts`](tests/generator.test.ts) for per-case configuration and preprocessing. Change route inputs/configuration or templates, then regenerate route trees and expected snapshots through the test harness.
+- Layout: `filesystem/` scans the routing conventions (ported path logic; `utils.ts` holds its helpers), `analyze/route-file.ts` is the only parser user (Yuku: the Route export, its constructor by binding, recorded option keys, offset splices), `scaffold/` writes new route files, `model/` builds the tree model (a pure function of the scan and the per-file facts; nothing of a model outlives a generation), `print/` prints the runtime tree and its types from that model, `publish/` replaces files atomically, `generator.ts` is the session (event queue, one drain loop, per-file facts by content), `watch/` the chokidar watcher of bundlers whose own watcher only sees the bundle.
+- Keep writes atomic (temporary file, rename; beside the destination on EXDEV), route file edits guarded by a content recheck before the rename, and change detection content-based: the generator's own writes come back as events and must be no-ops.
+- Prettier is only loaded (lazily) when `enableRouteTreeFormatting` is `true`; the printer emits `quoteStyle`/`semicolons` itself.
+- Run the complete `test:unit` and `test:integration` targets after generator changes. The fixtures run in copies (no test writes into this package); `test:integration` type-checks the route trees generated there (`tests/integration/fixture-types-*.test.ts`); `test:types` excludes the generator fixtures.
+- Add generation cases under `tests/generator//`. Read [`tests/generator.test.ts`](tests/generator.test.ts) for per-case configuration and preprocessing. Change route inputs/configuration or templates; the test harness generates the route trees (no expected snapshots: the tests read the generated tree through a real router, the type checker and the text the documented output options control).
- `preprocess()` recreates selected route files for `file-modification*` and `custom-scaffolding`. Edit their templates/configuration/preprocessing when changing those inputs; edits to recreated files are overwritten.
+- To run one test file or `-t` filter quickly, the slow-tier load gate and the test budgets: [compiler-test-utils/AGENTS.md](../compiler-test-utils/AGENTS.md).
+- What these tests are, the spec they cite (`J4.12`, `G3`, `§5.7`) and the known bugs: [compiler-test-utils/oracle/README.md](../compiler-test-utils/oracle/README.md).
diff --git a/packages/router-generator/CHANGELOG.md b/packages/router-generator/CHANGELOG.md
index a37550d255..1e31d7aeeb 100644
--- a/packages/router-generator/CHANGELOG.md
+++ b/packages/router-generator/CHANGELOG.md
@@ -1,18 +1,5 @@
# @tanstack/router-generator
-## 1.168.0
-
-### Minor Changes
-
-- [#8855](https://github.com/TanStack/router/pull/8855) [`446ce1b`](https://github.com/TanStack/router/commit/446ce1b30650d85f1fc78f2d1ee42712e40b75c6) - Require Node `^20.19.0 || >=22.12.0` (was `>=20.19`), so the CommonJS builds can load ESM-only dependencies through `require(esm)`. Node 21 and Node 22.0–22.11 do not enable it by default, so they are no longer supported.
-
-### Patch Changes
-
-- [#8857](https://github.com/TanStack/router/pull/8857) [`ad5b3b7`](https://github.com/TanStack/router/commit/ad5b3b7a0990eed7351d672ea6695d341108e0d6) - A pathless layout inside a route group (`routes/(group)/_layout.tsx`) or a route group's own layout (`routes/(group)/route.tsx`) is typed with the full path `'/'` in `FileRoutesByPath`, like the router gives it at runtime, instead of `''`. When no index route claims `/`, the layout also appears under `'/'` in `FileRoutesByFullPath` and `FileRoutesByTo`, as a pathless layout outside a group already does.
-
-- Updated dependencies [[`446ce1b`](https://github.com/TanStack/router/commit/446ce1b30650d85f1fc78f2d1ee42712e40b75c6), [`ff157f0`](https://github.com/TanStack/router/commit/ff157f0079982e90d62be7fdeecfb77e4fdcec69)]:
- - @tanstack/router-utils@1.163.0
-
## 1.167.46
### Patch Changes
diff --git a/packages/router-generator/eslint.config.js b/packages/router-generator/eslint.config.js
index 8ce6ad05fc..a9b4a96a84 100644
--- a/packages/router-generator/eslint.config.js
+++ b/packages/router-generator/eslint.config.js
@@ -2,4 +2,16 @@
import rootConfig from '../../eslint.config.js'
-export default [...rootConfig]
+export default [
+ ...rootConfig,
+ {
+ // The generator's fixture apps (route files, virtual route configs,
+ // generated and snapshot route trees): inputs and outputs whose bytes the
+ // tests compare, most outside the TypeScript project (tsconfig.json).
+ // Their type tests are linted.
+ ignores: [
+ 'tests/generator/**/*.{ts,tsx,js,jsx}',
+ '!tests/generator/**/*.test-d.ts',
+ ],
+ },
+]
diff --git a/packages/router-generator/package.json b/packages/router-generator/package.json
index e62e105068..6ee8eea151 100644
--- a/packages/router-generator/package.json
+++ b/packages/router-generator/package.json
@@ -1,6 +1,6 @@
{
"name": "@tanstack/router-generator",
- "version": "1.168.0",
+ "version": "1.167.46",
"description": "Modern and scalable routing for React applications",
"author": "Tanner Linsley",
"license": "MIT",
@@ -26,7 +26,7 @@
"scripts": {
"clean": "rimraf ./dist && rimraf ./coverage",
"clean:snapshots": "rimraf **/*snapshot* --glob",
- "test:eslint": "eslint ./src",
+ "test:eslint": "eslint ./src ./tests",
"test:types": "pnpm run \"/^test:types:ts[0-9]{2}$/\"",
"test:types:ts56": "node ../../node_modules/typescript56/lib/tsc.js -p tsconfig.legacy.json",
"test:types:ts57": "node ../../node_modules/typescript57/lib/tsc.js -p tsconfig.legacy.json",
@@ -34,7 +34,8 @@
"test:types:ts59": "node ../../node_modules/typescript59/lib/tsc.js -p tsconfig.legacy.json",
"test:types:ts60": "tsc6 -p tsconfig.legacy.json",
"test:types:ts70": "tsc -p tsconfig.legacy.json",
- "test:unit": "vitest --typecheck false && vitest run --typecheck.only",
+ "test:unit": "vitest --project unit",
+ "test:integration": "vitest --project integration",
"test:unit:dev": "pnpm run test:unit --watch --hideSkippedTests",
"test:build": "publint --strict && attw --ignore-rules no-resolution --pack .",
"build": "vite build"
@@ -65,36 +66,33 @@
"node": "^20.19.0 || >=22.12.0"
},
"dependencies": {
- "@babel/types": "catalog:",
"@tanstack/router-core": "workspace:*",
- "@tanstack/router-utils": "workspace:*",
"@tanstack/virtual-file-routes": "workspace:*",
+ "chokidar": "catalog:",
"jiti": "^2.7.0",
- "magic-string": "^0.30.21",
"prettier": "^3.9.6",
+ "yuku": "0.23.0",
"zod": "catalog:"
},
"devDependencies": {
+ "@tanstack/compiler-test-utils": "workspace:*",
"@tanstack/react-router": "workspace:*",
+ "@tanstack/vue-router": "workspace:*",
"@types/node": ">=20",
"@types/react": "catalog:",
+ "@vitejs/plugin-vue": "^6.0.5",
"react": "catalog:",
"vite": "catalog:",
+ "vue": "catalog:",
"@tanstack/vite-config": "catalog:",
"vitest": "catalog:",
"@arethetypeswrong/cli": "catalog:",
"publint": "catalog:",
- "rimraf": "catalog:"
- },
- "nx": {
- "targets": {
- "test:unit": {
- "outputs": [
- "...",
- "{projectRoot}/tests/generator/*/routeTree.gen.{ts,js}",
- "{projectRoot}/tests/generator/file-modification/routes/*/*.tsx"
- ]
- }
- }
+ "rimraf": "catalog:",
+ "@tanstack/solid-router": "workspace:*",
+ "react-dom": "catalog:",
+ "solid-js": "catalog:",
+ "vite-plugin-solid": "catalog:",
+ "@types/react-dom": "catalog:"
}
}
diff --git a/packages/router-generator/src/analyze/route-file.ts b/packages/router-generator/src/analyze/route-file.ts
new file mode 100644
index 0000000000..b59a461038
--- /dev/null
+++ b/packages/router-generator/src/analyze/route-file.ts
@@ -0,0 +1,556 @@
+import { parse, unwrap } from 'yuku'
+import { lit } from '../print/style'
+import type { CodeStyle } from '../print/style'
+import type { RouteProps } from '../types'
+import type { CallExpression, Expression, Node, SourceFile } from 'yuku'
+
+export type RouteConstructorName = 'createFileRoute' | 'createLazyFileRoute'
+
+const routeConstructors: ReadonlyArray = [
+ 'createFileRoute',
+ 'createLazyFileRoute',
+]
+
+/** A problem in a route file, at a position of its source. */
+export interface FileDiagnostic {
+ severity: 'warning' | 'error'
+ message: string
+ /** 1-based line and column, when the problem has a position. */
+ line?: number
+ column?: number
+}
+
+export type RouteFileAnalysis =
+ /** The file does not parse: nothing else is known. */
+ | { kind: 'error'; diagnostics: Array }
+ /** The file exports no `Route`. */
+ | { kind: 'no-route' }
+ /**
+ * The file exports a `Route`. `output` is the file with its id and
+ * constructor kept up, or null when it needs no edit (or is not ours to
+ * edit: a route made by another module or factory, which is left as it
+ * is).
+ */
+ | {
+ kind: 'route'
+ output: string | null
+ props: RouteProps
+ diagnostics: Array
+ }
+
+export interface RouteFileExpectation {
+ /** The route id the file's location implies. */
+ routeId: string
+ /** Whether the file is a `.lazy` route file (`createLazyFileRoute`). */
+ lazy: boolean
+ /** The router package the constructor comes from (`@tanstack/react-router`). */
+ routerPackage: string
+ /** The style of an import the file gets, when it has no import to copy it from. */
+ style: CodeStyle
+}
+
+interface Splice {
+ start: number
+ end: number
+ text: string
+}
+
+const unknownProps: RouteProps = { known: new Set(), unknown: true }
+
+function langOf(file: string) {
+ // `.ts` files are TypeScript without JSX (`x` is a type assertion);
+ // every other script is read as TSX, which also covers JSX in `.js`.
+ return /\.[mc]?ts$/.test(file) ? 'ts' : 'tsx'
+}
+
+function lineEndingOf(source: string): '\r\n' | '\n' | '\r' {
+ if (source.includes('\r\n')) {
+ return '\r\n'
+ }
+ if (source.includes('\n')) {
+ return '\n'
+ }
+ if (source.includes('\r')) {
+ return '\r'
+ }
+ return '\n'
+}
+
+function applySplices(source: string, splices: Array) {
+ let output = source
+ for (const splice of [...splices].sort((a, b) => b.start - a.start)) {
+ output =
+ output.slice(0, splice.start) + splice.text + output.slice(splice.end)
+ }
+ return output
+}
+
+function diagnosticAt(
+ file: SourceFile,
+ offset: number,
+ severity: FileDiagnostic['severity'],
+ message: string,
+): FileDiagnostic {
+ const { line, column } = file.locate(offset)
+ return { severity, message, line, column: column + 1 }
+}
+
+/** The option keys of a route's options argument (SPEC J1.9). */
+function propsOf(options: Node | undefined): RouteProps {
+ if (!options) {
+ return { known: new Set(), unknown: false }
+ }
+ const object = unwrap(options as Expression)
+ if (object.type !== 'ObjectExpression') {
+ return unknownProps
+ }
+ const known = new Set()
+ let unknown = false
+ for (const property of object.properties) {
+ if (property.type !== 'Property') {
+ // A spread: any key
+ unknown = true
+ continue
+ }
+ const keyNode = property.key as Node
+ if (!property.computed && keyNode.type === 'Identifier') {
+ known.add((keyNode as { name: string }).name)
+ } else if (
+ keyNode.type === 'Literal' &&
+ typeof (keyNode as { value: unknown }).value === 'string'
+ ) {
+ known.add((keyNode as { value: string }).value)
+ } else if (
+ !property.computed &&
+ keyNode.type === 'Literal' &&
+ typeof (keyNode as { value: unknown }).value === 'number'
+ ) {
+ known.add(String((keyNode as { value: number }).value))
+ } else {
+ unknown = true
+ }
+ }
+ return { known, unknown }
+}
+
+/**
+ * How the file creates its Route, found through the binding of the
+ * constructor (SPEC G15): the router package's constructor under any local
+ * name or through a namespace import (`ours`), an unbound
+ * `createFileRoute`/`createLazyFileRoute` (`repair`: the import is missing),
+ * or anything else (`foreign`: the app's own constructor or factory).
+ */
+type CalleeKind =
+ | { kind: 'ours'; name: RouteConstructorName; specifier?: Node }
+ | { kind: 'ours-namespace'; name: RouteConstructorName; property: Node }
+ | { kind: 'repair'; name: RouteConstructorName }
+ | { kind: 'foreign' }
+
+function classifyCallee(
+ file: SourceFile,
+ callee: Node,
+ routerPackage: string,
+): CalleeKind {
+ if (callee.type === 'Identifier') {
+ const name = (callee as { name: string }).name
+ const binding = file.referenceOf(callee)?.binding ?? null
+ if (!binding) {
+ return routeConstructors.includes(name)
+ ? { kind: 'repair', name: name as RouteConstructorName }
+ : { kind: 'foreign' }
+ }
+ const imported = binding.import
+ if (
+ imported &&
+ imported.kind === 'named' &&
+ !imported.typeOnly &&
+ imported.specifier === routerPackage &&
+ imported.name !== null &&
+ routeConstructors.includes(imported.name)
+ ) {
+ return {
+ kind: 'ours',
+ name: imported.name as RouteConstructorName,
+ specifier: imported.node,
+ }
+ }
+ return { kind: 'foreign' }
+ }
+ if (
+ callee.type === 'MemberExpression' &&
+ !(callee as { computed: boolean }).computed
+ ) {
+ const { object, property } = callee as unknown as {
+ object: Node
+ property: Node & { name: string }
+ }
+ if (
+ object.type === 'Identifier' &&
+ routeConstructors.includes(property.name)
+ ) {
+ const imported = file.referenceOf(object)?.binding?.import
+ if (
+ imported &&
+ imported.kind === 'namespace' &&
+ !imported.typeOnly &&
+ imported.specifier === routerPackage
+ ) {
+ return {
+ kind: 'ours-namespace',
+ name: property.name as RouteConstructorName,
+ property,
+ }
+ }
+ }
+ }
+ return { kind: 'foreign' }
+}
+
+/** A callee as written (`createFileRoute`, `R.createFileRoute`). */
+function calleeName(callee: Node): string {
+ if (callee.type === 'Identifier') {
+ return (callee as { name: string }).name
+ }
+ if (callee.type === 'MemberExpression') {
+ const { object, property } = callee as unknown as {
+ object: Node
+ property: Node
+ }
+ return `${calleeName(object)}.${calleeName(property)}`
+ }
+ return 'its constructor'
+}
+
+/** Whether `callee` is bound to an `import type` (or `import { type … }`). */
+function isTypeOnlyImport(file: SourceFile, callee: Node) {
+ const object =
+ callee.type === 'MemberExpression'
+ ? (callee as unknown as { object: Node }).object
+ : callee
+ return (
+ object.type === 'Identifier' &&
+ file.referenceOf(object)?.binding?.import?.typeOnly === true
+ )
+}
+
+/** The start of the first statement after the directive prologue. */
+function headerInsertOffset(file: SourceFile) {
+ for (const statement of file.program.body) {
+ if (
+ statement.type === 'ExpressionStatement' &&
+ typeof (statement as { directive?: unknown }).directive === 'string'
+ ) {
+ continue
+ }
+ return statement.start
+ }
+ return file.source.length
+}
+
+function isStringLiteral(node: Node | undefined): node is Node & {
+ value: string
+} {
+ return (
+ node?.type === 'Literal' &&
+ typeof (node as { value: unknown }).value === 'string'
+ )
+}
+
+/**
+ * Reads a route file and computes the edits that keep it up (SPEC J1.1,
+ * J1.2): the id argument of its Route's constructor call, the constructor
+ * of its kind, and that constructor's import. Every other byte stays: the
+ * edits are offset splices.
+ */
+export function analyzeRouteFile(
+ source: string,
+ filePath: string,
+ expected: RouteFileExpectation,
+): RouteFileAnalysis {
+ // (no `Route` anywhere: no Route export, without parsing)
+ if (!source.includes('Route')) {
+ return { kind: 'no-route' }
+ }
+ const file = parse(source, {
+ lang: langOf(filePath),
+ sourceType: 'module',
+ semantic: true,
+ })
+ const errors = file.diagnostics.filter((d) => d.severity === 'error')
+ if (errors.length) {
+ return {
+ kind: 'error',
+ diagnostics: errors.map((d) =>
+ diagnosticAt(file, d.start, 'error', d.message),
+ ),
+ }
+ }
+
+ const routeExport = file.exports.find(
+ (e) => e.name === 'Route' && !e.typeOnly,
+ )
+ if (!routeExport) {
+ return { kind: 'no-route' }
+ }
+ // Not a route this file creates (re-exported, imported, destructured,
+ // a function...): left as it is.
+ const notOurs = (diagnostics: Array = []) =>
+ ({
+ kind: 'route',
+ output: null,
+ props: unknownProps,
+ diagnostics,
+ }) as const
+
+ const binding = routeExport.kind === 'named' ? routeExport.local : null
+ const declaredName = binding?.declarations[0]
+ const declarator = declaredName ? file.parentOf(declaredName) : null
+ if (
+ !declarator ||
+ declarator.type !== 'VariableDeclarator' ||
+ (declarator as { id: Node }).id !== declaredName
+ ) {
+ return notOurs()
+ }
+ const init = unwrap(
+ (declarator as { init: Expression | null }).init ?? undefined,
+ )
+ if (init?.type !== 'CallExpression') {
+ return notOurs()
+ }
+
+ // `createFileRoute('/id')(options)`, or the malformed
+ // `createFileRoute(options)`
+ const outer = init
+ const innerCallee = unwrap(outer.callee)
+ let callee: Node
+ let idCall: CallExpression | undefined
+ let options: Node | undefined
+ if (
+ innerCallee.type === 'CallExpression' &&
+ classifyCallee(file, unwrap(innerCallee.callee), expected.routerPackage)
+ .kind !== 'foreign'
+ ) {
+ idCall = innerCallee
+ callee = unwrap(idCall.callee)
+ options = outer.arguments[0]
+ } else if (
+ classifyCallee(file, innerCallee, expected.routerPackage).kind !==
+ 'foreign' &&
+ !isStringLiteral(outer.arguments[0])
+ ) {
+ callee = innerCallee
+ options = outer.arguments[0]
+ } else {
+ // The app's own constructor or route factory: its route is left as the
+ // app makes it. Its id is not kept up, which the user is told when it
+ // visibly differs.
+ const inner = innerCallee.type === 'CallExpression' ? innerCallee : outer
+ const idArg = inner.arguments[0]
+ if (isStringLiteral(idArg) && idArg.value !== expected.routeId) {
+ const reason =
+ inner === outer
+ ? // `createFileRoute('/id')` without the options call
+ `calls ${calleeName(innerCallee)}(${JSON.stringify(idArg.value)}) without route options (\`${calleeName(innerCallee)}(${JSON.stringify(expected.routeId)})({ ... })\`)`
+ : isTypeOnlyImport(file, unwrap(inner.callee))
+ ? `uses ${calleeName(unwrap(inner.callee))}, imported as a type only`
+ : `is not created by createFileRoute/createLazyFileRoute of ${expected.routerPackage}`
+ return notOurs([
+ diagnosticAt(
+ file,
+ idArg.start,
+ 'warning',
+ `The Route of ${filePath} ${reason}: its route id ${JSON.stringify(idArg.value)} is not updated to ${JSON.stringify(expected.routeId)}.`,
+ ),
+ ])
+ }
+ return notOurs()
+ }
+
+ const calleeKind = classifyCallee(file, callee, expected.routerPackage)
+ if (calleeKind.kind === 'foreign') {
+ return notOurs()
+ }
+ const props = propsOf(options)
+ const splices: Array = []
+ const quoteOf = (node: Node) => {
+ const first = source[node.start]
+ return first === '"' || first === "'" ? first : expected.style.quote
+ }
+
+ // The id argument
+ let idText = ''
+ if (idCall) {
+ const idArg = idCall.arguments[0]
+ if (!idArg) {
+ // `createFileRoute()`: the id goes between the parentheses
+ splices.push({
+ start: idCall.end - 1,
+ end: idCall.end - 1,
+ text: lit(expected.routeId, expected.style.quote),
+ })
+ } else if (isStringLiteral(idArg)) {
+ if (idArg.value !== expected.routeId) {
+ splices.push({
+ start: idArg.start,
+ end: idArg.end,
+ text: lit(expected.routeId, quoteOf(idArg)),
+ })
+ }
+ } else if (
+ idArg.type === 'TemplateLiteral' &&
+ (idArg as unknown as { expressions: Array }).expressions.length ===
+ 0
+ ) {
+ const quasis = (
+ idArg as unknown as { quasis: Array<{ value: { cooked: string } }> }
+ ).quasis
+ if (quasis[0]?.value.cooked !== expected.routeId) {
+ splices.push({
+ start: idArg.start,
+ end: idArg.end,
+ text: lit(expected.routeId, expected.style.quote),
+ })
+ }
+ } else {
+ // An id computed at runtime: the file is left as it is
+ return {
+ kind: 'route',
+ output: null,
+ props,
+ diagnostics: [
+ diagnosticAt(
+ file,
+ idArg.start,
+ 'warning',
+ `The route id of ${filePath} is not a string literal, so it cannot be kept up: use ${lit(expected.routeId)}.`,
+ ),
+ ],
+ }
+ }
+ } else {
+ // Malformed `createFileRoute(options)`: repaired into the curried call
+ idText = `(${lit(expected.routeId, expected.style.quote)})`
+ }
+
+ // The constructor of the file's kind
+ const wanted: RouteConstructorName = expected.lazy
+ ? 'createLazyFileRoute'
+ : 'createFileRoute'
+ let calleeText = source.slice(callee.start, callee.end)
+ if (calleeKind.kind === 'ours-namespace') {
+ if (calleeKind.name !== wanted) {
+ const { property } = calleeKind
+ calleeText =
+ source.slice(callee.start, property.start) +
+ wanted +
+ source.slice(property.end, callee.end)
+ }
+ } else if (calleeKind.kind === 'repair' || calleeKind.name !== wanted) {
+ calleeText = bindConstructor(file, source, expected, wanted, calleeKind, {
+ splices,
+ callee,
+ })
+ }
+ calleeText += idText
+ if (calleeText !== source.slice(callee.start, callee.end)) {
+ splices.push({ start: callee.start, end: callee.end, text: calleeText })
+ }
+
+ return {
+ kind: 'route',
+ output: splices.length ? applySplices(source, splices) : null,
+ props,
+ diagnostics: [],
+ }
+}
+
+/**
+ * A local name bound to the router's `wanted` constructor at the Route's
+ * call, adding the import edits that need: an existing value import of it
+ * (any alias), the file's import of the other constructor switched in place
+ * when the call is its only use, or a new import (under a fresh name when
+ * the file uses the name for something else).
+ */
+function bindConstructor(
+ file: SourceFile,
+ source: string,
+ expected: RouteFileExpectation,
+ wanted: RouteConstructorName,
+ calleeKind: CalleeKind,
+ { splices, callee }: { splices: Array; callee: Node },
+): string {
+ const existing = file.imports.find(
+ (i) =>
+ i.kind === 'named' &&
+ !i.typeOnly &&
+ i.specifier === expected.routerPackage &&
+ i.name === wanted &&
+ i.local,
+ )
+ if (existing?.local) {
+ return existing.local.name
+ }
+
+ const nameFree = (name: string) =>
+ file.rootScope.lookup(name) === null &&
+ !file.references.some(
+ (reference) => reference.name === name && reference.node !== callee,
+ )
+
+ if (calleeKind.kind === 'ours' && calleeKind.specifier) {
+ const specifier = calleeKind.specifier as Node & {
+ imported: Node & { type: string }
+ local: Node & { name: string }
+ }
+ const binding = file.referenceOf(callee)?.binding
+ const uses = binding?.references.filter((r) => !r.inTypePosition) ?? []
+ if (
+ specifier.type === 'ImportSpecifier' &&
+ specifier.imported.type === 'Identifier' &&
+ specifier.imported.start === specifier.local.start &&
+ uses.length === 1 &&
+ uses[0]!.node === callee &&
+ nameFree(wanted)
+ ) {
+ // `import { createLazyFileRoute }` used only by this call: switched
+ splices.push({
+ start: specifier.start,
+ end: specifier.end,
+ text: wanted,
+ })
+ return wanted
+ }
+ }
+
+ let local: string = wanted
+ if (calleeKind.kind !== 'repair' || calleeKind.name !== wanted) {
+ for (let n = 2; !nameFree(local); n++) {
+ local = `${wanted}${n}`
+ }
+ } else if (file.rootScope.lookup(wanted) !== null) {
+ for (let n = 2; !nameFree(local); n++) {
+ local = `${wanted}${n}`
+ }
+ }
+
+ // The new import copies the quotes and semicolons of the file's first
+ // import, and goes after the directive prologue and any header comments
+ // (license, pragmas).
+ const firstImport = file.program.body.find(
+ (statement) => statement.type === 'ImportDeclaration',
+ ) as (Node & { source: Node }) | undefined
+ const quote = firstImport
+ ? (source[firstImport.source.start] as "'" | '"')
+ : expected.style.quote
+ const semicolon = firstImport
+ ? source.slice(firstImport.start, firstImport.end).endsWith(';')
+ : expected.style.semicolons
+ const offset = headerInsertOffset(file)
+ splices.push({
+ start: offset,
+ end: offset,
+ text: `import { ${local === wanted ? wanted : `${wanted} as ${local}`} } from ${lit(expected.routerPackage, quote)}${semicolon ? ';' : ''}${lineEndingOf(source)}`,
+ })
+ return local
+}
diff --git a/packages/router-generator/src/config.ts b/packages/router-generator/src/config.ts
index 5c719183db..6c07194a55 100644
--- a/packages/router-generator/src/config.ts
+++ b/packages/router-generator/src/config.ts
@@ -56,7 +56,7 @@ export const configSchema = baseConfigSchema.extend({
.transform((v) =>
typeof v === 'string' ? (v.startsWith('.') ? v : `.${v}`) : v,
),
- enableRouteTreeFormatting: z.boolean().optional().default(true),
+ enableRouteTreeFormatting: z.boolean().optional().default(false),
routeTreeFileFooter: z
.union([
z.array(z.string()).optional().default([]),
diff --git a/packages/router-generator/src/filesystem/physical/getRouteNodes.ts b/packages/router-generator/src/filesystem/physical/getRouteNodes.ts
index 09e7fc6c25..082d78d27f 100644
--- a/packages/router-generator/src/filesystem/physical/getRouteNodes.ts
+++ b/packages/router-generator/src/filesystem/physical/getRouteNodes.ts
@@ -63,9 +63,13 @@ export async function getRouteNodes(
const routeNodes: Array = []
const allPhysicalDirectories: Array = []
- async function recurse(dir: string) {
+ async function recurse(dir: string): Promise> {
const fullDir = path.resolve(config.routesDirectory, dir)
- let dirList = await fsp.readdir(fullDir, { withFileTypes: true })
+ // Sorted by name: the scan's output order is the same whatever order the
+ // filesystem lists entries in (SPEC J1.5).
+ let dirList = (await fsp.readdir(fullDir, { withFileTypes: true })).sort(
+ (a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0),
+ )
dirList = dirList.filter((d) => {
if (
@@ -158,18 +162,18 @@ export async function getRouteNodes(
delete node._virtualParentRoutePath
})
- routeNodes.push(...virtualRouteNodes)
-
- return
+ return virtualRouteNodes
}
- await Promise.all(
- dirList.map(async (dirent) => {
+ // Entries are scanned concurrently; each one's nodes are collected in
+ // its own slot and appended in directory order.
+ const nodesByEntry = await Promise.all(
+ dirList.map(async (dirent): Promise> => {
const fullPath = replaceBackslash(path.join(fullDir, dirent.name))
const relativePath = path.posix.join(dir, dirent.name)
if (dirent.isDirectory()) {
- await recurse(relativePath)
+ return recurse(relativePath)
} else if (fullPath.match(/\.(tsx|ts|jsx|js|vue)$/)) {
const filePath = replaceBackslash(path.join(dir, dirent.name))
const filePathNoExt = removeExt(filePath)
@@ -190,7 +194,7 @@ export async function getRouteNodes(
}
if (disallowedRouteGroupConfiguration.test(dirent.name)) {
- const errorMessage = `A route configuration for a route group was found at \`${filePath}\`. This is not supported. Did you mean to use a layout/pathless route instead?`
+ const errorMessage = `A route configuration for a route group was found at \`${fullPath}\`. This is not supported. Did you mean to use a layout/pathless route instead?`
logger.error(`ERROR: ${errorMessage}`)
throw new Error(errorMessage)
}
@@ -217,9 +221,16 @@ export async function getRouteNodes(
routeType = 'pathless_layout'
}
+ // A `.lazy.vue` single-file component is the lazily loaded
+ // component of its route (its default export), not a lazy route
+ // module (SPEC J1.17).
+ const isVueFile = filePath.endsWith('.vue')
+ if (isVueFile && routeType === 'lazy') {
+ routeType = 'component'
+ }
+
// Only show deprecation warning for .tsx/.ts files, not .vue files
// Vue files using .component.vue is the Vue-native way
- const isVueFile = filePath.endsWith('.vue')
if (!isVueFile) {
;(
[
@@ -282,18 +293,37 @@ export async function getRouteNodes(
routeTokenSegmentRegex.test(lastRouteSegment) &&
!isRouteTokenEscaped
- if (suffixToStrip || shouldStripRouteToken) {
- const stripSegment = suffixToStrip ?? lastRouteSegment
+ const stripLastSegment = (segment: string) => {
routePath = routePath.replace(
- new RegExp(`/${escapeRegExp(stripSegment)}$`),
+ new RegExp(`/${escapeRegExp(segment)}$`),
'',
)
originalRoutePath = originalRoutePath.replace(
- new RegExp(`/${escapeRegExp(stripSegment)}$`),
+ new RegExp(`/${escapeRegExp(segment)}$`),
'',
)
}
+ if (suffixToStrip) {
+ stripLastSegment(suffixToStrip)
+ // A piece of a directory route (`posts/route.component.vue`)
+ // belongs to the route itself: its route token goes too.
+ const originalSegmentsAfter = originalRoutePath
+ .split('/')
+ .filter(Boolean)
+ const lastOriginalAfter =
+ originalSegmentsAfter[originalSegmentsAfter.length - 1] || ''
+ const lastAfter = routePath.split('/').filter(Boolean).pop() || ''
+ if (
+ routeTokenSegmentRegex.test(lastAfter) &&
+ lastOriginalAfter === lastAfter
+ ) {
+ stripLastSegment(lastAfter)
+ }
+ } else if (shouldStripRouteToken) {
+ stripLastSegment(lastRouteSegment)
+ }
+
// Check if the index token should be treated specially or as a literal path
// Escaping stays literal-only: if the last original segment is bracket-wrapped,
// treat it as literal even if it matches the token regex.
@@ -335,26 +365,29 @@ export async function getRouteNodes(
}
}
- routeNodes.push({
- filePath,
- fullPath,
- routePath,
- variableName,
- _fsRouteType: routeType,
- originalRoutePath,
- _routePathSegmentMetadata: createRoutePathSegmentMetadata(
+ return [
+ {
+ filePath,
+ fullPath,
routePath,
+ variableName,
+ _fsRouteType: routeType,
originalRoutePath,
- ),
- })
+ _routePathSegmentMetadata: createRoutePathSegmentMetadata(
+ routePath,
+ originalRoutePath,
+ ),
+ },
+ ]
}
+ return []
}),
)
- return routeNodes
+ return nodesByEntry.flat()
}
- await recurse('./')
+ routeNodes.push(...(await recurse('./')))
// Find the root route node - prefer the actual route file over component/loader files
const rootRouteNode =
diff --git a/packages/router-generator/src/filesystem/scan.ts b/packages/router-generator/src/filesystem/scan.ts
new file mode 100644
index 0000000000..d69bb9c494
--- /dev/null
+++ b/packages/router-generator/src/filesystem/scan.ts
@@ -0,0 +1,89 @@
+import path from 'node:path'
+import { createTokenRegex, replaceBackslash } from '../utils'
+import { getRouteNodes as physicalGetRouteNodes } from './physical/getRouteNodes'
+import { getRouteNodes as virtualGetRouteNodes } from './virtual/getRouteNodes'
+import { rootPathId } from './physical/rootPathId'
+import type { Config } from '../config'
+import type { RouteNode } from '../types'
+
+/** What one scan of the routes found. Immutable once returned. */
+export interface ScanResult {
+ rootRouteNode: RouteNode
+ /** Every route file and file-less virtual route but the root route. */
+ routeNodes: ReadonlyArray
+ /** The directories `physical()` mounts scan (absolute, `/`-separated). */
+ physicalDirectories: ReadonlyArray
+}
+
+/**
+ * Scans the routes directory (or the virtual route config): which route
+ * files exist and which route each one is, by the routing conventions.
+ * Virtual route config modules are evaluated anew on every scan.
+ */
+export async function scanRoutes(
+ config: Config,
+ root: string,
+): Promise {
+ const tokenRegexes = {
+ indexTokenSegmentRegex: createTokenRegex(config.indexToken, {
+ type: 'segment',
+ }),
+ routeTokenSegmentRegex: createTokenRegex(config.routeToken, {
+ type: 'segment',
+ }),
+ }
+ const result = config.virtualRouteConfig
+ ? await virtualGetRouteNodes(config, root, tokenRegexes)
+ : await physicalGetRouteNodes(config, root, tokenRegexes)
+
+ if (result.rootRouteNode === undefined) {
+ let errorMessage = `rootRouteNode must not be undefined. Make sure you've added your root route into the route-tree.`
+ if (!config.virtualRouteConfig) {
+ errorMessage += `\nMake sure that you add a "${rootPathId}.${config.disableTypes ? 'js' : 'tsx'}" file to your routes directory.\nAdd the file in: "${config.routesDirectory}/${rootPathId}.${config.disableTypes ? 'js' : 'tsx'}"`
+ }
+ throw new Error(errorMessage)
+ }
+
+ checkRouteFilesUsedOnce(new Set([result.rootRouteNode, ...result.routeNodes]))
+
+ return {
+ rootRouteNode: result.rootRouteNode,
+ routeNodes: result.routeNodes,
+ physicalDirectories: [
+ ...new Set(
+ result.physicalDirectories.map((dir) =>
+ replaceBackslash(path.resolve(dir)),
+ ),
+ ),
+ ].sort(),
+ }
+}
+
+/**
+ * A route file is one route: a virtual route config naming a file twice
+ * (two `route()` entries, two `physical()` mounts of one directory, a
+ * `__virtual.ts` entry for a file the directory scan routes too) is an error
+ * naming the file (SPEC J1.7).
+ */
+function checkRouteFilesUsedOnce(nodes: ReadonlySet) {
+ const routesByFile = new Map>()
+ for (const node of nodes) {
+ if (node.isVirtual || node.isVirtualParentRoute) {
+ continue
+ }
+ const routes = routesByFile.get(node.fullPath) ?? []
+ routes.push(node.routePath ?? `/${rootPathId}`)
+ routesByFile.set(node.fullPath, routes)
+ }
+ const reused = [...routesByFile].filter(([, routes]) => routes.length > 1)
+ if (reused.length) {
+ throw new Error(
+ `A route file can be used for one route only. Files used for several routes:\n${reused
+ .map(
+ ([file, routes]) =>
+ ` ${file}: ${routes.map((route) => `"${route}"`).join(', ')}`,
+ )
+ .join('\n')}\n`,
+ )
+ }
+}
diff --git a/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts b/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts
index 5d3cd610be..61ad218bfa 100644
--- a/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts
+++ b/packages/router-generator/src/filesystem/virtual/getRouteNodes.ts
@@ -116,7 +116,9 @@ async function getVirtualRouteConfigFromFileExport(
) {
throw new Error(`virtualRouteConfig is undefined or empty`)
}
- const exports = await loadConfigFile(join(root, tsrConfig.virtualRouteConfig))
+ const exports = await loadConfigFile(
+ resolve(root, tsrConfig.virtualRouteConfig),
+ )
if (!('routes' in exports) && !('default' in exports)) {
throw new Error(
diff --git a/packages/router-generator/src/filesystem/virtual/loadConfigFile.ts b/packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
index a4606e4e19..0bf6a30692 100644
--- a/packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
+++ b/packages/router-generator/src/filesystem/virtual/loadConfigFile.ts
@@ -1,9 +1,16 @@
-import { createJiti } from 'jiti'
-
+/**
+ * Evaluates a virtual route config module (`virtualRouteConfig` file,
+ * `__virtual.ts`). Every call evaluates the file again: the generator only
+ * calls it when the scan is redone, and an edited config must be seen
+ * (SPEC J1.10), so no module cache is kept between loads.
+ */
export async function loadConfigFile(filePath: string) {
+ // only virtual route configs need jiti: keep it off the startup path
+ const { createJiti } = await import('jiti')
const jiti = createJiti(filePath, {
interopDefault: false,
tsconfigPaths: true,
+ moduleCache: false,
})
const loaded = await jiti.import(filePath)
return loaded
diff --git a/packages/router-generator/src/generator.ts b/packages/router-generator/src/generator.ts
index 91f87dadda..dc3fab0174 100644
--- a/packages/router-generator/src/generator.ts
+++ b/packages/router-generator/src/generator.ts
@@ -1,155 +1,36 @@
import path from 'node:path'
import * as fsp from 'node:fs/promises'
-import { existsSync, mkdirSync } from 'node:fs'
-import crypto from 'node:crypto'
-import { rootRouteId } from '@tanstack/router-core'
import { logging } from './logger'
-import {
- isVirtualConfigFile,
- getRouteNodes as physicalGetRouteNodes,
-} from './filesystem/physical/getRouteNodes'
-import { getRouteNodes as virtualGetRouteNodes } from './filesystem/virtual/getRouteNodes'
+import { isVirtualConfigFile } from './filesystem/physical/getRouteNodes'
import { rootPathId } from './filesystem/physical/rootPathId'
+import { scanRoutes } from './filesystem/scan'
+import { replaceBackslash } from './utils'
+import { analyzeRouteFile } from './analyze/route-file'
+import { routerPackageOf, scaffoldRouteFile } from './scaffold/templates'
+import { buildTreeModel, checkRouteFullPathUniqueness } from './model/build'
+import { printTree } from './print/tree'
+import { styleOf } from './print/style'
+import { formatWithPrettier } from './print/format'
import {
- RoutePrefixMap,
- buildFileRoutesByPathInterface,
- buildImportString,
- buildRouteTreeConfig,
- checkFileExists,
- checkRouteFullPathUniqueness,
- countRoutePathSegments,
- countSlashSeparatedParts,
- createRouteNodesByFullPath,
- createRouteNodesById,
- createRouteNodesByTo,
- createTokenRegex,
- determineNodePath,
- findParent,
- format,
- getImportForRouteNode,
- getResolvedRouteNodeVariableName,
- hasParentRoute,
- isSegmentPathless,
- mergeImportDeclarations,
- multiSortBy,
- removeExt,
- removeGroups,
- removeLastSegmentFromPath,
- removeLayoutSegmentsAndUnderscoresWithEscape,
- removeTrailingSlash,
- replaceBackslash,
- sortRouteNodes,
- trimPathLeft,
-} from './utils'
-import { fillTemplate, getTargetTemplate } from './template'
-import { transform } from './transform/transform'
+ AtomicPublisher,
+ ConcurrentEditError,
+ readIfExists,
+} from './publish/atomic'
import { validateRouteParams } from './validate-route-params'
+import type { FileDiagnostic } from './analyze/route-file'
+import type { ScanResult } from './filesystem/scan'
import type { GeneratorPlugin } from './plugin/types'
-import type { TargetTemplate } from './template'
+import type { CodeStyle } from './print/style'
import type {
FsRouteType,
- GetRouteNodesResult,
GetRoutesByFileMapResult,
- HandleNodeAccumulator,
- ImportDeclaration,
RouteNode,
- RoutePathSegmentMetadata,
+ RouteProps,
+ TreeModel,
} from './types'
import type { Config } from './config'
import type { Logger } from './logger'
-interface fs {
- stat: (
- filePath: string,
- ) => Promise<{ mtimeMs: bigint; mode: number; uid: number; gid: number }>
- rename: (oldPath: string, newPath: string) => Promise
- writeFile: (filePath: string, content: string) => Promise
- readFile: (
- filePath: string,
- ) => Promise<
- { stat: { mtimeMs: bigint }; fileContent: string } | 'file-not-existing'
- >
- chmod: (filePath: string, mode: number) => Promise
- chown: (filePath: string, uid: number, gid: number) => Promise
-}
-
-function getRoutePathSegmentMetadataForPath(
- node: RouteNode,
- routePath: string,
- parentRoutePath?: string,
-): Array | undefined {
- if (!node._routePathSegmentMetadata) return undefined
-
- const segments = routePath.split('/')
- const result = new Array(
- segments.length,
- )
- const parentSegmentCount = countRoutePathSegments(parentRoutePath)
- let hasMetadata = false
- let segmentCount = 0
-
- for (let i = 0; i < segments.length; i++) {
- if (!segments[i]) continue
- const sourceIndex = parentSegmentCount + segmentCount + 1
- result[i] = node._routePathSegmentMetadata[sourceIndex]
- hasMetadata ||= !!result[i]
- segmentCount++
- }
-
- return hasMetadata ? result : undefined
-}
-
-const DefaultFileSystem: fs = {
- stat: async (filePath) => {
- const res = await fsp.stat(filePath, { bigint: true })
- return {
- mtimeMs: res.mtimeMs,
- mode: Number(res.mode),
- uid: Number(res.uid),
- gid: Number(res.gid),
- }
- },
- rename: (oldPath, newPath) => fsp.rename(oldPath, newPath),
- writeFile: (filePath, content) => fsp.writeFile(filePath, content),
- readFile: async (filePath: string) => {
- try {
- const fileHandle = await fsp.open(filePath, 'r')
- const stat = await fileHandle.stat({ bigint: true })
- const fileContent = (await fileHandle.readFile()).toString()
- await fileHandle.close()
- return { stat, fileContent }
- } catch (e: any) {
- if ('code' in e) {
- if (e.code === 'ENOENT') {
- return 'file-not-existing'
- }
- }
- throw e
- }
- },
- chmod: (filePath, mode) => fsp.chmod(filePath, mode),
- chown: (filePath, uid, gid) => fsp.chown(filePath, uid, gid),
-}
-
-interface Rerun {
- rerun: true
- msg?: string
- event: GeneratorEvent
-}
-function rerun(opts: { msg?: string; event?: GeneratorEvent }): Rerun {
- const { event, ...rest } = opts
- return { rerun: true, event: event ?? { type: 'rerun' }, ...rest }
-}
-
-function isRerun(result: unknown): result is Rerun {
- return (
- typeof result === 'object' &&
- result !== null &&
- 'rerun' in result &&
- result.rerun === true
- )
-}
-
export type FileEventType = 'create' | 'update' | 'delete'
export type FileEvent = {
type: FileEventType
@@ -157,1507 +38,693 @@ export type FileEvent = {
}
export type GeneratorEvent = FileEvent | { type: 'rerun' }
-type FileCacheChange =
- | {
- result: false
- cacheEntry: TCacheEntry
- }
- | { result: true; mtimeMs: bigint; cacheEntry: TCacheEntry }
- | {
- result: 'file-not-in-cache'
- }
- | {
- result: 'cannot-stat-file'
- }
+/** What a route file contributes to the tree, from its last analysis. */
+type FileFacts =
+ | { included: false }
+ | { included: true; props: RouteProps | undefined }
-interface GeneratorCacheEntry {
- mtimeMs: bigint
- fileContent: string
+/** A file's modification time and size, to tell it unchanged without reading it. */
+interface FileStamp {
+ readonly mtimeMs: number
+ readonly size: number
}
-interface RouteNodeCacheEntry extends GeneratorCacheEntry {
- routeId: string
- node: RouteNode
+interface FileState {
+ /** The content last read (or written by the generator). */
+ readonly content: string
+ readonly stamp?: FileStamp
+ readonly facts: FileFacts
+ /**
+ * The route the file was kept up for (`roleOf`): a file is analysed again
+ * when the scan gives it another route, its content unchanged (SPEC J1.1).
+ */
+ readonly role: string
}
-type GeneratorRouteNodeCache = Map** filePath **/ string, RouteNodeCacheEntry>
-
-interface CrawlingResult {
- rootRouteNode: RouteNode
- routeFileResult: Array
- acc: HandleNodeAccumulator
+/** What a file's analysis depends on besides its content. */
+function roleOf(node: RouteNode, isRoot: boolean) {
+ return `${isRoot ? 'root' : node._fsRouteType}:${node.routePath ?? ''}`
}
+/**
+ * `TSR_COMPILER_STATS=1` (measurement aid): registers the generator's
+ * per-file facts in the process-global registry `compilerStats()` of
+ * `@tanstack/router-utils/compiler` reads (held through a `WeakRef`).
+ */
+function registerStats(
+ generator: Generator,
+ read: (g: Generator) => Record,
+): void {
+ const g = globalThis as Record
+ const key = Symbol.for('tanstack.compiler.stats')
+ const registry = (g[key] ??= []) as Array
+ registry.push({
+ label: 'router-generator',
+ owner: new WeakRef(generator),
+ read,
+ })
+}
+
+async function stampOf(file: string): Promise {
+ try {
+ const { mtimeMs, size } = await fsp.stat(file)
+ return { mtimeMs, size }
+ } catch (error) {
+ if ((error as NodeJS.ErrnoException).code === 'ENOENT') {
+ return null
+ }
+ throw error
+ }
+}
+
+const pieceTypes: ReadonlyArray = [
+ 'loader',
+ 'component',
+ 'pendingComponent',
+ 'errorComponent',
+ 'notFoundComponent',
+]
+
+const routeFileExtension = /\.(tsx|ts|jsx|js|vue)$/
+
+/** The files of a scan: the root route's and every route file's, once each. */
+function filesOf(scan: ScanResult) {
+ return [
+ scan.rootRouteNode,
+ ...scan.routeNodes.filter(
+ (node) =>
+ node !== scan.rootRouteNode &&
+ !node.isVirtual &&
+ !node.isVirtualParentRoute,
+ ),
+ ]
+}
+
+/** A path as the scan spells it: absolute, `/`-separated. */
+function normalize(file: string) {
+ return replaceBackslash(path.resolve(file))
+}
+
+function isUnder(file: string, dir: string) {
+ return file.startsWith(dir.endsWith('/') ? dir : `${dir}/`)
+}
+
+function sameProps(a: RouteProps | undefined, b: RouteProps | undefined) {
+ if (!a || !b) {
+ return a === b
+ }
+ return (
+ a.unknown === b.unknown &&
+ a.known.size === b.known.size &&
+ [...a.known].every((name) => b.known.has(name))
+ )
+}
+
+function formatDiagnostic(file: string, diagnostic: FileDiagnostic) {
+ const position =
+ diagnostic.line === undefined
+ ? ''
+ : `:${diagnostic.line}:${diagnostic.column ?? 1}`
+ return `${file}${position}: ${diagnostic.message}`
+}
+
+/**
+ * The route generator of one app: keeps its route files up and its route
+ * tree generated. Events (`run(event)`) are queued and drained by one loop,
+ * a batch at a time, so events that arrive together are handled together
+ * and none is lost (SPEC J1.10). Each batch rebuilds the tree model from
+ * the scan and the facts of each route file, which are kept by path and
+ * replaced whenever the file's content changes; the model itself is never
+ * reused (no route node outlives a generation).
+ */
export class Generator {
- /**
- * why do we have two caches for the route files?
- * During processing, we READ from the cache and WRITE to the shadow cache.
- *
- * After a route file is processed, we write to the shadow cache.
- * If during processing we bail out and re-run, we don't lose this modification
- * but still can track whether the file contributed changes and thus the route tree file needs to be regenerated.
- * After all files are processed, we swap the shadow cache with the main cache and initialize a new shadow cache.
- * That way we also ensure deleted/renamed files don't stay in the cache forever.
- */
- private routeNodeCache: GeneratorRouteNodeCache = new Map()
- private routeNodeShadowCache: GeneratorRouteNodeCache = new Map()
-
- private routeTreeFileCache: GeneratorCacheEntry | undefined
-
- private crawlingResult: CrawlingResult | undefined
public config: Config
- public targetTemplate: TargetTemplate
+ private readonly root: string
+ private readonly logger: Logger
+ private readonly plugins: ReadonlyArray
+ private readonly style: CodeStyle
+ private readonly routerPackage: string
+ private readonly treeFile: string
+ /** The route tree file as event paths spell it. */
+ private readonly treeKey: string
+ private readonly routesDirectory: string
+ private readonly virtualConfigFile: string | undefined
+ private readonly publisher: AtomicPublisher
- private root: string
- private routesDirectoryPath: string
- private sessionId?: string
- private fs: fs
- private logger: Logger
- private generatedRouteTreePath: string
- private runPromise: Promise | undefined
- private fileEventQueue: Array = []
- private plugins: Array = []
- private static routeGroupPatternRegex = /\(.+\)/
- private physicalDirectories: Array = []
+ private scan: ScanResult | undefined
+ private readonly files = new Map()
+ private model: TreeModel | undefined
+ /** The route tree as last published, to tell an external change of it. */
+ private published:
+ | { content: string; mtimeMs: number; size: number }
+ | undefined
+ /** A batch failed after the scan changed: the next one rebuilds the tree. */
+ private stale = false
+ private routesByFile: GetRoutesByFileMapResult = new Map()
+ /** The real paths of the scan roots, for those that differ. */
+ private realRoots: Array<[scanned: string, real: string]> = []
- /**
- * Token regexes are pre-compiled once here and reused throughout route processing.
- * We need TWO types of regex for each token because they match against different inputs:
- *
- * 1. FILENAME regexes: Match token patterns within full file path strings.
- * Example: For file "routes/dashboard.index.tsx", we want to detect ".index."
- * Pattern: `[./](?:token)[.]` - matches token bounded by path separators/dots
- * Used in: sorting route nodes by file path
- *
- * 2. SEGMENT regexes: Match token against a single logical route segment.
- * Example: For segment "index" (extracted from path), match the whole segment
- * Pattern: `^(?:token)$` - matches entire segment exactly
- * Used in: route parsing, determining route types, escape detection
- *
- * We cannot reuse one for the other without false positives or missing matches.
- */
- private indexTokenFilenameRegex: RegExp
- private routeTokenFilenameRegex: RegExp
- private indexTokenSegmentRegex: RegExp
- private routeTokenSegmentRegex: RegExp
- private static componentPieceRegex =
- /[./](component|errorComponent|notFoundComponent|pendingComponent|loader|lazy)[.]/
+ private queue: Array = []
+ private waiters: Array<{
+ resolve: () => void
+ reject: (error: unknown) => void
+ }> = []
+ private draining: Promise | undefined
- constructor(opts: { config: Config; root: string; fs?: fs }) {
+ constructor(opts: { config: Config; root: string }) {
this.config = opts.config
- this.logger = logging({ disabled: this.config.disableLogging })
this.root = opts.root
- this.fs = opts.fs || DefaultFileSystem
- this.generatedRouteTreePath = this.getGeneratedRouteTreePath()
- this.targetTemplate = getTargetTemplate(this.config)
-
- this.routesDirectoryPath = this.getRoutesDirectoryPath()
- this.plugins.push(...(opts.config.plugins || []))
-
- // Create all token regexes once in constructor
- this.indexTokenFilenameRegex = createTokenRegex(this.config.indexToken, {
- type: 'filename',
- })
- this.routeTokenFilenameRegex = createTokenRegex(this.config.routeToken, {
- type: 'filename',
- })
- this.indexTokenSegmentRegex = createTokenRegex(this.config.indexToken, {
- type: 'segment',
- })
- this.routeTokenSegmentRegex = createTokenRegex(this.config.routeToken, {
- type: 'segment',
- })
-
+ this.logger = logging({ disabled: this.config.disableLogging })
+ this.style = styleOf(this.config)
+ this.routerPackage = routerPackageOf(this.config.target)
+ this.treeFile = path.resolve(this.root, this.config.generatedRouteTree)
+ this.treeKey = normalize(this.treeFile)
+ this.routesDirectory = normalize(
+ path.resolve(this.root, this.config.routesDirectory),
+ )
+ this.virtualConfigFile =
+ typeof this.config.virtualRouteConfig === 'string'
+ ? normalize(path.resolve(this.root, this.config.virtualRouteConfig))
+ : undefined
+ this.publisher = new AtomicPublisher(this.config.tmpDir)
+ this.plugins = [...(this.config.plugins ?? [])]
for (const plugin of this.plugins) {
plugin.init?.({ generator: this })
}
- }
-
- private getGeneratedRouteTreePath() {
- const generatedRouteTreePath = path.isAbsolute(
- this.config.generatedRouteTree,
- )
- ? this.config.generatedRouteTree
- : path.resolve(this.root, this.config.generatedRouteTree)
-
- const generatedRouteTreeDir = path.dirname(generatedRouteTreePath)
-
- if (!existsSync(generatedRouteTreeDir)) {
- mkdirSync(generatedRouteTreeDir, { recursive: true })
+ if (process.env.TSR_COMPILER_STATS === '1') {
+ registerStats(this, (g) => {
+ let contentBytes = 0
+ for (const f of g.files.values()) {
+ contentBytes += f.content.length * 2
+ }
+ return {
+ files: g.files.size,
+ contentBytes,
+ routesByFile: g.routesByFile.size,
+ queue: g.queue.length,
+ waiters: g.waiters.length,
+ }
+ })
}
-
- return generatedRouteTreePath
}
- private getRoutesDirectoryPath() {
- return path.isAbsolute(this.config.routesDirectory)
- ? this.config.routesDirectory
- : path.resolve(this.root, this.config.routesDirectory)
+ /**
+ * Handles a file event (or, without one, regenerates everything) and
+ * resolves once every queued event is handled; rejects when the last
+ * batch failed (no root route, conflicting routes, a failed write).
+ */
+ public run(event?: GeneratorEvent): Promise {
+ if (event && event.type !== 'rerun') {
+ if (!this.isRelevant(event.path)) {
+ return Promise.resolve()
+ }
+ this.queue.push({ type: event.type, path: normalize(event.path) })
+ } else {
+ this.queue.push({ type: 'rerun' })
+ }
+ const done = new Promise((resolve, reject) => {
+ this.waiters.push({ resolve, reject })
+ })
+ this.drain()
+ return done
}
+ /** The route files of the tree (scanned and real paths) and their route ids. */
public getRoutesByFileMap(): GetRoutesByFileMapResult {
- return new Map(
- [...this.routeNodeCache.entries()].map(([filePath, cacheEntry]) => [
- filePath,
- { routeId: cacheEntry.routeId },
- ]),
- )
+ return this.routesByFile
}
- public async run(event?: GeneratorEvent): Promise {
- if (
- event &&
- event.type !== 'rerun' &&
- !this.isFileRelevantForRouteTreeGeneration(event.path)
- ) {
- return
- }
- this.fileEventQueue.push(event ?? { type: 'rerun' })
- // only allow a single run at a time
- if (this.runPromise) {
- return this.runPromise
- }
-
- this.runPromise = (async () => {
- do {
- // synchronously copy and clear the queue since we are going to iterate asynchronously over it
- // and while we do so, a new event could be put into the queue
- const tempQueue = this.fileEventQueue
- this.fileEventQueue = []
- // if we only have 'update' events in the queue
- // and we already have the affected files' latest state in our cache, we can exit early
- const remainingEvents = (
- await Promise.all(
- tempQueue.map(async (e) => {
- if (e.type === 'update') {
- let cacheEntry: GeneratorCacheEntry | undefined
- if (e.path === this.generatedRouteTreePath) {
- cacheEntry = this.routeTreeFileCache
- } else {
- // we only check the routeNodeCache here
- // if the file's state is only up-to-date in the shadow cache we need to re-run
- cacheEntry = this.routeNodeCache.get(e.path)
- }
- const change = await this.didFileChangeComparedToCache(
- { path: e.path },
- cacheEntry,
- )
- if (change.result === false) {
- return null
- }
- }
- return e
- }),
- )
- ).filter((e) => e !== null)
-
- if (remainingEvents.length === 0) {
- break
- }
-
- try {
- await this.generatorInternal()
- } catch (err) {
- const errArray = !Array.isArray(err) ? [err] : err
-
- const recoverableErrors = errArray.filter((e) => isRerun(e))
- if (recoverableErrors.length === errArray.length) {
- this.fileEventQueue.push(...recoverableErrors.map((e) => e.event))
- recoverableErrors.forEach((e) => {
- if (e.msg) {
- this.logger.info(e.msg)
- }
- })
- } else {
- const unrecoverableErrors = errArray.filter((e) => !isRerun(e))
- this.runPromise = undefined
- throw new Error(
- unrecoverableErrors.map((e) => (e as Error).message).join(),
- )
- }
- }
- } while (this.fileEventQueue.length)
- this.runPromise = undefined
- })()
- return this.runPromise
+ /** The tree model of the last generation, after the queued events. */
+ public async getTreeModel(): Promise {
+ await this.draining
+ return this.model
}
- private async generatorInternal() {
- let writeRouteTreeFile: boolean | 'force' = false
-
- let getRouteNodesResult: GetRouteNodesResult
-
- if (this.config.virtualRouteConfig) {
- getRouteNodesResult = await virtualGetRouteNodes(this.config, this.root, {
- indexTokenSegmentRegex: this.indexTokenSegmentRegex,
- routeTokenSegmentRegex: this.routeTokenSegmentRegex,
- })
- } else {
- getRouteNodesResult = await physicalGetRouteNodes(
- this.config,
- this.root,
- {
- indexTokenSegmentRegex: this.indexTokenSegmentRegex,
- routeTokenSegmentRegex: this.routeTokenSegmentRegex,
- },
- )
- }
-
- const {
- rootRouteNode,
- routeNodes: beforeRouteNodes,
- physicalDirectories,
- } = getRouteNodesResult
- if (rootRouteNode === undefined) {
- let errorMessage = `rootRouteNode must not be undefined. Make sure you've added your root route into the route-tree.`
- if (!this.config.virtualRouteConfig) {
- errorMessage += `\nMake sure that you add a "${rootPathId}.${this.config.disableTypes ? 'js' : 'tsx'}" file to your routes directory.\nAdd the file in: "${this.config.routesDirectory}/${rootPathId}.${this.config.disableTypes ? 'js' : 'tsx'}"`
- }
- throw new Error(errorMessage)
- }
- this.physicalDirectories = physicalDirectories
-
- await this.handleRootNode(rootRouteNode)
-
- const preRouteNodes = multiSortBy(beforeRouteNodes, [
- (d) => (d.routePath === '/' ? -1 : 1),
- (d) =>
- d.routePath === undefined
- ? undefined
- : countSlashSeparatedParts(d.routePath),
- (d) => (d.filePath.match(this.indexTokenFilenameRegex) ? 1 : -1),
- (d) => (d.filePath.match(Generator.componentPieceRegex) ? 1 : -1),
- (d) => (d.filePath.match(this.routeTokenFilenameRegex) ? -1 : 1),
- (d) => (d.routePath?.endsWith('/') ? -1 : 1),
- (d) => d.routePath,
- ]).filter((d) => {
- // Exclude the root route itself, but keep component/loader pieces for the root
- if (d.routePath === `/${rootPathId}`) {
- return [
- 'component',
- 'errorComponent',
- 'notFoundComponent',
- 'pendingComponent',
- 'loader',
- 'lazy',
- ].includes(d._fsRouteType)
- }
- return true
+ /**
+ * Prints a route tree module of `model` (e.g. a pruned copy) with this
+ * generator's options, some of them overridden.
+ */
+ public printRouteTree(
+ model: TreeModel,
+ overrides: {
+ disableTypes?: boolean
+ header?: ReadonlyArray
+ footer?: ReadonlyArray
+ } = {},
+ ): string {
+ return printTree(model, {
+ style: this.style,
+ disableTypes: overrides.disableTypes ?? this.config.disableTypes,
+ routerPackage: this.routerPackage,
+ treeFile: this.treeFile,
+ addExtensions: this.config.addExtensions,
+ importRoutesUsingAbsolutePaths:
+ this.config.importRoutesUsingAbsolutePaths,
+ header: overrides.header ?? this.config.routeTreeFileHeader,
+ footer: overrides.footer ?? this.footer(),
})
-
- const routeFileAllResult = await Promise.allSettled(
- preRouteNodes
- // only process routes that are backed by an actual file
- .filter((n) => !n.isVirtualParentRoute && !n.isVirtual)
- .map((n) => this.processRouteNodeFile(n)),
- )
-
- const rejections = routeFileAllResult.filter(
- (result) => result.status === 'rejected',
- )
- if (rejections.length > 0) {
- throw rejections.map((e) => e.reason)
- }
-
- const routeFileResult = routeFileAllResult.flatMap((result) => {
- if (result.status === 'fulfilled' && result.value !== null) {
- if (result.value.shouldWriteTree) {
- writeRouteTreeFile = true
- }
- return result.value.node
- }
- return []
- })
-
- // reset children in case we re-use a node from the cache
- routeFileResult.forEach((r) => (r.children = undefined))
-
- const acc: HandleNodeAccumulator = {
- routeTree: [],
- routeNodes: [],
- routePiecesByPath: {},
- routeNodesByPath: new Map(),
- }
-
- const prefixMap = new RoutePrefixMap(routeFileResult)
-
- for (const node of routeFileResult) {
- Generator.handleNode(node, acc, prefixMap, this.config)
- }
-
- this.crawlingResult = { rootRouteNode, routeFileResult, acc }
-
- // this is the first time the generator runs, so read in the route tree file if it exists yet
- if (!this.routeTreeFileCache) {
- const routeTreeFile = await this.fs.readFile(this.generatedRouteTreePath)
- if (routeTreeFile !== 'file-not-existing') {
- this.routeTreeFileCache = {
- fileContent: routeTreeFile.fileContent,
- mtimeMs: routeTreeFile.stat.mtimeMs,
- }
- }
- writeRouteTreeFile = true
- } else {
- const routeTreeFileChange = await this.didFileChangeComparedToCache(
- { path: this.generatedRouteTreePath },
- this.routeTreeFileCache,
- )
- if (routeTreeFileChange.result !== false) {
- writeRouteTreeFile = 'force'
- if (routeTreeFileChange.result === true) {
- const routeTreeFile = await this.fs.readFile(
- this.generatedRouteTreePath,
- )
- if (routeTreeFile !== 'file-not-existing') {
- this.routeTreeFileCache = {
- fileContent: routeTreeFile.fileContent,
- mtimeMs: routeTreeFile.stat.mtimeMs,
- }
- }
- }
- }
- }
-
- if (!writeRouteTreeFile) {
- // only needs to be done if no other changes have been detected yet
- // compare shadowCache and cache to identify deleted routes
- if (this.routeNodeCache.size !== this.routeNodeShadowCache.size) {
- writeRouteTreeFile = true
- } else {
- for (const fullPath of this.routeNodeCache.keys()) {
- if (!this.routeNodeShadowCache.has(fullPath)) {
- writeRouteTreeFile = true
- break
- }
- }
- }
- }
-
- if (!writeRouteTreeFile) {
- this.swapCaches()
- return
- }
-
- const buildResult = this.buildRouteTree({
- rootRouteNode,
- acc,
- routeFileResult,
- })
- let routeTreeContent = buildResult.routeTreeContent
-
- routeTreeContent = this.config.enableRouteTreeFormatting
- ? await format(routeTreeContent, this.config)
- : routeTreeContent
-
- let newMtimeMs: bigint | undefined
- if (this.routeTreeFileCache) {
- if (this.routeTreeFileCache.fileContent === routeTreeContent) {
- // existing route tree file is already up-to-date, don't write it.
- // When 'force' was set because an external change was detected,
- // we still re-read and re-check here, but if the generated content
- // matches we skip the write to avoid triggering another watcher cycle.
- } else {
- const newRouteTreeFileStat = await this.safeFileWrite({
- filePath: this.generatedRouteTreePath,
- newContent: routeTreeContent,
- strategy: {
- type: 'mtime',
- expectedMtimeMs: this.routeTreeFileCache.mtimeMs,
- },
- })
- newMtimeMs = newRouteTreeFileStat.mtimeMs
- }
- } else {
- const newRouteTreeFileStat = await this.safeFileWrite({
- filePath: this.generatedRouteTreePath,
- newContent: routeTreeContent,
- strategy: {
- type: 'new-file',
- },
- })
- newMtimeMs = newRouteTreeFileStat.mtimeMs
- }
-
- if (newMtimeMs !== undefined) {
- this.routeTreeFileCache = {
- fileContent: routeTreeContent,
- mtimeMs: newMtimeMs,
- }
- }
-
- this.plugins.map((plugin) => {
- return plugin.onRouteTreeChanged?.({
- routeTree: buildResult.routeTree,
- routeNodes: buildResult.routeNodes,
- acc,
- rootRouteNode,
- })
- })
- this.swapCaches()
}
- private swapCaches() {
- this.routeNodeCache = this.routeNodeShadowCache
- this.routeNodeShadowCache = new Map()
- }
-
- public buildRouteTree(opts: {
- rootRouteNode: RouteNode
- acc: HandleNodeAccumulator
- routeFileResult: Array
- config?: Partial
- }) {
- const config = { ...this.config, ...(opts.config || {}) }
-
- const { rootRouteNode, acc } = opts
-
- // Use pre-compiled regex if config hasn't been overridden, otherwise create new one
- const indexTokenSegmentRegex =
- config.indexToken === this.config.indexToken
- ? this.indexTokenSegmentRegex
- : createTokenRegex(config.indexToken, { type: 'segment' })
-
- const sortedRouteNodes = sortRouteNodes(
- acc.routeNodes,
- indexTokenSegmentRegex,
- )
-
- const routeImports: Array = []
- const virtualRouteNodes: Array = []
-
- for (const node of sortedRouteNodes) {
- if (node.isVirtual) {
- virtualRouteNodes.push(
- `const ${node.variableName}RouteImport = createFileRoute('${node.routePath}')()`,
- )
- } else {
- routeImports.push(
- getImportForRouteNode(
- node,
- config,
- this.generatedRouteTreePath,
- this.root,
- ),
- )
- }
- }
-
- const imports: Array = []
- if (virtualRouteNodes.length > 0) {
- imports.push({
- specifiers: [{ imported: 'createFileRoute' }],
- source: this.targetTemplate.fullPkg,
- })
- }
- // Add lazyRouteComponent import if there are component pieces
- let hasComponentPieces = false
- let hasLoaderPieces = false
- for (const node of sortedRouteNodes) {
- const pieces = acc.routePiecesByPath[node.routePath!]
- if (pieces) {
- if (
- pieces.component ||
- pieces.errorComponent ||
- pieces.notFoundComponent ||
- pieces.pendingComponent
- ) {
- hasComponentPieces = true
- }
- if (pieces.loader) {
- hasLoaderPieces = true
- }
- if (hasComponentPieces && hasLoaderPieces) break
- }
- }
- if (hasComponentPieces || hasLoaderPieces) {
- const runtimeImport: ImportDeclaration = {
- specifiers: [],
- source: this.targetTemplate.fullPkg,
- }
- if (hasComponentPieces) {
- runtimeImport.specifiers.push({ imported: 'lazyRouteComponent' })
- }
- if (hasLoaderPieces) {
- runtimeImport.specifiers.push({ imported: 'lazyFn' })
- }
- imports.push(runtimeImport)
- }
- const routeTreeConfig = buildRouteTreeConfig(
- acc.routeTree,
- config.disableTypes,
- )
-
- const createUpdateRoutes = sortedRouteNodes.map((node) => {
- const pieces = acc.routePiecesByPath[node.routePath!]
- const loaderNode = pieces?.loader
- const componentNode = pieces?.component
- const errorComponentNode = pieces?.errorComponent
- const notFoundComponentNode = pieces?.notFoundComponent
- const pendingComponentNode = pieces?.pendingComponent
- const lazyComponentNode = pieces?.lazy
-
- return [
- [
- `const ${node.variableName}Route = ${node.variableName}RouteImport.update({
- ${[
- `id: '${node.path}'`,
- !node.isNonPath ||
- (node._fsRouteType === 'pathless_layout' && node.cleanedPath)
- ? `path: '${node.cleanedPath}'`
- : undefined,
- `getParentRoute: () => ${findParent(node)}`,
- ]
- .filter(Boolean)
- .join(',')}
- }${config.disableTypes ? '' : 'as any'})`,
- loaderNode
- ? `.updateLoader({ loader: lazyFn(() => import('./${replaceBackslash(
- removeExt(
- path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(config.routesDirectory, loaderNode.filePath),
- ),
- config.addExtensions,
- ),
- )}'), 'loader') })`
- : '',
- componentNode ||
- errorComponentNode ||
- notFoundComponentNode ||
- pendingComponentNode
- ? `.update({
- ${(
- [
- ['component', componentNode],
- ['errorComponent', errorComponentNode],
- ['notFoundComponent', notFoundComponentNode],
- ['pendingComponent', pendingComponentNode],
- ] as const
- )
- .filter((d) => d[1])
- .map((d) => {
- // For .vue files, use 'default' as the export name since Vue SFCs export default
- const isVueFile = d[1]!.filePath.endsWith('.vue')
- const exportName = isVueFile ? 'default' : d[0]
- // Keep .vue extension for Vue files since Vite requires it
- const importPath = replaceBackslash(
- isVueFile
- ? path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(
- config.routesDirectory,
- d[1]!.filePath,
- ),
- )
- : removeExt(
- path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(
- config.routesDirectory,
- d[1]!.filePath,
- ),
- ),
- config.addExtensions,
- ),
- )
- return `${
- d[0]
- }: lazyRouteComponent(() => import('./${importPath}'), '${exportName}')`
- })
- .join('\n,')}
- })`
- : '',
- lazyComponentNode
- ? (() => {
- // For .vue files, use 'default' export since Vue SFCs export default
- const isVueFile = lazyComponentNode.filePath.endsWith('.vue')
- const exportAccessor = isVueFile ? 'd.default' : 'd.Route'
- // Keep .vue extension for Vue files since Vite requires it
- const importPath = replaceBackslash(
- isVueFile
- ? path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(
- config.routesDirectory,
- lazyComponentNode.filePath,
- ),
- )
- : removeExt(
- path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(
- config.routesDirectory,
- lazyComponentNode.filePath,
- ),
- ),
- config.addExtensions,
- ),
- )
- return `.lazy(() => import('./${importPath}').then((d) => ${exportAccessor}))`
- })()
- : '',
- ].join(''),
- ].join('\n\n')
- })
-
- // Generate update for root route if it has component pieces
- const rootRoutePath = `/${rootPathId}`
- const rootPieces = acc.routePiecesByPath[rootRoutePath]
- const rootComponentNode = rootPieces?.component
- const rootErrorComponentNode = rootPieces?.errorComponent
- const rootNotFoundComponentNode = rootPieces?.notFoundComponent
- const rootPendingComponentNode = rootPieces?.pendingComponent
-
- let rootRouteUpdate = ''
- if (
- rootComponentNode ||
- rootErrorComponentNode ||
- rootNotFoundComponentNode ||
- rootPendingComponentNode
- ) {
- rootRouteUpdate = `const rootRouteWithChildren = rootRouteImport${
- rootComponentNode ||
- rootErrorComponentNode ||
- rootNotFoundComponentNode ||
- rootPendingComponentNode
- ? `.update({
- ${(
- [
- ['component', rootComponentNode],
- ['errorComponent', rootErrorComponentNode],
- ['notFoundComponent', rootNotFoundComponentNode],
- ['pendingComponent', rootPendingComponentNode],
- ] as const
- )
- .filter((d) => d[1])
- .map((d) => {
- // For .vue files, use 'default' as the export name since Vue SFCs export default
- const isVueFile = d[1]!.filePath.endsWith('.vue')
- const exportName = isVueFile ? 'default' : d[0]
- // Keep .vue extension for Vue files since Vite requires it
- const importPath = replaceBackslash(
- isVueFile
- ? path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(config.routesDirectory, d[1]!.filePath),
- )
- : removeExt(
- path.relative(
- path.dirname(config.generatedRouteTree),
- path.resolve(
- config.routesDirectory,
- d[1]!.filePath,
- ),
- ),
- config.addExtensions,
- ),
- )
- return `${d[0]}: lazyRouteComponent(() => import('./${importPath}'), '${exportName}')`
- })
- .join('\n,')}
- })`
- : ''
- }._addFileChildren(rootRouteChildren)${config.disableTypes ? '' : `._addFileTypes()`}`
- }
-
- let fileRoutesByPathInterface = ''
- let fileRoutesByFullPath = ''
-
- if (!config.disableTypes) {
- const routeNodesByFullPath = createRouteNodesByFullPath(acc.routeNodes)
- const routeNodesByTo = createRouteNodesByTo(acc.routeNodes)
- const routeNodesById = createRouteNodesById(acc.routeNodes)
-
- fileRoutesByFullPath = [
- `export interface FileRoutesByFullPath {
-${[...routeNodesByFullPath.entries()]
- .filter(([fullPath]) => fullPath)
- .map(([fullPath, routeNode]) => {
- return `'${fullPath}': typeof ${getResolvedRouteNodeVariableName(routeNode)}`
- })}
-}`,
- `export interface FileRoutesByTo {
-${[...routeNodesByTo.entries()]
- .filter(([to]) => to)
- .map(([to, routeNode]) => {
- return `'${to}': typeof ${getResolvedRouteNodeVariableName(routeNode)}`
- })}
-}`,
- `export interface FileRoutesById {
-'${rootRouteId}': typeof rootRouteImport,
-${[...routeNodesById.entries()].map(([id, routeNode]) => {
- return `'${id}': typeof ${getResolvedRouteNodeVariableName(routeNode)}`
-})}
-}`,
- `export interface FileRouteTypes {
-fileRoutesByFullPath: FileRoutesByFullPath
-fullPaths: ${
- acc.routeNodes.length > 0
- ? [...routeNodesByFullPath.keys()]
- .filter((fullPath) => fullPath)
- .map((fullPath) => `'${fullPath}'`)
- .join('|')
- : 'never'
- }
-fileRoutesByTo: FileRoutesByTo
-to: ${
- acc.routeNodes.length > 0
- ? [...routeNodesByTo.keys()]
- .filter((to) => to)
- .map((to) => `'${to}'`)
- .join('|')
- : 'never'
- }
-id: ${[`'${rootRouteId}'`, ...[...routeNodesById.keys()].map((id) => `'${id}'`)].join('|')}
-fileRoutesById: FileRoutesById
-}`,
- `export interface RootRouteChildren {
-${acc.routeTree.map((child) => `${child.variableName}Route: typeof ${getResolvedRouteNodeVariableName(child)}`).join(',')}
-}`,
- ].join('\n')
-
- fileRoutesByPathInterface = buildFileRoutesByPathInterface({
- module: this.targetTemplate.fullPkg,
- interfaceName: 'FileRoutesByPath',
- routeNodes: sortedRouteNodes,
- config,
- })
- }
-
- const routeTree = [
- `const rootRouteChildren${config.disableTypes ? '' : `: RootRouteChildren`} = {
- ${acc.routeTree
- .map(
- (child) =>
- `${child.variableName}Route: ${getResolvedRouteNodeVariableName(child)}`,
- )
- .join(',')}
-}`,
- rootRouteUpdate
- ? rootRouteUpdate.replace(
- 'const rootRouteWithChildren = ',
- 'export const routeTree = ',
- )
- : `export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren)${config.disableTypes ? '' : `._addFileTypes()`}`,
- ].join('\n')
-
- checkRouteFullPathUniqueness(
- sortedRouteNodes.filter(
- (d) => d.children === undefined && 'lazy' !== d._fsRouteType,
- ),
- config,
- )
-
- let mergedImports = mergeImportDeclarations(imports)
- if (config.disableTypes) {
- mergedImports = mergedImports.filter((d) => d.importKind !== 'type')
- }
-
- const importStatements = mergedImports.map(buildImportString)
-
- const rootRouteImport = getImportForRouteNode(
- rootRouteNode,
- config,
- this.generatedRouteTreePath,
- this.root,
- )
- routeImports.unshift(rootRouteImport)
-
- let footer: Array = []
- if (config.routeTreeFileFooter) {
- if (Array.isArray(config.routeTreeFileFooter)) {
- footer = config.routeTreeFileFooter
- } else {
- footer = config.routeTreeFileFooter()
- }
- }
- const routeTreeContent = [
- ...config.routeTreeFileHeader,
- `// This file was automatically generated by TanStack Router.
-// You should NOT make any changes in this file as it will be overwritten.
-// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.`,
- [...importStatements].join('\n'),
- mergeImportDeclarations(routeImports).map(buildImportString).join('\n'),
- virtualRouteNodes.join('\n'),
- createUpdateRoutes.join('\n'),
- fileRoutesByFullPath,
- fileRoutesByPathInterface,
- routeTreeConfig.join('\n'),
- routeTree,
- ...footer,
- ]
- .filter(Boolean)
- .join('\n\n')
+ /**
+ * What a watcher must watch for this generator: the routes directory and
+ * every `physical()` mount (for created, changed and deleted files), and
+ * the route tree and virtual route config files.
+ */
+ public watchTargets(): { directories: Array; files: Array } {
return {
- routeTreeContent,
- routeTree: acc.routeTree,
- routeNodes: acc.routeNodes,
+ directories: [
+ this.routesDirectory,
+ ...(this.scan?.physicalDirectories ?? []).filter(
+ (dir) => !isUnder(dir, this.routesDirectory),
+ ),
+ ],
+ files: [
+ this.treeKey,
+ ...(this.virtualConfigFile ? [this.virtualConfigFile] : []),
+ ],
}
}
- private async processRouteNodeFile(node: RouteNode): Promise<{
- shouldWriteTree: boolean
- cacheEntry: RouteNodeCacheEntry
- node: RouteNode
- } | null> {
- const result = await this.isRouteFileCacheFresh(node)
+ private footer(): Array {
+ const footer = this.config.routeTreeFileFooter
+ if (!footer) {
+ return []
+ }
+ return Array.isArray(footer) ? footer : footer()
+ }
- if (result.status === 'fresh') {
- return {
- node: result.cacheEntry.node,
- shouldWriteTree: false,
- cacheEntry: result.cacheEntry,
+ private isRelevant(file: string) {
+ const normalized = normalize(file)
+ if (
+ normalized === this.treeKey ||
+ normalized === this.virtualConfigFile ||
+ isVirtualConfigFile(path.basename(normalized)) ||
+ this.files.has(normalized)
+ ) {
+ return true
+ }
+ if (!routeFileExtension.test(normalized)) {
+ return false
+ }
+ return (
+ isUnder(normalized, this.routesDirectory) ||
+ (this.scan?.physicalDirectories ?? []).some((dir) =>
+ isUnder(normalized, dir),
+ )
+ )
+ }
+
+ private drain() {
+ if (this.draining) {
+ return
+ }
+ this.draining = (async () => {
+ // Events reported together (a rename's delete and create) join one batch
+ await Promise.resolve()
+ let failure: { error: unknown } | undefined
+ while (this.queue.length) {
+ const batch = this.queue.splice(0)
+ try {
+ await this.processBatch(batch)
+ failure = undefined
+ } catch (error) {
+ failure = { error }
+ }
+ }
+ const waiters = this.waiters.splice(0)
+ this.draining = undefined
+ for (const waiter of waiters) {
+ if (failure) {
+ waiter.reject(failure.error)
+ } else {
+ waiter.resolve()
+ }
+ }
+ })()
+ }
+
+ private async processBatch(batch: Array) {
+ let structural = !this.scan || this.stale
+ let treeChanged = structural
+ const changed = new Set()
+ /** The files the batch's events name: read whatever their stamps say. */
+ const named = new Set()
+ for (const event of batch) {
+ if (event.type === 'rerun') {
+ structural = true
+ treeChanged = true
+ continue
+ }
+ named.add(event.path)
+ if (event.path === this.treeKey) {
+ // Mostly our own write coming back: the tree is printed again only
+ // when the file on disk is no longer the one published (below)
+ continue
+ }
+ if (
+ event.type !== 'update' ||
+ event.path === this.virtualConfigFile ||
+ isVirtualConfigFile(path.basename(event.path)) ||
+ !this.files.has(event.path)
+ ) {
+ // A file added or removed, a virtual route config edited, or a file
+ // the last scan did not see: the routes are scanned again.
+ structural = true
+ } else {
+ changed.add(event.path)
}
}
- const previousCacheEntry = result.cacheEntry
+ // What the re-read files changed: the tree's routes, or only the
+ // recorded options of some
+ const changes = { routes: false, props: false }
+ const consider = (key: string, before: FileState | undefined) => {
+ const after = this.files.get(key)
+ if (after?.facts.included !== before?.facts.included) {
+ changes.routes = true
+ } else if (
+ after?.facts.included &&
+ before?.facts.included &&
+ !sameProps(after.facts.props, before.facts.props)
+ ) {
+ changes.props = true
+ }
+ }
- const existingRouteFile = await this.fs.readFile(node.fullPath)
- if (existingRouteFile === 'file-not-existing') {
- throw new Error(`⚠️ File ${node.fullPath} does not exist`)
+ if (structural) {
+ this.stale = true
+ const scan = await scanRoutes(this.config, this.root)
+ this.scan = scan
+ const nodes = filesOf(scan)
+ const keys = new Set(nodes.map((node) => node.fullPath))
+ for (const key of [...this.files.keys()]) {
+ if (!keys.has(key)) {
+ this.files.delete(key)
+ }
+ }
+ await Promise.all(
+ nodes.map((node) =>
+ this.updateFile(node, {
+ isRoot: node === scan.rootRouteNode,
+ force: named.has(node.fullPath),
+ }),
+ ),
+ )
+ changes.routes = true
+ this.realRoots = await this.realRootsOf(scan)
+ } else {
+ const byKey = new Map(
+ filesOf(this.scan!).map((node) => [node.fullPath, node]),
+ )
+ await Promise.all(
+ [...changed].map(async (key) => {
+ const node = byKey.get(key)
+ if (!node) {
+ return
+ }
+ const before = this.files.get(key)
+ await this.updateFile(node, {
+ isRoot: node === this.scan!.rootRouteNode,
+ force: true,
+ })
+ consider(key, before)
+ }),
+ )
+ }
+
+ if (!changes.routes && !treeChanged) {
+ // The tree's routes are as before (no tree rebuild, no print), unless
+ // the tree on disk is no longer the one published.
+ if (!(await this.treeOnDiskIsPublished())) {
+ treeChanged = true
+ } else {
+ if (changes.props) {
+ this.rebuildModel()
+ this.notifyPlugins()
+ }
+ return
+ }
+ }
+
+ // (until published: a failure here rebuilds on the next batch)
+ this.stale = true
+ this.rebuildModel()
+ await this.publishTree()
+ this.routesByFile = this.computeRoutesByFile()
+ this.stale = false
+ this.notifyPlugins()
+ }
+
+ private rebuildModel() {
+ const scan = this.scan!
+ const factsOf = (node: RouteNode) => this.files.get(node.fullPath)?.facts
+ const model = buildTreeModel({
+ scan,
+ config: this.config,
+ isIncluded: (node) => factsOf(node)?.included ?? false,
+ propsOf: (node) => {
+ const facts = factsOf(node)
+ return facts?.included ? facts.props : undefined
+ },
+ })
+ checkRouteFullPathUniqueness(model)
+ this.model = model
+ }
+
+ private notifyPlugins() {
+ for (const plugin of this.plugins) {
+ plugin.onRouteTreeChanged?.({ model: this.model!, generator: this })
+ }
+ }
+
+ private async publishTree() {
+ let content = this.printRouteTree(this.model!)
+ if (this.config.enableRouteTreeFormatting === true) {
+ content = await formatWithPrettier(content, this.style)
+ }
+ // Compared with the disk, not with what was written last: a deleted or
+ // edited tree is written again (unchanged since published: no read).
+ const onDisk = (await this.treeOnDiskIsPublished())
+ ? this.published!.content
+ : await readIfExists(this.treeFile)
+ if (onDisk !== content) {
+ await this.publisher.write(this.treeFile, content)
+ }
+ const stat = await fsp.stat(this.treeFile)
+ this.published = { content, mtimeMs: stat.mtimeMs, size: stat.size }
+ }
+
+ private async treeOnDiskIsPublished() {
+ if (!this.published) {
+ return false
+ }
+ const stat = await fsp.stat(this.treeFile).catch(() => null)
+ return (
+ stat !== null &&
+ stat.mtimeMs === this.published.mtimeMs &&
+ stat.size === this.published.size
+ )
+ }
+
+ /**
+ * Reads a route file and, when its content changed since the last read,
+ * scaffolds or keeps it up and records its facts. A file that does not
+ * parse keeps the facts of its last good content (its route stays), and
+ * is reported with the position of the problem.
+ */
+ private async updateFile(
+ node: RouteNode,
+ { isRoot, force }: { isRoot: boolean; force: boolean },
+ ) {
+ const key = node.fullPath
+ const file = node.fullPath
+ const role = roleOf(node, isRoot)
+ const known = this.files.get(key)
+ const previous = known?.role === role ? known : undefined
+ // (stamped before the read: a change after it shows in the next stamp)
+ const stamp = await stampOf(file)
+ if (
+ !force &&
+ stamp &&
+ previous?.stamp?.mtimeMs === stamp.mtimeMs &&
+ previous.stamp.size === stamp.size
+ ) {
+ return
+ }
+ const content = stamp ? await readIfExists(file) : null
+ if (content === null) {
+ if (isRoot) {
+ throw new Error(`⚠️ expected root route to exist at ${file}`)
+ }
+ this.files.set(key, { content: '', facts: { included: false }, role })
+ return
+ }
+ if (previous && previous.content === content) {
+ this.files.set(key, { ...previous, stamp: stamp! })
+ return
+ }
+ try {
+ const state = await this.factsOf(node, isRoot, content, known)
+ this.files.set(key, {
+ ...state,
+ role,
+ // (rewritten by the generator: the stamp of what it wrote)
+ stamp:
+ (state.content === content ? stamp : await stampOf(file)) ??
+ undefined,
+ })
+ } catch (error) {
+ if (error instanceof ConcurrentEditError) {
+ // Edited while we kept it up: handled again with its new content
+ this.queue.push({ type: 'update', path: key })
+ return
+ }
+ throw error
+ }
+ }
+
+ private async factsOf(
+ node: RouteNode,
+ isRoot: boolean,
+ content: string,
+ previous: FileState | undefined,
+ ): Promise> {
+ const file = node.fullPath
+ const isVue = file.endsWith('.vue')
+ const isPiece = pieceTypes.includes(node._fsRouteType)
+ const routeId = node.routePath ?? ''
+
+ if (isRoot) {
+ if (content !== '') {
+ return { content, facts: { included: true, props: undefined } }
+ }
+ const scaffold = scaffoldRouteFile({
+ target: this.config.target,
+ kind: 'root',
+ routeId: rootPathId,
+ noJsx: /\.[mc]?ts$/.test(file),
+ style: this.style,
+ })
+ this.logger.log(`🟡 Creating ${file}`)
+ await this.publisher.write(file, scaffold, content)
+ return {
+ content: scaffold,
+ facts: { included: true, props: undefined },
+ }
+ }
+
+ if (content === '' && (isVue || isPiece)) {
+ // Empty pieces stay empty and unused (SPEC J1.3, J1.17)
+ return { content, facts: { included: false } }
+ }
+ if (isVue) {
+ // Single-file components are pieces the generator never edits
+ return { content, facts: { included: true, props: undefined } }
}
if (node.routePath) {
validateRouteParams(node.routePath, node.filePath, this.logger)
}
- const updatedCacheEntry: RouteNodeCacheEntry = {
- fileContent: existingRouteFile.fileContent,
- mtimeMs: existingRouteFile.stat.mtimeMs,
- routeId: node.routePath ?? '$$TSR_NO_ROUTE_PATH_ASSIGNED$$',
- node,
- }
-
- const escapedRoutePath = node.routePath?.replaceAll('$', '$$') ?? ''
-
- let shouldWriteRouteFile = false
- let shouldWriteTree = false
- // now we need to either scaffold the file or transform it
- if (!existingRouteFile.fileContent) {
- shouldWriteRouteFile = true
- shouldWriteTree = true
- // Creating a new lazy route file
- if (node._fsRouteType === 'lazy') {
- const tLazyRouteTemplate = this.targetTemplate.lazyRoute
- // Check by default check if the user has a specific lazy route template
- // If not, check if the user has a route template and use that instead
- updatedCacheEntry.fileContent = await fillTemplate(
- this.config,
- (this.config.customScaffolding?.lazyRouteTemplate ||
- this.config.customScaffolding?.routeTemplate) ??
- tLazyRouteTemplate.template(),
- {
- tsrImports: tLazyRouteTemplate.imports.tsrImports(),
- tsrPath: escapedRoutePath.replaceAll(/\{(.+?)\}/gm, '$1'),
- tsrExportStart:
- tLazyRouteTemplate.imports.tsrExportStart(escapedRoutePath),
- tsrExportEnd: tLazyRouteTemplate.imports.tsrExportEnd(),
- },
- )
- } else if (
- // Creating a new normal route file
- (['layout', 'static'] satisfies Array).some(
- (d) => d === node._fsRouteType,
- ) ||
- (
- [
- 'component',
- 'pendingComponent',
- 'errorComponent',
- 'notFoundComponent',
- 'loader',
- ] satisfies Array
- ).every((d) => d !== node._fsRouteType)
- ) {
- const tRouteTemplate = this.targetTemplate.route
- updatedCacheEntry.fileContent = await fillTemplate(
- this.config,
- this.config.customScaffolding?.routeTemplate ??
- tRouteTemplate.template(),
- {
- tsrImports: tRouteTemplate.imports.tsrImports(),
- tsrPath: escapedRoutePath.replaceAll(/\{(.+?)\}/gm, '$1'),
- tsrExportStart:
- tRouteTemplate.imports.tsrExportStart(escapedRoutePath),
- tsrExportEnd: tRouteTemplate.imports.tsrExportEnd(),
- },
- )
- } else {
- return null
- }
- }
-
- // Check if this is a Vue component file
- // Vue SFC files (.vue) don't need transformation as they can't have a Route export
- const isVueFile = node.filePath.endsWith('.vue')
-
- if (!isVueFile) {
- // transform the file
- const transformResult = await transform({
- source: updatedCacheEntry.fileContent,
- filename: node.fullPath,
- ctx: {
- target: this.config.target,
- routeId: escapedRoutePath,
- lazy: node._fsRouteType === 'lazy',
- },
- node,
+ const lazy = node._fsRouteType === 'lazy'
+ let source = content
+ if (content === '') {
+ const custom = this.config.customScaffolding
+ source = scaffoldRouteFile({
+ target: this.config.target,
+ kind: lazy ? 'lazy' : 'route',
+ routeId,
+ noJsx: /\.[mc]?ts$/.test(file),
+ style: this.style,
+ template: lazy
+ ? (custom?.lazyRouteTemplate ?? custom?.routeTemplate)
+ : custom?.routeTemplate,
})
+ }
- if (transformResult.result === 'no-route-export') {
- const fileName = path.basename(node.fullPath)
- const dirName = path.dirname(node.fullPath)
- const ignorePrefix = this.config.routeFileIgnorePrefix
- const ignorePattern = this.config.routeFileIgnorePattern
- const suggestedFileName = `${ignorePrefix}${fileName}`
- const suggestedFullPath = path.join(dirName, suggestedFileName)
+ const analysis = analyzeRouteFile(source, file, {
+ routeId,
+ lazy,
+ routerPackage: this.routerPackage,
+ style: this.style,
+ })
- let message = `Warning: Route file "${node.fullPath}" does not export a Route. This file will not be included in the route tree.`
- message += `\n\nIf this file is not intended to be a route, you can exclude it using one of these options:`
- message += `\n 1. Rename the file to "${suggestedFullPath}" (prefix with "${ignorePrefix}")`
- message += `\n 2. Use 'routeFileIgnorePattern' in your config to match this file`
- message += `\n\nCurrent configuration:`
- message += `\n routeFileIgnorePrefix: "${ignorePrefix}"`
- message += `\n routeFileIgnorePattern: ${ignorePattern ? `"${ignorePattern}"` : 'undefined'}`
-
- this.logger.warn(message)
- return null
+ if (analysis.kind === 'error') {
+ for (const diagnostic of analysis.diagnostics) {
+ console.warn(formatDiagnostic(file, diagnostic))
}
- if (transformResult.result === 'error') {
- throw new Error(
- `Error transforming route file ${node.fullPath}: ${transformResult.error}`,
- )
- }
- if (transformResult.result === 'modified') {
- updatedCacheEntry.fileContent = transformResult.output
- shouldWriteRouteFile = true
+ return {
+ content,
+ facts: previous?.facts.included ? previous.facts : { included: false },
}
}
- for (const plugin of this.plugins) {
- plugin.afterTransform?.({ node, prevNode: previousCacheEntry?.node })
+ if (analysis.kind === 'no-route') {
+ if (source !== content) {
+ await this.publisher.write(file, source, content)
+ }
+ this.warnNoRouteExport(file)
+ return { content: source, facts: { included: false } }
}
- // file was changed
- if (shouldWriteRouteFile) {
- const stats = await this.safeFileWrite({
- filePath: node.fullPath,
- newContent: updatedCacheEntry.fileContent,
- strategy: {
- type: 'mtime',
- expectedMtimeMs: updatedCacheEntry.mtimeMs,
- expectedContent: existingRouteFile.fileContent,
- },
- })
- updatedCacheEntry.mtimeMs = stats.mtimeMs
+ for (const diagnostic of analysis.diagnostics) {
+ console.warn(formatDiagnostic(file, diagnostic))
+ }
+ const output = analysis.output ?? source
+ if (output !== content) {
+ await this.publisher.write(file, output, content)
}
-
- this.routeNodeShadowCache.set(node.fullPath, updatedCacheEntry)
return {
- node,
- shouldWriteTree,
- cacheEntry: updatedCacheEntry,
+ content: output,
+ facts: { included: true, props: analysis.props },
}
}
- private async didRouteFileChangeComparedToCache(
- file: {
- path: string
- mtimeMs?: bigint
- },
- cache: 'routeNodeCache' | 'routeNodeShadowCache',
- ): Promise> {
- const cacheEntry = this[cache].get(file.path)
- return this.didFileChangeComparedToCache(file, cacheEntry)
+ private warnNoRouteExport(file: string) {
+ const fileName = path.basename(file)
+ const dirName = path.dirname(file)
+ const ignorePrefix = this.config.routeFileIgnorePrefix
+ const ignorePattern = this.config.routeFileIgnorePattern
+ const suggestedFullPath = path.join(dirName, `${ignorePrefix}${fileName}`)
+
+ let message = `Warning: Route file "${file}" does not export a Route. This file will not be included in the route tree.`
+ message += `\n\nIf this file is not intended to be a route, you can exclude it using one of these options:`
+ message += `\n 1. Rename the file to "${suggestedFullPath}" (prefix with "${ignorePrefix}")`
+ message += `\n 2. Use 'routeFileIgnorePattern' in your config to match this file`
+ message += `\n\nCurrent configuration:`
+ message += `\n routeFileIgnorePrefix: "${ignorePrefix}"`
+ message += `\n routeFileIgnorePattern: ${ignorePattern ? `"${ignorePattern}"` : 'undefined'}`
+ console.warn(message)
}
- private async didFileChangeComparedToCache<
- TCacheEntry extends GeneratorCacheEntry,
- >(
- file: {
- path: string
- mtimeMs?: bigint
- },
- cacheEntry: TCacheEntry | undefined,
- ): Promise> {
- // for now we rely on the modification time of the file
- // to determine if the file has changed
- // we could also compare the file content but this would be slower as we would have to read the file
-
- if (!cacheEntry) {
- return { result: 'file-not-in-cache' }
- }
- let mtimeMs = file.mtimeMs
-
- if (mtimeMs === undefined) {
- try {
- const currentStat = await this.fs.stat(file.path)
- mtimeMs = currentStat.mtimeMs
- } catch {
- return { result: 'cannot-stat-file' }
- }
- }
- return { result: mtimeMs !== cacheEntry.mtimeMs, mtimeMs, cacheEntry }
- }
-
- private async safeFileWrite(opts: {
- filePath: string
- newContent: string
- strategy:
- | {
- type: 'mtime'
- expectedMtimeMs: bigint
- // An in-place save can truncate and rewrite a file within one mtime
- // tick, so user-authored files also compare the content.
- expectedContent?: string
- }
- | {
- type: 'new-file'
- }
- }) {
- const tmpPath = this.getTempFileName(opts.filePath)
- await this.fs.writeFile(tmpPath, opts.newContent)
-
- if (opts.strategy.type === 'mtime') {
- const { expectedMtimeMs, expectedContent } = opts.strategy
- const beforeStat = await this.fs.stat(opts.filePath)
- const newFileState = await this.fs.stat(tmpPath)
- if (newFileState.mode !== beforeStat.mode) {
- await this.fs.chmod(tmpPath, beforeStat.mode)
- }
- if (
- newFileState.uid !== beforeStat.uid ||
- newFileState.gid !== beforeStat.gid
- ) {
- try {
- await this.fs.chown(tmpPath, beforeStat.uid, beforeStat.gid)
- } catch (err) {
- if (
- typeof err === 'object' &&
- err !== null &&
- 'code' in err &&
- (err as any).code === 'EPERM'
- ) {
- console.warn(
- `[safeFileWrite] chown failed: ${(err as any).message}`,
- )
- } else {
- throw err
- }
- }
- }
- // Check right before the rename so that changes made while the
- // temporary file was prepared are not overwritten.
- let changed: boolean
- if (expectedContent === undefined) {
- const current = await this.fs.stat(opts.filePath)
- changed = current.mtimeMs !== expectedMtimeMs
- } else {
- const current = await this.fs.readFile(opts.filePath)
- changed =
- current === 'file-not-existing' ||
- current.stat.mtimeMs !== expectedMtimeMs ||
- current.fileContent !== expectedContent
- }
- if (changed) {
- throw rerun({
- msg: `File ${opts.filePath} was modified by another process during processing.`,
- event: { type: 'update', path: opts.filePath },
- })
- }
- } else {
- if (await checkFileExists(opts.filePath)) {
- throw rerun({
- msg: `File ${opts.filePath} already exists. Cannot overwrite.`,
- event: { type: 'update', path: opts.filePath },
- })
- }
- }
-
- await this.fs.rename(tmpPath, opts.filePath)
-
- // stat the target file AFTER rename so the cached mtime matches
- // what the filesystem reports for the actual file path.
- // Previously we stat'd the temp file before rename, but rename()
- // can assign a different mtime to the target on some filesystems,
- // causing the cache to be permanently stale.
- const stat = await this.fs.stat(opts.filePath)
-
- return stat
- }
-
- private getTempFileName(filePath: string) {
- const absPath = path.resolve(filePath)
- const hash = crypto.createHash('md5').update(absPath).digest('hex')
- // lazy initialize sessionId to only create tmpDir when it is first needed
- if (!this.sessionId) {
- // ensure the directory exists
- mkdirSync(this.config.tmpDir, { recursive: true })
- this.sessionId = crypto.randomBytes(4).toString('hex')
- }
- return path.join(this.config.tmpDir, `${this.sessionId}-${hash}`)
- }
-
- private async isRouteFileCacheFresh(node: RouteNode): Promise<
- | {
- status: 'fresh'
- cacheEntry: RouteNodeCacheEntry
- }
- | { status: 'stale'; cacheEntry?: RouteNodeCacheEntry }
- > {
- const fileChangedCache = await this.didRouteFileChangeComparedToCache(
- { path: node.fullPath },
- 'routeNodeCache',
+ private async realRootsOf(scan: ScanResult) {
+ const roots = [this.routesDirectory, ...scan.physicalDirectories]
+ const real = await Promise.all(
+ roots.map(async (dir): Promise<[string, string] | undefined> => {
+ const resolved = await fsp.realpath(dir).catch(() => dir)
+ const normalized = replaceBackslash(resolved)
+ return normalized === dir ? undefined : [dir, normalized]
+ }),
)
- if (fileChangedCache.result === false) {
- this.routeNodeShadowCache.set(node.fullPath, fileChangedCache.cacheEntry)
- return {
- status: 'fresh',
- cacheEntry: fileChangedCache.cacheEntry,
+ return real.filter((entry) => entry !== undefined)
+ }
+
+ private computeRoutesByFile(): GetRoutesByFileMapResult {
+ const map: GetRoutesByFileMapResult = new Map()
+ const scan = this.scan!
+ for (const node of filesOf(scan)) {
+ const key = node.fullPath
+ if (!this.files.get(key)?.facts.included) {
+ continue
}
- }
- if (fileChangedCache.result === 'cannot-stat-file') {
- throw new Error(`⚠️ expected route file to exist at ${node.fullPath}`)
- }
- const mtimeMs =
- fileChangedCache.result === true ? fileChangedCache.mtimeMs : undefined
-
- const shadowCacheFileChange = await this.didRouteFileChangeComparedToCache(
- { path: node.fullPath, mtimeMs },
- 'routeNodeShadowCache',
- )
-
- if (shadowCacheFileChange.result === 'cannot-stat-file') {
- throw new Error(`⚠️ expected route file to exist at ${node.fullPath}`)
- }
-
- if (shadowCacheFileChange.result === false) {
- // shadow cache has latest file state already
- if (fileChangedCache.result === true) {
- return {
- status: 'fresh',
- cacheEntry: shadowCacheFileChange.cacheEntry,
+ const value = { routeId: node.routePath ?? `/${rootPathId}` }
+ map.set(key, value)
+ for (const [scanned, real] of this.realRoots) {
+ if (isUnder(key, scanned)) {
+ map.set(real + key.slice(scanned.length), value)
}
}
}
-
- if (fileChangedCache.result === 'file-not-in-cache') {
- return {
- status: 'stale',
- }
- }
- return { status: 'stale', cacheEntry: fileChangedCache.cacheEntry }
- }
-
- private async handleRootNode(node: RouteNode) {
- const result = await this.isRouteFileCacheFresh(node)
-
- if (result.status === 'fresh') {
- this.routeNodeShadowCache.set(node.fullPath, result.cacheEntry)
- }
- const rootNodeFile = await this.fs.readFile(node.fullPath)
- if (rootNodeFile === 'file-not-existing') {
- throw new Error(`⚠️ expected root route to exist at ${node.fullPath}`)
- }
-
- const updatedCacheEntry: RouteNodeCacheEntry = {
- fileContent: rootNodeFile.fileContent,
- mtimeMs: rootNodeFile.stat.mtimeMs,
- routeId: node.routePath ?? '$$TSR_NO_ROOT_ROUTE_PATH_ASSIGNED$$',
- node,
- }
-
- // scaffold the root route
- if (!rootNodeFile.fileContent) {
- const rootTemplate = this.targetTemplate.rootRoute
- const rootRouteContent = await fillTemplate(
- this.config,
- rootTemplate.template(),
- {
- tsrImports: rootTemplate.imports.tsrImports(),
- tsrPath: rootPathId,
- tsrExportStart: rootTemplate.imports.tsrExportStart(),
- tsrExportEnd: rootTemplate.imports.tsrExportEnd(),
- },
- )
-
- this.logger.log(`🟡 Creating ${node.fullPath}`)
- const stats = await this.safeFileWrite({
- filePath: node.fullPath,
- newContent: rootRouteContent,
- strategy: {
- type: 'mtime',
- expectedMtimeMs: rootNodeFile.stat.mtimeMs,
- expectedContent: rootNodeFile.fileContent,
- },
- })
- updatedCacheEntry.fileContent = rootRouteContent
- updatedCacheEntry.mtimeMs = stats.mtimeMs
- }
-
- this.routeNodeShadowCache.set(node.fullPath, updatedCacheEntry)
- }
-
- public async getCrawlingResult(): Promise {
- await this.runPromise
- return this.crawlingResult
- }
-
- private static handleNode(
- node: RouteNode,
- acc: HandleNodeAccumulator,
- prefixMap: RoutePrefixMap,
- config?: Config,
- ) {
- let parentRoute = hasParentRoute(prefixMap, node, node.routePath)
-
- // Check routeNodesByPath for a closer parent that may not be in prefixMap.
- //
- // Why: The prefixMap excludes lazy routes by design. When lazy-only routes are
- // nested inside a pathless layout, the virtual route created from the lazy file
- // won't be in the prefixMap, but it will be in routeNodesByPath.
- //
- // Example: Given files _layout/path.lazy.tsx and _layout/path.index.lazy.tsx:
- // - prefixMap contains: /_layout (from route.tsx)
- // - routeNodesByPath contains: /_layout AND /_layout/path (virtual from lazy)
- // - For /_layout/path/, hasParentRoute returns /_layout (wrong)
- // - But the correct parent is /_layout/path (the virtual route from path.lazy.tsx)
- //
- // We walk up the path segments to find the closest registered parent. This handles
- // cases where multiple path segments (e.g., $a/$b) don't have intermediate routes.
- if (node.routePath) {
- let searchPath = node.routePath
- while (searchPath.length > 0) {
- const lastSlash = searchPath.lastIndexOf('/')
- if (lastSlash <= 0) break
-
- searchPath = searchPath.substring(0, lastSlash)
- const candidate = acc.routeNodesByPath.get(searchPath)
- if (candidate && candidate.routePath !== node.routePath) {
- // Found a parent in routeNodesByPath
- // If it's different from what prefixMap found AND is a closer match, use it
- if (candidate !== parentRoute) {
- // Check if this candidate is a closer parent than what prefixMap found
- // (longer path prefix means closer parent)
- if (
- !parentRoute ||
- (candidate.routePath?.length ?? 0) >
- (parentRoute.routePath?.length ?? 0)
- ) {
- parentRoute = candidate
- }
- }
- break
- }
- }
- }
-
- // Virtual routes may have an explicit parent from virtual config.
- // If we can find that exact parent, use it to prevent auto-nesting siblings
- // based on path prefix matching (#5822, #5431).
- if (node._virtualParentRoutePath !== undefined) {
- const explicitParent = acc.routeNodesByPath.get(
- node._virtualParentRoutePath,
- )
- if (explicitParent) {
- parentRoute = explicitParent
- } else if (node._virtualParentRoutePath === `/${rootPathId}`) {
- // The explicit parent is the root route (handled separately).
- // Override path-based inference so this node stays at root level.
- parentRoute = null
- }
- // Otherwise the explicit parent was a virtual file-less route that got
- // filtered out. Fall back to the path-based parentRoute already computed.
- }
-
- if (parentRoute) node.parent = parentRoute
-
- node.path = determineNodePath(node)
-
- const trimmedPath = trimPathLeft(node.path ?? '')
- const originalPath =
- node.originalRoutePath && node.parent?.originalRoutePath
- ? node.originalRoutePath.replace(node.parent.originalRoutePath, '') ||
- '/'
- : node.originalRoutePath
- const routePathSegmentMetadata = getRoutePathSegmentMetadataForPath(
- node,
- node.path ?? '/',
- node.parent?.routePath,
- )
- const trimmedOriginalPath = trimPathLeft(originalPath ?? '')
-
- const split = trimmedPath.split('/')
- const pathSplit = (node.path ?? '').split('/')
- const originalSplit = trimmedOriginalPath.split('/')
- const lastRouteSegment = split[split.length - 1] ?? trimmedPath
- const lastOriginalSegment =
- originalSplit[originalSplit.length - 1] ?? trimmedOriginalPath
- const lastRouteSegmentMetadata =
- routePathSegmentMetadata?.[pathSplit.length - 1]
-
- // A segment is non-path if it starts with underscore AND the underscore is not escaped
- node.isNonPath =
- (!lastRouteSegmentMetadata?.literalLeadingUnderscore &&
- isSegmentPathless(lastRouteSegment, lastOriginalSegment)) ||
- split.every((part) => this.routeGroupPatternRegex.test(part))
-
- // Use a single pass so layout removal does not desync escaped underscore checks.
- node.cleanedPath = removeGroups(
- removeLayoutSegmentsAndUnderscoresWithEscape(
- node.path,
- originalPath,
- routePathSegmentMetadata,
- ),
- )
-
- if (
- node._fsRouteType === 'layout' ||
- node._fsRouteType === 'pathless_layout'
- ) {
- node.cleanedPath = removeTrailingSlash(node.cleanedPath)
- }
-
- if (
- !node.isVirtual &&
- (
- [
- 'lazy',
- 'loader',
- 'component',
- 'pendingComponent',
- 'errorComponent',
- 'notFoundComponent',
- ] satisfies Array
- ).some((d) => d === node._fsRouteType)
- ) {
- acc.routePiecesByPath[node.routePath!] =
- acc.routePiecesByPath[node.routePath!] || {}
-
- const pieceKey =
- node._fsRouteType === 'lazy'
- ? 'lazy'
- : (node._fsRouteType as keyof (typeof acc.routePiecesByPath)[string])
- acc.routePiecesByPath[node.routePath!]![pieceKey] = node
-
- const anchorRoute = acc.routeNodesByPath.get(node.routePath!)
-
- // Don't create virtual routes for root route component pieces - the root route is handled separately
- if (!anchorRoute && node.routePath !== `/${rootPathId}`) {
- this.handleNode(
- {
- ...node,
- isVirtual: true,
- _fsRouteType: 'static',
- },
- acc,
- prefixMap,
- config,
- )
- }
- return
- }
-
- const isPathlessLayoutWithPath =
- node._fsRouteType === 'pathless_layout' &&
- node.cleanedPath &&
- node.cleanedPath.length > 0
-
- // Special handling: pathless layouts with path need to find real ancestor
- if (!node.isVirtual && isPathlessLayoutWithPath) {
- const immediateParentPath =
- removeLastSegmentFromPath(node.routePath) || '/'
- const immediateParentOriginalPath =
- removeLastSegmentFromPath(node.originalRoutePath) || '/'
- let searchPath = immediateParentPath
-
- // Find nearest real (non-virtual, non-index) parent
- while (searchPath) {
- const candidate = acc.routeNodesByPath.get(searchPath)
- if (candidate && !candidate.isVirtual && candidate.path !== '/') {
- node.parent = candidate
- node.path =
- node.routePath?.replace(candidate.routePath ?? '', '') || '/'
- const pathRelativeToParent =
- immediateParentPath.replace(candidate.routePath ?? '', '') || '/'
- const originalPathRelativeToParent =
- immediateParentOriginalPath.replace(
- candidate.originalRoutePath ?? '',
- '',
- ) || '/'
- const routePathSegmentMetadataRelativeToParent =
- getRoutePathSegmentMetadataForPath(
- node,
- pathRelativeToParent,
- candidate.routePath,
- )
- node.cleanedPath = removeGroups(
- removeLayoutSegmentsAndUnderscoresWithEscape(
- pathRelativeToParent,
- originalPathRelativeToParent,
- routePathSegmentMetadataRelativeToParent,
- ),
- )
- break
- }
- if (searchPath === '/') break
- searchPath = removeLastSegmentFromPath(searchPath) || '/'
- }
- }
-
- // Add to parent's children or to root
- if (node.parent) {
- node.parent.children = node.parent.children ?? []
- node.parent.children.push(node)
- } else {
- acc.routeTree.push(node)
- }
-
- acc.routeNodes.push(node)
- if (node.routePath) {
- // Always register routes by path so child routes can find parents.
- // Virtual routes (created from lazy-only files) also need to be registered
- // so that index routes like path.index.lazy.tsx can find their parent path.lazy.tsx.
- // If a non-virtual route is later processed for the same path, it will overwrite.
- acc.routeNodesByPath.set(node.routePath, node)
- }
- }
-
- // only process files that are relevant for the route tree generation
- private isFileRelevantForRouteTreeGeneration(filePath: string): boolean {
- // the generated route tree file
- if (filePath === this.generatedRouteTreePath) {
- return true
- }
-
- // files inside the routes folder
- if (filePath.startsWith(this.routesDirectoryPath)) {
- return true
- }
-
- // the virtual route config file passed into `virtualRouteConfig`
- if (
- typeof this.config.virtualRouteConfig === 'string' &&
- filePath === this.config.virtualRouteConfig
- ) {
- return true
- }
-
- // this covers all files that are mounted via `virtualRouteConfig` or any `__virtual.ts` files
- if (this.routeNodeCache.has(filePath)) {
- return true
- }
-
- // virtual config files such as`__virtual.ts`
- if (isVirtualConfigFile(path.basename(filePath))) {
- return true
- }
-
- // route files inside directories mounted via `physical()` inside a virtual route config
- if (this.physicalDirectories.some((dir) => filePath.startsWith(dir))) {
- return true
- }
-
- return false
+ return map
}
}
diff --git a/packages/router-generator/src/index.ts b/packages/router-generator/src/index.ts
index 9a4f8a17ff..d16664d355 100644
--- a/packages/router-generator/src/index.ts
+++ b/packages/router-generator/src/index.ts
@@ -23,21 +23,18 @@ export {
removeUnderscores,
resetRegex,
multiSortBy,
- writeIfDifferent,
- format,
removeExt,
- checkRouteFullPathUniqueness,
- inferFullPath,
} from './utils'
export type {
RouteNode,
+ RouteProps,
+ ModelRoute,
+ TreeModel,
+ RoutePieceName,
GetRouteNodesResult,
GetRoutesByFileMapResult,
GetRoutesByFileMapResultValue,
- ImportDeclaration,
- ImportSpecifier,
- HandleNodeAccumulator,
} from './types'
export { getRouteNodes as physicalGetRouteNodes } from './filesystem/physical/getRouteNodes'
@@ -45,4 +42,5 @@ export { getRouteNodes as virtualGetRouteNodes } from './filesystem/virtual/getR
export { rootPathId } from './filesystem/physical/rootPathId'
-export type { TransformContext, TransformOptions } from './transform/types'
+export { watchRouteFiles } from './watch/chokidar'
+export type { RouteFileWatcher } from './watch/chokidar'
diff --git a/packages/router-generator/src/model/build.ts b/packages/router-generator/src/model/build.ts
new file mode 100644
index 0000000000..00a90b94c8
--- /dev/null
+++ b/packages/router-generator/src/model/build.ts
@@ -0,0 +1,588 @@
+import path from 'node:path'
+import {
+ cleanPath,
+ rootRouteId,
+ trimPathLeft,
+ trimPathRight,
+} from '@tanstack/router-core/tooling'
+import { rootPathId } from '../filesystem/physical/rootPathId'
+import {
+ RoutePrefixMap,
+ countRoutePathSegments,
+ countSlashSeparatedParts,
+ createTokenRegex,
+ determineNodePath,
+ hasParentRoute,
+ isSegmentPathless,
+ multiSortBy,
+ removeGroups,
+ removeLastSegmentFromPath,
+ removeLayoutSegmentsAndUnderscoresWithEscape,
+ removeTrailingSlash,
+ sortRouteNodes,
+} from '../utils'
+import type { Config } from '../config'
+import type { ScanResult } from '../filesystem/scan'
+import type {
+ FsRouteType,
+ ModelRoute,
+ RouteNode,
+ RoutePathSegmentMetadata,
+ RoutePieceName,
+ RouteProps,
+ TreeModel,
+} from '../types'
+
+const pieceTypes: ReadonlyArray = [
+ 'lazy',
+ 'loader',
+ 'component',
+ 'pendingComponent',
+ 'errorComponent',
+ 'notFoundComponent',
+]
+
+const componentPieceRegex =
+ /[./](component|errorComponent|notFoundComponent|pendingComponent|loader|lazy)[.]/
+const routeGroupPatternRegex = /\(.+\)/
+
+export interface TreeModelInput {
+ scan: ScanResult
+ config: Pick
+ /** Whether a route file joins the tree (its analysis found a route). */
+ isIncluded: (node: RouteNode) => boolean
+ /** The recorded option keys of a route file. */
+ propsOf: (node: RouteNode) => RouteProps | undefined
+}
+
+type RoutePieces = Partial>
+
+interface Accumulator {
+ routeTree: Array
+ routeNodes: Array
+ routePiecesByPath: Record
+ routeNodesByPath: Map
+}
+
+function getRoutePathSegmentMetadataForPath(
+ node: RouteNode,
+ routePath: string,
+ parentRoutePath?: string,
+): Array | undefined {
+ if (!node._routePathSegmentMetadata) return undefined
+
+ const segments = routePath.split('/')
+ const result = new Array(
+ segments.length,
+ )
+ const parentSegmentCount = countRoutePathSegments(parentRoutePath)
+ let hasMetadata = false
+ let segmentCount = 0
+
+ for (let i = 0; i < segments.length; i++) {
+ if (!segments[i]) continue
+ const sourceIndex = parentSegmentCount + segmentCount + 1
+ result[i] = node._routePathSegmentMetadata[sourceIndex]
+ hasMetadata ||= !!result[i]
+ segmentCount++
+ }
+
+ return hasMetadata ? result : undefined
+}
+
+/**
+ * The kind of the route the tree creates for a path that has only a lazy
+ * file or pieces: a pathless layout when its own last segment is one, as
+ * the route file at that path would be (SPEC J1.8), otherwise a plain route.
+ */
+function anchorKind(node: RouteNode): FsRouteType {
+ const segments = (node.routePath ?? '').split('/')
+ const originalSegments = (node.originalRoutePath ?? '').split('/')
+ const index = segments.length - 1
+ const last = segments[index] ?? ''
+ if (last === rootPathId) {
+ return 'static'
+ }
+ const metadata = node._routePathSegmentMetadata?.[index]
+ return !metadata?.literalLeadingUnderscore &&
+ isSegmentPathless(last, originalSegments[index] ?? '')
+ ? 'pathless_layout'
+ : 'static'
+}
+
+function handleNode(
+ node: RouteNode,
+ acc: Accumulator,
+ prefixMap: RoutePrefixMap,
+) {
+ let parentRoute = hasParentRoute(prefixMap, node, node.routePath)
+
+ // Check routeNodesByPath for a closer parent that may not be in prefixMap
+ // (the prefixMap excludes lazy routes, while the routes the tree creates
+ // for lazy-only files are in routeNodesByPath). Walk up the path segments
+ // to the closest registered route.
+ if (node.routePath) {
+ let searchPath = node.routePath
+ while (searchPath.length > 0) {
+ const lastSlash = searchPath.lastIndexOf('/')
+ if (lastSlash <= 0) break
+
+ searchPath = searchPath.substring(0, lastSlash)
+ const candidate = acc.routeNodesByPath.get(searchPath)
+ if (candidate && candidate.routePath !== node.routePath) {
+ if (candidate !== parentRoute) {
+ if (
+ !parentRoute ||
+ (candidate.routePath?.length ?? 0) >
+ (parentRoute.routePath?.length ?? 0)
+ ) {
+ parentRoute = candidate
+ }
+ }
+ break
+ }
+ }
+ }
+
+ // Virtual routes may have an explicit parent from virtual config.
+ // If we can find that exact parent, use it to prevent auto-nesting siblings
+ // based on path prefix matching (#5822, #5431).
+ if (node._virtualParentRoutePath !== undefined) {
+ const explicitParent = acc.routeNodesByPath.get(
+ node._virtualParentRoutePath,
+ )
+ if (explicitParent) {
+ parentRoute = explicitParent
+ } else if (node._virtualParentRoutePath === `/${rootPathId}`) {
+ parentRoute = null
+ }
+ // Otherwise the explicit parent was a virtual file-less route that got
+ // filtered out. Fall back to the path-based parentRoute already computed.
+ }
+
+ if (parentRoute) node.parent = parentRoute
+
+ node.path = determineNodePath(node)
+
+ const trimmedPath = trimPathLeft(node.path ?? '')
+ const originalPath =
+ node.originalRoutePath && node.parent?.originalRoutePath
+ ? node.originalRoutePath.replace(node.parent.originalRoutePath, '') || '/'
+ : node.originalRoutePath
+ const routePathSegmentMetadata = getRoutePathSegmentMetadataForPath(
+ node,
+ node.path ?? '/',
+ node.parent?.routePath,
+ )
+ const trimmedOriginalPath = trimPathLeft(originalPath ?? '')
+
+ const split = trimmedPath.split('/')
+ const pathSplit = (node.path ?? '').split('/')
+ const originalSplit = trimmedOriginalPath.split('/')
+ const lastRouteSegment = split[split.length - 1] ?? trimmedPath
+ const lastOriginalSegment =
+ originalSplit[originalSplit.length - 1] ?? trimmedOriginalPath
+ const lastRouteSegmentMetadata =
+ routePathSegmentMetadata?.[pathSplit.length - 1]
+
+ // A segment is non-path if it starts with underscore AND the underscore is not escaped
+ node.isNonPath =
+ (!lastRouteSegmentMetadata?.literalLeadingUnderscore &&
+ isSegmentPathless(lastRouteSegment, lastOriginalSegment)) ||
+ split.every((part) => routeGroupPatternRegex.test(part))
+
+ // Use a single pass so layout removal does not desync escaped underscore checks.
+ node.cleanedPath = removeGroups(
+ removeLayoutSegmentsAndUnderscoresWithEscape(
+ node.path,
+ originalPath,
+ routePathSegmentMetadata,
+ ),
+ )
+
+ if (
+ node._fsRouteType === 'layout' ||
+ node._fsRouteType === 'pathless_layout'
+ ) {
+ node.cleanedPath = removeTrailingSlash(node.cleanedPath)
+ }
+
+ if (!node.isVirtual && pieceTypes.includes(node._fsRouteType)) {
+ const pieces = (acc.routePiecesByPath[node.routePath!] ??= {})
+ pieces[node._fsRouteType as RoutePieceName] = node
+
+ const anchorRoute = acc.routeNodesByPath.get(node.routePath!)
+
+ // A path with only a lazy file or pieces gets a route of its own (the
+ // root route's pieces belong to the root route).
+ if (!anchorRoute && node.routePath !== `/${rootPathId}`) {
+ handleNode(
+ {
+ ...node,
+ isVirtual: true,
+ _fsRouteType: anchorKind(node),
+ },
+ acc,
+ prefixMap,
+ )
+ }
+ return
+ }
+
+ const isPathlessLayoutWithPath =
+ node._fsRouteType === 'pathless_layout' &&
+ node.cleanedPath &&
+ node.cleanedPath.length > 0
+
+ // A pathless layout with a path nests under its nearest ancestor route
+ // (a route the tree creates for a lazy-only file included, SPEC J1.14).
+ if (!node.isVirtual && isPathlessLayoutWithPath) {
+ const immediateParentPath = removeLastSegmentFromPath(node.routePath) || '/'
+ const immediateParentOriginalPath =
+ removeLastSegmentFromPath(node.originalRoutePath) || '/'
+ let searchPath = immediateParentPath
+
+ while (searchPath) {
+ const candidate = acc.routeNodesByPath.get(searchPath)
+ if (candidate && candidate.path !== '/') {
+ node.parent = candidate
+ node.path =
+ node.routePath?.replace(candidate.routePath ?? '', '') || '/'
+ const pathRelativeToParent =
+ immediateParentPath.replace(candidate.routePath ?? '', '') || '/'
+ const originalPathRelativeToParent =
+ immediateParentOriginalPath.replace(
+ candidate.originalRoutePath ?? '',
+ '',
+ ) || '/'
+ const routePathSegmentMetadataRelativeToParent =
+ getRoutePathSegmentMetadataForPath(
+ node,
+ pathRelativeToParent,
+ candidate.routePath,
+ )
+ node.cleanedPath = removeGroups(
+ removeLayoutSegmentsAndUnderscoresWithEscape(
+ pathRelativeToParent,
+ originalPathRelativeToParent,
+ routePathSegmentMetadataRelativeToParent,
+ ),
+ )
+ break
+ }
+ if (searchPath === '/') break
+ searchPath = removeLastSegmentFromPath(searchPath) || '/'
+ }
+ }
+
+ if (node.parent) {
+ node.parent.children = node.parent.children ?? []
+ node.parent.children.push(node)
+ } else {
+ acc.routeTree.push(node)
+ }
+
+ acc.routeNodes.push(node)
+ if (node.routePath) {
+ // Registered by path so child routes can find parents (the routes
+ // created for lazy-only files included; a route file at the same path
+ // processed later replaces them).
+ acc.routeNodesByPath.set(node.routePath, node)
+ }
+}
+
+/** The path a route types: its cleaned path without a trailing slash, except `/`. */
+function typePathOf(node: RouteNode): string {
+ if (node.cleanedPath === '/') {
+ return node.cleanedPath
+ }
+ return node.cleanedPath?.replace(/\/$/, '') ?? ''
+}
+
+/** Identifiers the printed tree declares besides the routes' own. */
+const reservedNames = new Set([
+ 'rootRouteImport',
+ 'rootRouteChildren',
+ 'routeTree',
+ 'createFileRoute',
+ 'lazyRouteComponent',
+ 'lazyFn',
+])
+
+/** The identifiers a route's variable name gives in the printed tree. */
+function namesOf(base: string) {
+ return [
+ `${base}RouteImport`,
+ `${base}Route`,
+ `${base}RouteWithChildren`,
+ `${base}RouteChildren`,
+ ]
+}
+
+/**
+ * Unique variable names, assigned in the routes' order: a name another
+ * route already took (`about-us` and `aboutUs`, `users/$id` and
+ * `users/id`) gets a numeric suffix.
+ */
+function uniqueVariableNames(nodes: ReadonlyArray) {
+ const taken = new Set(reservedNames)
+ const names = new Map()
+ for (const node of nodes) {
+ let base = node.variableName
+ for (let n = 2; namesOf(base).some((name) => taken.has(name)); n++) {
+ base = `${node.variableName}${n}`
+ }
+ namesOf(base).forEach((name) => taken.add(name))
+ names.set(node, base)
+ }
+ return names
+}
+
+/**
+ * The tree model: which routes the tree has, their parents, ids, paths and
+ * pieces. A pure function of the scan and the per-file facts: every call
+ * builds new nodes (no route node outlives a generation).
+ */
+export function buildTreeModel(input: TreeModelInput): TreeModel {
+ const { scan, config } = input
+ const indexTokenFilenameRegex = createTokenRegex(config.indexToken, {
+ type: 'filename',
+ })
+ const routeTokenFilenameRegex = createTokenRegex(config.routeToken, {
+ type: 'filename',
+ })
+ const indexTokenSegmentRegex = createTokenRegex(config.indexToken, {
+ type: 'segment',
+ })
+
+ const preRouteNodes = multiSortBy(scan.routeNodes, [
+ (d) => (d.routePath === '/' ? -1 : 1),
+ (d) =>
+ d.routePath === undefined
+ ? undefined
+ : countSlashSeparatedParts(d.routePath),
+ (d) => (d.filePath.match(indexTokenFilenameRegex) ? 1 : -1),
+ (d) => (d.filePath.match(componentPieceRegex) ? 1 : -1),
+ (d) => (d.filePath.match(routeTokenFilenameRegex) ? -1 : 1),
+ (d) => (d.routePath?.endsWith('/') ? -1 : 1),
+ (d) => d.routePath,
+ ]).filter((d) => {
+ // Exclude the root route itself, but keep its pieces
+ if (d.routePath === `/${rootPathId}`) {
+ return pieceTypes.includes(d._fsRouteType)
+ }
+ return true
+ })
+
+ // Fresh nodes: only route files whose analysis found a route (file-less
+ // virtual routes are not routes of the tree).
+ const source = new Map()
+ const routeFileNodes: Array = []
+ for (const node of preRouteNodes) {
+ if (
+ node.isVirtualParentRoute ||
+ node.isVirtual ||
+ !input.isIncluded(node)
+ ) {
+ continue
+ }
+ const copy: RouteNode = { ...node, children: undefined, parent: undefined }
+ source.set(copy, node)
+ routeFileNodes.push(copy)
+ }
+
+ const acc: Accumulator = {
+ routeTree: [],
+ routeNodes: [],
+ routePiecesByPath: {},
+ routeNodesByPath: new Map(),
+ }
+ const prefixMap = new RoutePrefixMap(routeFileNodes)
+ for (const node of routeFileNodes) {
+ handleNode(node, acc, prefixMap)
+ }
+
+ const sorted = sortRouteNodes(acc.routeNodes, indexTokenSegmentRegex)
+ const variableNames = uniqueVariableNames(sorted)
+
+ const piecesOf = (routePath: string | undefined) => {
+ const pieces: Partial> = {}
+ const found = routePath ? acc.routePiecesByPath[routePath] : undefined
+ if (found) {
+ for (const [name, piece] of Object.entries(found)) {
+ pieces[name as RoutePieceName] = piece.fullPath
+ }
+ }
+ return pieces
+ }
+
+ const propsOf = (node: RouteNode) => {
+ const scanned = source.get(node)
+ return scanned ? input.propsOf(scanned) : undefined
+ }
+
+ // The router's own formulas (router-core `Route.init`), from the options
+ // the tree passes: the types describe the runtime tree (SPEC J1.13).
+ const models = new Map()
+ const toModel = (node: RouteNode): ModelRoute => {
+ const existing = models.get(node)
+ if (existing) {
+ return existing
+ }
+ const parent = node.parent ? toModel(node.parent) : undefined
+ const parentId = parent?.id ?? rootRouteId
+ const parentFullPath = parent?.fullPath ?? '/'
+ const relativeId = node.path ?? '/'
+ const pathOption =
+ !node.isNonPath ||
+ (node._fsRouteType === 'pathless_layout' && node.cleanedPath)
+ ? (node.cleanedPath ?? '')
+ : undefined
+ let runtimePath = pathOption
+ if (runtimePath && runtimePath !== '/') {
+ runtimePath = trimPathLeft(runtimePath)
+ }
+ const id = cleanPath(
+ (parentId === rootRouteId ? '' : parentId) + '/' + relativeId,
+ )
+ const fullPath =
+ runtimePath === undefined
+ ? parentFullPath
+ : cleanPath(parentFullPath + '/' + runtimePath)
+ const model: ModelRoute = {
+ routePath: node.routePath ?? '',
+ id,
+ fullPath,
+ to: trimPathRight(fullPath),
+ relativeId,
+ pathOption,
+ typePath: typePathOf(node),
+ variableName: variableNames.get(node) ?? node.variableName,
+ kind: node._fsRouteType,
+ isNonPath: !!node.isNonPath,
+ isAnchor: !!node.isVirtual,
+ file: node.isVirtual ? undefined : node.fullPath,
+ filePath: node.filePath,
+ parent,
+ children: [],
+ pieces: piecesOf(node.routePath),
+ props: node.isVirtual ? undefined : propsOf(node),
+ }
+ models.set(node, model)
+ return model
+ }
+
+ const routes = sorted.map(toModel)
+ for (const node of sorted) {
+ const model = models.get(node)!
+ ;(model.children as Array).push(
+ ...(node.children ?? []).map((child) => models.get(child)!),
+ )
+ }
+ for (const route of routes) {
+ const children = route.children as Array
+ children.splice(0, children.length, ...ownersLast(children))
+ }
+
+ const rootNode = scan.rootRouteNode
+ return {
+ root: {
+ file: rootNode.fullPath,
+ filePath: rootNode.filePath,
+ routePath: rootNode.routePath ?? `/${rootPathId}`,
+ pieces: piecesOf(`/${rootPathId}`),
+ props: input.propsOf(rootNode),
+ },
+ routes,
+ children: ownersLast(acc.routeTree.map((node) => models.get(node)!)),
+ attachOrder: acc.routeNodes.map((node) => models.get(node)!),
+ }
+}
+
+/**
+ * Siblings with routes that own no URL first: a pathless layout without
+ * children yet matches its parent's path, like an index route there, and of
+ * two such leaves the router matches the one declared last (SPEC J1.15:
+ * the index route is the page).
+ */
+function ownersLast(routes: Array) {
+ const ownsNoUrl = (route: ModelRoute) =>
+ route.isNonPath && route.children.length === 0
+ return [
+ ...routes.filter(ownsNoUrl),
+ ...routes.filter((route) => !ownsNoUrl(route)),
+ ]
+}
+
+/**
+ * Checks that no two routes of the tree have the same URL (SPEC J1.7):
+ * routes with child routes, lazy files and routes without a path segment
+ * of their own (pathless layouts, groups: they own no URL, J1.15) aside.
+ * The error names the files.
+ */
+export function checkRouteFullPathUniqueness(model: TreeModel) {
+ checkRouteIdUniqueness(model)
+
+ const routes = model.routes.filter(
+ (route) =>
+ route.children.length === 0 && route.kind !== 'lazy' && !route.isNonPath,
+ )
+ const fileOf = (route: ModelRoute) =>
+ path.normalize(
+ route.file ?? Object.values(route.pieces)[0] ?? route.routePath,
+ )
+
+ const emptyPathRoutes = routes.filter((route) => route.routePath === '')
+ if (emptyPathRoutes.length) {
+ throw new Error(
+ `Invalid route path "" was found. Root routes must be defined via __root.tsx (createRootRoute), not createFileRoute('') or a route file that resolves to an empty path.
+Conflicting files: \n ${emptyPathRoutes.map(fileOf).join('\n ')}\n`,
+ )
+ }
+
+ const byFullPath = new Map>()
+ for (const route of routes) {
+ const list = byFullPath.get(route.fullPath) ?? []
+ list.push(route)
+ byFullPath.set(route.fullPath, list)
+ }
+ const conflicting = [...byFullPath.values()]
+ .filter((list) => list.length > 1)
+ .flat()
+ if (conflicting.length) {
+ throw new Error(
+ `Conflicting configuration paths were found for the following route${conflicting.length > 1 ? 's' : ''}: ${conflicting
+ .map((route) => `"${route.fullPath}"`)
+ .join(', ')}.
+Please ensure each Route has a unique full path.
+Conflicting files: \n ${conflicting.map(fileOf).join('\n ')}\n`,
+ )
+ }
+}
+
+/**
+ * Two routes with one id (`posts.tsx` and `posts/route.tsx` once a child
+ * route nests under one of them) are an error naming their files: the
+ * router would reject the tree at startup without naming any (SPEC J1.7).
+ */
+function checkRouteIdUniqueness(model: TreeModel) {
+ const byId = new Map>()
+ for (const route of model.routes) {
+ const list = byId.get(route.id) ?? []
+ list.push(route)
+ byId.set(route.id, list)
+ }
+ const duplicates = [...byId].filter(([, list]) => list.length > 1)
+ if (duplicates.length) {
+ throw new Error(
+ `Several route files were found for the route${duplicates.length > 1 ? 's' : ''} ${duplicates
+ .map(([id]) => `"${id}"`)
+ .join(', ')}. Please keep one route file per route.
+Conflicting files: \n ${duplicates
+ .flatMap(([, list]) =>
+ list.map((route) => path.normalize(route.file ?? route.routePath)),
+ )
+ .join('\n ')}\n`,
+ )
+ }
+}
diff --git a/packages/router-generator/src/plugin/types.ts b/packages/router-generator/src/plugin/types.ts
index 57d210b40b..cfa69b3b29 100644
--- a/packages/router-generator/src/plugin/types.ts
+++ b/packages/router-generator/src/plugin/types.ts
@@ -1,18 +1,15 @@
-import type { HandleNodeAccumulator, RouteNode } from '../types'
+import type { TreeModel } from '../types'
import type { Generator } from '../generator'
export interface GeneratorPlugin {
name: string
init?: (opts: { generator: Generator }) => void
+ /**
+ * After each generation that rebuilt the tree model: the routes changed,
+ * or the recorded options of a route file did.
+ */
onRouteTreeChanged?: (opts: {
- routeTree: Array
- routeNodes: Array
- rootRouteNode: RouteNode
- acc: HandleNodeAccumulator
- }) => void
-
- afterTransform?: (opts: {
- node: RouteNode
- prevNode: RouteNode | undefined
+ model: TreeModel
+ generator: Generator
}) => void
}
diff --git a/packages/router-generator/src/print/format.ts b/packages/router-generator/src/print/format.ts
new file mode 100644
index 0000000000..52d8cb7572
--- /dev/null
+++ b/packages/router-generator/src/print/format.ts
@@ -0,0 +1,19 @@
+import type { CodeStyle } from './style'
+
+/**
+ * Formats the route tree with Prettier, only when
+ * `enableRouteTreeFormatting` is `true`: Prettier is loaded on first use,
+ * never at startup otherwise (the direct printer already prints the
+ * configured style).
+ */
+export async function formatWithPrettier(
+ source: string,
+ style: CodeStyle,
+): Promise {
+ const prettier = await import('prettier')
+ return prettier.format(source, {
+ semi: style.semicolons,
+ singleQuote: style.quote === "'",
+ parser: 'typescript',
+ })
+}
diff --git a/packages/router-generator/src/print/style.ts b/packages/router-generator/src/print/style.ts
new file mode 100644
index 0000000000..506abdc19d
--- /dev/null
+++ b/packages/router-generator/src/print/style.ts
@@ -0,0 +1,62 @@
+/** The code style of what the generator prints (`quoteStyle`, `semicolons`). */
+export interface CodeStyle {
+ quote: "'" | '"'
+ semicolons: boolean
+}
+
+export function styleOf(config: {
+ quoteStyle: 'single' | 'double'
+ semicolons: boolean
+}): CodeStyle {
+ return {
+ quote: config.quoteStyle === 'double' ? '"' : "'",
+ semicolons: config.semicolons,
+ }
+}
+
+const needsEscape = {
+ "'": /['\\\n\r\u2028\u2029]/,
+ '"': /["\\\n\r\u2028\u2029]/,
+ '`': /[`$\\\n\r\u2028\u2029]/,
+}
+
+/** A string literal of `value` in quote `quote`, escaped as needed. */
+export function lit(value: string, quote: "'" | '"' | '`' = "'"): string {
+ if (!needsEscape[quote].test(value)) {
+ return quote + value + quote
+ }
+ let out = quote
+ for (const char of value) {
+ switch (char) {
+ case '\\':
+ out += '\\\\'
+ break
+ case '\n':
+ out += '\\n'
+ break
+ case '\r':
+ out += '\\r'
+ break
+ case '
':
+ out += '\\u2028'
+ break
+ case '
':
+ out += '\\u2029'
+ break
+ default:
+ if (char === quote || (quote === '`' && char === '$')) {
+ out += `\\${char}`
+ } else {
+ out += char
+ }
+ }
+ }
+ return out + quote
+}
+
+const identifierRegex = /^[A-Za-z_$][\w$]*$/
+
+/** An object or interface key: the name itself when it is an identifier. */
+export function key(name: string, style: CodeStyle): string {
+ return identifierRegex.test(name) ? name : lit(name, style.quote)
+}
diff --git a/packages/router-generator/src/print/tree.ts b/packages/router-generator/src/print/tree.ts
new file mode 100644
index 0000000000..defae3e9fc
--- /dev/null
+++ b/packages/router-generator/src/print/tree.ts
@@ -0,0 +1,332 @@
+import path from 'node:path'
+import { rootRouteId } from '@tanstack/router-core/tooling'
+import { removeExt, replaceBackslash } from '../utils'
+import { key, lit } from './style'
+import type { CodeStyle } from './style'
+import type { ModelRoute, RoutePieceName, TreeModel } from '../types'
+
+export interface PrintTreeOptions {
+ style: CodeStyle
+ disableTypes: boolean
+ /** The router package the tree imports its runtime from (`@tanstack/react-router`). */
+ routerPackage: string
+ /** Where the tree is written (its imports are relative to it). */
+ treeFile: string
+ addExtensions: boolean | string
+ importRoutesUsingAbsolutePaths: boolean
+ header: ReadonlyArray
+ footer: ReadonlyArray
+}
+
+const componentPieces = [
+ 'component',
+ 'errorComponent',
+ 'notFoundComponent',
+ 'pendingComponent',
+] as const satisfies ReadonlyArray
+
+/** The name of the value a route has once its children are added. */
+function resolvedName(route: ModelRoute) {
+ return route.children.length
+ ? `${route.variableName}RouteWithChildren`
+ : `${route.variableName}Route`
+}
+
+function parentName(route: ModelRoute) {
+ return route.parent ? `${route.parent.variableName}Route` : 'rootRouteImport'
+}
+
+/**
+ * Prints the route tree module of `model` in the configured style: the
+ * runtime tree and, unless disabled, its types, both from the same model
+ * (SPEC J1.13). Every string goes through one escaper (`lit`), every import
+ * of a route file through one specifier function.
+ */
+export function printTree(model: TreeModel, options: PrintTreeOptions) {
+ const { style, disableTypes } = options
+ const q = (value: string) => lit(value, style.quote)
+ const semi = style.semicolons ? ';' : ''
+ const memberSemi = style.semicolons ? ';' : ''
+ const runtime = new Set<'createFileRoute' | 'lazyRouteComponent' | 'lazyFn'>()
+
+ const specifierFor = (file: string) => {
+ const keepExtension = file.endsWith('.vue')
+ if (options.importRoutesUsingAbsolutePaths) {
+ return replaceBackslash(
+ keepExtension ? file : removeExt(file, options.addExtensions),
+ )
+ }
+ const relative = replaceBackslash(
+ path.relative(path.dirname(options.treeFile), file),
+ )
+ const withoutExt = keepExtension
+ ? relative
+ : removeExt(relative, options.addExtensions)
+ return withoutExt.startsWith('../') ? withoutExt : `./${withoutExt}`
+ }
+ const dynamicImport = (file: string) => `import(${q(specifierFor(file))})`
+
+ const componentUpdate = (
+ pieces: ModelRoute['pieces'],
+ indent: string,
+ ): string | undefined => {
+ const entries = componentPieces.flatMap((option) => {
+ const file = pieces[option]
+ if (!file) {
+ return []
+ }
+ runtime.add('lazyRouteComponent')
+ // A Vue single-file component's component is its default export
+ const exportName = file.endsWith('.vue') ? 'default' : option
+ return [
+ `${indent} ${option}: lazyRouteComponent(() => ${dynamicImport(file)}, ${q(exportName)}),`,
+ ]
+ })
+ return entries.length
+ ? `.update({\n${entries.join('\n')}\n${indent}})`
+ : undefined
+ }
+
+ const routeImports: Array = [
+ `import { Route as rootRouteImport } from ${q(specifierFor(model.root.file))}${semi}`,
+ ]
+ const anchors: Array = []
+ const updates: Array = []
+
+ for (const route of model.routes) {
+ const imported = `${route.variableName}RouteImport`
+ if (route.isAnchor || !route.file) {
+ runtime.add('createFileRoute')
+ anchors.push(
+ `const ${imported} = createFileRoute(${q(route.routePath)})()${semi}`,
+ )
+ } else {
+ routeImports.push(
+ `import { Route as ${imported} } from ${q(specifierFor(route.file))}${semi}`,
+ )
+ }
+
+ const options = [
+ ` id: ${q(route.relativeId)},`,
+ ...(route.pathOption !== undefined
+ ? [` path: ${q(route.pathOption)},`]
+ : []),
+ ` getParentRoute: () => ${parentName(route)},`,
+ ]
+ const chain: Array = []
+ if (route.pieces.loader) {
+ runtime.add('lazyFn')
+ chain.push(
+ ` .updateLoader({\n loader: lazyFn(() => ${dynamicImport(route.pieces.loader)}, ${q('loader')}),\n })`,
+ )
+ }
+ const components = componentUpdate(route.pieces, ' ')
+ if (components) {
+ chain.push(` ${components}`)
+ }
+ if (route.pieces.lazy) {
+ chain.push(
+ ` .lazy(() => ${dynamicImport(route.pieces.lazy)}.then((d) => d.Route))`,
+ )
+ }
+ updates.push(
+ `const ${route.variableName}Route = ${imported}.update({\n${options.join('\n')}\n}${disableTypes ? '' : ' as any'})${chain.length ? `\n${chain.join('\n')}` : ''}${semi}`,
+ )
+ }
+
+ const sections: Array = []
+
+ if (!disableTypes) {
+ sections.push(printTypes(model, options))
+ }
+
+ // Each route with children: its children object and the route with them,
+ // children before parents.
+ const childrenBlocks: Array = []
+ const addChildren = (route: ModelRoute) => {
+ if (!route.children.length) {
+ return
+ }
+ route.children.forEach(addChildren)
+ const name = `${route.variableName}RouteChildren`
+ if (!disableTypes) {
+ childrenBlocks.push(
+ `interface ${name} {\n${route.children
+ .map(
+ (child) =>
+ ` ${child.variableName}Route: typeof ${resolvedName(child)}${memberSemi}`,
+ )
+ .join('\n')}\n}`,
+ )
+ }
+ childrenBlocks.push(
+ `const ${name}${disableTypes ? '' : `: ${name}`} = {\n${route.children
+ .map((child) => ` ${child.variableName}Route: ${resolvedName(child)},`)
+ .join('\n')}\n}${semi}`,
+ )
+ childrenBlocks.push(
+ `const ${route.variableName}RouteWithChildren = ${route.variableName}Route._addFileChildren(${name})${semi}`,
+ )
+ }
+ model.children.forEach(addChildren)
+
+ const rootComponents = componentUpdate(model.root.pieces, ' ')
+ const rootChildren = [
+ `const rootRouteChildren${disableTypes ? '' : ': RootRouteChildren'} = {\n${model.children
+ .map((child) => ` ${child.variableName}Route: ${resolvedName(child)},`)
+ .join('\n')}\n}${semi}`,
+ `export const routeTree = rootRouteImport${rootComponents ? `\n ${rootComponents}` : ''}\n ._addFileChildren(rootRouteChildren)${disableTypes ? '' : '\n ._addFileTypes()'}${semi}`,
+ ]
+
+ const runtimeImport = runtime.size
+ ? [
+ `import { ${[...runtime].sort().join(', ')} } from ${q(options.routerPackage)}${semi}`,
+ ]
+ : []
+
+ const blocks = [
+ options.header.join('\n'),
+ `// This file was automatically generated by TanStack Router.
+// You should NOT make any changes in this file as it will be overwritten.
+// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.`,
+ [...runtimeImport, ...routeImports].join('\n'),
+ anchors.join('\n'),
+ updates.join('\n'),
+ ...sections,
+ childrenBlocks.join('\n\n'),
+ rootChildren.join('\n'),
+ options.footer.join('\n'),
+ ]
+ return `${blocks.filter(Boolean).join('\n\n')}\n`
+}
+
+function printTypes(model: TreeModel, options: PrintTreeOptions) {
+ const { style } = options
+ const q = (value: string) => lit(value, style.quote)
+ const memberSemi = style.semicolons ? ';' : ''
+ const member = (name: string, type: string, indent = ' ') =>
+ `${indent}${key(name, style)}: ${type}${memberSemi}`
+ const union = (values: Array) =>
+ values.length ? values.map(q).join(' | ') : 'never'
+
+ const byFullPath = routesByFullPath(model.attachOrder)
+ const byTo = routesByTo(model.attachOrder)
+ const byId = new Map(model.attachOrder.map((route) => [route.id, route]))
+ const fullPaths = [...byFullPath.keys()].filter(Boolean)
+ const tos = [...byTo.keys()].filter(Boolean)
+ const ids = [...byId.keys()]
+
+ const interfaceOf = (name: string, members: Array) =>
+ `export interface ${name} {\n${members.join('\n')}\n}`
+
+ const types = [
+ interfaceOf(
+ 'FileRoutesByFullPath',
+ fullPaths.map((fullPath) =>
+ member(fullPath, `typeof ${resolvedName(byFullPath.get(fullPath)!)}`),
+ ),
+ ),
+ interfaceOf(
+ 'FileRoutesByTo',
+ tos.map((to) => member(to, `typeof ${resolvedName(byTo.get(to)!)}`)),
+ ),
+ interfaceOf('FileRoutesById', [
+ member(rootRouteId, 'typeof rootRouteImport'),
+ ...[...byId].map(([id, route]) =>
+ member(id, `typeof ${resolvedName(route)}`),
+ ),
+ ]),
+ interfaceOf('FileRouteTypes', [
+ member('fileRoutesByFullPath', 'FileRoutesByFullPath'),
+ member('fullPaths', union(fullPaths)),
+ member('fileRoutesByTo', 'FileRoutesByTo'),
+ member('to', union(tos)),
+ member('id', union([rootRouteId, ...ids])),
+ member('fileRoutesById', 'FileRoutesById'),
+ ]),
+ interfaceOf(
+ 'RootRouteChildren',
+ model.children.map((child) =>
+ member(`${child.variableName}Route`, `typeof ${resolvedName(child)}`),
+ ),
+ ),
+ ].join('\n')
+
+ const byPath = model.routes
+ .map((route) =>
+ [
+ ` ${key(route.routePath, style)}: {`,
+ member('id', q(route.id), ' '),
+ member('path', q(route.typePath), ' '),
+ member('fullPath', q(route.fullPath), ' '),
+ member(
+ 'preLoaderRoute',
+ `typeof ${route.variableName}RouteImport`,
+ ' ',
+ ),
+ member('parentRoute', `typeof ${parentName(route)}`, ' '),
+ ` }${memberSemi}`,
+ ].join('\n'),
+ )
+ .join('\n')
+ const declareModule = `declare module ${q(options.routerPackage)} {\n interface FileRoutesByPath {\n${byPath}\n }\n}`
+
+ return `${types}\n\n${declareModule}`
+}
+
+const isIndex = (route: ModelRoute) => route.routePath.endsWith('/')
+const isPathless = (route: ModelRoute) => route.kind === 'pathless_layout'
+
+/**
+ * The route each full path stands for in the types: a route over its own
+ * pathless layout, the index route over others at `/`.
+ */
+function routesByFullPath(routes: ReadonlyArray) {
+ const map = new Map()
+ for (const route of routes) {
+ const existing = map.get(route.fullPath)
+ if (existing) {
+ if (
+ route.fullPath === '/' &&
+ existing.typePath === '/' &&
+ route.typePath !== '/'
+ ) {
+ continue
+ }
+ if (isPathless(route) && !isPathless(existing)) {
+ continue
+ }
+ }
+ map.set(route.fullPath, route)
+ }
+ return map
+}
+
+/**
+ * The route each `to` stands for in the types: an index route over the
+ * route of its directory, a route over a pathless layout with the same
+ * `to`.
+ */
+function routesByTo(routes: ReadonlyArray) {
+ const map = new Map()
+ for (const route of routes) {
+ // A route with an index child: `to` is the index route's
+ if (route.children.some((child) => child.typePath === '/')) {
+ continue
+ }
+ const existing = map.get(route.to)
+ if (existing) {
+ if (isIndex(route) !== isIndex(existing)) {
+ if (!isIndex(route)) {
+ continue
+ }
+ } else if (isPathless(route) !== isPathless(existing)) {
+ if (isPathless(route)) {
+ continue
+ }
+ }
+ }
+ map.set(route.to, route)
+ }
+ return map
+}
diff --git a/packages/router-generator/src/publish/atomic.ts b/packages/router-generator/src/publish/atomic.ts
new file mode 100644
index 0000000000..ab1c6b4c62
--- /dev/null
+++ b/packages/router-generator/src/publish/atomic.ts
@@ -0,0 +1,134 @@
+import path from 'node:path'
+import crypto from 'node:crypto'
+import * as fsp from 'node:fs/promises'
+
+/** A route file changed on disk between our read and our write. */
+export class ConcurrentEditError extends Error {
+ constructor(readonly file: string) {
+ super(`File ${file} was modified by another process during processing.`)
+ }
+}
+
+function isErrorCode(error: unknown, code: string) {
+ return (
+ typeof error === 'object' &&
+ error !== null &&
+ (error as NodeJS.ErrnoException).code === code
+ )
+}
+
+/** Reads a file; null when it does not exist. */
+export async function readIfExists(file: string): Promise {
+ try {
+ return await fsp.readFile(file, 'utf8')
+ } catch (error) {
+ if (isErrorCode(error, 'ENOENT')) {
+ return null
+ }
+ throw error
+ }
+}
+
+/**
+ * Atomic file replacement (SPEC J1.6, J1.16): the content is written to a
+ * temporary file, which is renamed over the destination, so a reader sees
+ * the old or the new file, never a part. Temporary files go to `tmpDir`;
+ * when a rename from there crosses devices (EXDEV), the temporary file is
+ * written beside the destination instead (a dot file, which the route scan
+ * skips), for that directory from then on.
+ */
+export class AtomicPublisher {
+ private readonly session = crypto.randomBytes(4).toString('hex')
+ /** Numbers the temporary files: writes in flight never share one. */
+ private writes = 0
+ private tmpDirReady: Promise | undefined
+ /** Destination directories whose renames from `tmpDir` cross devices. */
+ private readonly besideDestination = new Set()
+
+ constructor(private readonly tmpDir: string) {}
+
+ /**
+ * Replaces `file` with `content`. With `expected`, the file must still
+ * hold exactly that (null: must not exist) right before the rename, or a
+ * `ConcurrentEditError` is thrown and nothing changes.
+ */
+ async write(
+ file: string,
+ content: string,
+ expected?: string | null,
+ ): Promise {
+ const dir = path.dirname(file)
+ await fsp.mkdir(dir, { recursive: true })
+ if (this.besideDestination.has(dir)) {
+ await this.writeVia(this.besideName(file), file, content, expected)
+ return
+ }
+ this.tmpDirReady ??= fsp.mkdir(this.tmpDir, { recursive: true })
+ await this.tmpDirReady
+ try {
+ await this.writeVia(
+ path.join(this.tmpDir, `${this.session}-${this.writes++}`),
+ file,
+ content,
+ expected,
+ )
+ } catch (error) {
+ if (!isErrorCode(error, 'EXDEV')) {
+ throw error
+ }
+ this.besideDestination.add(dir)
+ await this.writeVia(this.besideName(file), file, content, expected)
+ }
+ }
+
+ private besideName(file: string) {
+ return path.join(
+ path.dirname(file),
+ `.${path.basename(file)}.${this.session}-${this.writes++}.tmp`,
+ )
+ }
+
+ private async writeVia(
+ temporary: string,
+ file: string,
+ content: string,
+ expected: string | null | undefined,
+ ) {
+ try {
+ await fsp.writeFile(temporary, content)
+ const current = await fsp.stat(file).catch((error: unknown) => {
+ if (isErrorCode(error, 'ENOENT')) {
+ return null
+ }
+ throw error
+ })
+ if (current) {
+ // The replacement keeps the file's mode and owner
+ const written = await fsp.stat(temporary)
+ if (written.mode !== current.mode) {
+ await fsp.chmod(temporary, current.mode)
+ }
+ if (written.uid !== current.uid || written.gid !== current.gid) {
+ await fsp
+ .chown(temporary, current.uid, current.gid)
+ .catch((error: unknown) => {
+ if (!isErrorCode(error, 'EPERM')) {
+ throw error
+ }
+ })
+ }
+ }
+ if (expected !== undefined) {
+ // Right before the rename: an edit made meanwhile is not overwritten
+ const now = await readIfExists(file)
+ if (now !== expected) {
+ throw new ConcurrentEditError(file)
+ }
+ }
+ await fsp.rename(temporary, file)
+ } catch (error) {
+ await fsp.rm(temporary, { force: true }).catch(() => {})
+ throw error
+ }
+ }
+}
diff --git a/packages/router-generator/src/scaffold/templates.ts b/packages/router-generator/src/scaffold/templates.ts
new file mode 100644
index 0000000000..4c75510bd5
--- /dev/null
+++ b/packages/router-generator/src/scaffold/templates.ts
@@ -0,0 +1,169 @@
+import { lit } from '../print/style'
+import type { CodeStyle } from '../print/style'
+import type { Config } from '../config'
+
+export type ScaffoldKind = 'root' | 'route' | 'lazy'
+
+export interface ScaffoldOptions {
+ target: Config['target']
+ kind: ScaffoldKind
+ /** The route id (`__root` for the root route). */
+ routeId: string
+ /** Whether the file is TypeScript without JSX (`.ts`, `.mts`, `.cts`). */
+ noJsx: boolean
+ style: CodeStyle
+ /** A `customScaffolding` template (`%%tag%%` placeholders), used as written. */
+ template?: string
+}
+
+type TemplateTag = 'tsrImports' | 'tsrPath' | 'tsrExportStart' | 'tsrExportEnd'
+
+export function routerPackageOf(target: Config['target']) {
+ switch (target) {
+ case 'react':
+ case 'solid':
+ case 'vue':
+ return `@tanstack/${target}-router`
+ default:
+ throw new Error(`router-generator: Unknown target type: ${target}`)
+ }
+}
+
+/**
+ * The content of a new, empty route file (SPEC J1.3): a working route of
+ * its target and kind, in the configured quote style and semicolons. A
+ * `.ts` file gets no JSX. A custom template is filled in as written.
+ */
+export function scaffoldRouteFile(options: ScaffoldOptions): string {
+ const { style, kind, routeId } = options
+ const q = (value: string) => lit(value, style.quote)
+ const semi = style.semicolons ? ';' : ''
+ const routerPackage = routerPackageOf(options.target)
+ const constructor =
+ kind === 'root'
+ ? 'createRootRoute'
+ : kind === 'lazy'
+ ? 'createLazyFileRoute'
+ : 'createFileRoute'
+ const routerImports =
+ kind === 'root' ? ['Outlet', constructor] : [constructor]
+ // The path as shown by the page (braces of optional params read badly in
+ // text, and are not valid in JSX text)
+ const shownPath = routeId.replace(/\{(.+?)\}/g, '$1')
+ const tags: Record & Record =
+ {
+ tsrImports: `import { ${routerImports.join(', ')} } from ${q(routerPackage)}${semi}`,
+ tsrPath: shownPath,
+ tsrExportStart:
+ kind === 'root'
+ ? `export const Route = ${constructor}(`
+ : `export const Route = ${constructor}(${q(routeId)})(`,
+ tsrExportEnd: `)${semi}`,
+ }
+
+ if (options.template !== undefined) {
+ return options.template.replace(
+ /%%(\w+)%%/g,
+ (_, tag: string) => tags[tag] ?? '',
+ )
+ }
+
+ const component = kind === 'root' ? 'RootComponent' : 'RouteComponent'
+ const text = `Hello "${shownPath}"!`
+ const { imports, body } = componentOf(
+ options.target,
+ kind === 'root',
+ options.noJsx,
+ text,
+ q,
+ semi,
+ )
+ return [
+ ...imports.map((specifierAndSource) => `${specifierAndSource}${semi}`),
+ tags.tsrImports,
+ '',
+ `${tags.tsrExportStart}{`,
+ ` component: ${component},`,
+ `}${tags.tsrExportEnd}`,
+ '',
+ `function ${component}() {`,
+ ...body,
+ '}',
+ '',
+ ].join('\n')
+}
+
+function componentOf(
+ target: Config['target'],
+ isRoot: boolean,
+ noJsx: boolean,
+ text: string,
+ q: (value: string) => string,
+ semi: string,
+): { imports: Array; body: Array } {
+ if (target === 'vue') {
+ return {
+ imports: [`import { h } from ${q('vue')}`],
+ body: [
+ isRoot
+ ? ` return h(${q('div')}, {}, [${q(text)}, h(Outlet)])${semi}`
+ : ` return h(${q('div')}, {}, ${q(text)})${semi}`,
+ ],
+ }
+ }
+ if (noJsx) {
+ if (target === 'react') {
+ return {
+ imports: [`import * as React from ${q('react')}`],
+ body: isRoot
+ ? [
+ ` return React.createElement(`,
+ ` React.Fragment,`,
+ ` null,`,
+ ` React.createElement(${q('div')}, null, ${q(text)}),`,
+ ` React.createElement(Outlet),`,
+ ` )${semi}`,
+ ]
+ : [
+ ` return React.createElement(${q('div')}, null, ${q(text)})${semi}`,
+ ],
+ }
+ }
+ return {
+ imports: isRoot
+ ? [`import { createComponent } from ${q('solid-js')}`]
+ : [],
+ body: isRoot
+ ? [` return [${q(text)}, createComponent(Outlet, {})]${semi}`]
+ : [` return ${q(text)}${semi}`],
+ }
+ }
+ if (target === 'react') {
+ return {
+ imports: isRoot ? [`import * as React from ${q('react')}`] : [],
+ body: isRoot
+ ? [
+ ' return (',
+ ' ',
+ ` ${text}
`,
+ ' ',
+ ' ',
+ ` )${semi}`,
+ ]
+ : [` return ${text}
${semi}`],
+ }
+ }
+ return {
+ imports: [],
+ body: isRoot
+ ? [
+ ' return (',
+ ' <>',
+ ` ${text}
`,
+ ' ',
+ ' >',
+ ` )${semi}`,
+ ]
+ : [` return ${text}
${semi}`],
+ }
+}
diff --git a/packages/router-generator/src/template.ts b/packages/router-generator/src/template.ts
deleted file mode 100644
index 11ca968933..0000000000
--- a/packages/router-generator/src/template.ts
+++ /dev/null
@@ -1,222 +0,0 @@
-import { format } from './utils'
-import type { Config } from './config'
-
-type TemplateTag = 'tsrImports' | 'tsrPath' | 'tsrExportStart' | 'tsrExportEnd'
-
-export function fillTemplate(
- config: Config,
- template: string,
- values: Record,
-) {
- const replaced = template.replace(
- /%%(\w+)%%/g,
- (_, key) => values[key as TemplateTag] || '',
- )
- return format(replaced, config)
-}
-
-export type TargetTemplate = {
- fullPkg: string
- subPkg: string
- rootRoute: {
- template: () => string
- imports: {
- tsrImports: () => string
- tsrExportStart: () => string
- tsrExportEnd: () => string
- }
- }
- route: {
- template: () => string
- imports: {
- tsrImports: () => string
- tsrExportStart: (routePath: string) => string
- tsrExportEnd: () => string
- }
- }
- lazyRoute: {
- template: () => string
- imports: {
- tsrImports: () => string
- tsrExportStart: (routePath: string) => string
- tsrExportEnd: () => string
- }
- }
-}
-
-function serializeRoutePath(routePath: string) {
- return JSON.stringify(routePath)
-}
-
-export function getTargetTemplate(config: Config): TargetTemplate {
- const target = config.target
- switch (target) {
- case 'react':
- return {
- fullPkg: '@tanstack/react-router',
- subPkg: 'react-router',
- rootRoute: {
- template: () =>
- [
- 'import * as React from "react"\n',
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RootComponent\n }%%tsrExportEnd%%\n\n',
- 'function RootComponent() { return (Hello "%%tsrPath%%"!
) };\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { Outlet, createRootRoute } from '@tanstack/react-router';",
- tsrExportStart: () => 'export const Route = createRootRoute(',
- tsrExportEnd: () => ');',
- },
- },
- route: {
- template: () =>
- [
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RouteComponent\n }%%tsrExportEnd%%\n\n',
- 'function RouteComponent() { return Hello "%%tsrPath%%"!
};\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { createFileRoute } from '@tanstack/react-router';",
- tsrExportStart: (routePath) =>
- `export const Route = createFileRoute(${serializeRoutePath(routePath)})(`,
- tsrExportEnd: () => ');',
- },
- },
- lazyRoute: {
- template: () =>
- [
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RouteComponent\n }%%tsrExportEnd%%\n\n',
- 'function RouteComponent() { return Hello "%%tsrPath%%"!
};\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { createLazyFileRoute } from '@tanstack/react-router';",
- tsrExportStart: (routePath) =>
- `export const Route = createLazyFileRoute(${serializeRoutePath(routePath)})(`,
- tsrExportEnd: () => ');',
- },
- },
- }
- case 'solid':
- return {
- fullPkg: '@tanstack/solid-router',
- subPkg: 'solid-router',
- rootRoute: {
- template: () =>
- [
- 'import * as Solid from "solid-js"\n',
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RootComponent\n }%%tsrExportEnd%%\n\n',
- 'function RootComponent() { return (<>Hello "%%tsrPath%%"!
>) };\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { Outlet, createRootRoute } from '@tanstack/solid-router';",
- tsrExportStart: () => 'export const Route = createRootRoute(',
- tsrExportEnd: () => ');',
- },
- },
- route: {
- template: () =>
- [
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RouteComponent\n }%%tsrExportEnd%%\n\n',
- 'function RouteComponent() { return Hello "%%tsrPath%%"!
};\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { createFileRoute } from '@tanstack/solid-router';",
- tsrExportStart: (routePath) =>
- `export const Route = createFileRoute(${serializeRoutePath(routePath)})(`,
- tsrExportEnd: () => ');',
- },
- },
- lazyRoute: {
- template: () =>
- [
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RouteComponent\n }%%tsrExportEnd%%\n\n',
- 'function RouteComponent() { return Hello "%%tsrPath%%"!
};\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { createLazyFileRoute } from '@tanstack/solid-router';",
-
- tsrExportStart: (routePath) =>
- `export const Route = createLazyFileRoute(${serializeRoutePath(routePath)})(`,
-
- tsrExportEnd: () => ');',
- },
- },
- }
- case 'vue':
- return {
- fullPkg: '@tanstack/vue-router',
- subPkg: 'vue-router',
- rootRoute: {
- template: () =>
- [
- 'import { h } from "vue"\n',
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RootComponent\n }%%tsrExportEnd%%\n\n',
- 'function RootComponent() { return h("div", {}, ["Hello \\"%%tsrPath%%\\"!", h(Outlet)]) };\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { Outlet, createRootRoute } from '@tanstack/vue-router';",
- tsrExportStart: () => 'export const Route = createRootRoute(',
- tsrExportEnd: () => ');',
- },
- },
- route: {
- template: () =>
- [
- 'import { h } from "vue"\n',
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RouteComponent\n }%%tsrExportEnd%%\n\n',
- 'function RouteComponent() { return h("div", {}, "Hello \\"%%tsrPath%%\\"!") };\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { createFileRoute } from '@tanstack/vue-router';",
- tsrExportStart: (routePath) =>
- `export const Route = createFileRoute(${serializeRoutePath(routePath)})(`,
- tsrExportEnd: () => ');',
- },
- },
- lazyRoute: {
- template: () =>
- [
- 'import { h } from "vue"\n',
- '%%tsrImports%%',
- '\n\n',
- '%%tsrExportStart%%{\n component: RouteComponent\n }%%tsrExportEnd%%\n\n',
- 'function RouteComponent() { return h("div", {}, "Hello \\"%%tsrPath%%\\"!") };\n',
- ].join(''),
- imports: {
- tsrImports: () =>
- "import { createLazyFileRoute } from '@tanstack/vue-router';",
-
- tsrExportStart: (routePath) =>
- `export const Route = createLazyFileRoute(${serializeRoutePath(routePath)})(`,
-
- tsrExportEnd: () => ');',
- },
- },
- }
- default:
- throw new Error(`router-generator: Unknown target type: ${target}`)
- }
-}
diff --git a/packages/router-generator/src/transform/transform.ts b/packages/router-generator/src/transform/transform.ts
deleted file mode 100644
index 9fcad87948..0000000000
--- a/packages/router-generator/src/transform/transform.ts
+++ /dev/null
@@ -1,717 +0,0 @@
-import MagicString from 'magic-string'
-import * as t from '@babel/types'
-import { parseAst } from '@tanstack/router-utils'
-import type { TransformOptions, TransformResult } from './types'
-
-const routeConstructors = ['createFileRoute', 'createLazyFileRoute'] as const
-
-type RouteConstructorName = (typeof routeConstructors)[number]
-type SupportedRouteId = t.StringLiteral | t.TemplateLiteral
-type NamedImport = {
- imported: string
- local: string
- importKind?: 'type' | 'typeof' | 'value'
-}
-
-type ParsedImportDeclaration = {
- declaration: t.ImportDeclaration
- defaultImport?: string
- namespace?: string
- named: Array
- moduleName: string
- quote: '"' | "'"
- semicolon: boolean
-}
-
-type RouteImportAnalysis =
- | { kind: 'ok' }
- | {
- kind: 'rename'
- imported: t.Identifier
- local: t.Identifier
- next: RouteConstructorName
- }
- | { kind: 'normalize' }
-
-type RouteCall = {
- callee: t.Identifier & { name: RouteConstructorName }
- routeIdArg: SupportedRouteId
- optionsArg: t.CallExpression['arguments'][number] | undefined
-}
-
-type RouteCallAnalysis = {
- calls: Array
- hasUnsupportedRouteId: boolean
- hasMalformedRouteCall: boolean
-}
-
-export function transform({
- ctx,
- source,
- filename,
- node,
-}: TransformOptions): TransformResult {
- let ast: ReturnType
-
- try {
- ast = parseAst({ code: source, filename })
- } catch (error) {
- return {
- result: 'error',
- error,
- }
- }
-
- const exportedRouteNames = getExportedRouteNames(ast.program.body)
-
- if (exportedRouteNames.size === 0) {
- return { result: 'no-route-export' }
- }
-
- const {
- calls: routeCalls,
- hasUnsupportedRouteId,
- hasMalformedRouteCall,
- } = findExportedRouteCalls(ast.program.body, exportedRouteNames)
-
- if (routeCalls.length === 0 && hasMalformedRouteCall) {
- return {
- result: 'error',
- error: new Error(
- `expected Route export in ${ctx.routeId} to use createFileRoute('/path')({...}) or createLazyFileRoute('/path')({...})`,
- ),
- }
- }
-
- if (routeCalls.length === 0 && hasUnsupportedRouteId) {
- return {
- result: 'error',
- error: new Error(
- `expected route id to be a string literal or plain template literal in ${ctx.routeId}`,
- ),
- }
- }
-
- if (routeCalls.length === 0) {
- return { result: 'not-modified' }
- }
-
- if (routeCalls.length > 1) {
- return {
- result: 'error',
- error: new Error(
- `expected exactly one createFileRoute/createLazyFileRoute call in ${ctx.routeId}`,
- ),
- }
- }
-
- const routeCall = routeCalls[0]!
- const routeIdQuote = getRouteIdQuote(source, routeCall.routeIdArg)
-
- const createFileRouteProps = getCreateFileRouteProps(routeCall.optionsArg)
- if (createFileRouteProps) {
- node.createFileRouteProps = createFileRouteProps
- }
-
- const expectedCallee = getExpectedRouteConstructor(ctx.lazy)
- const expectedRouteId = `${routeIdQuote}${ctx.routeId}${routeIdQuote}`
- const currentRouteId = source.slice(
- routeCall.routeIdArg.start!,
- routeCall.routeIdArg.end!,
- )
- const targetModule = `@tanstack/${ctx.target}-router`
- const imports = parseTargetImports(ast.program.body, source, targetModule)
-
- const s = new MagicString(source)
- let modified = false
-
- if (routeCall.callee.name !== expectedCallee) {
- s.update(routeCall.callee.start!, routeCall.callee.end!, expectedCallee)
- modified = true
- }
-
- if (currentRouteId !== expectedRouteId) {
- s.update(
- routeCall.routeIdArg.start!,
- routeCall.routeIdArg.end!,
- expectedRouteId,
- )
- modified = true
- }
-
- if (
- updateRouteImports({
- imports,
- source,
- s,
- targetModule,
- required: expectedCallee,
- lineEnding: getLineEnding(source),
- })
- ) {
- modified = true
- }
-
- if (!modified) {
- return { result: 'not-modified' }
- }
-
- return {
- result: 'modified',
- output: s.toString(),
- }
-}
-
-function getExportedRouteNames(body: Array) {
- const exportedRouteNames = new Set()
-
- for (const statement of body) {
- if (!t.isExportNamedDeclaration(statement) || statement.source) {
- continue
- }
-
- if (t.isVariableDeclaration(statement.declaration)) {
- for (const declarator of statement.declaration.declarations) {
- if (t.isIdentifier(declarator.id) && declarator.id.name === 'Route') {
- exportedRouteNames.add('Route')
- }
- }
- }
-
- for (const specifier of statement.specifiers) {
- if (
- !t.isExportSpecifier(specifier) ||
- getExportedName(specifier.exported) !== 'Route'
- ) {
- continue
- }
-
- const localName = getLocalBindingName(specifier.local)
- if (localName) {
- exportedRouteNames.add(localName)
- }
- }
- }
-
- return exportedRouteNames
-}
-
-function findExportedRouteCalls(
- body: Array,
- exportedRouteNames: Set,
-): RouteCallAnalysis {
- const calls: Array = []
- let hasUnsupportedRouteId = false
- let hasMalformedRouteCall = false
-
- for (const statement of body) {
- const declaration = getVariableDeclaration(statement)
- if (!declaration) {
- continue
- }
-
- for (const declarator of declaration.declarations) {
- if (
- !t.isIdentifier(declarator.id) ||
- !exportedRouteNames.has(declarator.id.name)
- ) {
- continue
- }
-
- const init = getRouteConstructorInit(declarator.init)
- if (!init) {
- if (isDirectRouteConstructorCall(declarator.init)) {
- hasMalformedRouteCall = true
- }
- continue
- }
-
- const routeIdArg = init.innerCall.arguments[0]
- if (isSupportedRouteId(routeIdArg)) {
- calls.push({
- callee: init.callee,
- routeIdArg,
- optionsArg: init.outerCall.arguments[0],
- })
- } else {
- hasUnsupportedRouteId = true
- }
- }
- }
-
- return { calls, hasUnsupportedRouteId, hasMalformedRouteCall }
-}
-
-function getVariableDeclaration(statement: t.Statement) {
- const declaration = t.isExportNamedDeclaration(statement)
- ? statement.declaration
- : statement
-
- return t.isVariableDeclaration(declaration) ? declaration : null
-}
-
-function getExportedName(node: t.Identifier | t.StringLiteral) {
- return t.isIdentifier(node) ? node.name : node.value
-}
-
-function getLocalBindingName(node: t.Identifier | t.StringLiteral) {
- return t.isIdentifier(node) ? node.name : null
-}
-
-function getRouteConstructorInit(expression: t.Expression | null | undefined) {
- if (!expression || !t.isCallExpression(expression)) {
- return null
- }
-
- if (!t.isCallExpression(expression.callee)) {
- return null
- }
-
- const innerCall = expression.callee
-
- if (
- !t.isIdentifier(innerCall.callee) ||
- !isRouteConstructor(innerCall.callee)
- ) {
- return null
- }
-
- return {
- callee: innerCall.callee,
- outerCall: expression,
- innerCall,
- }
-}
-
-function isDirectRouteConstructorCall(
- expression: t.Expression | null | undefined,
-) {
- return (
- !!expression &&
- t.isCallExpression(expression) &&
- t.isIdentifier(expression.callee) &&
- isRouteConstructor(expression.callee)
- )
-}
-
-function isRouteConstructor(callee: t.Identifier): callee is t.Identifier & {
- name: RouteConstructorName
-} {
- return routeConstructors.includes(callee.name as RouteConstructorName)
-}
-
-function isSupportedRouteId(
- arg: t.CallExpression['arguments'][number] | undefined,
-): arg is SupportedRouteId {
- return (
- !!arg &&
- (t.isStringLiteral(arg) ||
- (t.isTemplateLiteral(arg) && arg.expressions.length === 0))
- )
-}
-
-function getRouteIdQuote(
- source: string,
- arg: SupportedRouteId,
-): '"' | "'" | '`' {
- const raw = source.slice(arg.start!, arg.end!)
-
- if (raw.startsWith("'")) return "'"
- if (raw.startsWith('"')) return '"'
- return '`'
-}
-
-function getCreateFileRouteProps(
- arg: t.CallExpression['arguments'][number] | undefined,
-) {
- if (!arg || !t.isObjectExpression(arg)) {
- return undefined
- }
-
- const props = new Set()
-
- for (const property of arg.properties) {
- if (!t.isObjectProperty(property) || property.computed) {
- continue
- }
-
- if (t.isIdentifier(property.key)) {
- props.add(property.key.name)
- continue
- }
-
- if (t.isStringLiteral(property.key)) {
- props.add(property.key.value)
- }
- }
-
- return props
-}
-
-function parseTargetImports(
- body: Array,
- source: string,
- targetModule: string,
-) {
- const imports: Array = []
-
- for (const statement of body) {
- if (
- !t.isImportDeclaration(statement) ||
- statement.importKind === 'type' ||
- statement.source.value !== targetModule
- ) {
- continue
- }
-
- const rawSource = source.slice(
- statement.source.start!,
- statement.source.end!,
- )
- const importStatement = source.slice(statement.start!, statement.end!)
-
- imports.push({
- declaration: statement,
- defaultImport: statement.specifiers.find((specifier) =>
- t.isImportDefaultSpecifier(specifier),
- )?.local.name,
- namespace: statement.specifiers.find((specifier) =>
- t.isImportNamespaceSpecifier(specifier),
- )?.local.name,
- named: statement.specifiers
- .filter((specifier): specifier is t.ImportSpecifier =>
- t.isImportSpecifier(specifier),
- )
- .map((specifier) => ({
- imported: t.isIdentifier(specifier.imported)
- ? specifier.imported.name
- : specifier.imported.value,
- local: specifier.local.name,
- importKind: specifier.importKind ?? undefined,
- })),
- moduleName: statement.source.value,
- quote: rawSource[0] as '"' | "'",
- semicolon: importStatement.trimEnd().endsWith(';'),
- })
- }
-
- return imports
-}
-
-function updateRouteImports({
- imports,
- source,
- s,
- targetModule,
- required,
- lineEnding,
-}: {
- imports: Array
- source: string
- s: MagicString
- targetModule: string
- required: RouteConstructorName
- lineEnding: '\r\n' | '\n' | '\r'
-}) {
- const analysis = analyzeRouteImports(imports, required)
-
- if (analysis.kind === 'ok') {
- return false
- }
-
- if (analysis.kind === 'rename') {
- s.update(analysis.imported.start!, analysis.imported.end!, analysis.next)
- s.update(analysis.local.start!, analysis.local.end!, analysis.next)
- return true
- }
-
- return normalizeRouteImports({
- imports,
- source,
- s,
- targetModule,
- required,
- lineEnding,
- })
-}
-
-function analyzeRouteImports(
- imports: Array,
- required: RouteConstructorName,
-): RouteImportAnalysis {
- const opposite = getOtherRouteConstructor(required)
- let requiredCount = 0
- let oppositeCount = 0
- let renameCandidate:
- | {
- imported: t.Identifier
- local: t.Identifier
- next: RouteConstructorName
- }
- | undefined
-
- for (const declaration of imports) {
- for (const specifier of declaration.declaration.specifiers) {
- if (!t.isImportSpecifier(specifier)) {
- continue
- }
-
- const imported = specifier.imported
- if (!t.isIdentifier(imported)) {
- return { kind: 'normalize' }
- }
-
- if (!isRouteConstructorName(imported.name)) {
- continue
- }
-
- if (specifier.local.name !== imported.name) {
- return { kind: 'normalize' }
- }
-
- if (imported.name === required) {
- requiredCount++
- continue
- }
-
- if (imported.name === opposite) {
- oppositeCount++
- renameCandidate = {
- imported,
- local: specifier.local,
- next: required,
- }
- }
- }
- }
-
- if (requiredCount === 1 && oppositeCount === 0) {
- return { kind: 'ok' }
- }
-
- if (requiredCount === 0 && oppositeCount === 1 && renameCandidate) {
- return {
- kind: 'rename',
- ...renameCandidate,
- }
- }
-
- return { kind: 'normalize' }
-}
-
-function normalizeRouteImports({
- imports,
- source,
- s,
- targetModule,
- required,
- lineEnding,
-}: {
- imports: Array
- source: string
- s: MagicString
- targetModule: string
- required: RouteConstructorName
- lineEnding: '\r\n' | '\n' | '\r'
-}) {
- const owner =
- imports.find((declaration) =>
- hasNamedImport(declaration.named, required),
- ) ?? imports.find((declaration) => !declaration.namespace)
-
- let modified = false
-
- for (const declaration of imports) {
- const named = normalizeNamedImports({
- named: declaration.named,
- required,
- isOwner: declaration === owner,
- })
-
- if (sameNamedImports(declaration.named, named)) {
- continue
- }
-
- const replacement = renderImportDeclaration({
- ...declaration,
- named,
- })
-
- if (replacement === null) {
- s.remove(
- declaration.declaration.start!,
- getRemovalEnd(source, declaration.declaration.end!),
- )
- modified = true
- continue
- }
-
- s.update(
- declaration.declaration.start!,
- declaration.declaration.end!,
- replacement,
- )
- modified = true
- }
-
- if (!owner) {
- const quote = imports[0]?.quote ?? "'"
- const semicolon = imports[0]?.semicolon ?? false
- s.prepend(
- `import { ${required} } from ${quote}${targetModule}${quote}${semicolon ? ';' : ''}${lineEnding}`,
- )
- modified = true
- }
-
- return modified
-}
-
-function normalizeNamedImports({
- named,
- required,
- isOwner,
-}: {
- named: Array
- required: RouteConstructorName
- isOwner: boolean
-}) {
- const banned = getOtherRouteConstructor(required)
- const nextNamed: Array = []
- const seen = new Set()
-
- for (const specifier of named) {
- if (specifier.imported === banned) {
- continue
- }
-
- if (
- specifier.local === required &&
- (specifier.imported !== required || !isOwner)
- ) {
- continue
- }
-
- const key = `${specifier.importKind ?? 'value'}:${specifier.imported}:${specifier.local}`
- if (seen.has(key)) {
- continue
- }
-
- seen.add(key)
- nextNamed.push(specifier)
- }
-
- if (isOwner && !hasNamedImport(nextNamed, required)) {
- nextNamed.push({ imported: required, local: required })
- }
-
- return nextNamed
-}
-
-function getExpectedRouteConstructor(lazy: boolean): RouteConstructorName {
- return lazy ? 'createLazyFileRoute' : 'createFileRoute'
-}
-
-function getOtherRouteConstructor(
- constructor: RouteConstructorName,
-): RouteConstructorName {
- return constructor === 'createFileRoute'
- ? 'createLazyFileRoute'
- : 'createFileRoute'
-}
-
-function hasNamedImport(
- named: Array,
- required: RouteConstructorName,
-) {
- return named.some(
- (specifier) =>
- specifier.imported === required &&
- specifier.local === required &&
- specifier.importKind !== 'type',
- )
-}
-
-function sameNamedImports(left: Array, right: Array) {
- return (
- left.length === right.length &&
- left.every(
- (specifier, index) =>
- specifier.imported === right[index]!.imported &&
- specifier.local === right[index]!.local &&
- specifier.importKind === right[index]!.importKind,
- )
- )
-}
-
-function isRouteConstructorName(value: string): value is RouteConstructorName {
- return routeConstructors.includes(value as RouteConstructorName)
-}
-
-function renderImportDeclaration(importDeclaration: {
- defaultImport?: string
- namespace?: string
- named: Array
- moduleName: string
- quote: '"' | "'"
- semicolon: boolean
-}) {
- const parts: Array = []
-
- if (importDeclaration.defaultImport) {
- parts.push(importDeclaration.defaultImport)
- }
-
- if (importDeclaration.namespace) {
- parts.push(`* as ${importDeclaration.namespace}`)
- }
-
- if (importDeclaration.named.length > 0) {
- parts.push(
- `{ ${importDeclaration.named
- .map(
- (specifier) =>
- `${specifier.importKind === 'type' ? 'type ' : ''}${specifier.imported === specifier.local ? specifier.imported : `${specifier.imported} as ${specifier.local}`}`,
- )
- .join(', ')} }`,
- )
- }
-
- if (parts.length === 0) {
- return null
- }
-
- return `import ${parts.join(', ')} from ${importDeclaration.quote}${importDeclaration.moduleName}${importDeclaration.quote}${importDeclaration.semicolon ? ';' : ''}`
-}
-
-function getLineEnding(source: string): '\r\n' | '\n' | '\r' {
- if (source.includes('\r\n')) {
- return '\r\n'
- }
-
- if (source.includes('\n')) {
- return '\n'
- }
-
- if (source.includes('\r')) {
- return '\r'
- }
-
- return '\n'
-}
-
-function getRemovalEnd(source: string, end: number) {
- let pos = end
- while (pos < source.length && (source[pos] === ' ' || source[pos] === '\t')) {
- pos++
- }
-
- if (source[pos] === '\r' && source[pos + 1] === '\n') {
- return pos + 2
- }
-
- if (source[pos] === '\n' || source[pos] === '\r') {
- return pos + 1
- }
-
- return end
-}
diff --git a/packages/router-generator/src/transform/types.ts b/packages/router-generator/src/transform/types.ts
deleted file mode 100644
index 4a8fecaada..0000000000
--- a/packages/router-generator/src/transform/types.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-import type { RouteNode } from '../types'
-import type { Config } from '../config'
-
-export interface TransformOptions {
- source: string
- filename?: string
- ctx: TransformContext
- node: RouteNode
-}
-
-export type TransformResult =
- | {
- result: 'no-route-export'
- }
- | {
- result: 'not-modified'
- }
- | {
- result: 'modified'
- output: string
- }
- | {
- result: 'error'
- error?: any
- }
-
-export interface TransformContext {
- target: Config['target']
- routeId: string
- lazy: boolean
-}
diff --git a/packages/router-generator/src/types.ts b/packages/router-generator/src/types.ts
index ec0aa226ce..f5db807ec5 100644
--- a/packages/router-generator/src/types.ts
+++ b/packages/router-generator/src/types.ts
@@ -3,6 +3,11 @@ export type RoutePathSegmentMetadata = {
literalTrailingUnderscore?: boolean
}
+/**
+ * A route file (or a file-less virtual route) as the scan of the routes
+ * directory and the virtual route config finds it. The scanners create new
+ * nodes on every scan; the tree model works on its own copies.
+ */
export type RouteNode = {
filePath: string
fullPath: string
@@ -17,7 +22,6 @@ export type RouteNode = {
isVirtual?: boolean
children?: Array
parent?: RouteNode
- createFileRouteProps?: Set
/**
* For virtual routes: the routePath of the explicit parent from virtual config.
* Used to prevent auto-nesting siblings based on path prefix matching (#5822, #5431).
@@ -47,31 +51,81 @@ export type FsRouteType =
| 'errorComponent' // @deprecated
| 'notFoundComponent' // @deprecated
-export type RouteSubNode = {
- component?: RouteNode
- errorComponent?: RouteNode
- notFoundComponent?: RouteNode
- pendingComponent?: RouteNode
- loader?: RouteNode
- lazy?: RouteNode
+export type RoutePieceName =
+ | 'component'
+ | 'errorComponent'
+ | 'notFoundComponent'
+ | 'pendingComponent'
+ | 'loader'
+ | 'lazy'
+
+/**
+ * The option keys of a route file's `createFileRoute(...)({...})` call
+ * (SPEC J1.9). `unknown` is set whenever a key may have been missed (a
+ * spread, a computed key that is not a string, options that are not an
+ * object literal, a route not created by the router's constructor):
+ * consumers must then assume any option may be present.
+ */
+export interface RouteProps {
+ readonly known: ReadonlySet
+ readonly unknown: boolean
}
-export type ImportSpecifier = {
- imported: string
- local?: string
-}
-export type ImportDeclaration = {
- source: string
- specifiers: Array
- importKind?: 'type' | 'value'
+/** A route of the tree model (`TreeModel`), rebuilt on every generation. */
+export interface ModelRoute {
+ /** The route's file route id: the `createFileRoute('…')` argument and the `FileRoutesByPath` key. */
+ readonly routePath: string
+ /** The `id` the router gives the route. */
+ readonly id: string
+ /** The `fullPath` the router gives the route. */
+ readonly fullPath: string
+ /** The `to` the router gives the route. */
+ readonly to: string
+ /** The `id` option the tree passes (relative to the parent). */
+ readonly relativeId: string
+ /** The `path` option the tree passes; undefined for a pathless route. */
+ readonly pathOption: string | undefined
+ /** The path the route types (`FileRoutesByPath` `path`). */
+ readonly typePath: string
+ readonly variableName: string
+ readonly kind: FsRouteType
+ /** Whether the route adds no path segment (pathless layouts, groups). */
+ readonly isNonPath: boolean
+ /** A route the tree creates without a route file (lazy-only or piece-only routes). */
+ readonly isAnchor: boolean
+ /** The route file (absolute path); undefined for an anchor. */
+ readonly file: string | undefined
+ /** The route file relative to the routes directory, as scanned. */
+ readonly filePath: string
+ readonly parent: ModelRoute | undefined
+ readonly children: ReadonlyArray
+ /** Lazily loaded files of the route, by option (absolute paths). */
+ readonly pieces: Readonly>>
+ readonly props: RouteProps | undefined
}
-export type HandleNodeAccumulator = {
- routeTree: Array
- routePiecesByPath: Record
- routeNodes: Array
- /** O(1) lookup by routePath - avoids O(n) .find() on every node */
- routeNodesByPath: Map
+/**
+ * The route tree, as a pure function of the scan and the facts of each route
+ * file. The runtime tree and its types are both printed from it.
+ */
+export interface TreeModel {
+ readonly root: {
+ readonly file: string
+ readonly filePath: string
+ readonly routePath: string
+ readonly pieces: Readonly>>
+ readonly props: RouteProps | undefined
+ }
+ /** Every route but the root, in a deterministic order (parents before children within a depth). */
+ readonly routes: ReadonlyArray
+ /** The root route's children. */
+ readonly children: ReadonlyArray
+ /**
+ * The routes in the order they were attached to the tree: which route a
+ * full path or `to` shared by several routes stands for in the types is
+ * decided in this order.
+ */
+ readonly attachOrder: ReadonlyArray
}
export type GetRoutesByFileMapResultValue = { routeId: string }
diff --git a/packages/router-generator/src/utils.ts b/packages/router-generator/src/utils.ts
index a3bb4b746c..547029f44c 100644
--- a/packages/router-generator/src/utils.ts
+++ b/packages/router-generator/src/utils.ts
@@ -1,14 +1,7 @@
/* eslint-disable @typescript-eslint/prefer-for-of */
-import * as fsp from 'node:fs/promises'
-import path from 'node:path'
-import * as prettier from 'prettier'
import { rootPathId } from './filesystem/physical/rootPathId'
-import type { Config, TokenMatcher } from './config'
-import type {
- ImportDeclaration,
- RouteNode,
- RoutePathSegmentMetadata,
-} from './types'
+import type { TokenMatcher } from './config'
+import type { RouteNode, RoutePathSegmentMetadata } from './types'
/**
* Prefix map for O(1) parent route lookups.
@@ -78,7 +71,7 @@ export class RoutePrefixMap {
}
export function multiSortBy(
- arr: Array,
+ arr: ReadonlyArray