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/