diff --git a/.changeset/rsbuild-manifest-module-chunks-once.md b/.changeset/rsbuild-manifest-module-chunks-once.md
new file mode 100644
index 0000000000..02febd9d84
--- /dev/null
+++ b/.changeset/rsbuild-manifest-module-chunks-once.md
@@ -0,0 +1,5 @@
+---
+'@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
new file mode 100644
index 0000000000..04e8e29928
--- /dev/null
+++ b/.changeset/rsbuild-manifest-own-chunks.md
@@ -0,0 +1,5 @@
+---
+'@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
new file mode 100644
index 0000000000..a84a054fbd
--- /dev/null
+++ b/.changeset/rsbuild-rule-use-falsy-loaders.md
@@ -0,0 +1,5 @@
+---
+'@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
new file mode 100644
index 0000000000..01a0c5ee6e
--- /dev/null
+++ b/.changeset/rsbuild-virtual-modules-build.md
@@ -0,0 +1,5 @@
+---
+'@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
new file mode 100644
index 0000000000..427043a712
--- /dev/null
+++ b/.changeset/rsbuild-virtual-modules-root.md
@@ -0,0 +1,5 @@
+---
+'@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
new file mode 100644
index 0000000000..9c828f13b3
--- /dev/null
+++ b/.changeset/rsc-security-floor.md
@@ -0,0 +1,8 @@
+---
+'@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-server-fn-custom-id-check.md b/.changeset/start-server-fn-custom-id-check.md
new file mode 100644
index 0000000000..384f0ade06
--- /dev/null
+++ b/.changeset/start-server-fn-custom-id-check.md
@@ -0,0 +1,7 @@
+---
+'@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
new file mode 100644
index 0000000000..d4e8221c59
--- /dev/null
+++ b/.changeset/start-vite-root-library-discovery.md
@@ -0,0 +1,5 @@
+---
+'@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/renovate.json b/.github/renovate.json
index 01be1ce5c2..6fd5aa1c86 100644
--- a/.github/renovate.json
+++ b/.github/renovate.json
@@ -21,7 +21,6 @@
"@types/node",
"@types/react",
"@types/react-dom",
- "h3",
"node",
"react",
"react-dom",
diff --git a/.github/workflows/client-nav-benchmarks.yml b/.github/workflows/benchmarks.yml
similarity index 71%
rename from .github/workflows/client-nav-benchmarks.yml
rename to .github/workflows/benchmarks.yml
index 3862ea66dc..d5163e2368 100644
--- a/.github/workflows/client-nav-benchmarks.yml
+++ b/.github/workflows/benchmarks.yml
@@ -22,10 +22,11 @@ on:
- '!packages/**/__tests__/**'
- '!packages/**/*.test.*'
- 'benchmarks/**'
+ - '.nvmrc'
workflow_dispatch:
concurrency:
- group: client-nav-benchmarks-${{ github.ref }}
+ group: benchmarks-${{ github.ref }}
cancel-in-progress: false
queue: single
@@ -62,7 +63,22 @@ jobs:
mode: memory
- benchmark: memory-client
mode: memory
- runs-on: ubuntu-latest
+ # Pinned to ubuntu-24.04 (not ubuntu-latest) because:
+ # - `mode: simulation` (client-nav, ssr) runs under CodSpeed's own valgrind
+ # build, which only exists for specific Ubuntu releases. ubuntu-latest moved
+ # to 26.04 in Nov 2026, and the runner bundled with CodSpeedHQ/action v5.2.1
+ # (runner 5.2.1) fails there with a bare "Unsupported system" error.
+ # `mode: memory` doesn't use valgrind, so only the CPU jobs broke.
+ # - An OS change silently shifts every CodSpeed baseline, so OS upgrades
+ # should be deliberate, not whenever GitHub moves ubuntu-latest.
+ #
+ # Blocker for moving to 26.04 / ubuntu-latest: Ubuntu 26.04 support landed in
+ # CodSpeedHQ/runner v5.7.0, but no CodSpeedHQ/action release bundles it yet
+ # (v5.6.3 ships runner 5.6.3). Check the `.codspeed-runner-version` file at
+ # https://github.com/CodSpeedHQ/action. Once an action release ships runner
+ # >= 5.7.0, bump the action pin below and this `runs-on` in the same PR,
+ # and expect a one-time jump in every baseline.
+ runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml
index 762faa49db..51ffa28e4c 100644
--- a/.github/workflows/bundle-size.yml
+++ b/.github/workflows/bundle-size.yml
@@ -9,12 +9,18 @@ on:
- 'packages/**'
- 'benchmarks/**'
- 'scripts/benchmarks/bundle-size/**'
+ - '.nvmrc'
+ - 'package.json'
+ - 'pnpm-lock.yaml'
push:
branches: [main]
paths:
- 'packages/**'
- 'benchmarks/**'
- 'scripts/benchmarks/bundle-size/**'
+ - '.nvmrc'
+ - 'package.json'
+ - 'pnpm-lock.yaml'
workflow_dispatch:
concurrency:
@@ -103,6 +109,8 @@ jobs:
cat benchmarks/bundle-size/results/pr-comment.md
- name: Upsert Sticky PR Comment
+ # Fork PRs have a read-only GITHUB_TOKEN, so they cannot update comments.
+ if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
diff --git a/.github/workflows/compiler-platforms.yml b/.github/workflows/compiler-platforms.yml
new file mode 100644
index 0000000000..ad70e39bb6
--- /dev/null
+++ b/.github/workflows/compiler-platforms.yml
@@ -0,0 +1,101 @@
+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.
+
+on:
+ pull_request:
+ paths:
+ - 'packages/router-utils/**'
+ - 'packages/router-generator/**'
+ - 'packages/router-plugin/**'
+ - 'packages/start-plugin-core/**'
+ - 'pnpm-lock.yaml'
+ - '.github/workflows/compiler-platforms.yml'
+ schedule:
+ # Weekly, to catch new Yuku releases and runner image updates
+ - cron: '0 6 * * 1'
+ workflow_dispatch:
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.event.number || github.ref }}
+ cancel-in-progress: true
+
+permissions:
+ contents: read
+
+env:
+ NX_DAEMON: 'false'
+ NX_NO_CLOUD: 'true'
+
+defaults:
+ run:
+ shell: bash
+
+jobs:
+ compiler:
+ name: ${{ matrix.name }}
+ runs-on: ${{ matrix.os }}
+ # actions/setup-node only ships glibc builds, so musl uses Alpine's Node image
+ container: ${{ matrix.container }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - name: Windows x64
+ os: windows-latest
+ - name: macOS arm64
+ os: macos-latest
+ - name: Linux arm64
+ os: ubuntu-24.04-arm
+ - name: Linux x64 musl
+ os: ubuntu-latest
+ container: node:24.8.0-alpine3.22@sha256:3e843c608bb5232f39ecb2b25e41214b958b0795914707374c8acc28487dea17
+ steps:
+ - name: Install system packages
+ if: ${{ matrix.container }}
+ shell: sh
+ run: apk add --no-cache bash git
+ - 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
+ run: |
+ git config --global core.autocrlf false
+ git config --global core.eol lf
+ - name: Checkout
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ persist-credentials: false
+ - name: Setup pnpm
+ if: ${{ !matrix.container }}
+ uses: pnpm/action-setup@73e46992e05b19abd31f2f3c20e0e7370d762115 # v6.1.1
+ - name: Setup Node
+ if: ${{ !matrix.container }}
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
+ with:
+ node-version-file: .nvmrc
+ package-manager-cache: false
+ - name: Setup pnpm (container)
+ if: ${{ matrix.container }}
+ run: npm install --global "$(node -p "require('./package.json').packageManager")"
+ - name: Install dependencies
+ run: >-
+ pnpm install --frozen-lockfile
+ --filter .
+ --filter "@tanstack/router-utils..."
+ --filter "@tanstack/router-generator..."
+ --filter "@tanstack/router-plugin..."
+ --filter "@tanstack/start-plugin-core..."
+ --filter "tanstack-react-start-e2e-basic..."
+ - name: Unit tests
+ 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: Production builds
+ run: >-
+ pnpm nx run-many --targets=build:vite:ssr,build:rsbuild:ssr
+ --projects=tanstack-react-start-e2e-basic
+ --skip-nx-cache --outputStyle=static
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index d8c779b170..fde1100409 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -9,6 +9,8 @@ permissions:
jobs:
labeler:
+ # Fork PRs have a read-only GITHUB_TOKEN, so they cannot update labels.
+ if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
runs-on: ubuntu-latest
steps:
- name: Labeller
diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml
index 71026a0a92..ae19b4f0d2 100644
--- a/.github/workflows/pr.yml
+++ b/.github/workflows/pr.yml
@@ -10,6 +10,13 @@ concurrency:
env:
NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
SERVER_PRESET: 'node-server'
+ # Enable dynamic task packing for distributed CI.
+ NX_CLOUD_AGENT_TASK_QUEUE: true
+ NX_CLOUD_AUTO_TASK_PACKING: true
+ NX_CLOUD_AGENT_UNCAPPED_GROUP_WORK: true
+ NX_CLOUD_PACKING_MEM_MULTIPLIER: 1.5
+ NX_CLOUD_BUFFER_TASK_COMPLETIONS: true
+ NX_CLOUD_CONTINUOUS_ASSIGNMENT: true
permissions:
contents: read
@@ -26,8 +33,8 @@ jobs:
with:
fetch-depth: 0
persist-credentials: false
- - name: Start Nx Agents
- run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml"
+ - name: Start Nx Workers
+ run: npx nx-cloud start-workers
- name: Setup Tools
uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main
- name: Get base and head commits for `nx affected`
@@ -36,9 +43,9 @@ jobs:
main-branch-name: main
- name: Run Checks
run: pnpm run test:pr --parallel=3
- - name: Stop Nx Agents
+ - name: Stop Nx Workers
if: ${{ always() }}
- run: npx nx-cloud stop-all-agents
+ run: npx nx-cloud stop-all-workers
preview:
name: Preview
runs-on: ubuntu-latest
diff --git a/.nvmrc b/.nvmrc
index b404027604..63f87c20ef 100644
--- a/.nvmrc
+++ b/.nvmrc
@@ -1 +1 @@
-24.8.0
+26.12.1
diff --git a/.nx/ci-config.yaml b/.nx/ci-config.yaml
new file mode 100644
index 0000000000..2f0783feb4
--- /dev/null
+++ b/.nx/ci-config.yaml
@@ -0,0 +1,5 @@
+dte:
+ distribute-on:
+ small-changeset: 6 linux-medium-js
+ medium-changeset: 12 linux-medium-js
+ large-changeset: 18 linux-medium-js
diff --git a/.nx/workflows/dynamic-changesets.yaml b/.nx/workflows/dynamic-changesets.yaml
deleted file mode 100644
index 39d858d5b2..0000000000
--- a/.nx/workflows/dynamic-changesets.yaml
+++ /dev/null
@@ -1,4 +0,0 @@
-distribute-on:
- small-changeset: 4 linux-medium-js
- medium-changeset: 8 linux-medium-js
- large-changeset: 16 linux-medium-js
diff --git a/.nx/workflows/sandboxing-config.yaml b/.nx/workflows/ultracache-config.yaml
similarity index 88%
rename from .nx/workflows/sandboxing-config.yaml
rename to .nx/workflows/ultracache-config.yaml
index c6f527f6b2..b3ed223621 100644
--- a/.nx/workflows/sandboxing-config.yaml
+++ b/.nx/workflows/ultracache-config.yaml
@@ -1,21 +1,21 @@
-exclude-reads:
+ignore-reads:
- e2e/.gitignore
- '**/src/routeTree.gen.ts'
-exclude-writes:
+ignore-writes:
- '**/src/routeTree.gen.ts'
task-exclusions:
- target: test:build
- exclude-reads:
+ ignore-reads:
- LICENSE
# HMR tests edit these inputs in place and restore their original contents.
# Keep them out of cached outputs so cache replay never overwrites source.
- project: tanstack-react-start-e2e-deferred-hydration
target: test:e2e
- exclude-writes:
+ ignore-writes:
- e2e/react-start/deferred-hydration/src/routes/components.tsx
- project: tanstack-react-start-e2e-hmr
target: test:e2e
- exclude-writes: &hmr-source-writes
+ ignore-writes: &hmr-source-writes
- e2e/react-start/hmr/src/components/AliasedRouteImportChildPanel.tsx
- e2e/react-start/hmr/src/components/AliasedRouteImportParentPanel.tsx
- e2e/react-start/hmr/src/hmr/server-fn-hmr-factory.ts
@@ -32,25 +32,25 @@ task-exclusions:
- e2e/react-start/hmr/src/routes/inputs.tsx
- project: tanstack-react-start-e2e-hmr
target: test:e2e--vite-ssr
- exclude-writes: *hmr-source-writes
+ ignore-writes: *hmr-source-writes
- project: tanstack-react-start-e2e-hmr
target: test:e2e--vite-ssr--bundled-dev
- exclude-writes: *hmr-source-writes
+ ignore-writes: *hmr-source-writes
- project: tanstack-react-start-e2e-hmr
target: test:e2e--rsbuild-ssr
- exclude-writes: *hmr-source-writes
+ ignore-writes: *hmr-source-writes
- project: tanstack-react-start-e2e-rsbuild
target: test:e2e--rsbuild-ssr
- exclude-writes:
+ ignore-writes:
- e2e/react-start/rsbuild/src/routes/index.tsx
- project: tanstack-react-start-e2e-server-functions
target: test:e2e
- exclude-writes:
+ ignore-writes:
- e2e/react-start/server-functions/src/routes/consistent.tsx
# Scaffolding tests deliberately populate tracked empty route fixtures.
- project: '@tanstack/router-generator'
target: test:unit
- exclude-writes:
+ ignore-writes:
- packages/router-generator/tests/generator/custom-scaffolding/routes/__root.tsx
- packages/router-generator/tests/generator/custom-scaffolding/routes/api/bar.tsx
- packages/router-generator/tests/generator/custom-scaffolding/routes/foo.lazy.tsx
@@ -58,67 +58,67 @@ task-exclusions:
# These reads are of scratch files created by the same test invocation.
- project: tanstack-solid-start-e2e-basic-auth
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/solid-start/basic-auth/.tmp/dev.db
- project: tanstack-vue-start-e2e-basic-auth
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/vue-start/basic-auth/.tmp/dev.db
- project: '@tanstack/router-generator'
target: test:unit
- exclude-reads:
+ ignore-reads:
- packages/router-generator/tests/generator/file-modification/routes/[(]test[)]/initiallyEmpty.tsx
- packages/router-generator/tests/generator/file-modification/routes/[(]test[)]/initiallyEmpty.lazy.tsx
# Mutable counters are scratch state, not artifacts to replay from cache.
- project: tanstack-react-start-e2e-basic-tsr-config
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/react-start/basic-tsr-config/count.txt
- exclude-writes:
+ ignore-writes:
- e2e/react-start/basic-tsr-config/count.txt
- project: tanstack-solid-start-e2e-basic-tsr-config
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/solid-start/basic-tsr-config/count.txt
- exclude-writes:
+ ignore-writes:
- e2e/solid-start/basic-tsr-config/count.txt
- project: tanstack-vue-start-e2e-basic-tsr-config
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/vue-start/basic-tsr-config/count.txt
- exclude-writes:
+ ignore-writes:
- e2e/vue-start/basic-tsr-config/count.txt
# Paraglide downloads compiler plugins from the URLs in settings.json.
# Ignore warm-cache reads; the settings remain inputs and cache files outputs.
- project: tanstack-react-start-e2e-i18n-paraglide
target: build
- exclude-reads:
+ ignore-reads:
- e2e/react-start/i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-router-e2e-react-i18n-paraglide
target: build
- exclude-reads:
+ ignore-reads:
- e2e/react-router/i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-react-start-e2e-i18n-paraglide
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/react-start/i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-router-e2e-react-i18n-paraglide
target: test:e2e
- exclude-reads:
+ ignore-reads:
- e2e/react-router/i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-router-i18n-paraglide
target: build
- exclude-reads:
+ ignore-reads:
- examples/react/i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-start-i18n-paraglide
target: build
- exclude-reads:
+ ignore-reads:
- examples/react/start-i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-router-solid-i18n-paraglide
target: build
- exclude-reads:
+ ignore-reads:
- examples/solid/i18n-paraglide/project.inlang/cache/plugins/*
- project: tanstack-solid-start-i18n-paraglide
target: build
- exclude-reads:
+ ignore-reads:
- examples/solid/start-i18n-paraglide/project.inlang/cache/plugins/*
diff --git a/AGENTS.md b/AGENTS.md
index 41d28bbd38..f47b5103e1 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -8,16 +8,19 @@
## Work and validation
- Start bug fixes with a failing regression test that uses only public APIs to reproduce and assert user- or developer-visible behavior. Do not manufacture bugs by mutating internals. Establish whether real usage can reach the failing state before adding runtime handling; simplify handling of states proven unreachable.
+- When removing an API, option, or behavior, delete its tests. Never add tests that assert the removed thing is gone, such as `not.toHaveProperty('oldName')`, a type error for the old call, or a runtime throw.
- For suspected dependency issues, verify the upstream root cause, then propose an upstream fix to the user, including for other `@tanstack/*` packages. **Never implement a workaround in this repository unless the user explicitly authorizes it.**
- During debugging/prototyping, keep fixes aligned with the PR's intended architecture. If making a test pass requires another flag, counter, copied deadline, or duplicate completion authority, stop and consolidate state and ownership. Remove superseded paths instead of accumulating patches and bundle growth.
- Use Node from `.nvmrc` and pnpm from root `package.json`. Install at the root with `CI=1 pnpm install --frozen-lockfile`.
- For sandbox-blocked registry/store access, escalate the same command; report the blocker if unavailable. Do not change stores, delete dependencies/lockfiles, use `--force`/`--ignore-scripts`, or weaken workspace trust/build policies to bypass it.
- Never manually edit `pnpm-lock.yaml` or any `routeTree.gen.ts`. Regenerate the lockfile with `pnpm install --no-frozen-lockfile` after intentional dependency changes; regenerate route trees through app builds/dev servers or the generator fixture harness.
- Always use control-flow braces. Run `pnpm format` before validation.
-- Use Nx: workspace imports consume built packages, so direct runners can test stale dependencies. Inspect resolved targets; some are inferred.
+- Use Nx: workspace imports consume built packages, so direct runners can test stale dependencies. Inspect resolved targets with `pnpm nx show project --json`; some are inferred.
+- Run finite validation through `run-many` with explicit projects and targets, including a single project/target. Nx automatically selects `summary` output when it detects an AI agent: omit `--outputStyle` for normal runs. Read the reported full log files for failures; use `--outputStyle=summary` if agent detection is unavailable.
+- Use `--outputStyle=static` or `pnpm nx run :` only when diagnosing a task and its full output is needed. Continuous/watch targets may use live output.
```sh
-CI=1 NX_DAEMON=false pnpm nx run : --outputStyle=stream --skipRemoteCache
+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.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index ce76a5ba5d..4b6e808af1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -142,6 +142,14 @@ pnpm dev
## AI-assisted contributions
+
+
AI tools can be useful for exploring the codebase, drafting changes, and writing tests. They do not replace the contributor's responsibility for the result.
1. **Keep the contribution in your own voice**. Review and rewrite generated code comments, issue reports, and pull request descriptions so they reflect what you actually mean.
diff --git a/benchmarks/AGENTS.md b/benchmarks/AGENTS.md
index 268e23d9cc..9d56a2411a 100644
--- a/benchmarks/AGENTS.md
+++ b/benchmarks/AGENTS.md
@@ -10,4 +10,6 @@ Read the relevant README before running benchmarks. Compare baseline and candida
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.
+Run `vitest bench` directly only with `--mode benchmark`, as the Nx targets do. Vitest 5 otherwise uses Vite's `test` mode, where vite-plugin-solid injects a jest-dom setup file that benchmark packages cannot resolve.
+
For bundle-size work, follow the full optimization skill required by the root guide. Full API fixtures are maintained manually: when public hooks/components change, update matching `bundle-size/scenarios/*-full/src/routes/__root.tsx` fixtures. Save baseline results separately because each run overwrites `bundle-size/results/current.json`; report final gzip deltas and explain remaining growth.
diff --git a/benchmarks/README.md b/benchmarks/README.md
index 7e9a5f4248..94d2f31802 100644
--- a/benchmarks/README.md
+++ b/benchmarks/README.md
@@ -76,7 +76,7 @@ Node and use `setImmediate` directly.
Dispatch the existing `Benchmarks` workflow against an unchanged branch:
```sh
-gh workflow run client-nav-benchmarks.yml --ref
+gh workflow run benchmarks.yml --ref
```
Wait for each workflow run to finish before dispatching the next repetition at
diff --git a/benchmarks/bundle-size/README.md b/benchmarks/bundle-size/README.md
index b5f7404480..2185d6b43f 100644
--- a/benchmarks/bundle-size/README.md
+++ b/benchmarks/bundle-size/README.md
@@ -42,7 +42,7 @@ pnpm benchmark:bundle-size:run --scenario react-router.minimal,react-router.full
The runner calls `measure.mjs`, which builds the selected package projects through Nx. Full runs build the package projects for all scenarios.
`pnpm benchmark:bundle-size` uses the Nx build cache for the full benchmark, then generates `current.json` with the current commit, branch, dirty status, and report timestamp. CI uses this command as well.
-Nx caches the bundles, `measurements.json`, and `benchmark-action.json`. Git metadata does not affect the build cache. The report preserves the original `measuredAt` and build duration when measurements come from cache; `generatedAt` records when the report was generated. Running `pnpm nx run @benchmarks/bundle-size:build` directly produces only the cacheable outputs; run `node scripts/benchmarks/bundle-size/report.mjs` afterward to refresh `current.json`.
+Nx caches the bundles, `measurements.json`, and `benchmark-action.json`. Git metadata does not affect the build cache. The report preserves the original `measuredAt` and build duration when measurements come from cache; `generatedAt` records when the report was generated. Running `pnpm nx run @benchmarks/bundle-size:measure` directly produces only the cacheable outputs; run `node scripts/benchmarks/bundle-size/report.mjs` afterward to refresh `current.json`.
If the required packages are already built and unchanged, skip that step:
diff --git a/benchmarks/bundle-size/package.json b/benchmarks/bundle-size/package.json
index 283f675e44..ca34cd6cd7 100644
--- a/benchmarks/bundle-size/package.json
+++ b/benchmarks/bundle-size/package.json
@@ -3,12 +3,13 @@
"private": true,
"type": "module",
"scripts": {
- "build": "node ../../scripts/benchmarks/bundle-size/measure.mjs --skip-package-builds --measurements-only",
+ "measure": "node ../../scripts/benchmarks/bundle-size/measure.mjs --skip-package-builds --measurements-only",
"test:unit": "node --test ../../scripts/benchmarks/bundle-size/pr-report.test.mjs ../../scripts/benchmarks/bundle-size/run.test.mjs ../../scripts/benchmarks/bundle-size/report.test.mjs ../../scripts/benchmarks/bundle-size/build.test.mjs ../../scripts/benchmarks/bundle-size/compress.test.mjs ../../scripts/benchmarks/bundle-size/timings.test.mjs"
},
"nx": {
"targets": {
- "build": {
+ "measure": {
+ "cache": true,
"inputs": [
"buildProduction",
"^buildProduction",
@@ -67,7 +68,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
- "@rsbuild/core": "^2.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-plugin": "workspace:^",
"@types/react": "^19.0.8",
diff --git a/benchmarks/client-nav/README.md b/benchmarks/client-nav/README.md
index 67ea50cb4e..ec34ecc0c1 100644
--- a/benchmarks/client-nav/README.md
+++ b/benchmarks/client-nav/README.md
@@ -78,6 +78,7 @@ scenarios follow these navigation/mount conventions:
- Scenarios behave like a real user app: navigation happens through `` clicks dispatched on real anchor elements (unless a scenario specifically measures the imperative API), the router uses the default browser history, and `scrollRestoration` is enabled.
- Each benchmark iteration advances a fixed, circular sequence of steps; every step awaits the router's `onRendered` event, so render work is included and steps cannot overlap. No two consecutive steps may target the same location, and the sequence ends back on the initial route.
- Setup runs one warm-up lap through the sequence and asserts each step's observable output (e.g. `document.title`), so a scenario that silently stops doing its work fails instead of reporting a fast time.
+- Apps are mounted and disposed outside timing by `benchLifecycle` (`benchmarks/cpu-simulation.ts`): CodSpeed measures a single invocation, so every invocation gets a freshly mounted app; plain `vitest bench` keeps one app per warmup/run phase. Bench functions must be `async` functions, because CodSpeed's Vitest 5 provider awaits only `AsyncFunction`s.
- Determinism: no wall-clock timers (async work is resolved promises or counted `setTimeout(0)` hops), `staleTime`/`gcTime` only ever `0` or effectively-infinite, no `Math.random`/`Date.now` in the measured loop. Scroll restoration uses `getScrollRestorationKey: (location) => location.pathname` so its cache stays bounded (the default random per-entry key grows one cache entry per push navigation). The `mount` scenario opts out of `scrollRestoration` entirely and destroys its history on unmount — both register page-lifetime globals that would leak across its mount/unmount loop.
- Push-only step laps grow jsdom's session-history entry list over a run (jsdom never truncates entries behind the current index). Per-push cost stays O(1) so timings are unaffected; only the `history` scenario needs — and has — a lap that is depth-stationary.
- Calibration: pick per-iteration step counts so a bench's `vitest bench` run stays roughly between 8 and 30 seconds (long enough to average out, short enough for CI).
@@ -102,7 +103,7 @@ Run a single scenario app manually (after building it through Nx):
```bash
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav--:build:client --outputStyle=stream --skipRemoteCache
-cd benchmarks/client-nav && NODE_ENV=production vitest bench --config ./scenarios///vite.config.ts
+cd benchmarks/client-nav && NODE_ENV=production vitest bench --mode benchmark --config ./scenarios///vite.config.ts
```
Run framework-specific flame benchmarks (10 second loop, profiled with `@platformatic/flame`, forced to `NODE_ENV=production`):
@@ -178,11 +179,10 @@ task cancellation, and window disposal also run outside measurement. Diagnostic
tests count Link renders or reactive evaluations and check they stop before the
measured region ends; counting is disabled in the timed workload.
-CodSpeed uses suite `beforeEach`/`afterEach` hooks. Ordinary Vitest instead
-installs Tinybench's public Task iteration hooks from its stage-level `setup`.
-Using only stage-level setup would let later iterations reuse an already
-hydrated document. The hydration unit tests cover fresh-state setup through
-both paths.
+The bench's own `beforeEach`/`afterEach` hooks prepare and dispose every
+sample outside timing, in both CodSpeed and ordinary Vitest runs. Per-phase
+setup would let later iterations reuse an already hydrated document. The
+hydration unit tests cover repeated fresh-state setup.
Each scenario is included in its framework's aggregate build and CodSpeed run.
Land the benchmark independently to establish main's baseline before comparing a
@@ -196,7 +196,7 @@ construction. `scenarios/mount` includes construction but also rendering and
loading. To isolate initialization, use the core construction benchmark:
```bash
-CI=1 NX_DAEMON=false pnpm nx run @tanstack/router-core:test:unit --outputStyle=stream --skipRemoteCache -- bench tests/route-tree-construction.bench.ts --run --testNamePattern=1000.routes --outputJson /tmp/route-tree-construction.json
+CI=1 NX_DAEMON=false pnpm nx run @tanstack/router-core:test:unit --outputStyle=stream --skipRemoteCache -- bench tests/route-tree-construction.bench.ts --run --testNamePattern=1000.routes --reporter=json --outputFile=/tmp/route-tree-construction.json
```
It covers 100, 1,000, and 10,000 static, dynamic, nested, or mixed routes.
@@ -220,7 +220,7 @@ CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:cl
CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:ssr --outputStyle=stream --skipRemoteCache -- --run
# Select a feature and save the normal Vitest JSON report.
-CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:client --outputStyle=stream --skipRemoteCache -- --run -t "updater|optional|splat" --outputJson /tmp/link-perf.json
+CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:client --outputStyle=stream --skipRemoteCache -- --run -t "updater|optional|splat" --reporter=json --outputFile=/tmp/link-perf.json
```
The cases cover repeated versus unique destination params, updater functions,
diff --git a/benchmarks/client-nav/link-performance/client.bench.ts b/benchmarks/client-nav/link-performance/client.bench.ts
index 086fadd161..f819fab52b 100644
--- a/benchmarks/client-nav/link-performance/client.bench.ts
+++ b/benchmarks/client-nav/link-performance/client.bench.ts
@@ -1,4 +1,5 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../cpu-simulation'
import { LINK_CASES } from './cases'
import { createClientScenario, samplingOptions } from './scenario'
import type * as App from './src/client'
@@ -10,7 +11,7 @@ if (app.serverEnvironment !== false) {
}
for (const { id, label } of LINK_CASES) {
- describe(label, () => {
+ test(label, async ({ bench }) => {
const scenario = createClientScenario(app, id)
function finish() {
try {
@@ -19,13 +20,11 @@ for (const { id, label } of LINK_CASES) {
scenario.teardown()
}
}
- beforeEach(scenario.setup)
- afterEach(finish)
- bench(`client Links: ${id}`, scenario.batch, {
- ...samplingOptions,
- setup: scenario.setup,
- teardown: finish,
- })
+ await bench(
+ `client Links: ${id}`,
+ benchLifecycle({ before: scenario.setup, after: finish }),
+ scenario.batch,
+ ).run(samplingOptions)
})
}
diff --git a/benchmarks/client-nav/link-performance/project.json b/benchmarks/client-nav/link-performance/project.json
index 899f013818..fd1751c081 100644
--- a/benchmarks/client-nav/link-performance/project.json
+++ b/benchmarks/client-nav/link-performance/project.json
@@ -36,7 +36,7 @@
"cache": false,
"dependsOn": ["build:client"],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./link-performance/vite.client.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./link-performance/vite.client.config.ts",
"cwd": "benchmarks/client-nav"
}
},
@@ -45,7 +45,7 @@
"cache": false,
"dependsOn": ["build:ssr"],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./link-performance/vite.ssr.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./link-performance/vite.ssr.config.ts",
"cwd": "benchmarks/client-nav"
}
},
diff --git a/benchmarks/client-nav/link-performance/ssr.bench.ts b/benchmarks/client-nav/link-performance/ssr.bench.ts
index 2a4b431292..c30084e510 100644
--- a/benchmarks/client-nav/link-performance/ssr.bench.ts
+++ b/benchmarks/client-nav/link-performance/ssr.bench.ts
@@ -1,4 +1,5 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../cpu-simulation'
import { LINK_CASES } from './cases'
import { createSsrScenario, samplingOptions } from './scenario'
import type * as App from './src/ssr'
@@ -10,7 +11,7 @@ if (app.serverEnvironment !== true) {
}
for (const { id, label } of LINK_CASES) {
- describe(label, () => {
+ test(label, async ({ bench }) => {
const scenario = createSsrScenario(app, id)
function finish() {
try {
@@ -19,13 +20,11 @@ for (const { id, label } of LINK_CASES) {
scenario.teardown()
}
}
- beforeEach(scenario.setup)
- afterEach(finish)
- bench(`SSR Links: ${id}`, scenario.batch, {
- ...samplingOptions,
- setup: scenario.setup,
- teardown: finish,
- })
+ await bench(
+ `SSR Links: ${id}`,
+ benchLifecycle({ before: scenario.setup, after: finish }),
+ scenario.batch,
+ ).run(samplingOptions)
})
}
diff --git a/benchmarks/client-nav/package.json b/benchmarks/client-nav/package.json
index bc2eb66c4c..1f878adc67 100644
--- a/benchmarks/client-nav/package.json
+++ b/benchmarks/client-nav/package.json
@@ -9,10 +9,10 @@
"test:flame:react": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./react/speed.flame.ts",
"test:flame:solid": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./solid/speed.flame.ts",
"test:flame:vue": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./vue/speed.flame.ts",
- "test:perf": "NODE_ENV=production vitest bench --config ./vitest.config.ts",
- "test:perf:react": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
- "test:perf:solid": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
- "test:perf:vue": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "test:perf": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.config.ts",
+ "test:perf:react": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
+ "test:perf:solid": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
+ "test:perf:vue": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"test:types": "pnpm run test:types:react && pnpm run test:types:solid && pnpm run test:types:vue",
"test:types:react": "tsc -p ./react/tsconfig.json --noEmit",
"test:types:solid": "tsc -p ./solid/tsconfig.json --noEmit",
@@ -31,7 +31,7 @@
},
"devDependencies": {
"@platformatic/flame": "^1.6.0",
- "@codspeed/vitest-plugin": "^5.7.1",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@tanstack/router-plugin": "workspace:^",
"@testing-library/react": "^16.2.0",
"@vitejs/plugin-react": "^6.0.1",
diff --git a/benchmarks/client-nav/react/speed.bench.ts b/benchmarks/client-nav/react/speed.bench.ts
index fcc15b5fbc..944f182734 100644
--- a/benchmarks/client-nav/react/speed.bench.ts
+++ b/benchmarks/client-nav/react/speed.bench.ts
@@ -1,34 +1,19 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-nav', () => {
- const test = setup()
+test('client-nav', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores "suite hooks" like `beforeAll` and `afterAll`,
- * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.
- *
- * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,
- * but it does support `beforeAll` and `afterAll`.
- *
- * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.
- */
-
- beforeAll(test.before)
- afterAll(test.after)
-
- bench(
+ await bench(
'client-side navigation loop (react)',
+ { beforeAll: scenario.before, afterAll: scenario.after },
async () => {
for (let i = 0; i < 10; i++) {
- await test.tick()
+ await scenario.tick()
}
},
- {
- warmupIterations: 100,
- time: 10_000,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ })
})
diff --git a/benchmarks/client-nav/react/vite.config.ts b/benchmarks/client-nav/react/vite.config.ts
index ea85a49a21..7df3f80e71 100644
--- a/benchmarks/client-nav/react/vite.config.ts
+++ b/benchmarks/client-nav/react/vite.config.ts
@@ -34,5 +34,6 @@ export default defineConfig({
watch: false,
environment: 'jsdom',
setupFiles: [`${rootDir}vitest.setup.ts`],
+ benchmark: { include: ['react/speed.bench.ts'] },
},
})
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
index c3f4c5231c..65dab0781e 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-async-pipeline', () => {
- const test = setup()
+test('client-async-pipeline', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-async-pipeline navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
index 96082e9963..acef710469 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-async-pipeline', () => {
- const test = setup()
+test('client-async-pipeline', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-async-pipeline navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 7c15baf4e9..27b9498b11 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 NestedRouteImport } from './routes/nested'
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 NestedRouteImport } from './routes/nested'
import { Route as CtxIdRouteImport } from './routes/ctx.$id'
+import { Route as NestedIdRouteImport } from './routes/nested.$id'
+import { Route as SlowIdRouteImport } from './routes/slow.$id'
-const NestedRoute = NestedRouteImport.update({
- id: '/nested',
- path: '/nested',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const SlowIdRoute = SlowIdRouteImport.update({
- id: '/slow/$id',
- path: '/slow/$id',
+const NestedRoute = NestedRouteImport.update({
+ id: '/nested',
+ path: '/nested',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const CtxIdRoute = CtxIdRouteImport.update({
+ id: '/ctx/$id',
+ path: '/ctx/$id',
getParentRoute: () => rootRouteImport,
} as any)
const NestedIdRoute = NestedIdRouteImport.update({
@@ -35,9 +35,9 @@ const NestedIdRoute = NestedIdRouteImport.update({
path: '/$id',
getParentRoute: () => NestedRoute,
} as any)
-const CtxIdRoute = CtxIdRouteImport.update({
- id: '/ctx/$id',
- path: '/ctx/$id',
+const SlowIdRoute = SlowIdRouteImport.update({
+ id: '/slow/$id',
+ path: '/slow/$id',
getParentRoute: () => rootRouteImport,
} as any)
@@ -80,13 +80,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/nested': {
- id: '/nested'
- path: '/nested'
- fullPath: '/nested'
- preLoaderRoute: typeof NestedRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -94,11 +87,18 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/slow/$id': {
- id: '/slow/$id'
- path: '/slow/$id'
- fullPath: '/slow/$id'
- preLoaderRoute: typeof SlowIdRouteImport
+ '/nested': {
+ id: '/nested'
+ path: '/nested'
+ fullPath: '/nested'
+ preLoaderRoute: typeof NestedRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/ctx/$id': {
+ id: '/ctx/$id'
+ path: '/ctx/$id'
+ fullPath: '/ctx/$id'
+ preLoaderRoute: typeof CtxIdRouteImport
parentRoute: typeof rootRouteImport
}
'/nested/$id': {
@@ -108,11 +108,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof NestedIdRouteImport
parentRoute: typeof NestedRoute
}
- '/ctx/$id': {
- id: '/ctx/$id'
- path: '/ctx/$id'
- fullPath: '/ctx/$id'
- preLoaderRoute: typeof CtxIdRouteImport
+ '/slow/$id': {
+ id: '/slow/$id'
+ path: '/slow/$id'
+ fullPath: '/slow/$id'
+ preLoaderRoute: typeof SlowIdRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
index 193a3837df..f0fd3e58df 100644
--- a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-async-pipeline', () => {
- const test = setup()
+test('client-async-pipeline', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-async-pipeline navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
index 7f1153021f..d6f2190be7 100644
--- a/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-control-flow', () => {
- const test = setup()
+test('client-control-flow', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-control-flow navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
index a88093ca52..d803d2a313 100644
--- a/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-control-flow', () => {
- const test = setup()
+test('client-control-flow', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-control-flow navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 44d88e9f8d..cd84f99d5d 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 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 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 MissingIdRouteImport } from './routes/missing.$id'
-const TargetRoute = TargetRouteImport.update({
- id: '/target',
- path: '/target',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop2Route = Hop2RouteImport.update({
- id: '/hop2',
- path: '/hop2',
- getParentRoute: () => rootRouteImport,
-} as any)
-const Hop1Route = Hop1RouteImport.update({
- id: '/hop1',
- path: '/hop1',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const BrokenRoute = BrokenRouteImport.update({
@@ -36,9 +26,19 @@ const BrokenRoute = BrokenRouteImport.update({
path: '/broken',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const Hop1Route = Hop1RouteImport.update({
+ id: '/hop1',
+ path: '/hop1',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const Hop2Route = Hop2RouteImport.update({
+ id: '/hop2',
+ path: '/hop2',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const TargetRoute = TargetRouteImport.update({
+ id: '/target',
+ path: '/target',
getParentRoute: () => rootRouteImport,
} as any)
const MissingIdRoute = MissingIdRouteImport.update({
@@ -98,25 +98,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/target': {
- id: '/target'
- path: '/target'
- fullPath: '/target'
- preLoaderRoute: typeof TargetRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop2': {
- id: '/hop2'
- path: '/hop2'
- fullPath: '/hop2'
- preLoaderRoute: typeof Hop2RouteImport
- parentRoute: typeof rootRouteImport
- }
- '/hop1': {
- id: '/hop1'
- path: '/hop1'
- fullPath: '/hop1'
- preLoaderRoute: typeof Hop1RouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/broken': {
@@ -126,11 +112,25 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof BrokenRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/hop1': {
+ id: '/hop1'
+ path: '/hop1'
+ fullPath: '/hop1'
+ preLoaderRoute: typeof Hop1RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/hop2': {
+ id: '/hop2'
+ path: '/hop2'
+ fullPath: '/hop2'
+ preLoaderRoute: typeof Hop2RouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/target': {
+ id: '/target'
+ path: '/target'
+ fullPath: '/target'
+ preLoaderRoute: typeof TargetRouteImport
parentRoute: typeof rootRouteImport
}
'/missing/$id': {
diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
index 9a335cfb87..8a019945c7 100644
--- a/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-control-flow', () => {
- const test = setup()
+test('client-control-flow', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-control-flow navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/head/react/speed.bench.ts b/benchmarks/client-nav/scenarios/head/react/speed.bench.ts
index 97c76a1a11..d0d731a09f 100644
--- a/benchmarks/client-nav/scenarios/head/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/head/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-head', () => {
- const test = setup()
+test('client-head', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-head navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
index 075e7673de..ca156c950b 100644
--- a/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-head', () => {
- const test = setup()
+test('client-head', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-head navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 ead6a4436a..b6f217e527 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 SettingsRouteImport } from './routes/settings'
-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 DocsRouteImport } from './routes/docs'
+import { Route as SettingsRouteImport } from './routes/settings'
import { Route as ArticlesIdRouteImport } from './routes/articles.$id'
+import { Route as DocsSectionRouteImport } from './routes/docs.$section'
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const DocsRoute = DocsRouteImport.update({
@@ -25,9 +25,14 @@ const DocsRoute = DocsRouteImport.update({
path: '/docs',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ArticlesIdRoute = ArticlesIdRouteImport.update({
+ id: '/articles/$id',
+ path: '/articles/$id',
getParentRoute: () => rootRouteImport,
} as any)
const DocsSectionRoute = DocsSectionRouteImport.update({
@@ -35,11 +40,6 @@ 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 {
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/docs': {
@@ -100,11 +100,18 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof DocsRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/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
parentRoute: typeof rootRouteImport
}
'/docs/$section': {
@@ -114,13 +121,6 @@ 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/head/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
index 7080b4ea7d..d188a9dd7a 100644
--- a/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-head', () => {
- const test = setup()
+test('client-head', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-head navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/history/react/speed.bench.ts b/benchmarks/client-nav/scenarios/history/react/speed.bench.ts
index 9192258b66..6ec7031857 100644
--- a/benchmarks/client-nav/scenarios/history/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/history/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-history', () => {
- const test = setup()
+test('client-history', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-history navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
index d7f4fd898d..56af035b2b 100644
--- a/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-history', () => {
- const test = setup()
+test('client-history', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-history navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 a6ab2a4fc8..af253f4a15 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 GalleryRouteImport } from './routes/gallery'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
+import { Route as GalleryRouteImport } from './routes/gallery'
import { Route as PagesNRouteImport } from './routes/pages.$n'
+import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId'
-const GalleryRoute = GalleryRouteImport.update({
- id: '/gallery',
- path: '/gallery',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
- id: '/photos/$photoId',
- path: '/photos/$photoId',
+const GalleryRoute = GalleryRouteImport.update({
+ id: '/gallery',
+ path: '/gallery',
getParentRoute: () => rootRouteImport,
} as any)
const PagesNRoute = PagesNRouteImport.update({
@@ -34,6 +29,11 @@ const PagesNRoute = PagesNRouteImport.update({
path: '/pages/$n',
getParentRoute: () => rootRouteImport,
} as any)
+const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({
+ id: '/photos/$photoId',
+ path: '/photos/$photoId',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/gallery': {
- id: '/gallery'
- path: '/gallery'
- fullPath: '/gallery'
- preLoaderRoute: typeof GalleryRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -85,11 +78,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/photos/$photoId': {
- id: '/photos/$photoId'
- path: '/photos/$photoId'
- fullPath: '/photos/$photoId'
- preLoaderRoute: typeof PhotosPhotoIdRouteImport
+ '/gallery': {
+ id: '/gallery'
+ path: '/gallery'
+ fullPath: '/gallery'
+ preLoaderRoute: typeof GalleryRouteImport
parentRoute: typeof rootRouteImport
}
'/pages/$n': {
@@ -99,6 +92,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof PagesNRouteImport
parentRoute: typeof rootRouteImport
}
+ '/photos/$photoId': {
+ id: '/photos/$photoId'
+ path: '/photos/$photoId'
+ fullPath: '/photos/$photoId'
+ preLoaderRoute: typeof PhotosPhotoIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
index a378e45ac5..3d36ac4cfa 100644
--- a/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-history', () => {
- const test = setup()
+test('client-history', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-history navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts b/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts
index 4217b66af0..7e466cbaed 100644
--- a/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts
+++ b/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts
@@ -36,23 +36,6 @@ test('restores data and context into fresh DOMs and includes follow-up renders',
expect(schedulerTasks.size).toBe(1)
})
-test('installs per-iteration preparation for the ordinary Vitest runner', async () => {
- const scenario = setup()
- const task: Parameters[0] = {
- opts: {},
- }
- scenario.installIterationHooks(task)
- for (let iteration = 0; iteration < 2; iteration++) {
- await task.opts.beforeEach!()
- try {
- expect(scenario.snapshot().diagnostics.mounted).toBe(false)
- await scenario.run()
- } finally {
- await task.opts.afterEach!()
- }
- }
-})
-
test('rejects an empty measurement and still releases its sample', async () => {
const scenario = setup()
await scenario.before()
diff --git a/benchmarks/client-nav/scenarios/hydration/react/project.json b/benchmarks/client-nav/scenarios/hydration/react/project.json
index ece8f2de66..ca23838c0f 100644
--- a/benchmarks/client-nav/scenarios/hydration/react/project.json
+++ b/benchmarks/client-nav/scenarios/hydration/react/project.json
@@ -25,7 +25,7 @@
"cache": false,
"dependsOn": ["build:client"],
"options": {
- "command": "NODE_ENV=production vitest bench --run --config ./scenarios/hydration/react/vite.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --run --config ./scenarios/hydration/react/vite.config.ts",
"cwd": "benchmarks/client-nav"
}
},
diff --git a/benchmarks/client-nav/scenarios/hydration/react/setup.ts b/benchmarks/client-nav/scenarios/hydration/react/setup.ts
index 8a6aa3286f..7c588af3fd 100644
--- a/benchmarks/client-nav/scenarios/hydration/react/setup.ts
+++ b/benchmarks/client-nav/scenarios/hydration/react/setup.ts
@@ -9,13 +9,6 @@ import type { FixtureArtifact } from './fixture'
import type * as Client from './src/client'
type ClientApp = typeof Client
-type TaskHooks = {
- opts: {
- beforeEach?: () => void | Promise
- afterEach?: () => void | Promise
- }
-}
-
const turn = () => new Promise((resolve) => setImmediate(resolve))
// React's scheduler ends a time slice once performance.now() has advanced 5 ms.
@@ -319,11 +312,5 @@ export function setup({ countRenders = false } = {}) {
after,
snapshot,
schedulerTasks,
- // Vitest passes setup to the Tinybench Bench, where it runs once per
- // warmup/run stage. Install the Task's public per-iteration hooks there.
- installIterationHooks(task: TaskHooks) {
- task.opts.beforeEach = before
- task.opts.afterEach = after
- },
}
}
diff --git a/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts b/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts
index 6f6142b9de..643877760e 100644
--- a/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts
@@ -1,23 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-hydration', () => {
+test('client-hydration', async ({ bench }) => {
const scenario = setup()
- // CodSpeed uses suite hooks; ordinary Vitest uses the Tinybench Task hooks
- // installed below. Both prepare and dispose every sample outside timing.
- beforeEach(scenario.before)
- afterEach(scenario.after)
- bench(
+
+ await bench(
'hydrate restored route state and mixed Links (react)',
+ { beforeEach: scenario.before, afterEach: scenario.after },
async () => {
await scenario.run()
},
- {
- setup: scenario.installIterationHooks,
- time: 5000,
- warmupTime: 1000,
- warmupIterations: 20,
- throws: true,
- },
- )
+ ).run({
+ time: 5000,
+ warmupTime: 1000,
+ warmupIterations: 20,
+ throws: true,
+ })
})
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts b/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts
index ca519d98bb..4e5f3208ca 100644
--- a/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts
+++ b/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts
@@ -50,21 +50,17 @@ test('restores fresh DOMs and route state and completes hash-link reactivity', a
}
})
-test('installs per-iteration preparation for the ordinary Vitest runner', async () => {
+test('prepares every sample without counting diagnostics', async () => {
const scenario = setup()
- const task: Parameters[0] = {
- opts: {},
- }
- scenario.installIterationHooks(task)
for (let iteration = 0; iteration < 2; iteration++) {
- await task.opts.beforeEach!()
+ await scenario.before()
try {
expect(scenario.snapshot().diagnostics.mounted).toBe(false)
expect(scenario.snapshot().diagnostics.clicks).toBe(0)
await scenario.run()
expect(scenario.snapshot().diagnostics.hashEvaluations).toBe(0)
} finally {
- await task.opts.afterEach!()
+ await scenario.after()
}
}
})
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/project.json b/benchmarks/client-nav/scenarios/hydration/solid/project.json
index 978fdc6bf7..1fa162771b 100644
--- a/benchmarks/client-nav/scenarios/hydration/solid/project.json
+++ b/benchmarks/client-nav/scenarios/hydration/solid/project.json
@@ -25,7 +25,7 @@
"cache": false,
"dependsOn": ["build:client"],
"options": {
- "command": "NODE_ENV=production vitest bench --run --config ./scenarios/hydration/solid/vite.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --run --config ./scenarios/hydration/solid/vite.config.ts",
"cwd": "benchmarks/client-nav"
}
},
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/setup.ts b/benchmarks/client-nav/scenarios/hydration/solid/setup.ts
index 29a86d6743..ebdbc8e9b2 100644
--- a/benchmarks/client-nav/scenarios/hydration/solid/setup.ts
+++ b/benchmarks/client-nav/scenarios/hydration/solid/setup.ts
@@ -8,13 +8,6 @@ import type { FixtureArtifact } from './fixture'
import type * as Client from './src/client'
type ClientApp = typeof Client
-type TaskHooks = {
- opts: {
- beforeEach?: () => void | Promise
- afterEach?: () => void | Promise
- }
-}
-
const turn = () => new Promise((resolve) => setImmediate(resolve))
const maxSettleTurns = 100
@@ -329,11 +322,5 @@ export function setup({ countUpdates = false } = {}) {
run,
after,
snapshot,
- // Vitest's Bench setup runs once per warmup/run stage. Install Tinybench's
- // public Task hooks to prepare and dispose outside every measured call.
- installIterationHooks(task: TaskHooks) {
- task.opts.beforeEach = before
- task.opts.afterEach = after
- },
}
}
diff --git a/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts
index 1f91ec00f3..b386cb8215 100644
--- a/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts
@@ -1,23 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-hydration', () => {
+test('client-hydration', async ({ bench }) => {
const scenario = setup()
- // CodSpeed uses suite hooks; ordinary Vitest uses the Tinybench Task hooks
- // installed below. Both prepare and dispose every sample outside timing.
- beforeEach(scenario.before)
- afterEach(scenario.after)
- bench(
+
+ await bench(
'hydrate restored route state and mixed Links (solid)',
+ { beforeEach: scenario.before, afterEach: scenario.after },
async () => {
await scenario.run()
},
- {
- setup: scenario.installIterationHooks,
- time: 5000,
- warmupTime: 1000,
- warmupIterations: 20,
- throws: true,
- },
- )
+ ).run({
+ time: 5000,
+ warmupTime: 1000,
+ warmupIterations: 20,
+ throws: true,
+ })
})
diff --git a/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts
index 05197319b8..ca0b370528 100644
--- a/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-link-churn', () => {
- const test = setup()
+test('client-link-churn', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-link-churn navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts
index 9efdb6e3f8..80c4aaa6fd 100644
--- a/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-link-churn', () => {
- const test = setup()
+test('client-link-churn', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-link-churn navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts
index 4fbbaf4ca0..dea511c24c 100644
--- a/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-link-churn', () => {
- const test = setup()
+test('client-link-churn', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-link-churn navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/links/react/speed.bench.ts b/benchmarks/client-nav/scenarios/links/react/speed.bench.ts
index 0892308901..75f5f725d4 100644
--- a/benchmarks/client-nav/scenarios/links/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/links/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-links', () => {
- const test = setup()
+test('client-links', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-links navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
index a3d690b423..fc7f3e71e7 100644
--- a/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-links', () => {
- const test = setup()
+test('client-links', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-links navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 b61431e40d..0da70513e8 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 AboutRouteImport } from './routes/about'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as AboutRouteImport } from './routes/about'
import { Route as ItemsIdRouteImport } from './routes/items.$id'
-const AboutRoute = AboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const AboutRoute = AboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ 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 {
- '/about': {
- id: '/about'
- path: '/about'
- fullPath: '/about'
- preLoaderRoute: typeof AboutRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/about': {
+ id: '/about'
+ path: '/about'
+ fullPath: '/about'
+ preLoaderRoute: typeof AboutRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/items/$id': {
id: '/items/$id'
path: '/items/$id'
diff --git a/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
index e2d3f7c47a..2ace7a8409 100644
--- a/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-links', () => {
- const test = setup()
+test('client-links', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-links navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
index f5a51b29be..8bcc53b88e 100644
--- a/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-loaders', () => {
- const test = setup()
+test('client-loaders', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-loaders navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
index 9f3bd397db..953a17b31a 100644
--- a/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-loaders', () => {
- const test = setup()
+test('client-loaders', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-loaders navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 bdec400237..fa5d032141 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 DepsRouteImport } from './routes/deps'
import { Route as IndexRouteImport } from './routes/index'
-import { Route as FreshIdRouteImport } from './routes/fresh.$id'
+import { Route as DepsRouteImport } from './routes/deps'
import { Route as CachedIdRouteImport } from './routes/cached.$id'
+import { Route as FreshIdRouteImport } from './routes/fresh.$id'
-const DepsRoute = DepsRouteImport.update({
- id: '/deps',
- path: '/deps',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const FreshIdRoute = FreshIdRouteImport.update({
- id: '/fresh/$id',
- path: '/fresh/$id',
+const DepsRoute = DepsRouteImport.update({
+ id: '/deps',
+ path: '/deps',
getParentRoute: () => rootRouteImport,
} as any)
const CachedIdRoute = CachedIdRouteImport.update({
@@ -34,6 +29,11 @@ const CachedIdRoute = CachedIdRouteImport.update({
path: '/cached/$id',
getParentRoute: () => rootRouteImport,
} as any)
+const FreshIdRoute = FreshIdRouteImport.update({
+ id: '/fresh/$id',
+ path: '/fresh/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -71,13 +71,6 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/deps': {
- id: '/deps'
- path: '/deps'
- fullPath: '/deps'
- preLoaderRoute: typeof DepsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -85,11 +78,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/fresh/$id': {
- id: '/fresh/$id'
- path: '/fresh/$id'
- fullPath: '/fresh/$id'
- preLoaderRoute: typeof FreshIdRouteImport
+ '/deps': {
+ id: '/deps'
+ path: '/deps'
+ fullPath: '/deps'
+ preLoaderRoute: typeof DepsRouteImport
parentRoute: typeof rootRouteImport
}
'/cached/$id': {
@@ -99,6 +92,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof CachedIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/fresh/$id': {
+ id: '/fresh/$id'
+ path: '/fresh/$id'
+ fullPath: '/fresh/$id'
+ preLoaderRoute: typeof FreshIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
index 819fe020b0..1ae2f89a56 100644
--- a/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-loaders', () => {
- const test = setup()
+test('client-loaders', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-loaders navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
index 2d675ff259..6c3a64b026 100644
--- a/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-mount', () => {
- const test = setup()
+test('client-mount', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-mount loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
index eaf7f1ed34..236f875f57 100644
--- a/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-mount', () => {
- const test = setup()
+test('client-mount', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-mount loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 dc0acc183d..30247636dd 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 ShopRouteImport } from './routes/shop'
-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 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 ShopProductIdRouteImport } from './routes/shop.$productId'
import { Route as BlogSlugRouteImport } from './routes/blog.$slug'
+import { Route as ShopIndexRouteImport } from './routes/shop.index'
+import { Route as ShopProductIdRouteImport } from './routes/shop.$productId'
-const ShopRoute = ShopRouteImport.update({
- id: '/shop',
- path: '/shop',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SettingsRoute = SettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SearchRoute = SearchRouteImport.update({
- id: '/search',
- path: '/search',
- getParentRoute: () => rootRouteImport,
-} as any)
-const BlogRoute = BlogRouteImport.update({
- id: '/blog',
- path: '/blog',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const AboutRoute = AboutRouteImport.update({
@@ -45,31 +30,46 @@ const AboutRoute = AboutRouteImport.update({
path: '/about',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const BlogRoute = BlogRouteImport.update({
+ id: '/blog',
+ path: '/blog',
getParentRoute: () => rootRouteImport,
} as any)
-const ShopIndexRoute = ShopIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => ShopRoute,
+const SearchRoute = SearchRouteImport.update({
+ id: '/search',
+ path: '/search',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const SettingsRoute = SettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ShopRoute = ShopRouteImport.update({
+ id: '/shop',
+ path: '/shop',
+ getParentRoute: () => rootRouteImport,
} 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)
+const ShopIndexRoute = ShopIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => ShopRoute,
+} as any)
+const ShopProductIdRoute = ShopProductIdRouteImport.update({
+ id: '/$productId',
+ path: '/$productId',
+ getParentRoute: () => ShopRoute,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -154,32 +154,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/shop': {
- id: '/shop'
- path: '/shop'
- fullPath: '/shop'
- preLoaderRoute: typeof ShopRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/settings': {
- id: '/settings'
- path: '/settings'
- fullPath: '/settings'
- preLoaderRoute: typeof SettingsRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/search': {
- id: '/search'
- path: '/search'
- fullPath: '/search'
- preLoaderRoute: typeof SearchRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/blog': {
- id: '/blog'
- path: '/blog'
- fullPath: '/blog'
- preLoaderRoute: typeof BlogRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/about': {
@@ -189,19 +168,33 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof AboutRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/blog': {
+ id: '/blog'
+ path: '/blog'
+ fullPath: '/blog'
+ preLoaderRoute: typeof BlogRouteImport
parentRoute: typeof rootRouteImport
}
- '/shop/': {
- id: '/shop/'
- path: '/'
- fullPath: '/shop/'
- preLoaderRoute: typeof ShopIndexRouteImport
- parentRoute: typeof ShopRoute
+ '/search': {
+ id: '/search'
+ path: '/search'
+ fullPath: '/search'
+ preLoaderRoute: typeof SearchRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/settings': {
+ id: '/settings'
+ path: '/settings'
+ fullPath: '/settings'
+ preLoaderRoute: typeof SettingsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/shop': {
+ id: '/shop'
+ path: '/shop'
+ fullPath: '/shop'
+ preLoaderRoute: typeof ShopRouteImport
+ parentRoute: typeof rootRouteImport
}
'/blog/': {
id: '/blog/'
@@ -210,13 +203,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof BlogIndexRouteImport
parentRoute: typeof BlogRoute
}
- '/shop/$productId': {
- id: '/shop/$productId'
- path: '/$productId'
- fullPath: '/shop/$productId'
- preLoaderRoute: typeof ShopProductIdRouteImport
- parentRoute: typeof ShopRoute
- }
'/blog/$slug': {
id: '/blog/$slug'
path: '/$slug'
@@ -224,6 +210,20 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof BlogSlugRouteImport
parentRoute: typeof BlogRoute
}
+ '/shop/': {
+ id: '/shop/'
+ path: '/'
+ fullPath: '/shop/'
+ preLoaderRoute: typeof ShopIndexRouteImport
+ parentRoute: typeof ShopRoute
+ }
+ '/shop/$productId': {
+ id: '/shop/$productId'
+ path: '/$productId'
+ fullPath: '/shop/$productId'
+ preLoaderRoute: typeof ShopProductIdRouteImport
+ parentRoute: typeof ShopRoute
+ }
}
}
diff --git a/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
index f5538dd49c..d9268ba91b 100644
--- a/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts
@@ -1,32 +1,15 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-mount', () => {
- const test = setup()
+test('client-mount', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
- 'client-mount loop (vue)',
- async () => {
- for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
- }
- await test.finishBatch()
- },
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ await bench('client-mount loop (vue)', benchLifecycle(scenario), async () => {
+ for (let i = 0; i < ticksPerIteration; i++) {
+ await scenario.tick()
+ }
+ await scenario.finishBatch()
+ }).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
index 3dfe93c117..fa5809c1fd 100644
--- a/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-nested-params', () => {
- const test = setup()
+test('client-nested-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-nested-params navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
index dc7ec11f6b..2c64d9a221 100644
--- a/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-nested-params', () => {
- const test = setup()
+test('client-nested-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-nested-params navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
index fcb336d1db..bd3e82e070 100644
--- a/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-nested-params', () => {
- const test = setup()
+test('client-nested-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-nested-params navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
index 5b188a0a0b..5c210b2fd7 100644
--- a/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-preload', () => {
- const test = setup()
+test('client-preload', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-preload interaction loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
index 267c9fd41d..f835b4a7b9 100644
--- a/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-preload', () => {
- const test = setup()
+test('client-preload', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-preload interaction loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 645d925238..97e215b6da 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 DocsRouteImport } from './routes/docs'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as DocsRouteImport } from './routes/docs'
import { Route as SectionsSectionRouteImport } from './routes/sections.$section'
-const DocsRoute = DocsRouteImport.update({
- id: '/docs',
- path: '/docs',
- getParentRoute: () => rootRouteImport,
-} as any)
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const DocsRoute = DocsRouteImport.update({
+ id: '/docs',
+ path: '/docs',
+ 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 {
- '/docs': {
- id: '/docs'
- path: '/docs'
- fullPath: '/docs'
- preLoaderRoute: typeof DocsRouteImport
- parentRoute: typeof rootRouteImport
- }
'/': {
id: '/'
path: '/'
@@ -75,6 +68,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/docs': {
+ id: '/docs'
+ path: '/docs'
+ fullPath: '/docs'
+ preLoaderRoute: typeof DocsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/sections/$section': {
id: '/sections/$section'
path: '/sections/$section'
diff --git a/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
index 38a2e9e664..e0ec83619b 100644
--- a/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-preload', () => {
- const test = setup()
+test('client-preload', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-preload interaction loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
index 8e79c6db7e..dd1b6f3686 100644
--- a/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-rewrites', () => {
- const test = setup()
+test('client-rewrites', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-rewrites navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
index cf70bcaa40..9c4313e2ff 100644
--- a/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-rewrites', () => {
- const test = setup()
+test('client-rewrites', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-rewrites navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
index 2dc9eb2679..e96aff39eb 100644
--- a/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-rewrites', () => {
- const test = setup()
+test('client-rewrites', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-rewrites navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
index 337ba35b73..6f4b448775 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-route-tree-scale', () => {
- const test = setup()
+test('client-route-tree-scale', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-route-tree-scale navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
index 545b501617..9244ef1350 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-route-tree-scale', () => {
- const test = setup()
+test('client-route-tree-scale', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-route-tree-scale navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 20b4af6146..e6f3596562 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,68 +9,52 @@
// 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 SecFRouteImport } from './routes/sec-f'
-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 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 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 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 SecFSettingsRouteImport } from './routes/sec-f.settings'
-const SecFRoute = SecFRouteImport.update({
- id: '/sec-f',
- path: '/sec-f',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const SecERoute = SecERouteImport.update({
- id: '/sec-e',
- path: '/sec-e',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecDRoute = SecDRouteImport.update({
- id: '/sec-d',
- path: '/sec-d',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecCRoute = SecCRouteImport.update({
- id: '/sec-c',
- path: '/sec-c',
- getParentRoute: () => rootRouteImport,
-} as any)
-const SecBRoute = SecBRouteImport.update({
- id: '/sec-b',
- path: '/sec-b',
+const LayoutRoute = LayoutRouteImport.update({
+ id: '/_layout',
getParentRoute: () => rootRouteImport,
} as any)
const SecARoute = SecARouteImport.update({
@@ -78,134 +62,55 @@ const SecARoute = SecARouteImport.update({
path: '/sec-a',
getParentRoute: () => rootRouteImport,
} as any)
-const LayoutRoute = LayoutRouteImport.update({
- id: '/_layout',
+const SecBRoute = SecBRouteImport.update({
+ id: '/sec-b',
+ path: '/sec-b',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const SecCRoute = SecCRouteImport.update({
+ id: '/sec-c',
+ path: '/sec-c',
getParentRoute: () => rootRouteImport,
} as any)
-const SecFIndexRoute = SecFIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecFRoute,
+const SecDRoute = SecDRouteImport.update({
+ id: '/sec-d',
+ path: '/sec-d',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecEIndexRoute = SecEIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecERoute,
+const SecERoute = SecERouteImport.update({
+ id: '/sec-e',
+ path: '/sec-e',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecDIndexRoute = SecDIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecDRoute,
+const SecFRoute = SecFRouteImport.update({
+ id: '/sec-f',
+ path: '/sec-f',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecCIndexRoute = SecCIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecCRoute,
+const marketingPricingRoute = marketingPricingRouteImport.update({
+ id: '/(marketing)/pricing',
+ path: '/pricing',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecBIndexRoute = SecBIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecBRoute,
+const marketingPromoRoute = marketingPromoRouteImport.update({
+ id: '/(marketing)/promo',
+ path: '/promo',
+ getParentRoute: () => rootRouteImport,
} as any)
-const SecAIndexRoute = SecAIndexRouteImport.update({
- id: '/',
- path: '/',
- getParentRoute: () => SecARoute,
+const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
+ id: '/alpha',
+ path: '/alpha',
+ getParentRoute: () => LayoutRoute,
} as any)
-const SecFSettingsRoute = SecFSettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- getParentRoute: () => SecFRoute,
+const LayoutBetaRoute = LayoutBetaRouteImport.update({
+ id: '/beta',
+ path: '/beta',
+ getParentRoute: () => LayoutRoute,
} as any)
-const SecFAboutRoute = SecFAboutRouteImport.update({
- id: '/about',
- path: '/about',
- getParentRoute: () => SecFRoute,
-} as any)
-const SecFIdRoute = SecFIdRouteImport.update({
- id: '/$id',
- path: '/$id',
- getParentRoute: () => SecFRoute,
-} as any)
-const SecESettingsRoute = SecESettingsRouteImport.update({
- id: '/settings',
- path: '/settings',
- 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,
+const FilesSplatRoute = FilesSplatRouteImport.update({
+ id: '/files/$',
+ path: '/files/$',
+ getParentRoute: () => rootRouteImport,
} as any)
const ReleaseVChar123versionChar125Route =
ReleaseVChar123versionChar125RouteImport.update({
@@ -213,30 +118,125 @@ const ReleaseVChar123versionChar125Route =
path: '/release/v{$version}',
getParentRoute: () => rootRouteImport,
} as any)
-const FilesSplatRoute = FilesSplatRouteImport.update({
- id: '/files/$',
- path: '/files/$',
- getParentRoute: () => rootRouteImport,
+const SecAIndexRoute = SecAIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecARoute,
} as any)
-const LayoutBetaRoute = LayoutBetaRouteImport.update({
- id: '/beta',
- path: '/beta',
- getParentRoute: () => LayoutRoute,
+const SecAIdRoute = SecAIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecARoute,
} as any)
-const LayoutAlphaRoute = LayoutAlphaRouteImport.update({
- id: '/alpha',
- path: '/alpha',
- getParentRoute: () => LayoutRoute,
+const SecAAboutRoute = SecAAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecARoute,
} as any)
-const marketingPromoRoute = marketingPromoRouteImport.update({
- id: '/(marketing)/promo',
- path: '/promo',
- getParentRoute: () => rootRouteImport,
+const SecASettingsRoute = SecASettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecARoute,
} as any)
-const marketingPricingRoute = marketingPricingRouteImport.update({
- id: '/(marketing)/pricing',
- path: '/pricing',
- getParentRoute: () => rootRouteImport,
+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,
+} as any)
+const SecFIndexRoute = SecFIndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFIdRoute = SecFIdRouteImport.update({
+ id: '/$id',
+ path: '/$id',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFAboutRoute = SecFAboutRouteImport.update({
+ id: '/about',
+ path: '/about',
+ getParentRoute: () => SecFRoute,
+} as any)
+const SecFSettingsRoute = SecFSettingsRouteImport.update({
+ id: '/settings',
+ path: '/settings',
+ getParentRoute: () => SecFRoute,
} as any)
export interface FileRoutesByFullPath {
@@ -484,46 +484,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/sec-f': {
- id: '/sec-f'
- path: '/sec-f'
- fullPath: '/sec-f'
- preLoaderRoute: typeof SecFRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-e': {
- id: '/sec-e'
- path: '/sec-e'
- fullPath: '/sec-e'
- preLoaderRoute: typeof SecERouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-d': {
- id: '/sec-d'
- path: '/sec-d'
- fullPath: '/sec-d'
- preLoaderRoute: typeof SecDRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-c': {
- id: '/sec-c'
- path: '/sec-c'
- fullPath: '/sec-c'
- preLoaderRoute: typeof SecCRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-b': {
- id: '/sec-b'
- path: '/sec-b'
- fullPath: '/sec-b'
- preLoaderRoute: typeof SecBRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/sec-a': {
- id: '/sec-a'
- path: '/sec-a'
- fullPath: '/sec-a'
- preLoaderRoute: typeof SecARouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/_layout': {
@@ -533,47 +498,89 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof LayoutRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/sec-a': {
+ id: '/sec-a'
+ path: '/sec-a'
+ fullPath: '/sec-a'
+ preLoaderRoute: typeof SecARouteImport
parentRoute: typeof rootRouteImport
}
- '/sec-f/': {
- id: '/sec-f/'
- path: '/'
- fullPath: '/sec-f/'
- preLoaderRoute: typeof SecFIndexRouteImport
- parentRoute: typeof SecFRoute
+ '/sec-b': {
+ id: '/sec-b'
+ path: '/sec-b'
+ fullPath: '/sec-b'
+ preLoaderRoute: typeof SecBRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-e/': {
- id: '/sec-e/'
- path: '/'
- fullPath: '/sec-e/'
- preLoaderRoute: typeof SecEIndexRouteImport
- parentRoute: typeof SecERoute
+ '/sec-c': {
+ id: '/sec-c'
+ path: '/sec-c'
+ fullPath: '/sec-c'
+ preLoaderRoute: typeof SecCRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-d/': {
- id: '/sec-d/'
- path: '/'
- fullPath: '/sec-d/'
- preLoaderRoute: typeof SecDIndexRouteImport
- parentRoute: typeof SecDRoute
+ '/sec-d': {
+ id: '/sec-d'
+ path: '/sec-d'
+ fullPath: '/sec-d'
+ preLoaderRoute: typeof SecDRouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-c/': {
- id: '/sec-c/'
- path: '/'
- fullPath: '/sec-c/'
- preLoaderRoute: typeof SecCIndexRouteImport
- parentRoute: typeof SecCRoute
+ '/sec-e': {
+ id: '/sec-e'
+ path: '/sec-e'
+ fullPath: '/sec-e'
+ preLoaderRoute: typeof SecERouteImport
+ parentRoute: typeof rootRouteImport
}
- '/sec-b/': {
- id: '/sec-b/'
- path: '/'
- fullPath: '/sec-b/'
- preLoaderRoute: typeof SecBIndexRouteImport
- parentRoute: typeof SecBRoute
+ '/sec-f': {
+ id: '/sec-f'
+ path: '/sec-f'
+ fullPath: '/sec-f'
+ preLoaderRoute: typeof SecFRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/pricing': {
+ id: '/(marketing)/pricing'
+ path: '/pricing'
+ fullPath: '/pricing'
+ preLoaderRoute: typeof marketingPricingRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/(marketing)/promo': {
+ id: '/(marketing)/promo'
+ path: '/promo'
+ fullPath: '/promo'
+ preLoaderRoute: typeof marketingPromoRouteImport
+ 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
+ parentRoute: typeof rootRouteImport
+ }
+ '/release/v{$version}': {
+ id: '/release/v{$version}'
+ path: '/release/v{$version}'
+ fullPath: '/release/v{$version}'
+ preLoaderRoute: typeof ReleaseVChar123versionChar125RouteImport
+ parentRoute: typeof rootRouteImport
}
'/sec-a/': {
id: '/sec-a/'
@@ -582,125 +589,6 @@ declare module '@tanstack/solid-router' {
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': {
- id: '/sec-f/about'
- path: '/about'
- fullPath: '/sec-f/about'
- preLoaderRoute: typeof SecFAboutRouteImport
- parentRoute: typeof SecFRoute
- }
- '/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'
@@ -708,47 +596,159 @@ declare module '@tanstack/solid-router' {
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
+ '/sec-a/about': {
+ id: '/sec-a/about'
+ path: '/about'
+ fullPath: '/sec-a/about'
+ preLoaderRoute: typeof SecAAboutRouteImport
+ parentRoute: typeof SecARoute
}
- '/files/$': {
- id: '/files/$'
- path: '/files/$'
- fullPath: '/files/$'
- preLoaderRoute: typeof FilesSplatRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-a/settings': {
+ id: '/sec-a/settings'
+ path: '/settings'
+ fullPath: '/sec-a/settings'
+ preLoaderRoute: typeof SecASettingsRouteImport
+ parentRoute: typeof SecARoute
}
- '/_layout/beta': {
- id: '/_layout/beta'
- path: '/beta'
- fullPath: '/beta'
- preLoaderRoute: typeof LayoutBetaRouteImport
- parentRoute: typeof LayoutRoute
+ '/sec-b/': {
+ id: '/sec-b/'
+ path: '/'
+ fullPath: '/sec-b/'
+ preLoaderRoute: typeof SecBIndexRouteImport
+ parentRoute: typeof SecBRoute
}
- '/_layout/alpha': {
- id: '/_layout/alpha'
- path: '/alpha'
- fullPath: '/alpha'
- preLoaderRoute: typeof LayoutAlphaRouteImport
- parentRoute: typeof LayoutRoute
+ '/sec-b/$id': {
+ id: '/sec-b/$id'
+ path: '/$id'
+ fullPath: '/sec-b/$id'
+ preLoaderRoute: typeof SecBIdRouteImport
+ parentRoute: typeof SecBRoute
}
- '/(marketing)/promo': {
- id: '/(marketing)/promo'
- path: '/promo'
- fullPath: '/promo'
- preLoaderRoute: typeof marketingPromoRouteImport
- parentRoute: typeof rootRouteImport
+ '/sec-b/about': {
+ id: '/sec-b/about'
+ path: '/about'
+ fullPath: '/sec-b/about'
+ preLoaderRoute: typeof SecBAboutRouteImport
+ parentRoute: typeof SecBRoute
}
- '/(marketing)/pricing': {
- id: '/(marketing)/pricing'
- path: '/pricing'
- fullPath: '/pricing'
- preLoaderRoute: typeof marketingPricingRouteImport
- parentRoute: typeof rootRouteImport
+ '/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
+ }
+ '/sec-f/': {
+ id: '/sec-f/'
+ path: '/'
+ fullPath: '/sec-f/'
+ preLoaderRoute: typeof SecFIndexRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/$id': {
+ id: '/sec-f/$id'
+ path: '/$id'
+ fullPath: '/sec-f/$id'
+ preLoaderRoute: typeof SecFIdRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/about': {
+ id: '/sec-f/about'
+ path: '/about'
+ fullPath: '/sec-f/about'
+ preLoaderRoute: typeof SecFAboutRouteImport
+ parentRoute: typeof SecFRoute
+ }
+ '/sec-f/settings': {
+ id: '/sec-f/settings'
+ path: '/settings'
+ fullPath: '/sec-f/settings'
+ preLoaderRoute: typeof SecFSettingsRouteImport
+ parentRoute: typeof SecFRoute
}
}
}
diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
index 9365231579..331e8e008f 100644
--- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-route-tree-scale', () => {
- const test = setup()
+test('client-route-tree-scale', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-route-tree-scale navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
index 5bdd994e32..0b38f7bddb 100644
--- a/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-search-params', () => {
- const test = setup()
+test('client-search-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-search-params navigation loop (react)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
index ea0baa1098..caa626c596 100644
--- a/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-search-params', () => {
- const test = setup()
+test('client-search-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-search-params navigation loop (solid)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
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 96d211d64c..b15beed09b 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 ProductsRouteImport } from './routes/products'
-import { Route as CatalogRouteImport } from './routes/catalog'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as CatalogRouteImport } from './routes/catalog'
+import { Route as ProductsRouteImport } from './routes/products'
-const ProductsRoute = ProductsRouteImport.update({
- id: '/products',
- path: '/products',
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
getParentRoute: () => rootRouteImport,
} as any)
const CatalogRoute = CatalogRouteImport.update({
@@ -23,9 +23,9 @@ const CatalogRoute = CatalogRouteImport.update({
path: '/catalog',
getParentRoute: () => rootRouteImport,
} as any)
-const IndexRoute = IndexRouteImport.update({
- id: '/',
- path: '/',
+const ProductsRoute = ProductsRouteImport.update({
+ id: '/products',
+ path: '/products',
getParentRoute: () => rootRouteImport,
} as any)
@@ -61,11 +61,11 @@ export interface RootRouteChildren {
declare module '@tanstack/solid-router' {
interface FileRoutesByPath {
- '/products': {
- id: '/products'
- path: '/products'
- fullPath: '/products'
- preLoaderRoute: typeof ProductsRouteImport
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
'/catalog': {
@@ -75,11 +75,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof CatalogRouteImport
parentRoute: typeof rootRouteImport
}
- '/': {
- id: '/'
- path: '/'
- fullPath: '/'
- preLoaderRoute: typeof IndexRouteImport
+ '/products': {
+ id: '/products'
+ path: '/products'
+ fullPath: '/products'
+ preLoaderRoute: typeof ProductsRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
index c82efd49c9..728d2779e8 100644
--- a/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
+++ b/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts
@@ -1,32 +1,19 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
+import { test } from 'vitest'
+import { benchLifecycle } from '../../../../cpu-simulation'
import { benchOptions, ticksPerIteration } from '../shared'
import { setup } from './setup'
-describe('client-search-params', () => {
- const test = setup()
+test('client-search-params', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores suite hooks, so Tinybench uses the `setup`
- * and `teardown` options below. CodSpeed bypasses those options but supports
- * `beforeEach` and `afterEach`. Only one lifecycle path runs in either
- * environment, and every measured invocation receives fresh application state.
- */
-
- beforeEach(test.before)
- afterEach(test.after)
-
- bench(
+ await bench(
'client-search-params navigation loop (vue)',
+ benchLifecycle(scenario),
async () => {
for (let i = 0; i < ticksPerIteration; i++) {
- await test.tick()
+ await scenario.tick()
}
- await test.finishBatch()
+ await scenario.finishBatch()
},
- {
- ...benchOptions,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run(benchOptions)
})
diff --git a/benchmarks/client-nav/solid/speed.bench.ts b/benchmarks/client-nav/solid/speed.bench.ts
index 34791180ce..d629da17a8 100644
--- a/benchmarks/client-nav/solid/speed.bench.ts
+++ b/benchmarks/client-nav/solid/speed.bench.ts
@@ -1,34 +1,19 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-nav', () => {
- const test = setup()
+test('client-nav', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores "suite hooks" like `beforeAll` and `afterAll`,
- * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.
- *
- * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,
- * but it does support `beforeAll` and `afterAll`.
- *
- * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.
- */
-
- beforeAll(test.before)
- afterAll(test.after)
-
- bench(
+ await bench(
'client-side navigation loop (solid)',
+ { beforeAll: scenario.before, afterAll: scenario.after },
async () => {
for (let i = 0; i < 10; i++) {
- await test.tick()
+ await scenario.tick()
}
},
- {
- warmupIterations: 100,
- time: 10_000,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ })
})
diff --git a/benchmarks/client-nav/solid/vite.config.ts b/benchmarks/client-nav/solid/vite.config.ts
index 1dd8e1e15c..0c26b32f5f 100644
--- a/benchmarks/client-nav/solid/vite.config.ts
+++ b/benchmarks/client-nav/solid/vite.config.ts
@@ -37,6 +37,7 @@ export default defineConfig({
watch: false,
environment: 'jsdom',
setupFiles: [`${rootDir}vitest.setup.ts`],
+ benchmark: { include: ['solid/speed.bench.ts'] },
server: {
deps: {
inline: [/@solidjs/, /@tanstack\/solid-store/],
diff --git a/benchmarks/client-nav/vue/speed.bench.ts b/benchmarks/client-nav/vue/speed.bench.ts
index f9e532f5ba..503e91e7b7 100644
--- a/benchmarks/client-nav/vue/speed.bench.ts
+++ b/benchmarks/client-nav/vue/speed.bench.ts
@@ -1,34 +1,19 @@
-import { afterAll, beforeAll, bench, describe } from 'vitest'
+import { test } from 'vitest'
import { setup } from './setup'
-describe('client-nav', () => {
- const test = setup()
+test('client-nav', async ({ bench }) => {
+ const scenario = setup()
- /**
- * Running `vitest bench` ignores "suite hooks" like `beforeAll` and `afterAll`,
- * so we use tinybench's `setup` and `teardown` options to run our setup and teardown logic.
- *
- * But CodSpeed calls the benchmarked function directly, bypassing `setup` and `teardown`,
- * but it does support `beforeAll` and `afterAll`.
- *
- * So it looks like we're setting up in duplicate, but in reality, it's only running once per environment, as intended.
- */
-
- beforeAll(test.before)
- afterAll(test.after)
-
- bench(
+ await bench(
'client-side navigation loop (vue)',
+ { beforeAll: scenario.before, afterAll: scenario.after },
async () => {
for (let i = 0; i < 10; i++) {
- await test.tick()
+ await scenario.tick()
}
},
- {
- warmupIterations: 100,
- time: 10_000,
- setup: test.before,
- teardown: test.after,
- },
- )
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ })
})
diff --git a/benchmarks/client-nav/vue/vite.config.ts b/benchmarks/client-nav/vue/vite.config.ts
index 7abe24b455..78d8ae5638 100644
--- a/benchmarks/client-nav/vue/vite.config.ts
+++ b/benchmarks/client-nav/vue/vite.config.ts
@@ -36,5 +36,6 @@ export default defineConfig({
watch: false,
environment: 'jsdom',
setupFiles: [`${rootDir}vitest.setup.ts`],
+ benchmark: { include: ['vue/speed.bench.ts'] },
},
})
diff --git a/benchmarks/cpu-simulation.ts b/benchmarks/cpu-simulation.ts
index 7e16bf4c5a..9b8859f74d 100644
--- a/benchmarks/cpu-simulation.ts
+++ b/benchmarks/cpu-simulation.ts
@@ -1,9 +1,23 @@
+function codspeedRunnerMode() {
+ return process.env.CODSPEED_ENV === undefined
+ ? undefined
+ : process.env.CODSPEED_RUNNER_MODE
+}
+
+/**
+ * Whether CodSpeed's simulation or memory instrument drives the run. Both
+ * measure one invocation after a few warmup calls instead of sampling.
+ */
+export function isCodSpeedAnalysis() {
+ const mode = codspeedRunnerMode()
+ return (
+ mode === 'simulation' || mode === 'instrumentation' || mode === 'memory'
+ )
+}
+
/** Extra worker flags for CodSpeed CPU simulation, not walltime benchmarks. */
export function cpuSimulationExecArgv() {
- const mode =
- process.env.CODSPEED_ENV === undefined
- ? undefined
- : process.env.CODSPEED_RUNNER_MODE
+ const mode = codspeedRunnerMode()
if (mode === 'simulation' || mode === 'instrumentation') {
// CodSpeed supplies --no-opt, which only disables TurboFan on Node 24.
// Maglev can still compile and inline hot functions between measured runs.
@@ -22,3 +36,18 @@ export function cpuSimulationExecArgv() {
}
return []
}
+
+/**
+ * Per-bench lifecycle for apps that a bench prepares and disposes outside
+ * timing. CodSpeed measures one invocation, so each invocation gets fresh
+ * state. Tinybench samples thousands of iterations and keeps one instance per
+ * warmup/run phase instead of preparing it for every iteration.
+ */
+export function benchLifecycle(hooks: {
+ before: () => Promise | void
+ after: () => Promise | void
+}) {
+ return isCodSpeedAnalysis()
+ ? { beforeEach: hooks.before, afterEach: hooks.after }
+ : { beforeAll: hooks.before, afterAll: hooks.after }
+}
diff --git a/benchmarks/memory/README.md b/benchmarks/memory/README.md
index 65a13f04a3..18b68768f9 100644
--- a/benchmarks/memory/README.md
+++ b/benchmarks/memory/README.md
@@ -2,7 +2,7 @@
Dedicated memory benchmarks for TanStack Router / Start, measured with the
CodSpeed **memory instrument** (`mode: memory` in
-`.github/workflows/client-nav-benchmarks.yml`). The workflow runs on every
+`.github/workflows/benchmarks.yml`). The workflow runs on every
push to `main` except docs/examples/e2e-only pushes: CodSpeed compares a PR
against the run on its merge-base commit, and a main commit without a run makes
CodSpeed silently fall back to an older base — a single outlier base run then
@@ -34,8 +34,8 @@ benchmarks/memory//
One app per scenario; apps and bench names are stable once landed (CodSpeed
continuity). Never grow an existing scenario for a new case — add a scenario.
`setup.ts` imports the built app and exports the concrete workload;
-`memory.bench.ts` registers `bench(...)` directly, and `memory.flame.ts` runs the
-same workload through the Flame profiler.
+`memory.bench.ts` registers it with Vitest's `bench` test fixture, and
+`memory.flame.ts` runs the same workload through the Flame profiler.
## How the memory instrument executes a bench
@@ -43,19 +43,21 @@ same workload through the Flame profiler.
after a forced GC. Under plain `vitest bench` the suites only smoke-test:
timing output is meaningless; real numbers come from CodSpeed.
- Under CodSpeed the bench fn runs several warmup invocations plus the
- measured one. Client suite hooks mount a fresh app before each invocation
- and tear it down afterward, outside the measurement window. This prevents
- warmup navigation history and caches from changing the starting state.
- Module-level counters/LCGs keep generated URLs unique across invocations.
-- Plain `vitest bench` never runs suite hooks (`beforeEach`/`afterEach`) and
- only honors tinybench's `setup`/`teardown` options; the CodSpeed runner
- does the exact opposite. Client benches therefore register **both** — in
- any given mode exactly one pair runs.
+ measured one. The bench's `beforeEach`/`afterEach` hooks
+ (`memoryBenchHooks`) run around every invocation, outside the measurement
+ window: client workloads mount a fresh app before each invocation and tear
+ it down afterward. This prevents warmup navigation history and caches from
+ changing the starting state. Plain `vitest bench` runs the same hooks around
+ its warmup and measured iteration. Module-level counters/LCGs keep generated
+ URLs unique across invocations.
+- Workload `run` functions must be `async` functions. CodSpeed's Vitest 5
+ provider awaits only `AsyncFunction`s; a plain function that returns a
+ promise would be measured only up to its first suspension.
- Worker flags live in `runtime.ts` and apply only to the CodSpeed memory
instrument. They supplement the integration's predictable execution flags;
the retained overrides are described below.
-- Before each CodSpeed invocation, a setup hook yields to the event loop,
- outside the measurement marker and before CodSpeed forces GC. Promise-only
+- Before each CodSpeed invocation, the `beforeEach` hook yields to the event
+ loop, outside the measurement marker and before CodSpeed forces GC. Promise-only
warmup chains can keep WeakRef targets alive through a collection in the same
job. Client app setup also runs before the forced GC.
- Do not force GC inside a measured request loop or poll `heapUsed` to choose
@@ -256,7 +258,7 @@ WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/mem
Run the benchmark workflow on an experiment branch:
```bash
-gh workflow run client-nav-benchmarks.yml --ref
+gh workflow run benchmarks.yml --ref
```
Repeat at the same commit, using distinct branch names if runs should overlap
diff --git a/benchmarks/memory/client/bench-utils.ts b/benchmarks/memory/client/bench-utils.ts
index 0cbaedbd71..785e8fac7f 100644
--- a/benchmarks/memory/client/bench-utils.ts
+++ b/benchmarks/memory/client/bench-utils.ts
@@ -1,3 +1,5 @@
+export { memoryBenchHooks } from '../turn'
+
export const memoryBenchOptions = {
iterations: 1,
warmupIterations: 1,
diff --git a/benchmarks/memory/client/benchmark.ts b/benchmarks/memory/client/benchmark.ts
index 8b877b0740..463047f4d9 100644
--- a/benchmarks/memory/client/benchmark.ts
+++ b/benchmarks/memory/client/benchmark.ts
@@ -1,6 +1,10 @@
export interface ClientMemoryWorkload {
name: string
before?: () => Promise | void
+ /**
+ * Must be an `async` function: CodSpeed's Vitest 5 provider awaits only
+ * `AsyncFunction`s and otherwise measures just the synchronous part.
+ */
run: () => Promise | void
sanity: () => Promise | void
after?: () => Promise | void
diff --git a/benchmarks/memory/client/package.json b/benchmarks/memory/client/package.json
index 2da6cb4ad8..4dc6246183 100644
--- a/benchmarks/memory/client/package.json
+++ b/benchmarks/memory/client/package.json
@@ -22,7 +22,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
- "@codspeed/vitest-plugin": "^5.7.1",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@datadog/pprof": "^5.13.2",
"@platformatic/flame": "^1.6.0",
"@testing-library/react": "^16.2.0",
@@ -202,7 +202,7 @@
"build:react"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
"cwd": "benchmarks/memory/client"
}
},
@@ -214,7 +214,7 @@
"build:solid"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
"cwd": "benchmarks/memory/client"
}
},
@@ -226,7 +226,7 @@
"build:vue"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"cwd": "benchmarks/memory/client"
}
},
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts
index 85a1f11ee6..43ab822de3 100644
--- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts
@@ -1,21 +1,14 @@
-import { afterEach, beforeEach, bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-client/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-client/bench-utils'
import { workload } from './setup'
await workload.sanity()
-describe('memory', () => {
- if (workload.before && workload.after) {
- beforeEach(workload.before)
- afterEach(workload.after)
-
- bench(workload.name, workload.run, {
- ...memoryBenchOptions,
- setup: workload.before,
- teardown: workload.after,
- })
- return
- }
-
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(workload), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/client/vitest.setup.ts b/benchmarks/memory/client/vitest.setup.ts
index 5f78f1a7d1..ce3127275a 100644
--- a/benchmarks/memory/client/vitest.setup.ts
+++ b/benchmarks/memory/client/vitest.setup.ts
@@ -1,6 +1,3 @@
-import { beforeEach } from 'vitest'
-import { endMemoryTurn, isMemoryInstrumented } from '../turn'
-
// @ts-expect-error
global.IS_REACT_ACT_ENVIRONMENT = true
@@ -10,7 +7,3 @@ window.scrollTo = scrollTo
globalThis.scrollTo = scrollTo
export {}
-
-if (isMemoryInstrumented()) {
- beforeEach(endMemoryTurn)
-}
diff --git a/benchmarks/memory/runtime.ts b/benchmarks/memory/runtime.ts
index 85f84d922b..010149b4df 100644
--- a/benchmarks/memory/runtime.ts
+++ b/benchmarks/memory/runtime.ts
@@ -29,8 +29,8 @@ export function memoryConfig(side: 'client' | 'server') {
return {
execArgv,
setupFiles:
- side === 'client' || isMemoryInstrumented()
- ? [fileURLToPath(new URL(`./${side}/vitest.setup.ts`, import.meta.url))]
+ side === 'client'
+ ? [fileURLToPath(new URL('./client/vitest.setup.ts', import.meta.url))]
: [],
}
}
diff --git a/benchmarks/memory/server/bench-utils.ts b/benchmarks/memory/server/bench-utils.ts
index 8893d5be4b..9caaf63384 100644
--- a/benchmarks/memory/server/bench-utils.ts
+++ b/benchmarks/memory/server/bench-utils.ts
@@ -1,3 +1,5 @@
+export { memoryBenchHooks } from '../turn'
+
export interface StartRequestHandler {
fetch: (request: Request) => Promise | Response
}
diff --git a/benchmarks/memory/server/benchmark.ts b/benchmarks/memory/server/benchmark.ts
index 301a9f956d..9b8dc2c76f 100644
--- a/benchmarks/memory/server/benchmark.ts
+++ b/benchmarks/memory/server/benchmark.ts
@@ -1,5 +1,9 @@
export interface ServerMemoryWorkload {
name: string
+ /**
+ * Must be an `async` function: CodSpeed's Vitest 5 provider awaits only
+ * `AsyncFunction`s and otherwise measures just the synchronous part.
+ */
run: () => Promise | void
}
diff --git a/benchmarks/memory/server/package.json b/benchmarks/memory/server/package.json
index 5d59987e68..d09343c7b6 100644
--- a/benchmarks/memory/server/package.json
+++ b/benchmarks/memory/server/package.json
@@ -23,7 +23,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
- "@codspeed/vitest-plugin": "^5.7.1",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@datadog/pprof": "^5.13.2",
"@platformatic/flame": "^1.6.0",
"@vitejs/plugin-react": "^6.0.1",
@@ -208,7 +208,7 @@
"build:react"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
"cwd": "benchmarks/memory/server"
}
},
@@ -220,7 +220,7 @@
"build:solid"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
"cwd": "benchmarks/memory/server"
}
},
@@ -232,7 +232,7 @@
"build:vue"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"cwd": "benchmarks/memory/server"
}
},
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/shared.ts b/benchmarks/memory/server/scenarios/aborted-requests/shared.ts
index b5a61594ba..29eca99e00 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/shared.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/shared.ts
@@ -221,7 +221,7 @@ export function createWorkloadGroup(
handler: StartRequestHandler,
) {
const mode = abortedRequestModes[framework]
- const run = () => runAbortedRequestLoop(handler, mode)
+ const run = async () => runAbortedRequestLoop(handler, mode)
return {
sanity: () => assertAbortedRequestsSanity(handler, mode),
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts
index 2780830cb2..a6f07b97be 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[0]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts
index d41877e6ce..89071137c3 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[2]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts
index 42d67b1164..fa6a6693ed 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[1]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts
index 6179e469dd..b2c3d24200 100644
--- a/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[3]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/shared.ts b/benchmarks/memory/server/scenarios/error-paths/shared.ts
index 966505f3a0..11ed293d22 100644
--- a/benchmarks/memory/server/scenarios/error-paths/shared.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/shared.ts
@@ -136,7 +136,7 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const runRedirect = () =>
+ const runRedirect = async () =>
runSequentialRequestLoop(handler, {
random: redirectRandom,
iterations: errorPathsIterations,
@@ -144,7 +144,7 @@ export function createWorkloadGroup(
validateResponse: validateRedirectResponse,
})
- const runNotFound = () =>
+ const runNotFound = async () =>
runSequentialRequestLoop(handler, {
random: notFoundRandom,
iterations: errorPathsIterations,
@@ -152,7 +152,7 @@ export function createWorkloadGroup(
validateResponse: validateNotFoundResponse,
})
- const runError = () =>
+ const runError = async () =>
runSequentialRequestLoop(handler, {
random: errorRandom,
iterations: errorPathsIterations,
@@ -160,7 +160,7 @@ export function createWorkloadGroup(
validateResponse: validateErrorResponse,
})
- const runUnmatched = () =>
+ const runUnmatched = async () =>
runSequentialRequestLoop(handler, {
random: unmatchedRandom,
iterations: errorPathsIterations,
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts
index 2780830cb2..a6f07b97be 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[0]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts
index d41877e6ce..89071137c3 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[2]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts
index 42d67b1164..fa6a6693ed 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[1]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts
index 6179e469dd..b2c3d24200 100644
--- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[3]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts
index 2780830cb2..a6f07b97be 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[0]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts
index d41877e6ce..89071137c3 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[2]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts
index 42d67b1164..fa6a6693ed 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[1]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts
index 6179e469dd..b2c3d24200 100644
--- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts
+++ b/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
const workload = workloadGroup.workloads[3]!
-describe('memory', () => {
- bench(workload.name, workload.run, memoryBenchOptions)
+test('memory', async ({ bench }) => {
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
})
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/shared.ts b/benchmarks/memory/server/scenarios/peak-large-page/shared.ts
index 486c025f5a..085e576244 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/shared.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/shared.ts
@@ -48,7 +48,7 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: peakLargePageIterations,
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/request-churn/shared.ts b/benchmarks/memory/server/scenarios/request-churn/shared.ts
index 32125148cd..b200c96ed6 100644
--- a/benchmarks/memory/server/scenarios/request-churn/shared.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/shared.ts
@@ -62,7 +62,7 @@ export function createWorkloadGroup(
return new Request(`http://localhost/items/${id}?q=${q}`, requestInit)
}
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
random: benchmarkRandom,
iterations: requestChurnIterations,
diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/shared.ts b/benchmarks/memory/server/scenarios/serialization-payload/shared.ts
index 7f40aeb9d2..14ec8f7e0a 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/shared.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/shared.ts
@@ -55,7 +55,7 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: serializationPayloadIterations,
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts b/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts
index 5fd1e22632..167b24d3b6 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts
@@ -202,7 +202,7 @@ export async function createWorkloadGroup(
handler: StartRequestHandler,
) {
const urls = await discoverUrls(handler)
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: serverFnChurnIterations,
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/shared.ts b/benchmarks/memory/server/scenarios/streaming-peak/shared.ts
index 01917c4743..c027047408 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/shared.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/shared.ts
@@ -92,7 +92,7 @@ export function createWorkloadGroup(
framework: Framework,
handler: StartRequestHandler,
) {
- const run = () =>
+ const run = async () =>
runSequentialRequestLoop(handler, {
seed: benchmarkSeed,
iterations: streamingPeakIterations,
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts
index 9a5c211fee..8b5f16ad63 100644
--- a/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts
+++ b/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts
@@ -1,11 +1,16 @@
-import { bench, describe } from 'vitest'
-import { memoryBenchOptions } from '#memory-server/bench-utils'
+import { test } from 'vitest'
+import {
+ memoryBenchHooks,
+ memoryBenchOptions,
+} from '#memory-server/bench-utils'
import { workloadGroup } from './setup'
await workloadGroup.sanity()
-describe('memory', () => {
+test('memory', async ({ bench }) => {
for (const workload of workloadGroup.workloads) {
- bench(workload.name, workload.run, memoryBenchOptions)
+ await bench(workload.name, memoryBenchHooks(), workload.run).run(
+ memoryBenchOptions,
+ )
}
})
diff --git a/benchmarks/memory/server/vitest.setup.ts b/benchmarks/memory/server/vitest.setup.ts
deleted file mode 100644
index be96c0067a..0000000000
--- a/benchmarks/memory/server/vitest.setup.ts
+++ /dev/null
@@ -1,4 +0,0 @@
-import { beforeEach } from 'vitest'
-import { endMemoryTurn } from '../turn'
-
-beforeEach(endMemoryTurn)
diff --git a/benchmarks/memory/turn.ts b/benchmarks/memory/turn.ts
index 3ee6d53833..08729685fe 100644
--- a/benchmarks/memory/turn.ts
+++ b/benchmarks/memory/turn.ts
@@ -10,3 +10,25 @@ export function isMemoryInstrumented() {
export function endMemoryTurn() {
return new Promise((resolve) => setImmediate(resolve))
}
+
+/**
+ * Per-invocation bench hooks. CodSpeed runs them around every warmup
+ * invocation and the measured one, outside the measurement marker: the turn
+ * ends first, then the workload prepares fresh state before the forced GC.
+ */
+export function memoryBenchHooks(
+ workload: {
+ before?: () => Promise | void
+ after?: () => Promise | void
+ } = {},
+) {
+ return {
+ async beforeEach() {
+ if (isMemoryInstrumented()) {
+ await endMemoryTurn()
+ }
+ await workload.before?.()
+ },
+ afterEach: workload.after,
+ }
+}
diff --git a/benchmarks/ssr/package.json b/benchmarks/ssr/package.json
index a6ab62efa5..20c1837468 100644
--- a/benchmarks/ssr/package.json
+++ b/benchmarks/ssr/package.json
@@ -15,7 +15,7 @@
"vue": "^3.5.16"
},
"devDependencies": {
- "@codspeed/vitest-plugin": "^5.7.1",
+ "@codspeed/vitest-plugin": "^6.0.1",
"@vitejs/plugin-react": "^6.0.1",
"@vitejs/plugin-vue-jsx": "^5.1.5",
"@types/react": "catalog:",
@@ -116,7 +116,7 @@
"build:vue"
],
"options": {
- "command": "NODE_ENV=production vitest bench",
+ "command": "NODE_ENV=production vitest bench --mode benchmark",
"cwd": "benchmarks/ssr"
}
},
@@ -134,7 +134,7 @@
"build:react"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.react.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts",
"cwd": "benchmarks/ssr"
}
},
@@ -145,7 +145,7 @@
"build:solid"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.solid.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts",
"cwd": "benchmarks/ssr"
}
},
@@ -156,7 +156,7 @@
"build:vue"
],
"options": {
- "command": "NODE_ENV=production vitest bench --config ./vitest.vue.config.ts",
+ "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts",
"cwd": "benchmarks/ssr"
}
},
diff --git a/benchmarks/ssr/react/speed.bench.ts b/benchmarks/ssr/react/speed.bench.ts
index 419b1ccb36..6825a7ddfb 100644
--- a/benchmarks/ssr/react/speed.bench.ts
+++ b/benchmarks/ssr/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import { runSsrRequestLoop } from '../bench-utils'
import type { StartRequestHandler } from '../bench-utils'
@@ -11,14 +11,12 @@ const { default: handler } = (await import(
default: StartRequestHandler
}
-describe('ssr', () => {
- bench(
- 'ssr request loop (react)',
- () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),
- {
- warmupIterations: 100,
- time: 10_000,
- throws: true,
- },
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr request loop (react)', async () =>
+ runSsrRequestLoop(handler, { seed: benchmarkSeed }),
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ throws: true,
+ })
})
diff --git a/benchmarks/ssr/scenarios/assets/react/speed.assets-linked-css-control.bench.ts b/benchmarks/ssr/scenarios/assets/react/speed.assets-linked-css-control.bench.ts
index 6413559b92..0496613afb 100644
--- a/benchmarks/ssr/scenarios/assets/react/speed.assets-linked-css-control.bench.ts
+++ b/benchmarks/ssr/scenarios/assets/react/speed.assets-linked-css-control.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertAssetsScenario,
assetsBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertAssetsScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr assets linked-css control (react)',
- () => runAssetsLinkedControlLoop(handler),
- assetsBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr assets linked-css control (react)', async () =>
+ runAssetsLinkedControlLoop(handler),
+ ).run(assetsBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/assets/react/speed.bench.ts b/benchmarks/ssr/scenarios/assets/react/speed.bench.ts
index 5970b88f0b..7dc57d89f1 100644
--- a/benchmarks/ssr/scenarios/assets/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/assets/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertAssetsScenario,
assetsBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertAssetsScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr assets inline-css cdn (react)',
- () => runAssetsInlineLoop(handler),
- assetsBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr assets inline-css cdn (react)', async () =>
+ runAssetsInlineLoop(handler),
+ ).run(assetsBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/assets/solid/speed.assets-linked-css-control.bench.ts b/benchmarks/ssr/scenarios/assets/solid/speed.assets-linked-css-control.bench.ts
index 63fa209ac3..d159124a04 100644
--- a/benchmarks/ssr/scenarios/assets/solid/speed.assets-linked-css-control.bench.ts
+++ b/benchmarks/ssr/scenarios/assets/solid/speed.assets-linked-css-control.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertAssetsScenario,
assetsBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertAssetsScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr assets linked-css control (solid)',
- () => runAssetsLinkedControlLoop(handler),
- assetsBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr assets linked-css control (solid)', async () =>
+ runAssetsLinkedControlLoop(handler),
+ ).run(assetsBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/assets/solid/speed.bench.ts b/benchmarks/ssr/scenarios/assets/solid/speed.bench.ts
index fb5631a50e..47f483df11 100644
--- a/benchmarks/ssr/scenarios/assets/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/assets/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertAssetsScenario,
assetsBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertAssetsScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr assets inline-css cdn (solid)',
- () => runAssetsInlineLoop(handler),
- assetsBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr assets inline-css cdn (solid)', async () =>
+ runAssetsInlineLoop(handler),
+ ).run(assetsBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/assets/vue/speed.assets-linked-css-control.bench.ts b/benchmarks/ssr/scenarios/assets/vue/speed.assets-linked-css-control.bench.ts
index ae8712da75..e56d41df6b 100644
--- a/benchmarks/ssr/scenarios/assets/vue/speed.assets-linked-css-control.bench.ts
+++ b/benchmarks/ssr/scenarios/assets/vue/speed.assets-linked-css-control.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertAssetsScenario,
assetsBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertAssetsScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr assets linked-css control (vue)',
- () => runAssetsLinkedControlLoop(handler),
- assetsBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr assets linked-css control (vue)', async () =>
+ runAssetsLinkedControlLoop(handler),
+ ).run(assetsBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/assets/vue/speed.bench.ts b/benchmarks/ssr/scenarios/assets/vue/speed.bench.ts
index 5225e3dc66..3f77a0dcc1 100644
--- a/benchmarks/ssr/scenarios/assets/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/assets/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertAssetsScenario,
assetsBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertAssetsScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr assets inline-css cdn (vue)',
- () => runAssetsInlineLoop(handler),
- assetsBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr assets inline-css cdn (vue)', async () =>
+ runAssetsInlineLoop(handler),
+ ).run(assetsBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts b/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
index 09073687c0..8a4355a168 100644
--- a/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertBeforeLoadScenario,
beforeLoadBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertBeforeLoadScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr before-load chain (react)',
- () => runBeforeLoadLoop(handler),
- beforeLoadBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr before-load chain (react)', async () =>
+ runBeforeLoadLoop(handler),
+ ).run(beforeLoadBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts b/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts
index 5f6e8baf8a..27e0d3a64c 100644
--- a/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertBeforeLoadScenario,
beforeLoadBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertBeforeLoadScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr before-load chain (solid)',
- () => runBeforeLoadLoop(handler),
- beforeLoadBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr before-load chain (solid)', async () =>
+ runBeforeLoadLoop(handler),
+ ).run(beforeLoadBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts b/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts
index d2cfd6814b..8684c159eb 100644
--- a/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertBeforeLoadScenario,
beforeLoadBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertBeforeLoadScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr before-load chain (vue)',
- () => runBeforeLoadLoop(handler),
- beforeLoadBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr before-load chain (vue)', async () =>
+ runBeforeLoadLoop(handler),
+ ).run(beforeLoadBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts b/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
index 3c0a3f502e..899f400799 100644
--- a/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr redirect (react)',
- () => runRedirectLoop(handler),
+test('ssr', async ({ bench }) => {
+ await bench('ssr redirect (react)', async () => runRedirectLoop(handler)).run(
controlFlowBenchOptions,
)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-error-500.bench.ts b/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-error-500.bench.ts
index 3e117895d8..0a93c5eac3 100644
--- a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-error-500.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-error-500.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow error 500 (react)',
- () => runErrorLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow error 500 (react)', async () =>
+ runErrorLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-route-headers.bench.ts b/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-route-headers.bench.ts
index 566748735e..53e09fd34e 100644
--- a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-route-headers.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-route-headers.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow route headers (react)',
- () => runRouteHeadersLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow route headers (react)', async () =>
+ runRouteHeadersLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-unmatched-404.bench.ts b/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-unmatched-404.bench.ts
index b7c25a0bb2..1cd7c1044c 100644
--- a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-unmatched-404.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-unmatched-404.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow unmatched 404 (react)',
- () => runUnmatchedLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow unmatched 404 (react)', async () =>
+ runUnmatchedLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/react/speed.not-found.bench.ts b/benchmarks/ssr/scenarios/control-flow/react/speed.not-found.bench.ts
index e56335c602..1e8abfd318 100644
--- a/benchmarks/ssr/scenarios/control-flow/react/speed.not-found.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/react/speed.not-found.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr not-found (react)',
- () => runNotFoundLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr not-found (react)', async () =>
+ runNotFoundLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts b/benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
index b76cd741df..904b693e25 100644
--- a/benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr redirect (solid)',
- () => runRedirectLoop(handler),
+test('ssr', async ({ bench }) => {
+ await bench('ssr redirect (solid)', async () => runRedirectLoop(handler)).run(
controlFlowBenchOptions,
)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-error-500.bench.ts b/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-error-500.bench.ts
index 119f65c9ee..57a2f0fbe9 100644
--- a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-error-500.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-error-500.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow error 500 (solid)',
- () => runErrorLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow error 500 (solid)', async () =>
+ runErrorLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-route-headers.bench.ts b/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-route-headers.bench.ts
index 8954e67986..6581e92b39 100644
--- a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-route-headers.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-route-headers.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow route headers (solid)',
- () => runRouteHeadersLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow route headers (solid)', async () =>
+ runRouteHeadersLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-unmatched-404.bench.ts b/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-unmatched-404.bench.ts
index d59282def9..40f1679320 100644
--- a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-unmatched-404.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-unmatched-404.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow unmatched 404 (solid)',
- () => runUnmatchedLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow unmatched 404 (solid)', async () =>
+ runUnmatchedLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/solid/speed.not-found.bench.ts b/benchmarks/ssr/scenarios/control-flow/solid/speed.not-found.bench.ts
index 66cf63fe79..efcb7cc229 100644
--- a/benchmarks/ssr/scenarios/control-flow/solid/speed.not-found.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/solid/speed.not-found.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr not-found (solid)',
- () => runNotFoundLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr not-found (solid)', async () =>
+ runNotFoundLoop(handler),
+ ).run(controlFlowBenchOptions)
})
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 5e7342c172..3cec17d9c8 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 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'
+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'
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
-const TargetIdRoute = TargetIdRouteImport.update({
- id: '/target/$id',
- path: '/target/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
-const MissingIdRoute = MissingIdRouteImport.update({
- id: '/missing/$id',
- path: '/missing/$id',
- getParentRoute: () => rootRouteImport,
-} as any)
-const HeadersIdRoute = HeadersIdRouteImport.update({
- id: '/headers/$id',
- path: '/headers/$id',
+const BoomIdRoute = BoomIdRouteImport.update({
+ id: '/boom/$id',
+ path: '/boom/$id',
getParentRoute: () => rootRouteImport,
} as any)
const FromIdRoute = FromIdRouteImport.update({
@@ -41,9 +31,19 @@ const FromIdRoute = FromIdRouteImport.update({
path: '/from/$id',
getParentRoute: () => rootRouteImport,
} as any)
-const BoomIdRoute = BoomIdRouteImport.update({
- id: '/boom/$id',
- path: '/boom/$id',
+const HeadersIdRoute = HeadersIdRouteImport.update({
+ id: '/headers/$id',
+ path: '/headers/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const MissingIdRoute = MissingIdRouteImport.update({
+ id: '/missing/$id',
+ path: '/missing/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const TargetIdRoute = TargetIdRouteImport.update({
+ id: '/target/$id',
+ path: '/target/$id',
getParentRoute: () => rootRouteImport,
} as any)
@@ -117,25 +117,11 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/target/$id': {
- id: '/target/$id'
- path: '/target/$id'
- fullPath: '/target/$id'
- preLoaderRoute: typeof TargetIdRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/missing/$id': {
- id: '/missing/$id'
- path: '/missing/$id'
- fullPath: '/missing/$id'
- preLoaderRoute: typeof MissingIdRouteImport
- parentRoute: typeof rootRouteImport
- }
- '/headers/$id': {
- id: '/headers/$id'
- path: '/headers/$id'
- fullPath: '/headers/$id'
- preLoaderRoute: typeof HeadersIdRouteImport
+ '/boom/$id': {
+ id: '/boom/$id'
+ path: '/boom/$id'
+ fullPath: '/boom/$id'
+ preLoaderRoute: typeof BoomIdRouteImport
parentRoute: typeof rootRouteImport
}
'/from/$id': {
@@ -145,11 +131,25 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof FromIdRouteImport
parentRoute: typeof rootRouteImport
}
- '/boom/$id': {
- id: '/boom/$id'
- path: '/boom/$id'
- fullPath: '/boom/$id'
- preLoaderRoute: typeof BoomIdRouteImport
+ '/headers/$id': {
+ id: '/headers/$id'
+ path: '/headers/$id'
+ fullPath: '/headers/$id'
+ preLoaderRoute: typeof HeadersIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/missing/$id': {
+ id: '/missing/$id'
+ path: '/missing/$id'
+ fullPath: '/missing/$id'
+ preLoaderRoute: typeof MissingIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/target/$id': {
+ id: '/target/$id'
+ path: '/target/$id'
+ fullPath: '/target/$id'
+ preLoaderRoute: typeof TargetIdRouteImport
parentRoute: typeof rootRouteImport
}
}
diff --git a/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts b/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
index e57ec26b52..0b95f426f2 100644
--- a/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr redirect (vue)',
- () => runRedirectLoop(handler),
+test('ssr', async ({ bench }) => {
+ await bench('ssr redirect (vue)', async () => runRedirectLoop(handler)).run(
controlFlowBenchOptions,
)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-error-500.bench.ts b/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-error-500.bench.ts
index e118e1dd28..262ca951af 100644
--- a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-error-500.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-error-500.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow error 500 (vue)',
- () => runErrorLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow error 500 (vue)', async () =>
+ runErrorLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-route-headers.bench.ts b/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-route-headers.bench.ts
index 0bef524eaf..bf8c90a8a1 100644
--- a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-route-headers.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-route-headers.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow route headers (vue)',
- () => runRouteHeadersLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow route headers (vue)', async () =>
+ runRouteHeadersLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-unmatched-404.bench.ts b/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-unmatched-404.bench.ts
index e29919dc56..d7f8ebeb9e 100644
--- a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-unmatched-404.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-unmatched-404.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr control-flow unmatched 404 (vue)',
- () => runUnmatchedLoop(handler),
- controlFlowBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr control-flow unmatched 404 (vue)', async () =>
+ runUnmatchedLoop(handler),
+ ).run(controlFlowBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/control-flow/vue/speed.not-found.bench.ts b/benchmarks/ssr/scenarios/control-flow/vue/speed.not-found.bench.ts
index b2ab3af3c7..4b84fb594c 100644
--- a/benchmarks/ssr/scenarios/control-flow/vue/speed.not-found.bench.ts
+++ b/benchmarks/ssr/scenarios/control-flow/vue/speed.not-found.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertControlFlowSanity,
controlFlowBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertControlFlowSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr not-found (vue)',
- () => runNotFoundLoop(handler),
+test('ssr', async ({ bench }) => {
+ await bench('ssr not-found (vue)', async () => runNotFoundLoop(handler)).run(
controlFlowBenchOptions,
)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts
index c68d718262..cb3f9f427c 100644
--- a/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw document (react)',
- () => runGlobalMiddlewareDocumentLoop(handler),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw document (react)', async () =>
+ runGlobalMiddlewareDocumentLoop(handler),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-fn.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-fn.bench.ts
index 2655ef2f49..48c444de77 100644
--- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-fn.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-fn.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-fn (react)',
- () => runGlobalMiddlewareServerFnLoop(handler, context),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-fn (react)', async () =>
+ runGlobalMiddlewareServerFnLoop(handler, context),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-0-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-0-middleware.bench.ts
index 2a784ec987..22f53883ee 100644
--- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-0-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-0-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 0 middleware (react)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 0),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 0 middleware (react)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 0),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-1-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-1-middleware.bench.ts
index 64e18cfe61..f01b48d66e 100644
--- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-1-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-1-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 1 middleware (react)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 1),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 1 middleware (react)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 1),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-2-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-2-middleware.bench.ts
index 4418f0867e..b01957f806 100644
--- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-2-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-2-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 2 middlewares (react)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 2),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 2 middlewares (react)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 2),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route.bench.ts
index 189f3b7ef6..08d97fcaf6 100644
--- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 3 middlewares (react)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 3),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 3 middlewares (react)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 3),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts
index 5f27210e36..0e5f504090 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw document (solid)',
- () => runGlobalMiddlewareDocumentLoop(handler),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw document (solid)', async () =>
+ runGlobalMiddlewareDocumentLoop(handler),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-fn.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-fn.bench.ts
index eb19e10ec9..915507ef9f 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-fn.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-fn.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-fn (solid)',
- () => runGlobalMiddlewareServerFnLoop(handler, context),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-fn (solid)', async () =>
+ runGlobalMiddlewareServerFnLoop(handler, context),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-0-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-0-middleware.bench.ts
index c7485b4ef4..a791145935 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-0-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-0-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 0 middleware (solid)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 0),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 0 middleware (solid)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 0),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-1-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-1-middleware.bench.ts
index ac18e0ca79..1baab0f344 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-1-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-1-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 1 middleware (solid)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 1),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 1 middleware (solid)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 1),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-2-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-2-middleware.bench.ts
index 7c2be97b01..d6fde20764 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-2-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-2-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 2 middlewares (solid)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 2),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 2 middlewares (solid)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 2),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route.bench.ts
index 7d21d72067..558ebeb9a4 100644
--- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 3 middlewares (solid)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 3),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 3 middlewares (solid)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 3),
+ ).run(globalMiddlewareBenchOptions)
})
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 28d816525e..65f7fa5848 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 PageIdRouteImport } from './routes/page.$id'
import { Route as ApiFnUrlsRouteImport } from './routes/api.fn-urls'
+import { Route as PageIdRouteImport } from './routes/page.$id'
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 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 PageIdRoute = PageIdRouteImport.update({
+ id: '/page/$id',
+ path: '/page/$id',
+ 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
}
- '/page/$id': {
- id: '/page/$id'
- path: '/page/$id'
- fullPath: '/page/$id'
- preLoaderRoute: typeof PageIdRouteImport
- parentRoute: typeof rootRouteImport
- }
'/api/fn-urls': {
id: '/api/fn-urls'
path: '/api/fn-urls'
@@ -92,6 +85,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof ApiFnUrlsRouteImport
parentRoute: typeof rootRouteImport
}
+ '/page/$id': {
+ id: '/page/$id'
+ path: '/page/$id'
+ fullPath: '/page/$id'
+ preLoaderRoute: typeof PageIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/api/ping/$id': {
id: '/api/ping/$id'
path: '/api/ping/$id'
diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts
index 5d92aab849..9660f29d07 100644
--- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw document (vue)',
- () => runGlobalMiddlewareDocumentLoop(handler),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw document (vue)', async () =>
+ runGlobalMiddlewareDocumentLoop(handler),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-fn.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-fn.bench.ts
index ab158504c8..297e8cee7b 100644
--- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-fn.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-fn.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-fn (vue)',
- () => runGlobalMiddlewareServerFnLoop(handler, context),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-fn (vue)', async () =>
+ runGlobalMiddlewareServerFnLoop(handler, context),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-0-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-0-middleware.bench.ts
index c334af8b65..d023dd458a 100644
--- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-0-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-0-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 0 middleware (vue)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 0),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 0 middleware (vue)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 0),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-1-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-1-middleware.bench.ts
index 7c1b91a0ea..5018163631 100644
--- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-1-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-1-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 1 middleware (vue)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 1),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 1 middleware (vue)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 1),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-2-middleware.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-2-middleware.bench.ts
index 5b00bd3ca9..f9abd8eb60 100644
--- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-2-middleware.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-2-middleware.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 2 middlewares (vue)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 2),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 2 middlewares (vue)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 2),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route.bench.ts
index 6cdc34241e..adcec3019f 100644
--- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route.bench.ts
+++ b/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertGlobalMiddlewareScenario,
globalMiddlewareBenchOptions,
@@ -18,10 +18,8 @@ const context = await setupGlobalMiddlewareBench(handler)
await assertGlobalMiddlewareScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr global-mw server-route 3 middlewares (vue)',
- () => runGlobalMiddlewareServerRouteLoop(handler, 3),
- globalMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr global-mw server-route 3 middlewares (vue)', async () =>
+ runGlobalMiddlewareServerRouteLoop(handler, 3),
+ ).run(globalMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/head/react/speed.bench.ts b/benchmarks/ssr/scenarios/head/react/speed.bench.ts
index 19158b32a9..f75008506e 100644
--- a/benchmarks/ssr/scenarios/head/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/head/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import { assertHeadSanity, headBenchOptions, runHeadLoop } from '../shared'
import type { StartRequestHandler } from '../shared'
@@ -12,6 +12,8 @@ const { default: handler } = (await import(
await assertHeadSanity(handler)
-describe('ssr', () => {
- bench('ssr head (react)', () => runHeadLoop(handler), headBenchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr head (react)', async () => runHeadLoop(handler)).run(
+ headBenchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/head/solid/speed.bench.ts b/benchmarks/ssr/scenarios/head/solid/speed.bench.ts
index ad5bf52809..333e2f091b 100644
--- a/benchmarks/ssr/scenarios/head/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/head/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import { assertHeadSanity, headBenchOptions, runHeadLoop } from '../shared'
import type { StartRequestHandler } from '../shared'
@@ -12,6 +12,8 @@ const { default: handler } = (await import(
await assertHeadSanity(handler)
-describe('ssr', () => {
- bench('ssr head (solid)', () => runHeadLoop(handler), headBenchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr head (solid)', async () => runHeadLoop(handler)).run(
+ headBenchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/head/vue/speed.bench.ts b/benchmarks/ssr/scenarios/head/vue/speed.bench.ts
index 5d8243b588..936735a909 100644
--- a/benchmarks/ssr/scenarios/head/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/head/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import { assertHeadSanity, headBenchOptions, runHeadLoop } from '../shared'
import type { StartRequestHandler } from '../shared'
@@ -12,6 +12,8 @@ const { default: handler } = (await import(
await assertHeadSanity(handler)
-describe('ssr', () => {
- bench('ssr head (vue)', () => runHeadLoop(handler), headBenchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr head (vue)', async () => runHeadLoop(handler)).run(
+ headBenchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts b/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts
index a5eecfc648..7acd43c635 100644
--- a/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertLoadersSanity,
benchOptions,
@@ -16,6 +16,8 @@ const { default: handler } = (await import(
await assertLoadersSanity(handler)
-describe('ssr', () => {
- bench('ssr loaders (react)', () => runLoadersLoop(handler), benchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr loaders (react)', async () => runLoadersLoop(handler)).run(
+ benchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts b/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts
index 7b3f6247ea..7fc8d88389 100644
--- a/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertLoadersSanity,
benchOptions,
@@ -16,6 +16,8 @@ const { default: handler } = (await import(
await assertLoadersSanity(handler)
-describe('ssr', () => {
- bench('ssr loaders (solid)', () => runLoadersLoop(handler), benchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr loaders (solid)', async () => runLoadersLoop(handler)).run(
+ benchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts b/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts
index fb39e0652c..321350d98c 100644
--- a/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertLoadersSanity,
benchOptions,
@@ -16,6 +16,8 @@ const { default: handler } = (await import(
await assertLoadersSanity(handler)
-describe('ssr', () => {
- bench('ssr loaders (vue)', () => runLoadersLoop(handler), benchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr loaders (vue)', async () => runLoadersLoop(handler)).run(
+ benchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts b/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts
index a8af260279..920186c5db 100644
--- a/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertRewriteScenario,
rewriteBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertRewriteScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr rewrite localized (react)',
- () => runRewriteLocalizedLoop(handler),
- rewriteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr rewrite localized (react)', async () =>
+ runRewriteLocalizedLoop(handler),
+ ).run(rewriteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/rewrites/react/speed.rewrite-passthrough.bench.ts b/benchmarks/ssr/scenarios/rewrites/react/speed.rewrite-passthrough.bench.ts
index cffabcafb5..f5d09089a6 100644
--- a/benchmarks/ssr/scenarios/rewrites/react/speed.rewrite-passthrough.bench.ts
+++ b/benchmarks/ssr/scenarios/rewrites/react/speed.rewrite-passthrough.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertRewriteScenario,
rewriteBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertRewriteScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr rewrite passthrough (react)',
- () => runRewritePassthroughLoop(handler),
- rewriteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr rewrite passthrough (react)', async () =>
+ runRewritePassthroughLoop(handler),
+ ).run(rewriteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts b/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
index 5fdef077c9..488fb2ca52 100644
--- a/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertRewriteScenario,
rewriteBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertRewriteScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr rewrite localized (solid)',
- () => runRewriteLocalizedLoop(handler),
- rewriteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr rewrite localized (solid)', async () =>
+ runRewriteLocalizedLoop(handler),
+ ).run(rewriteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/rewrites/solid/speed.rewrite-passthrough.bench.ts b/benchmarks/ssr/scenarios/rewrites/solid/speed.rewrite-passthrough.bench.ts
index 2458a59b69..7b86e2ba11 100644
--- a/benchmarks/ssr/scenarios/rewrites/solid/speed.rewrite-passthrough.bench.ts
+++ b/benchmarks/ssr/scenarios/rewrites/solid/speed.rewrite-passthrough.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertRewriteScenario,
rewriteBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertRewriteScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr rewrite passthrough (solid)',
- () => runRewritePassthroughLoop(handler),
- rewriteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr rewrite passthrough (solid)', async () =>
+ runRewritePassthroughLoop(handler),
+ ).run(rewriteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts b/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts
index b8a98c3408..5fd4da9d3e 100644
--- a/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertRewriteScenario,
rewriteBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertRewriteScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr rewrite localized (vue)',
- () => runRewriteLocalizedLoop(handler),
- rewriteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr rewrite localized (vue)', async () =>
+ runRewriteLocalizedLoop(handler),
+ ).run(rewriteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/rewrites/vue/speed.rewrite-passthrough.bench.ts b/benchmarks/ssr/scenarios/rewrites/vue/speed.rewrite-passthrough.bench.ts
index e011a9fc8d..f3664b5f21 100644
--- a/benchmarks/ssr/scenarios/rewrites/vue/speed.rewrite-passthrough.bench.ts
+++ b/benchmarks/ssr/scenarios/rewrites/vue/speed.rewrite-passthrough.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertRewriteScenario,
rewriteBenchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertRewriteScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr rewrite passthrough (vue)',
- () => runRewritePassthroughLoop(handler),
- rewriteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr rewrite passthrough (vue)', async () =>
+ runRewritePassthroughLoop(handler),
+ ).run(rewriteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts b/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts
index e0e8a0e3c4..ba6bd4a61d 100644
--- a/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSelectiveSanity,
benchOptions,
@@ -16,6 +16,8 @@ const { default: handler } = (await import(
await assertSelectiveSanity(handler)
-describe('ssr', () => {
- bench('ssr selective (react)', () => runSelectiveLoop(handler), benchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr selective (react)', async () =>
+ runSelectiveLoop(handler),
+ ).run(benchOptions)
})
diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts b/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts
index 6a2803d45f..76265397ab 100644
--- a/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSelectiveSanity,
benchOptions,
@@ -16,6 +16,8 @@ const { default: handler } = (await import(
await assertSelectiveSanity(handler)
-describe('ssr', () => {
- bench('ssr selective (solid)', () => runSelectiveLoop(handler), benchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr selective (solid)', async () =>
+ runSelectiveLoop(handler),
+ ).run(benchOptions)
})
diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts b/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts
index f3082a102d..ff60341b27 100644
--- a/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSelectiveSanity,
benchOptions,
@@ -16,6 +16,8 @@ const { default: handler } = (await import(
await assertSelectiveSanity(handler)
-describe('ssr', () => {
- bench('ssr selective (vue)', () => runSelectiveLoop(handler), benchOptions)
+test('ssr', async ({ bench }) => {
+ await bench('ssr selective (vue)', async () => runSelectiveLoop(handler)).run(
+ benchOptions,
+ )
})
diff --git a/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts b/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts
index 9032280e51..8be07d2643 100644
--- a/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSerializationScenario,
runRichSerializationLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertSerializationScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr dehydrate rich types (react)',
- () => runRichSerializationLoop(handler),
- serializationBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr dehydrate rich types (react)', async () =>
+ runRichSerializationLoop(handler),
+ ).run(serializationBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/serialization/react/speed.dehydrate-plain-control.bench.ts b/benchmarks/ssr/scenarios/serialization/react/speed.dehydrate-plain-control.bench.ts
index a6c8d99fb6..c70fddc6c4 100644
--- a/benchmarks/ssr/scenarios/serialization/react/speed.dehydrate-plain-control.bench.ts
+++ b/benchmarks/ssr/scenarios/serialization/react/speed.dehydrate-plain-control.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSerializationScenario,
runPlainSerializationLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertSerializationScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr dehydrate plain control (react)',
- () => runPlainSerializationLoop(handler),
- serializationBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr dehydrate plain control (react)', async () =>
+ runPlainSerializationLoop(handler),
+ ).run(serializationBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts b/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts
index 3fa22ccea9..70bda8c7af 100644
--- a/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSerializationScenario,
runRichSerializationLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertSerializationScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr dehydrate rich types (solid)',
- () => runRichSerializationLoop(handler),
- serializationBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr dehydrate rich types (solid)', async () =>
+ runRichSerializationLoop(handler),
+ ).run(serializationBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/serialization/solid/speed.dehydrate-plain-control.bench.ts b/benchmarks/ssr/scenarios/serialization/solid/speed.dehydrate-plain-control.bench.ts
index 354512e09d..d7ccb16f6f 100644
--- a/benchmarks/ssr/scenarios/serialization/solid/speed.dehydrate-plain-control.bench.ts
+++ b/benchmarks/ssr/scenarios/serialization/solid/speed.dehydrate-plain-control.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSerializationScenario,
runPlainSerializationLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertSerializationScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr dehydrate plain control (solid)',
- () => runPlainSerializationLoop(handler),
- serializationBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr dehydrate plain control (solid)', async () =>
+ runPlainSerializationLoop(handler),
+ ).run(serializationBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts
index 69b63cffe9..b9e25f918e 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 RichIdRouteImport } from './routes/rich.$id'
import { Route as PlainIdRouteImport } from './routes/plain.$id'
+import { Route as RichIdRouteImport } from './routes/rich.$id'
-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)
+const RichIdRoute = RichIdRouteImport.update({
+ id: '/rich/$id',
+ path: '/rich/$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 {
- '/rich/$id': {
- id: '/rich/$id'
- path: '/rich/$id'
- fullPath: '/rich/$id'
- preLoaderRoute: typeof RichIdRouteImport
- parentRoute: typeof rootRouteImport
- }
'/plain/$id': {
id: '/plain/$id'
path: '/plain/$id'
@@ -65,6 +58,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof PlainIdRouteImport
parentRoute: typeof rootRouteImport
}
+ '/rich/$id': {
+ id: '/rich/$id'
+ path: '/rich/$id'
+ fullPath: '/rich/$id'
+ preLoaderRoute: typeof RichIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts b/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts
index d68c615fdc..7f733dd601 100644
--- a/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSerializationScenario,
runRichSerializationLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertSerializationScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr dehydrate rich types (vue)',
- () => runRichSerializationLoop(handler),
- serializationBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr dehydrate rich types (vue)', async () =>
+ runRichSerializationLoop(handler),
+ ).run(serializationBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/serialization/vue/speed.dehydrate-plain-control.bench.ts b/benchmarks/ssr/scenarios/serialization/vue/speed.dehydrate-plain-control.bench.ts
index 875a858226..8efdeb6c79 100644
--- a/benchmarks/ssr/scenarios/serialization/vue/speed.dehydrate-plain-control.bench.ts
+++ b/benchmarks/ssr/scenarios/serialization/vue/speed.dehydrate-plain-control.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertSerializationScenario,
runPlainSerializationLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertSerializationScenario(handler)
-describe('ssr', () => {
- bench(
- 'ssr dehydrate plain control (vue)',
- () => runPlainSerializationLoop(handler),
- serializationBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr dehydrate plain control (vue)', async () =>
+ runPlainSerializationLoop(handler),
+ ).run(serializationBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts
index 149ff591ed..fa80cdb690 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnMultipartRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn multipart (react)',
- () => runServerFnMultipartRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn multipart (react)', async () =>
+ runServerFnMultipartRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-response.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-response.bench.ts
index 43b31c609d..fd535ee313 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-response.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-response.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnRawResponseRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn raw-response (react)',
- () => runServerFnRawResponseRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn raw-response (react)', async () =>
+ runServerFnRawResponseRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-stream.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-stream.bench.ts
index 4c90ffb847..8fbce405dd 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-stream.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-stream.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnRawStreamRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn raw-stream (react)',
- () => runServerFnRawStreamRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn raw-stream (react)', async () =>
+ runServerFnRawStreamRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts
index aaa2028902..adac07cb22 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnMultipartRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn multipart (solid)',
- () => runServerFnMultipartRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn multipart (solid)', async () =>
+ runServerFnMultipartRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-response.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-response.bench.ts
index 661430c3ae..843a4c97ce 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-response.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-response.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnRawResponseRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn raw-response (solid)',
- () => runServerFnRawResponseRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn raw-response (solid)', async () =>
+ runServerFnRawResponseRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-stream.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-stream.bench.ts
index 37d9b86e12..aa24d55e79 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-stream.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-stream.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnRawStreamRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn raw-stream (solid)',
- () => runServerFnRawStreamRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn raw-stream (solid)', async () =>
+ runServerFnRawStreamRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts
index 99d266298d..24305cf1bc 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnMultipartRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn multipart (vue)',
- () => runServerFnMultipartRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn multipart (vue)', async () =>
+ runServerFnMultipartRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-response.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-response.bench.ts
index 36e1b9ed22..2eeb9a4f6b 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-response.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-response.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnRawResponseRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn raw-response (vue)',
- () => runServerFnRawResponseRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn raw-response (vue)', async () =>
+ runServerFnRawResponseRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-stream.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-stream.bench.ts
index 4c9e5dc752..a73905004d 100644
--- a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-stream.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-stream.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnTransportScenario,
runServerFnRawStreamRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnTransportBench(handler)
await assertServerFnTransportScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn raw-stream (vue)',
- () => runServerFnRawStreamRequestLoop(handler, context),
- serverFnTransportBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn raw-stream (vue)', async () =>
+ runServerFnRawStreamRequestLoop(handler, context),
+ ).run(serverFnTransportBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts
index 697bfe967a..c876772ad1 100644
--- a/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnGetRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn GET (react)',
- () => runServerFnGetRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn GET (react)', async () =>
+ runServerFnGetRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-during-document-ssr.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-during-document-ssr.bench.ts
index 4b1c7c7d1e..6a0cb55f78 100644
--- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-during-document-ssr.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-during-document-ssr.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnDocumentSsrRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn during document ssr (react)',
- () => runServerFnDocumentSsrRequestLoop(handler),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn during document ssr (react)', async () =>
+ runServerFnDocumentSsrRequestLoop(handler),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-not-found.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-not-found.bench.ts
index 1f600dd8cf..96f1160078 100644
--- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-not-found.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-not-found.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnNotFoundRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn not-found (react)',
- () => runServerFnNotFoundRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn not-found (react)', async () =>
+ runServerFnNotFoundRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-post.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-post.bench.ts
index 0b4b3e5d6c..e85d5debd3 100644
--- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-post.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-post.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnPostRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn POST (react)',
- () => runServerFnPostRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn POST (react)', async () =>
+ runServerFnPostRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-redirect.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-redirect.bench.ts
index d07b4ab583..5dae598549 100644
--- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-redirect.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-redirect.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnRedirectRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn redirect (react)',
- () => runServerFnRedirectRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn redirect (react)', async () =>
+ runServerFnRedirectRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-send-context.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-send-context.bench.ts
index 589e2ccaf3..40d6961206 100644
--- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-send-context.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-send-context.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnSendContextRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn send-context (react)',
- () => runServerFnSendContextRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn send-context (react)', async () =>
+ runServerFnSendContextRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts
index 42e57c4ce2..f6bbdc9e73 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnGetRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn GET (solid)',
- () => runServerFnGetRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn GET (solid)', async () =>
+ runServerFnGetRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-during-document-ssr.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-during-document-ssr.bench.ts
index 1cbe7ef20b..933f61b59c 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-during-document-ssr.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-during-document-ssr.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnDocumentSsrRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn during document ssr (solid)',
- () => runServerFnDocumentSsrRequestLoop(handler),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn during document ssr (solid)', async () =>
+ runServerFnDocumentSsrRequestLoop(handler),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-not-found.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-not-found.bench.ts
index bd5cc10457..513b69f4ba 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-not-found.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-not-found.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnNotFoundRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn not-found (solid)',
- () => runServerFnNotFoundRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn not-found (solid)', async () =>
+ runServerFnNotFoundRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-post.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-post.bench.ts
index d2cf977cfa..e2ce8ad9ee 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-post.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-post.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnPostRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn POST (solid)',
- () => runServerFnPostRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn POST (solid)', async () =>
+ runServerFnPostRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-redirect.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-redirect.bench.ts
index 017ac79af0..14353f1290 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-redirect.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-redirect.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnRedirectRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn redirect (solid)',
- () => runServerFnRedirectRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn redirect (solid)', async () =>
+ runServerFnRedirectRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-send-context.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-send-context.bench.ts
index a3d0a991d1..76d3a554bd 100644
--- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-send-context.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-send-context.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnSendContextRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn send-context (solid)',
- () => runServerFnSendContextRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn send-context (solid)', async () =>
+ runServerFnSendContextRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
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 3db5e487b3..3d0bd34eaa 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 SsrCallIdRouteImport } from './routes/ssr-call.$id'
import { Route as ApiFnUrlsRouteImport } from './routes/api.fn-urls'
+import { Route as SsrCallIdRouteImport } from './routes/ssr-call.$id'
const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
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)
+const SsrCallIdRoute = SsrCallIdRouteImport.update({
+ id: '/ssr-call/$id',
+ path: '/ssr-call/$id',
+ getParentRoute: () => rootRouteImport,
+} as any)
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
@@ -68,13 +68,6 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
- '/ssr-call/$id': {
- id: '/ssr-call/$id'
- path: '/ssr-call/$id'
- fullPath: '/ssr-call/$id'
- preLoaderRoute: typeof SsrCallIdRouteImport
- parentRoute: typeof rootRouteImport
- }
'/api/fn-urls': {
id: '/api/fn-urls'
path: '/api/fn-urls'
@@ -82,6 +75,13 @@ declare module '@tanstack/solid-router' {
preLoaderRoute: typeof ApiFnUrlsRouteImport
parentRoute: typeof rootRouteImport
}
+ '/ssr-call/$id': {
+ id: '/ssr-call/$id'
+ path: '/ssr-call/$id'
+ fullPath: '/ssr-call/$id'
+ preLoaderRoute: typeof SsrCallIdRouteImport
+ parentRoute: typeof rootRouteImport
+ }
}
}
diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts
index c4d94659d9..3f67c1a500 100644
--- a/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnGetRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn GET (vue)',
- () => runServerFnGetRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn GET (vue)', async () =>
+ runServerFnGetRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-during-document-ssr.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-during-document-ssr.bench.ts
index c6155bcead..56c9addca5 100644
--- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-during-document-ssr.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-during-document-ssr.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnDocumentSsrRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn during document ssr (vue)',
- () => runServerFnDocumentSsrRequestLoop(handler),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn during document ssr (vue)', async () =>
+ runServerFnDocumentSsrRequestLoop(handler),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-not-found.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-not-found.bench.ts
index dca17511b8..e9a6e31617 100644
--- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-not-found.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-not-found.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnNotFoundRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn not-found (vue)',
- () => runServerFnNotFoundRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn not-found (vue)', async () =>
+ runServerFnNotFoundRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-post.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-post.bench.ts
index 4c2166056a..df9312ccd1 100644
--- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-post.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-post.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnPostRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn POST (vue)',
- () => runServerFnPostRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn POST (vue)', async () =>
+ runServerFnPostRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-redirect.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-redirect.bench.ts
index 25741baa62..67c4611644 100644
--- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-redirect.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-redirect.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnRedirectRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn redirect (vue)',
- () => runServerFnRedirectRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn redirect (vue)', async () =>
+ runServerFnRedirectRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-send-context.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-send-context.bench.ts
index c1c2d581ba..6f51ef4bab 100644
--- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-send-context.bench.ts
+++ b/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-send-context.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerFnScenario,
runServerFnSendContextRequestLoop,
@@ -16,10 +16,8 @@ const context = await setupServerFnBench(handler)
await assertServerFnScenario(handler, context)
-describe('ssr', () => {
- bench(
- 'ssr server-fn send-context (vue)',
- () => runServerFnSendContextRequestLoop(handler, context),
- serverFnBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-fn send-context (vue)', async () =>
+ runServerFnSendContextRequestLoop(handler, context),
+ ).run(serverFnBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts
index 8e96bc8e04..6331216522 100644
--- a/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerRouteMiddlewareResponse,
runServerRouteMiddlewareLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertServerRouteMiddlewareResponse(handler)
-describe('ssr', () => {
- bench(
- 'ssr server-route middleware (react)',
- () => runServerRouteMiddlewareLoop(handler),
- serverRouteMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-route middleware (react)', async () =>
+ runServerRouteMiddlewareLoop(handler),
+ ).run(serverRouteMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts
index 7e6fac4bbe..77d58e7b19 100644
--- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerRouteMiddlewareResponse,
runServerRouteMiddlewareLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertServerRouteMiddlewareResponse(handler)
-describe('ssr', () => {
- bench(
- 'ssr server-route middleware (solid)',
- () => runServerRouteMiddlewareLoop(handler),
- serverRouteMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-route middleware (solid)', async () =>
+ runServerRouteMiddlewareLoop(handler),
+ ).run(serverRouteMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts
index e67ca0a420..3d03b9c1fa 100644
--- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerRouteMiddlewareResponse,
runServerRouteMiddlewareLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertServerRouteMiddlewareResponse(handler)
-describe('ssr', () => {
- bench(
- 'ssr server-route middleware (vue)',
- () => runServerRouteMiddlewareLoop(handler),
- serverRouteMiddlewareBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-route middleware (vue)', async () =>
+ runServerRouteMiddlewareLoop(handler),
+ ).run(serverRouteMiddlewareBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts
index 1bdb7946b2..631314148a 100644
--- a/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerRouteResponse,
runServerRouteLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertServerRouteResponse(handler)
-describe('ssr', () => {
- bench(
- 'ssr server-route (react)',
- () => runServerRouteLoop(handler),
- serverRouteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-route (react)', async () =>
+ runServerRouteLoop(handler),
+ ).run(serverRouteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts
index ce3e1f8a21..4788d31854 100644
--- a/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerRouteResponse,
runServerRouteLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertServerRouteResponse(handler)
-describe('ssr', () => {
- bench(
- 'ssr server-route (solid)',
- () => runServerRouteLoop(handler),
- serverRouteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-route (solid)', async () =>
+ runServerRouteLoop(handler),
+ ).run(serverRouteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts
index f2b9e27acb..09c0bbe90b 100644
--- a/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertServerRouteResponse,
runServerRouteLoop,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertServerRouteResponse(handler)
-describe('ssr', () => {
- bench(
- 'ssr server-route (vue)',
- () => runServerRouteLoop(handler),
- serverRouteBenchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr server-route (vue)', async () =>
+ runServerRouteLoop(handler),
+ ).run(serverRouteBenchOptions)
})
diff --git a/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts b/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts
index c1dbf38ae5..eb4c9dc1d6 100644
--- a/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertStreamingSanity,
benchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertStreamingSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr streaming deferred (react)',
- () => runStreamingLoop(handler),
- benchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr streaming deferred (react)', async () =>
+ runStreamingLoop(handler),
+ ).run(benchOptions)
})
diff --git a/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts b/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts
index 0828715220..19d5817d32 100644
--- a/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertStreamingSanity,
benchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertStreamingSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr streaming deferred (solid)',
- () => runStreamingLoop(handler),
- benchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr streaming deferred (solid)', async () =>
+ runStreamingLoop(handler),
+ ).run(benchOptions)
})
diff --git a/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts b/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts
index a484f95d6a..42473fc694 100644
--- a/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts
+++ b/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import {
assertStreamingSanity,
benchOptions,
@@ -16,10 +16,8 @@ const { default: handler } = (await import(
await assertStreamingSanity(handler)
-describe('ssr', () => {
- bench(
- 'ssr streaming deferred (vue)',
- () => runStreamingLoop(handler),
- benchOptions,
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr streaming deferred (vue)', async () =>
+ runStreamingLoop(handler),
+ ).run(benchOptions)
})
diff --git a/benchmarks/ssr/solid/speed.bench.ts b/benchmarks/ssr/solid/speed.bench.ts
index 0c4317415d..2f72977612 100644
--- a/benchmarks/ssr/solid/speed.bench.ts
+++ b/benchmarks/ssr/solid/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import { runSsrRequestLoop } from '../bench-utils'
import type { StartRequestHandler } from '../bench-utils'
@@ -11,14 +11,12 @@ const { default: handler } = (await import(
default: StartRequestHandler
}
-describe('ssr', () => {
- bench(
- 'ssr request loop (solid)',
- () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),
- {
- warmupIterations: 100,
- time: 10_000,
- throws: true,
- },
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr request loop (solid)', async () =>
+ runSsrRequestLoop(handler, { seed: benchmarkSeed }),
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ throws: true,
+ })
})
diff --git a/benchmarks/ssr/vue/speed.bench.ts b/benchmarks/ssr/vue/speed.bench.ts
index 849f042e3c..57b59e0504 100644
--- a/benchmarks/ssr/vue/speed.bench.ts
+++ b/benchmarks/ssr/vue/speed.bench.ts
@@ -1,4 +1,4 @@
-import { bench, describe } from 'vitest'
+import { test } from 'vitest'
import { runSsrRequestLoop } from '../bench-utils'
import type { StartRequestHandler } from '../bench-utils'
@@ -11,14 +11,12 @@ const { default: handler } = (await import(
default: StartRequestHandler
}
-describe('ssr', () => {
- bench(
- 'ssr request loop (vue)',
- () => runSsrRequestLoop(handler, { seed: benchmarkSeed }),
- {
- warmupIterations: 100,
- time: 10_000,
- throws: true,
- },
- )
+test('ssr', async ({ bench }) => {
+ await bench('ssr request loop (vue)', async () =>
+ runSsrRequestLoop(handler, { seed: benchmarkSeed }),
+ ).run({
+ warmupIterations: 100,
+ time: 10_000,
+ throws: true,
+ })
})
diff --git a/docs/router/api/file-based-routing.md b/docs/router/api/file-based-routing.md
index ad3e07fad7..7c94d484d1 100644
--- a/docs/router/api/file-based-routing.md
+++ b/docs/router/api/file-based-routing.md
@@ -188,7 +188,7 @@ By default, this value is set to `false`.
### `autoCodeSplitting`
-This feature is only available if you are using the TanStack Router Bundler Plugin.
+This feature is only available if you are using the TanStack Router Bundler Plugin with Vite, Rspack/Rsbuild or Webpack. With Esbuild, setting it to `true` is an error.
This option is used to enable automatic code-splitting for non-critical route configuration items. See the "Automatic Code-Splitting" guide for more information.
diff --git a/docs/router/guide/automatic-code-splitting.md b/docs/router/guide/automatic-code-splitting.md
index be599845bc..859a19ff09 100644
--- a/docs/router/guide/automatic-code-splitting.md
+++ b/docs/router/guide/automatic-code-splitting.md
@@ -4,7 +4,7 @@ title: Automatic Code Splitting
The automatic code splitting feature in TanStack Router allows you to optimize your application's bundle size by lazily loading route components and their associated data. This is particularly useful for large applications where you want to minimize the initial load time by only loading the necessary code for the current route.
-To turn this feature on, simply set the `autoCodeSplitting` option to `true` in your bundler plugin configuration. This enables the router to automatically handle code splitting for your routes without requiring any additional setup.
+To turn this feature on, simply set the `autoCodeSplitting` option to `true` in your bundler plugin configuration. This enables the router to automatically handle code splitting for your routes without requiring any additional setup. It is available with Vite, Rspack/Rsbuild and Webpack, not with Esbuild.
```ts
// vite.config.ts
diff --git a/docs/router/guide/external-data-loading.md b/docs/router/guide/external-data-loading.md
index 664468752d..4ffb318686 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.
-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.
+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.
## To **Store** or to **Coordinate**?
diff --git a/docs/router/installation/with-esbuild.md b/docs/router/installation/with-esbuild.md
index b5cad0622c..8ecd9b8d0a 100644
--- a/docs/router/installation/with-esbuild.md
+++ b/docs/router/installation/with-esbuild.md
@@ -25,7 +25,6 @@ export default {
plugins: [
tanstackRouter({
target: 'react',
- autoCodeSplitting: true,
}),
],
}
@@ -50,10 +49,7 @@ const ctx = await esbuild.context({
format: 'esm',
target: ['esnext'],
sourcemap: true,
- plugins: [
- solidPlugin(),
- tanstackRouter({ target: 'solid', autoCodeSplitting: true }),
- ],
+ plugins: [solidPlugin(), tanstackRouter({ target: 'solid' })],
})
if (isDev) {
@@ -72,6 +68,9 @@ Or, you can clone our [Quickstart Esbuild example](https://github.com/TanStack/r
Now that you've added the plugin to your Esbuild configuration, you're all set to start using file-based routing with TanStack Router.
+> [!NOTE]
+> Automatic code splitting is not available with Esbuild: the plugin throws an error when `autoCodeSplitting` is `true`. Route generation works as usual. To split routes, use [manual code splitting](../guide/code-splitting.md) or another bundler.
+
## Ignoring the generated route tree file
If your project is configured to use a linter and/or formatter, you may want to ignore the generated route tree file. This file is managed by TanStack Router and therefore shouldn't be changed by your linter or formatter.
diff --git a/docs/start/config.json b/docs/start/config.json
index 8fa644fc1c..36af0e6e0d 100644
--- a/docs/start/config.json
+++ b/docs/start/config.json
@@ -36,6 +36,10 @@
{
"label": "Migrate from Next.js",
"to": "framework/react/migrate-from-next-js"
+ },
+ {
+ "label": "Migrate from the Release Candidate",
+ "to": "framework/react/migrate-from-release-candidate"
}
]
},
@@ -53,6 +57,10 @@
{
"label": "Build from Scratch",
"to": "framework/solid/build-from-scratch"
+ },
+ {
+ "label": "Migrate from the Release Candidate",
+ "to": "framework/solid/migrate-from-release-candidate"
}
]
}
diff --git a/docs/start/framework/react/guide/authentication-overview.md b/docs/start/framework/react/guide/authentication-overview.md
index a8ccd4bbb4..e80ba97f8c 100644
--- a/docs/start/framework/react/guide/authentication-overview.md
+++ b/docs/start/framework/react/guide/authentication-overview.md
@@ -116,7 +116,7 @@ Build your own authentication system using TanStack Start's server functions and
- **Full Control**: Complete customization over authentication flow
- **Server Primitives**: Sessions, OAuth, CSRF, rate limiting — see [Authentication Server Primitives](./authentication-server-primitives.md)
-- **Session Management**: HTTP-only cookies via `setResponseHeader`, read with `getRequestHeader`
+- **Session Management**: HTTP-only cookies written with `setCookie`, read with `getCookie`
- **Type Safety**: End-to-end type safety for authentication state
### 🌐 Other Excellent Options
diff --git a/docs/start/framework/react/guide/authentication-server-primitives.md b/docs/start/framework/react/guide/authentication-server-primitives.md
index 4fbd7e9e22..103e9c4455 100644
--- a/docs/start/framework/react/guide/authentication-server-primitives.md
+++ b/docs/start/framework/react/guide/authentication-server-primitives.md
@@ -28,47 +28,39 @@ Whichever you choose, the cookie flags matter:
```ts
// src/server/session.ts
import {
- getRequestHeader,
- setResponseHeader,
+ deleteCookie,
+ getCookie,
+ setCookie,
} from '@tanstack/react-start/server'
const SESSION_COOKIE = '__Host-session'
const ONE_DAY = 60 * 60 * 24
+const sessionCookieOptions = {
+ httpOnly: true,
+ secure: true,
+ sameSite: 'lax',
+ path: '/',
+} as const
+
export function setSessionCookie(token: string) {
- setResponseHeader(
- 'Set-Cookie',
- [
- `${SESSION_COOKIE}=${token}`,
- `HttpOnly`,
- `Secure`,
- `SameSite=Lax`,
- `Path=/`,
- `Max-Age=${ONE_DAY}`,
- ].join('; '),
- )
+ setCookie(SESSION_COOKIE, token, {
+ ...sessionCookieOptions,
+ maxAge: ONE_DAY,
+ })
}
export function clearSessionCookie() {
- setResponseHeader(
- 'Set-Cookie',
- `${SESSION_COOKIE}=; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=0`,
- )
+ deleteCookie(SESSION_COOKIE, sessionCookieOptions)
}
export function readSessionToken(): string | null {
- const header = getRequestHeader('cookie')
- if (!header) return null
- for (const part of header.split(/;\s*/)) {
- // Split only on the FIRST '=' — signed/base64 values often contain '='.
- const eq = part.indexOf('=')
- if (eq === -1) continue
- if (part.slice(0, eq) === SESSION_COOKIE) return part.slice(eq + 1)
- }
- return null
+ return getCookie(SESSION_COOKIE) ?? null
}
```
+Write cookies with `setCookie` (or `appendResponseHeader('set-cookie', serialized)` for a cookie that a library already serialized). Do not use `setResponseHeader('Set-Cookie', ...)` for this: it replaces every cookie on the outgoing response, including cookies set by other middleware or returned by a handler.
+
| Flag | Why |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `HttpOnly` | JavaScript can't read the cookie. An XSS bug can't exfiltrate the session. |
@@ -169,7 +161,7 @@ For OAuth authorization-code flow:
// src/server/oauth.functions.ts
import { createServerFn } from '@tanstack/react-start'
import { redirect } from '@tanstack/react-router'
-import { setResponseHeader } from '@tanstack/react-start/server'
+import { setCookie } from '@tanstack/react-start/server'
import crypto from 'node:crypto'
const OAUTH_STATE_COOKIE = '__Host-oauth'
@@ -190,10 +182,13 @@ export const startOAuth = createServerFn({ method: 'GET' }).handler(
crypto.createHash('sha256').update(verifier).digest(),
)
- setResponseHeader(
- 'Set-Cookie',
- `${OAUTH_STATE_COOKIE}=${signed({ state, verifier })}; HttpOnly; Secure; SameSite=Lax; Path=/; Max-Age=600`,
- )
+ setCookie(OAUTH_STATE_COOKIE, signed({ state, verifier }), {
+ httpOnly: true,
+ secure: true,
+ sameSite: 'lax',
+ path: '/',
+ maxAge: 600,
+ })
throw redirect({
href:
diff --git a/docs/start/framework/react/guide/authentication.md b/docs/start/framework/react/guide/authentication.md
index dd8adcebee..c77c681ee0 100644
--- a/docs/start/framework/react/guide/authentication.md
+++ b/docs/start/framework/react/guide/authentication.md
@@ -35,7 +35,7 @@ Authentication involves many considerations including password security, session
- **Authentication**: Who is this user? (Login/logout)
- **Authorization**: What can this user do? (Permissions/roles)
-TanStack Start provides the tools for both through server functions, sessions, and route protection.
+TanStack Start provides server functions, request and cookie utilities, and route protection. Session storage and authentication come from your application or a library you choose.
> Protect the data/API boundary first. Any server function, server route, or other API endpoint that returns or mutates private data must authorize the request itself. `beforeLoad` is useful for route UX: it keeps users out of screens they cannot use and avoids triggering work that would fail anyway. It is not the security boundary for the data. See [Authentication Server Primitives](./authentication-server-primitives.md) for the server-side pattern.
@@ -48,6 +48,7 @@ Server functions handle sensitive authentication logic securely on the server:
```tsx
import { createServerFn } from '@tanstack/react-start'
import { redirect } from '@tanstack/react-router'
+import { getAppSession } from '~/utils/session'
// Login server function
export const loginFn = createServerFn({ method: 'POST' })
@@ -61,11 +62,9 @@ export const loginFn = createServerFn({ method: 'POST' })
}
// Create session
- const session = await useAppSession()
- await session.update({
- userId: user.id,
- email: user.email,
- })
+ const session = await getAppSession()
+ session.userId = user.id
+ await session.save()
// Redirect to protected area
throw redirect({ to: '/dashboard' })
@@ -73,16 +72,16 @@ export const loginFn = createServerFn({ method: 'POST' })
// Logout server function
export const logoutFn = createServerFn({ method: 'POST' }).handler(async () => {
- const session = await useAppSession()
- await session.clear()
+ const session = await getAppSession()
+ session.destroy()
throw redirect({ to: '/' })
})
// Get current user
export const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(
async () => {
- const session = await useAppSession()
- const userId = session.data.userId
+ const session = await getAppSession()
+ const userId = session.userId
if (!userId) {
return null
@@ -96,33 +95,53 @@ export const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(
### 2. Session Management
-TanStack Start provides secure HTTP-only cookie sessions:
+Start does not provide a session API. This guide uses iron-session for encrypted cookie sessions. Start's cookie helpers connect it to server functions, server routes, and request middleware.
+
+For encrypted cookie sessions, install [iron-session](https://github.com/vvo/iron-session):
+
+```sh
+pnpm add iron-session
+```
+
+This example uses iron-session 9's cookie adapter. Its Node runtime requires Node 22.13 or newer; check the library's runtime requirements for other deployment targets.
```tsx
-// utils/session.ts
-import { useSession } from '@tanstack/react-start/server'
+// utils/session.ts — import only from server code
+import { getIronSession } from 'iron-session'
+import { getCookie, setCookie } from '@tanstack/react-start/server'
type SessionData = {
- userId?: string
- email?: string
- role?: string
+ userId: string
+ oauthState: string
}
-export function useAppSession() {
- return useSession({
- // Session configuration
- name: 'app-session',
- password: process.env.SESSION_SECRET!, // At least 32 characters
- // Optional: customize cookie settings
- cookie: {
- secure: process.env.NODE_ENV === 'production',
- sameSite: 'lax',
- httpOnly: true,
+export function getAppSession(ttl = 7 * 24 * 60 * 60) {
+ const password = process.env.SESSION_SECRET
+ if (!password || password.length < 32) {
+ throw new Error('SESSION_SECRET must be at least 32 characters')
+ }
+
+ return getIronSession(
+ { read: getCookie, write: setCookie },
+ {
+ cookieName: 'app-session',
+ password,
+ ttl,
+ cookieOptions: {
+ secure: process.env.NODE_ENV === 'production',
+ sameSite: 'lax',
+ httpOnly: true,
+ path: '/',
+ },
},
- })
+ )
}
```
+Read fields directly from the returned session, change them, then `await session.save()` before returning or redirecting. Missing or expired sessions have no user ID. `session.destroy()` removes the browser cookie. Keep one session object for the operation; another call to `getAppSession()` reads the incoming request again. For middleware, pass that object through request context when downstream code needs the same mutations.
+
+The `getAppSession` helper belongs to your application. Start does not cache sessions, choose expiration rules, or synchronize concurrent writes. Keep secrets and session objects in server code, and read request-specific configuration inside the active request.
+
### 3. Authentication Context
Load the current user in your root route's `beforeLoad` so the initial server render and child routes receive the same authentication state. `useServerFn` returns a callable function, not an object with `data`, `isLoading`, or `refetch`. You can call a server function directly from `beforeLoad`.
@@ -254,8 +273,9 @@ export const registerFn = createServerFn({ method: 'POST' })
})
// Create session
- const session = await useAppSession()
- await session.update({ userId: user.id })
+ const session = await getAppSession()
+ session.userId = user.id
+ await session.save()
return { success: true, user: { id: user.id, email: user.email } }
})
@@ -323,8 +343,9 @@ export const initiateOAuthFn = createServerFn({ method: 'POST' })
const state = generateRandomState()
// Store state in session for CSRF protection
- const session = await useAppSession()
- await session.update({ oauthState: state })
+ const session = await getAppSession()
+ session.oauthState = state
+ await session.save()
// Generate OAuth URL
const authUrl = generateOAuthUrl(provider, state)
@@ -387,21 +408,9 @@ const hashedPassword = await bcrypt.hash(password, saltRounds)
### 2. Session Security
-```tsx
-// Use secure session configuration
-export function useAppSession() {
- return useSession({
- name: 'app-session',
- password: process.env.SESSION_SECRET!, // 32+ characters
- cookie: {
- secure: process.env.NODE_ENV === 'production', // HTTPS only in production
- sameSite: 'lax', // CSRF protection
- httpOnly: true, // XSS protection
- maxAge: 7 * 24 * 60 * 60, // 7 days
- },
- })
-}
-```
+Set the library's server-validated expiration as well as appropriate cookie attributes. In the iron-session example, `ttl` limits a sealed credential's lifetime from its latest save; saving again renews it. A numeric `cookieOptions.maxAge` controls browser retention. In iron-session 9, explicitly setting `maxAge: undefined` also disables seal expiry; omit the property to use the configured `ttl`. Use an application-validated timestamp or a server-side record if you also need an absolute lifetime that writes cannot extend.
+
+Use `httpOnly`, `sameSite`, and `path` deliberately, and require `secure: true` on HTTPS deployments. These cookie attributes complement server-side authorization and CSRF protections. Keep only the minimum session data and load current account permissions from their authoritative store. Logout removes a stateless cookie from the current browser; it cannot revoke a copy without server-side state.
### 3. Rate Limiting
@@ -580,16 +589,14 @@ export const loginFn = createServerFn({ method: 'POST' })
)
.handler(async ({ data }) => {
const user = await authenticateUser(data.email, data.password)
- if (!user) return { error: 'Invalid credentials' }
+ if (!user) {
+ return { error: 'Invalid credentials' }
+ }
- const session = await useAppSession()
- await session.update(
- { userId: user.id },
- {
- // Extend session if remember me is checked
- maxAge: data.rememberMe ? 30 * 24 * 60 * 60 : undefined, // 30 days vs session
- },
- )
+ const ttl = data.rememberMe ? 30 * 24 * 60 * 60 : 8 * 60 * 60
+ const session = await getAppSession(ttl)
+ session.userId = user.id
+ await session.save()
return { success: true }
})
@@ -617,7 +624,6 @@ If you're migrating from client-side authentication (localStorage, context only)
### From Other Frameworks
- **Next.js**: Replace API routes with server functions, migrate NextAuth sessions
-- **Remix**: Convert loaders/actions to server functions, adapt session patterns
- **SvelteKit**: Move form actions to server functions, update route protection
## Production Considerations
diff --git a/docs/start/framework/react/guide/early-hints.md b/docs/start/framework/react/guide/early-hints.md
index a5913952e6..2341215022 100644
--- a/docs/start/framework/react/guide/early-hints.md
+++ b/docs/start/framework/react/guide/early-hints.md
@@ -164,6 +164,7 @@ Static Early Hints are collected from the final Start manifest resolved for the
- CDN URL rewrites are reflected in Early Hints.
- `crossOrigin` returned from `transformAssets` is reflected in Early Hints.
- JavaScript hints follow the client output format: `modulepreload` for module output, or `preload; as=script` for IIFE output.
+- JavaScript hints carry `fetchpriority=low`, matching the generated HTML preload links, so they don't compete with render-blocking stylesheets.
- Per-request transforms with `cache: false` are reflected in Early Hints for that request.
- Inlined CSS assets are skipped when Start's [CSS inlining](./css-styling#inline-route-css-in-production) build option inlines them into the HTML.
diff --git a/docs/start/framework/react/guide/environment-functions.md b/docs/start/framework/react/guide/environment-functions.md
index f472a3a26a..94fbb52501 100644
--- a/docs/start/framework/react/guide/environment-functions.md
+++ b/docs/start/framework/react/guide/environment-functions.md
@@ -121,3 +121,37 @@ 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 5b4a8c2661..2d02f881b3 100644
--- a/docs/start/framework/react/guide/hosting.md
+++ b/docs/start/framework/react/guide/hosting.md
@@ -116,6 +116,32 @@ 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_
@@ -475,7 +501,7 @@ In your Appwrite project, navigate to the **Sites** page from the sidebar. Click
3. Confirm the build settings:
- **Install command:** `npm install`
- **Build command:** `npm run build`
- - **Output directory:** `./dist` (if you're using Nitro v2 or v3, this should be `./.output`)
+ - **Output directory:** `./dist` (if you're using Nitro, this should be `./.output`)
4. Add any required **environment variables**
5. Click **Deploy**
diff --git a/docs/start/framework/react/guide/import-protection.md b/docs/start/framework/react/guide/import-protection.md
index 8bf47c729a..451d405f81 100644
--- a/docs/start/framework/react/guide/import-protection.md
+++ b/docs/start/framework/react/guide/import-protection.md
@@ -3,8 +3,6 @@ id: import-protection
title: Import Protection
---
-> **Experimental:** Import protection is experimental and subject to change.
-
Import protection prevents server-only code from leaking into client bundles and client-only code from leaking into server bundles. It runs inside TanStack Start and is enabled by default.
## How It Works
diff --git a/docs/start/framework/react/guide/path-aliases.md b/docs/start/framework/react/guide/path-aliases.md
index ff9735df83..bd75dc01ed 100644
--- a/docs/start/framework/react/guide/path-aliases.md
+++ b/docs/start/framework/react/guide/path-aliases.md
@@ -26,9 +26,7 @@ After updating your `tsconfig.json` file, configure your build tool so it resolv
# Vite
-## Vite 8
-
-Vite 8+ has [built-in support for path aliases](https://vite.dev/config/shared-options#resolve-tsconfigpaths), which is disabled by default. To enable it, simply add the following configuration to your `vite.config.ts` file:
+Vite has [built-in support for path aliases](https://vite.dev/config/shared-options#resolve-tsconfigpaths), which is disabled by default. To enable it, add the following configuration to your `vite.config.ts` file:
```ts
// vite.config.ts
@@ -42,31 +40,6 @@ export default defineConfig({
})
```
-## Vite 7 and earlier
-
-For Vite 7 and earlier, install the `vite-tsconfig-paths` plugin to enable path aliases in your TanStack Start project. You can do this by running the following command:
-
-```sh
-npm install -D vite-tsconfig-paths
-```
-
-Now, you'll need to update your `vite.config.ts` file to include the following:
-
-```ts
-// vite.config.ts
-import { defineConfig } from 'vite'
-import viteTsConfigPaths from 'vite-tsconfig-paths'
-
-export default defineConfig({
- plugins: [
- // this is the plugin that enables path aliases
- viteTsConfigPaths({
- projects: ['./tsconfig.json'],
- }),
- ],
-})
-```
-
# Rsbuild
Rsbuild reads the `paths` field from `tsconfig.json` by default. No extra config is needed when your aliases live in the root `tsconfig.json`.
diff --git a/docs/start/framework/react/guide/rendering-markdown.md b/docs/start/framework/react/guide/rendering-markdown.md
index 4258d6f4f1..bf644124d9 100644
--- a/docs/start/framework/react/guide/rendering-markdown.md
+++ b/docs/start/framework/react/guide/rendering-markdown.md
@@ -3,191 +3,85 @@ id: rendering-markdown
title: Rendering Markdown
---
-This guide covers two methods for importing and rendering markdown content in your TanStack Start application:
+Use [TanStack Markdown](https://tanstack.com/markdown/latest/docs/overview) to render Markdown in your TanStack Start application. Its React renderer works synchronously during server rendering and client navigation, so content does not need to wait for a client effect.
-1. **Static markdown** with `content-collections` for build-time loading (e.g., blog posts)
-2. **Dynamic markdown** fetched at runtime from GitHub or any remote source
+This guide covers static posts loaded with Content Collections and remote content fetched through a server function. Both use the same Markdown component.
-Both methods share a common rendering pipeline using the `unified` ecosystem.
+## Rendering Markdown
-## Setting Up the Markdown Processor
-
-Both approaches use the same markdown-to-HTML processing pipeline. First, install the required dependencies:
+Install TanStack Markdown:
```bash
-npm install unified remark-parse remark-gfm remark-rehype rehype-raw rehype-slug rehype-autolink-headings rehype-stringify shiki html-react-parser gray-matter
+npm install @tanstack/markdown
```
-Create a markdown processor utility:
-
-```tsx
-// src/utils/markdown.ts
-import { unified } from 'unified'
-import remarkParse from 'remark-parse'
-import remarkGfm from 'remark-gfm'
-import remarkRehype from 'remark-rehype'
-import rehypeRaw from 'rehype-raw'
-import rehypeSlug from 'rehype-slug'
-import rehypeAutolinkHeadings from 'rehype-autolink-headings'
-import rehypeStringify from 'rehype-stringify'
-
-export type MarkdownHeading = {
- id: string
- text: string
- level: number
-}
-
-export type MarkdownResult = {
- markup: string
- headings: Array
-}
-
-export async function renderMarkdown(content: string): Promise {
- const headings: Array = []
-
- const result = await unified()
- .use(remarkParse) // Parse markdown
- .use(remarkGfm) // Support GitHub Flavored Markdown
- .use(remarkRehype, { allowDangerousHtml: true }) // Convert to HTML AST
- .use(rehypeRaw) // Process raw HTML in markdown
- .use(rehypeSlug) // Add IDs to headings
- .use(rehypeAutolinkHeadings, {
- behavior: 'wrap',
- properties: { className: ['anchor'] },
- })
- .use(() => (tree) => {
- // Extract headings for table of contents
- const { visit } = require('unist-util-visit')
- const { toString } = require('hast-util-to-string')
-
- visit(tree, 'element', (node: any) => {
- if (['h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(node.tagName)) {
- headings.push({
- id: node.properties?.id || '',
- text: toString(node),
- level: parseInt(node.tagName.charAt(1), 10),
- })
- }
- })
- })
- .use(rehypeStringify) // Serialize to HTML string
- .process(content)
-
- return {
- markup: String(result),
- headings,
- }
-}
-```
-
-## Creating a Markdown Component
-
-Create a React component that renders the processed HTML with custom element handling:
+Create a shared component that accepts either Markdown source or a parsed document:
```tsx
// src/components/Markdown.tsx
-import parse, { type HTMLReactParserOptions, Element } from 'html-react-parser'
-import { renderMarkdown, type MarkdownResult } from '~/utils/markdown'
+import { Markdown as ReactMarkdown } from '@tanstack/markdown/react'
+import type { MarkdownDocument } from '@tanstack/markdown'
type MarkdownProps = {
- content: string
+ content: string | MarkdownDocument
className?: string
}
export function Markdown({ content, className }: MarkdownProps) {
- const [result, setResult] = useState(null)
-
- useEffect(() => {
- renderMarkdown(content).then(setResult)
- }, [content])
-
- if (!result) {
- return Loading...
- }
-
- const options: HTMLReactParserOptions = {
- replace: (domNode) => {
- if (domNode instanceof Element) {
- // Customize rendering of specific elements
- if (domNode.name === 'a') {
- // Handle links
- const href = domNode.attribs.href
- if (href?.startsWith('/')) {
- // Internal link - use your router's Link component
- return (
- {domToReact(domNode.children, options)}
- )
- }
- }
-
- if (domNode.name === 'img') {
- // Add lazy loading to images
- return (
-
- )
- }
- }
- },
- }
-
- return {parse(result.markup, options)}
+ return (
+
+ {content}
+
+ )
}
```
-## Method 1: Static Markdown with content-collections
+Headings receive stable IDs, and `headingAnchors` adds links to them. Raw HTML is escaped and unsafe URL protocols are removed by default. Keep these defaults for remote or user-written content. TanStack Markdown does not execute MDX or implement every CommonMark or GFM feature, so check the [supported syntax](https://tanstack.com/markdown/latest/docs/core-concepts/syntax-profile) when migrating existing content.
-The `content-collections` package is ideal for static content like blog posts that are included in your repository. It processes markdown files at build time and provides type-safe access to the content.
-
-### Installation
-
-```bash
-npm install @content-collections/core @content-collections/vite
-```
-
-### Configuration
-
-Create a `content-collections.ts` file in your project root:
+Use the `components` prop to customize elements, for example to lazy-load images:
```tsx
+
,
+ }}
+>
+ {content}
+
+```
+
+The examples below use `~/*` for the `src/*` import alias. The `prose` class is optional and requires your own typography styles, such as Tailwind Typography.
+
+## Static Markdown with Content Collections
+
+[Content Collections](https://www.content-collections.dev/docs/quickstart/tanstack-start) loads local Markdown files and validates their frontmatter. Pass the Markdown body from the generated collection to the shared renderer.
+
+### Installation and Configuration
+
+```bash
+npm install -D @content-collections/core @content-collections/vite zod
+```
+
+```ts
// content-collections.ts
import { defineCollection, defineConfig } from '@content-collections/core'
-import matter from 'gray-matter'
-
-function extractFrontMatter(content: string) {
- const { data, content: body, excerpt } = matter(content, { excerpt: true })
- return { data, body, excerpt: excerpt || '' }
-}
+import { z } from 'zod'
const posts = defineCollection({
name: 'posts',
- directory: './src/blog', // Directory containing your .md files
+ directory: './src/blog',
include: '*.md',
- schema: (z) => ({
+ schema: z.object({
title: z.string(),
- published: z.string().date(),
- description: z.string().optional(),
- authors: z.string().array(),
+ published: z.string().regex(/^\d{4}-\d{2}-\d{2}$/),
+ description: z.string(),
+ authors: z.array(z.string()),
+ content: z.string(),
+ }),
+ transform: (post) => ({
+ ...post,
+ slug: post._meta.path,
}),
- transform: ({ content, ...post }) => {
- const frontMatter = extractFrontMatter(content)
-
- // Extract header image (first image in the document)
- const headerImageMatch = content.match(/!\[([^\]]*)\]\(([^)]+)\)/)
- const headerImage = headerImageMatch ? headerImageMatch[2] : undefined
-
- return {
- ...post,
- slug: post._meta.path,
- excerpt: frontMatter.excerpt,
- description: frontMatter.data.description,
- headerImage,
- content: frontMatter.body,
- }
- },
})
export default defineConfig({
@@ -195,39 +89,55 @@ export default defineConfig({
})
```
-### Vite Integration
+Content Collections already separates frontmatter from `content`, so this transform does not need a second frontmatter parser.
-Add the content-collections plugin to your Vite config:
+Add the plugin to your existing Vite configuration, keeping any deployment plugins your app needs:
-```tsx
-// app.config.ts
-import { defineConfig } from '@tanstack/react-start/config'
+```ts
+// vite.config.ts
import contentCollections from '@content-collections/vite'
+import { tanstackStart } from '@tanstack/react-start/plugin/vite'
+import viteReact from '@vitejs/plugin-react'
+import { defineConfig } from 'vite'
+import tsConfigPaths from 'vite-tsconfig-paths'
export default defineConfig({
- vite: {
- plugins: [contentCollections()],
- },
+ plugins: [
+ contentCollections(),
+ tsConfigPaths({ projects: ['./tsconfig.json'] }),
+ tanstackStart(),
+ viteReact(),
+ ],
})
```
-### Creating Blog Posts
+Add the generated collection alias to your existing `tsconfig.json`:
-Create markdown files in your designated directory:
+```json
+{
+ "compilerOptions": {
+ "paths": {
+ "~/*": ["./src/*"],
+ "content-collections": ["./.content-collections/generated"]
+ }
+ }
+}
+```
+
+Add `.content-collections` to `.gitignore`. Starting the Vite dev server or running a build generates the collection.
+
+### Creating a Post
+
+Create `src/blog/hello-world.md`:
````markdown
-##
-
-title: Hello World
-published: 2024-01-15
-authors:
-
-- Jane Doe
- description: My first blog post
-
---
-
-
+title: Hello World
+published: '2026-01-15'
+description: My first blog post
+authors:
+ - Jane Doe
+---
Welcome to my blog! This is my first post.
@@ -240,13 +150,11 @@ console.log('Hello, world!')
```
````
-### Using the Collection
-
-Access your posts through the generated collection:
+### Listing Posts
```tsx
// src/routes/blog.index.tsx
-import { createFileRoute } from '@tanstack/react-router'
+import { createFileRoute, Link } from '@tanstack/react-router'
import { allPosts } from 'content-collections'
export const Route = createFileRoute('/blog/')({
@@ -254,31 +162,30 @@ export const Route = createFileRoute('/blog/')({
})
function BlogIndex() {
- // Posts are sorted by published date
- const sortedPosts = allPosts.sort(
- (a, b) => new Date(b.published).getTime() - new Date(a.published).getTime(),
+ const sortedPosts = [...allPosts].sort((a, b) =>
+ b.published.localeCompare(a.published),
)
return (
-
+
Blog
{sortedPosts.map((post) => (
-
-
{post.title}
- {post.excerpt}
- {post.published}
+ {post.title}
+ {post.description}
+
))}
-
+
)
}
```
-### Rendering a Single Post
+### Rendering a Post
```tsx
// src/routes/blog.$slug.tsx
@@ -288,7 +195,7 @@ import { Markdown } from '~/components/Markdown'
export const Route = createFileRoute('/blog/$slug')({
loader: ({ params }) => {
- const post = allPosts.find((p) => p.slug === params.slug)
+ const post = allPosts.find((post) => post.slug === params.slug)
if (!post) {
throw notFound()
}
@@ -302,202 +209,169 @@ function BlogPost() {
return (
-
+ {post.title}
+
+ By {post.authors.join(', ')} on {post.published}
+
)
}
```
-## Method 2: Dynamic Markdown from Remote Sources
+The renderer parses the Markdown synchronously and renders React elements on both the server and client.
-For content stored externally (like GitHub repositories), you can fetch and render markdown dynamically using server functions.
+## Remote Markdown with a Server Function
-### Creating a Fetch Utility
+Fetch remote content in a server function and parse it before returning it to the route. Install `gray-matter` if the remote files contain frontmatter:
-```tsx
-// src/utils/docs.server.ts
+```bash
+npm install gray-matter
+```
+
+Keep the repository, branch, and content directory in server code. Validate the requested filename before building the URL:
+
+```ts
+// src/utils/docs.ts
import { createServerFn } from '@tanstack/react-start'
+import { notFound } from '@tanstack/react-router'
+import { parseMarkdown } from '@tanstack/markdown/parser'
import matter from 'gray-matter'
-type FetchDocsParams = {
- repo: string // e.g., 'tanstack/router'
- branch: string // e.g., 'main'
- filePath: string // e.g., 'docs/guide/getting-started.md'
-}
-
export const fetchDocs = createServerFn({ method: 'GET' })
- .validator((params: FetchDocsParams) => params)
- .handler(async ({ data: { repo, branch, filePath } }) => {
- const url = `https://raw.githubusercontent.com/${repo}/${branch}/${filePath}`
-
- const response = await fetch(url, {
- headers: {
- // Add GitHub token for private repos or higher rate limits
- // Authorization: `token ${process.env.GITHUB_TOKEN}`,
- },
- })
+ .validator((slug: unknown) => {
+ if (typeof slug !== 'string' || !/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(slug)) {
+ throw new Error('Invalid document slug')
+ }
+ return slug
+ })
+ .handler(async ({ data: slug }) => {
+ // Replace this with your public repository's content directory.
+ const baseUrl =
+ 'https://raw.githubusercontent.com/your-org/your-repo/main/docs'
+ const response = await fetch(`${baseUrl}/${slug}.md`)
+ if (response.status === 404) {
+ throw notFound()
+ }
if (!response.ok) {
- throw new Error(`Failed to fetch: ${response.status}`)
+ throw new Error(`Failed to fetch document: ${response.status}`)
}
- const rawContent = await response.text()
- const { data: frontmatter, content } = matter(rawContent)
+ const { data, content } = matter(await response.text())
return {
- frontmatter,
- content,
- filePath,
+ title: typeof data.title === 'string' ? data.title : slug,
+ document: parseMarkdown(content),
}
})
```
-### Adding Cache Headers
-
-For production, add appropriate cache headers:
-
```tsx
-export const fetchDocs = createServerFn({ method: 'GET' })
- .validator((params: FetchDocsParams) => params)
- .handler(async ({ data: { repo, branch, filePath }, context }) => {
- // Set cache headers for CDN caching
- context.response.headers.set(
- 'Cache-Control',
- 'public, max-age=0, must-revalidate',
- )
- context.response.headers.set(
- 'CDN-Cache-Control',
- 'max-age=300, stale-while-revalidate=300',
- )
-
- // ... fetch logic
- })
-```
-
-### Using Dynamic Markdown in Routes
-
-```tsx
-// src/routes/docs.$path.tsx
+// src/routes/docs.$slug.tsx
import { createFileRoute } from '@tanstack/react-router'
-import { fetchDocs } from '~/utils/docs.server'
import { Markdown } from '~/components/Markdown'
+import { fetchDocs } from '~/utils/docs'
-export const Route = createFileRoute('/docs/$path')({
- loader: async ({ params }) => {
- return fetchDocs({
- data: {
- repo: 'your-org/your-repo',
- branch: 'main',
- filePath: `docs/${params.path}.md`,
- },
- })
- },
+export const Route = createFileRoute('/docs/$slug')({
+ loader: ({ params }) => fetchDocs({ data: params.slug }),
component: DocsPage,
})
function DocsPage() {
- const { frontmatter, content } = Route.useLoaderData()
+ const { title, document } = Route.useLoaderData()
return (
- {frontmatter.title}
-
+ {title}
+
)
}
```
-### Fetching Directory Contents
+Relative Markdown links and image URLs resolve against your app's URL, not the source repository. Use app-relative or absolute URLs in the content, or transform them for your site's route and asset layout.
-To build navigation from a GitHub directory:
+## Syntax Highlighting with TanStack Highlight
-```tsx
-// src/utils/docs.server.ts
-type GitHubContent = {
- name: string
- path: string
- type: 'file' | 'dir'
-}
+Install [TanStack Highlight](https://tanstack.com/highlight/latest/docs/overview). The Markdown adapter requires version `0.0.6` or newer:
-export const fetchRepoContents = createServerFn({ method: 'GET' })
- .validator((params: { repo: string; branch: string; path: string }) => params)
- .handler(async ({ data: { repo, branch, path } }) => {
- const url = `https://api.github.com/repos/${repo}/contents/${path}?ref=${branch}`
-
- const response = await fetch(url, {
- headers: {
- Accept: 'application/vnd.github.v3+json',
- // Authorization: `token ${process.env.GITHUB_TOKEN}`,
- },
- })
-
- if (!response.ok) {
- throw new Error(`Failed to fetch contents: ${response.status}`)
- }
-
- const contents: Array = await response.json()
-
- return contents
- .filter((item) => item.type === 'file' && item.name.endsWith('.md'))
- .map((item) => ({
- name: item.name.replace('.md', ''),
- path: item.path,
- }))
- })
+```bash
+npm install @tanstack/highlight
```
-## Adding Syntax Highlighting with Shiki
+Register the languages your content uses and create the Markdown adapter:
-For code blocks with syntax highlighting, integrate Shiki into your markdown processor:
+```ts
+// src/utils/markdown-highlighter.ts
+import { createHighlighter } from '@tanstack/highlight/core'
+import { js } from '@tanstack/highlight/languages/js'
+import { plaintext } from '@tanstack/highlight/languages/plaintext'
+import { ts } from '@tanstack/highlight/languages/ts'
+import { tsx } from '@tanstack/highlight/languages/tsx'
+import { createTanStackMarkdownHighlighter } from '@tanstack/highlight/markdown'
-```tsx
-// src/utils/markdown.ts
-import { codeToHtml } from 'shiki'
+const highlighter = createHighlighter({
+ languages: [plaintext, js, ts, tsx],
+})
-// Process code blocks after parsing
-export async function highlightCode(
- code: string,
- language: string,
-): Promise {
- return codeToHtml(code, {
- lang: language,
- themes: {
- light: 'github-light',
- dark: 'tokyo-night',
- },
- })
-}
+export const highlightMarkdownCode =
+ createTanStackMarkdownHighlighter(highlighter)
```
-Then handle code blocks in your Markdown component:
+Update the shared component to pass the highlighter and include its theme styles:
```tsx
-// In your Markdown component's replace function
-if (domNode.name === 'pre') {
- const codeElement = domNode.children.find(
- (child) => child instanceof Element && child.name === 'code',
+// src/components/Markdown.tsx
+import { createThemeCss } from '@tanstack/highlight/theme'
+import { githubDarkTheme } from '@tanstack/highlight/themes/github-dark'
+import { githubLightTheme } from '@tanstack/highlight/themes/github-light'
+import { Markdown as ReactMarkdown } from '@tanstack/markdown/react'
+import type { MarkdownDocument } from '@tanstack/markdown'
+import { highlightMarkdownCode } from '~/utils/markdown-highlighter'
+
+const themeCss = createThemeCss({
+ light: githubLightTheme,
+ dark: githubDarkTheme,
+ lightSelector: '.markdown-renderer',
+ darkSelector: '.dark .markdown-renderer',
+ codeBlockSelector: '.markdown-renderer pre.tm-code',
+ lineNumbersSelector: '.markdown-renderer .tm-code--line-numbers',
+})
+
+type MarkdownProps = {
+ content: string | MarkdownDocument
+ className?: string
+}
+
+export function Markdown({ content, className }: MarkdownProps) {
+ return (
+
+
+
+ {content}
+
+
)
- if (codeElement) {
- const className = codeElement.attribs.class || ''
- const language = className.replace('language-', '') || 'text'
- const code = getText(codeElement)
-
- return
- }
}
```
-## Summary
+The adapter returns escaped token markup inside the renderer's own `` elements. Unknown languages fall back to plain text. Add a `dark` class to an ancestor to select the dark theme. See the [syntax highlighting guide](https://tanstack.com/markdown/latest/docs/guides/syntax-highlighting) for line numbers and highlighted lines.
-| Approach | Best For | Pros | Cons |
-| ------------------- | ----------------------------------------- | ---------------------------------------------- | ----------------------------------------- |
-| content-collections | Blog posts, static docs bundled with app | Type-safe, build-time processing, fast runtime | Requires rebuild for content updates |
-| Dynamic fetching | External docs, frequently updated content | Always fresh, no rebuild needed | Runtime overhead, requires error handling |
+## Table of Contents
-Choose the approach that best fits your content update frequency and deployment workflow. For hybrid scenarios, you can use both methods in the same application.
+To collect headings, add the docs preset when parsing the document:
+
+```ts
+import { docsMarkdownExtensions } from '@tanstack/markdown/extensions/docs'
+import { parseMarkdown } from '@tanstack/markdown/parser'
+
+const document = parseMarkdown(content, {
+ extensions: docsMarkdownExtensions(),
+})
+
+const headings = document.headings ?? []
+// Each heading has an id, text, and level.
+```
+
+Use this in the server function, then render links to each heading's `id`. The [docs preset guide](https://tanstack.com/markdown/latest/docs/guides/docs-preset) also covers callouts and custom comment components. Those features need the same extensions passed to the renderer.
diff --git a/docs/start/framework/react/guide/server-components.md b/docs/start/framework/react/guide/server-components.md
index 356c901dee..581ae145bd 100644
--- a/docs/start/framework/react/guide/server-components.md
+++ b/docs/start/framework/react/guide/server-components.md
@@ -86,7 +86,7 @@ export default defineConfig({
-**Requirements:** React 19+, Vite 7+ or Rsbuild 2+
+**Requirements:** React 19+, Vite 8+ or Rsbuild 2+
## Quick Start
diff --git a/docs/start/framework/react/guide/server-entry-point.md b/docs/start/framework/react/guide/server-entry-point.md
index 127b04fc86..5f74eb7846 100644
--- a/docs/start/framework/react/guide/server-entry-point.md
+++ b/docs/start/framework/react/guide/server-entry-point.md
@@ -4,35 +4,71 @@ title: Server Entry Point
---
> [!NOTE]
-> The server entry point is **optional** out of the box. If not provided, TanStack Start will automatically handle the server entry point for you using the below as a default.
+> A custom server entry point is **optional**. Without one, TanStack Start uses its built-in entry, which renders requests and converts uncaught errors into HTTP responses automatically.
The Server Entry Point supports the universal fetch handler format, commonly used by [Cloudflare Workers](https://developers.cloudflare.com/workers/runtime-apis/handlers/fetch/) and other WinterCG-compatible runtimes.
-To ensure interoperability, the default export must conform to our `ServerEntry` interface:
-
-```ts
-export default {
- fetch(req: Request, opts?: RequestOptions): Response | Promise {
- // ...
- },
-}
-```
-
-TanStack Start exposes a wrapper to make creation type-safe. This is done in the `src/server.ts` file.
+The default export must provide a `fetch` method that accepts a `Request` and Start's request options, then returns a `Response` or `Promise`. Use `createServerEntry` to infer these types and keep the complete callback inside the request's context, including custom error handling. For example, this custom `src/server.ts` delegates to the built-in entry:
```tsx
// src/server.ts
import handler, { createServerEntry } from '@tanstack/react-start/server-entry'
export default createServerEntry({
- fetch(request) {
- return handler.fetch(request)
+ fetch(request, opts) {
+ return handler.fetch(request, opts)
},
})
```
Whether we are statically generating our app or serving it dynamically, the `server.ts` file is the entry point for doing all SSR-related work as well as for handling server routes and server function requests.
+## Configuring a Custom Server Entry
+
+Start automatically detects `src/server.ts`. If that file is absent, it uses the built-in entry. For a custom entry at another path, configure `server.entry` in your bundler plugin. This path is resolved relative to `srcDirectory`, which defaults to `src`.
+
+
+
+# Vite
+
+```ts title="vite.config.ts"
+import { defineConfig } from 'vite'
+import { tanstackStart } from '@tanstack/react-start/plugin/vite'
+import viteReact from '@vitejs/plugin-react'
+
+export default defineConfig({
+ plugins: [
+ tanstackStart({
+ server: {
+ entry: './server-entry.ts',
+ },
+ }),
+ viteReact(),
+ ],
+})
+```
+
+# Rsbuild
+
+```ts title="rsbuild.config.ts"
+import { defineConfig } from '@rsbuild/core'
+import { pluginReact } from '@rsbuild/plugin-react'
+import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
+
+export default defineConfig({
+ plugins: [
+ pluginReact(),
+ tanstackStart({
+ server: {
+ entry: './server-entry.ts',
+ },
+ }),
+ ],
+})
+```
+
+
+
## Custom Server Handlers
You can create custom server handlers to modify how your application is rendered:
@@ -51,16 +87,155 @@ const customHandler = defineHandlerCallback((ctx) => {
return defaultStreamHandler(ctx)
})
-const fetch = createStartHandler(customHandler)
+const startHandler = createStartHandler(customHandler)
export default createServerEntry({
- fetch,
+ fetch(request, opts) {
+ return startHandler(request, opts)
+ },
})
```
+## Error Handling
+
+The built-in entry uses `createServerEntry` to catch errors that escape the Start handler and call `handleStartError(error)` inside the active request context. This works without a custom `src/server.ts`. Response helpers such as `setResponseStatus`, `setResponseHeader`, and `setCookie` are applied to the error response.
+
+For an uncaught error, Start returns a generic JSON error body with status `500` unless a response helper or HTTP-style error property supplies an error status. A thrown `Response` keeps its body and response metadata, with response helpers applied, and loses its body for `HEAD` requests and for statuses `204`, `205`, and `304`, including one selected by a helper. The generic error body Start generates always uses an error status, so only `HEAD` removes it.
+
+For example, a request to this server route returns `401` with a `WWW-Authenticate` header:
+
+```tsx
+// src/routes/api/protected.ts
+import { createFileRoute } from '@tanstack/react-router'
+import { createMiddleware } from '@tanstack/react-start'
+import {
+ setResponseHeader,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+
+const authMiddleware = createMiddleware().server(() => {
+ setResponseStatus(401, 'Unauthorized')
+ setResponseHeader('www-authenticate', 'Bearer')
+ throw new Error('Unauthorized')
+})
+
+export const Route = createFileRoute('/api/protected')({
+ server: {
+ middleware: [authMiddleware],
+ handlers: {
+ GET: () => new Response('Protected content'),
+ },
+ },
+})
+```
+
+Error conversion preserves:
+
+- Error statuses (`400`-`599`) and their status text from `setResponseStatus`
+- Header operations from the response helpers
+- Cookies from `setCookie` and `appendResponseHeader('set-cookie', ...)`, including multiple `Set-Cookie` headers
+- HTTP-style error metadata such as `error.status`, `error.statusText`, `error.headers`, and `error.cause.headers`
+
+Start builds a new JSON body for an error, so it never copies the framing and connection headers `Content-Length`, `Content-Encoding`, `Transfer-Encoding`, `Trailer`, `Connection`, `Keep-Alive`, `Proxy-Connection`, and `TE` from error metadata. When `error.cause` is a `Response`, such as a failed upstream `fetch` from any fetch implementation, Start uses its status and status text but none of its headers, because they were written for that upstream reply.
+
+Explicit helper error statuses, their status text, and header operations take precedence over error metadata. An error response only uses an error status (`400`-`599`). A status set with `setResponseStatus` before the error applies only when it is an error status. A success, redirect, or bodyless status such as `200`, `201`, `302`, or `204` describes the response that the failure replaced, so Start discards it together with its status text and uses the error's own status or `500`. Error metadata such as `error.status` or `error.statusCode` likewise applies only when it is `400` or higher.
+
+Start logs the error to the server console unless the error's own metadata marks it as an HTTP error with a status of `400` or higher, even when a helper selected the status. The generic JSON body does not expose the error's message or stack.
+
+Errors that Router handles through route error components do not reach this top-level catch. Server function calls and their request middleware use a separate error response path that preserves the RPC serialization protocol. Failures during initialization, before that path is established, fall back to the top-level error response. Errors in a streamed body after the entry has returned its `Response` cannot replace that response's status or headers.
+
+You can use `createServerEntry` with your own `try`/`catch`, including for error reporting with Sentry. Your catch runs first; the wrapper converts only errors that escape your callback. Call the handler returned by `createStartHandler(...)` inside that catch, because it rethrows the original uncaught value:
+
+```tsx
+// src/server.ts
+import {
+ createStartHandler,
+ defaultStreamHandler,
+ handleStartError,
+} from '@tanstack/react-start/server'
+import { createServerEntry } from '@tanstack/react-start/server-entry'
+
+const startHandler = createStartHandler(defaultStreamHandler)
+
+export default createServerEntry({
+ async fetch(request, opts) {
+ try {
+ return await startHandler(request, opts)
+ } catch (error) {
+ // Report the original error here, for example to Sentry.
+ return handleStartError(error)
+ }
+ },
+})
+```
+
+After reporting, choose how to finish the catch:
+
+- Return `handleStartError(error)` to obtain Start's error response explicitly.
+- Rethrow `error` to let `createServerEntry` produce that same error response.
+- Return your own `Response` to choose its body, status, and headers.
+
+All three options keep `createServerEntry` and its request context. The first two preserve Start's response-helper state.
+
+The wrapper creates the request context before calling your `fetch` callback. The entire callback, including its own catch and code after `await`, runs inside that context. Calling the Start handler with the same `Request` reuses it. `handleStartError` therefore uses the correct request's state even when the thrown value is a primitive, or several requests throw the same `Error` object. Start does not attach request state to errors or remember them for a later catch. A catch outside this wrapper cannot recover a completed request's helper state from the error.
+
+The default export from `@tanstack/react-start/server-entry` is already wrapped. Calling its `fetch` method converts uncaught errors before an outer catch can see them. Use the handler returned by `createStartHandler(...)` inside your callback when you need to catch the original error, as above.
+
+Delegating to the default entry or another wrapped entry with the same `Request` object shares the current request context. A cloned or rewritten `Request` starts a separate context. When passing a new request to a raw `createStartHandler` handler, wrap that invocation with `createServerEntry` too, so errors are converted before leaving the new context:
+
+```tsx
+import {
+ createStartHandler,
+ defaultStreamHandler,
+} from '@tanstack/react-start/server'
+import { createServerEntry } from '@tanstack/react-start/server-entry'
+
+const rewrittenEntry = createServerEntry({
+ fetch: createStartHandler(defaultStreamHandler),
+})
+
+export default createServerEntry({
+ fetch(request, opts) {
+ const url = new URL(request.url)
+ if (url.pathname === '/legacy-home') {
+ url.pathname = '/'
+ }
+ return rewrittenEntry.fetch(new Request(url, request), opts)
+ },
+})
+```
+
+The rewritten request owns its response helper state. Catching a raw rewritten handler's error only in the original request's scope would not recover the rewritten request's headers or cookies.
+
+To replace an uncaught error response completely, return your own response from the custom catch:
+
+```tsx
+// src/server.ts
+import {
+ createStartHandler,
+ defaultStreamHandler,
+} from '@tanstack/react-start/server'
+import { createServerEntry } from '@tanstack/react-start/server-entry'
+
+const startHandler = createStartHandler(defaultStreamHandler)
+
+export default createServerEntry({
+ async fetch(request, opts) {
+ try {
+ return await startHandler(request, opts)
+ } catch (error) {
+ console.error(error)
+ return new Response('Internal Server Error', { status: 500 })
+ }
+ },
+})
+```
+
+`createServerEntry` returns custom responses as-is, whether they come from a catch or a successful callback. Such responses do not automatically inherit helper state. Likewise, helper writes after `await handler.fetch(...)` are not automatically applied to its returned response; modify that response directly or put the helper writes in Start middleware. Call `handleStartError` in a catch when the error response should inherit helper state.
+
## Request context
-When your server needs to pass additional, typed data into request handlers (for example, authenticated user info, a database connection, or per-request flags), register a request context type via TypeScript module augmentation. The registered context is delivered as the second argument to the server `fetch` handler and is available throughout the server-side middleware chain — including global middleware, request/function middleware, server routes, server functions, and the router itself.
+When your server needs to pass additional, typed data into request handlers (for example, authenticated user info, a database connection, or per-request flags), register a request context type via TypeScript module augmentation. Pass the runtime values through the `context` property of the second argument to `handler.fetch`. Type registration does not create these values. The context is available throughout the server-side middleware chain — including global middleware, request/function middleware, server routes, server functions, and the router itself.
To add types for your request context, augment the `Register` interface from `@tanstack/react-router` with a `server.requestContext` property. The runtime `context` you pass to `handler.fetch` will then match that type. Example:
@@ -81,8 +256,11 @@ declare module '@tanstack/react-router' {
}
export default createServerEntry({
- async fetch(request) {
- return handler.fetch(request, { context: { hello: 'world', foo: 123 } })
+ fetch(request, opts) {
+ return handler.fetch(request, {
+ ...opts,
+ context: { hello: 'world', foo: 123 },
+ })
},
})
```
diff --git a/docs/start/framework/react/guide/server-functions.md b/docs/start/framework/react/guide/server-functions.md
index 903e5d7b86..879aa9e867 100644
--- a/docs/start/framework/react/guide/server-functions.md
+++ b/docs/start/framework/react/guide/server-functions.md
@@ -390,7 +390,7 @@ Stream typed data from server functions to the client. See the [Streaming Data f
### Raw Responses
-Return `Response` objects binary data, or custom content types.
+Return a `Response` for binary data or custom content types, and the call resolves with it. Throw a `Response` instead to reject the call with it. Either way, the caller receives its body and headers, and its status unless a response helper set one. The browser follows a `Response` with a redirect status and a `Location` header before the caller sees it, so use `redirect()` to send the user elsewhere.
### Progressive Enhancement
@@ -425,7 +425,9 @@ Customization:
You can customize function ID generation for the production build by providing a `generateFunctionId` function when configuring the TanStack Start build tool plugin.
-Prefer deterministic inputs (filename + functionName) so IDs remain stable between builds.
+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.
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 7797ae306b..dec42ca26c 100644
--- a/docs/start/framework/react/guide/tanstack-query.md
+++ b/docs/start/framework/react/guide/tanstack-query.md
@@ -1,6 +1,12 @@
---
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 5739846a95..dc5377df08 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 11:
+Use Node 24 or newer and pnpm 12:
```sh
git clone --depth 1 https://github.com/TanStack/router.git
@@ -22,7 +22,7 @@ cd examples/react/start-next-migration
Follow the example's [README](https://github.com/TanStack/router/blob/main/examples/react/start-next-migration/README.md) to set `SESSION_PASSWORD` and `DEMO_PASSWORD`. Run `pnpm dev:next` at `http://localhost:3100` and `pnpm dev` in another terminal at `http://localhost:3101`.
-The example's single account is `reader@example.com`. It stores one saved-article flag in a session cookie so you can exercise a protected mutation without connecting a database. It is not a production authentication implementation. The two apps use different session formats and cookie names, so sign in separately to each.
+The example's single account is `reader@example.com`. It stores one saved-article flag in a session cookie so you can exercise a protected mutation without connecting a database. It is not a production authentication implementation. Both apps use iron-session with different cookie names, so sign in separately to each.
With those ports free, run:
@@ -148,7 +148,7 @@ Next.js Action forms and these Start event-handler forms have different no-JavaS
Follow the [authentication guide](./guide/authentication) for the route-context pattern. Check sessions on the server for private reads and mutations. A hidden button or a client route guard is not authorization.
-The example deliberately changes from `iron-session` with Next.js `cookies()` to Start's `useSession`. Existing cookies are not assumed to be compatible. A real migration can keep its existing auth provider or session service and adapt the request boundary instead. If sessions must survive cutover or rollback, verify cookie names, domains, paths, signing/encryption formats, expiration, key rotation, and logout in both deployments.
+The example keeps `iron-session` and replaces Next.js `cookies()` with a small adapter using Start's `getCookie` and `setCookie`. Start does not provide a session API. The example uses different cookie names to keep its two local apps independent; sharing a library alone does not make every session configuration compatible. A real migration can keep its existing auth provider or session service and adapt the request boundary instead. If sessions must survive cutover or rollback, verify cookie names, domains, paths, signing/encryption formats, expiration, key rotation, and logout in both deployments.
Private pages need a cache policy that prevents another user receiving personalized HTML. The Start reference returns `Cache-Control: private, no-store` for `/saved`. Check the final response through your deployment and CDN, including after sign-in and sign-out. Do not prerender or publicly cache pages that include private account data.
diff --git a/docs/start/framework/react/migrate-from-release-candidate.md b/docs/start/framework/react/migrate-from-release-candidate.md
new file mode 100644
index 0000000000..5cfa614cda
--- /dev/null
+++ b/docs/start/framework/react/migrate-from-release-candidate.md
@@ -0,0 +1,39 @@
+---
+id: migrate-from-release-candidate
+title: Migrate from the Release Candidate
+description: Upgrade a TanStack Start release-candidate app to the first stable release, 1.169.
+---
+
+`@tanstack/react-start` 1.169 is the first stable release of TanStack Start. Upgrading from a release candidate means replacing the removed APIs below and checking the behavior changes that apply to your app.
+
+## Vite 8
+
+Start requires Vite 8 when you build with Vite. Upgrade with Vite's [migration guide](https://vite.dev/guide/migration).
+
+## Removed APIs
+
+| Removed | Use instead |
+| ------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `@tanstack/nitro-v2-vite-plugin` | `nitro()` from `nitro/vite`. See [Nitro hosting](./guide/hosting#nitro). |
+| `useSession` | A session library such as iron-session. See [Session Management](./guide/authentication#2-session-management). The new library cannot read existing Start session cookies: use a new cookie name and sign users in again, or test a migration that reads the old cookies first. |
+| `.inputValidator()` on server functions and middleware | `.validator()`, which takes the same validator. |
+
+## Errors
+
+- A handler returned by `createStartHandler(...)` now rethrows the original error. `createServerEntry` converts errors to responses, and the built-in entry already uses it. In a custom entry, catch inside the `createServerEntry` callback and `return handleStartError(error)` or rethrow. See [Error Handling](./guide/server-entry-point#error-handling).
+- Uncaught errors produce a generic JSON body with a status from `400` to `599` (`500` by default), even if a success status was set before the error. Return a `Response` when an endpoint needs a specific error payload.
+- A server-function call rejects with whatever was thrown, including a `Response` and falsy values such as `undefined`. Return a `Response` to resolve the call with it. See [Raw Responses](./guide/server-functions#raw-responses).
+- Errors thrown by request middleware during a server-function call are sent to the client with their message, and their status is no longer always `500`.
+
+## Responses
+
+- Response helpers override the response you return or throw. `setResponseStatus(401)` followed by returning a `200` response sends `401`.
+- `setResponseHeader('set-cookie', cookie)` replaces all outgoing cookies. Use `setCookie` or `appendResponseHeader('set-cookie', cookie)` to add one.
+- `setResponseStatus` ignores codes outside `200`-`599` and warns outside production.
+- Serialized server-function replies never carry `Location`, `Content-Encoding`, or `Content-Length` from helpers, and ignore a helper `204`, `205`, or `304`. Use `redirect()` to redirect.
+
+## Requests and middleware
+
+- `getRequestHeader(name)` returns `''` for a header that is present but empty, and `undefined` only when it is missing.
+- A path with invalid percent-encoding, such as `/%E0%A4%A`, gets `400 Bad Request` before your server entry or middleware runs.
+- When no function middleware sends context, `sendContext` is `undefined` instead of `{}`.
diff --git a/docs/start/framework/react/overview.md b/docs/start/framework/react/overview.md
index 596dc77fe9..ced7b65458 100644
--- a/docs/start/framework/react/overview.md
+++ b/docs/start/framework/react/overview.md
@@ -5,9 +5,7 @@ description: Build full-stack React applications with TanStack Start, including
---
> [!NOTE]
-> TanStack Start is currently in the **Release Candidate** stage! This means it is considered feature-complete and its API is considered stable.
-> **This does not mean it is bug-free or without issues, which is why we invite you to try it out and provide feedback!**
-> The road to v1 will likely be a quick one, so don't wait too long to try it out!
+> TanStack Start is stable. If you're upgrading from a release candidate, follow [Migrate from the Release Candidate](./migrate-from-release-candidate).
TanStack Start is a full-stack React framework powered by TanStack Router. It provides a full-document SSR, streaming, server functions, client/server builds, and more. With [Vite](https://vite.dev/) and [Rsbuild](https://rsbuild.dev/) support, it's ready to develop and deploy to the hosting provider or runtime you want.
diff --git a/docs/start/framework/solid/guide/authentication.md b/docs/start/framework/solid/guide/authentication.md
index 4460e853ae..460a58747c 100644
--- a/docs/start/framework/solid/guide/authentication.md
+++ b/docs/start/framework/solid/guide/authentication.md
@@ -35,7 +35,7 @@ Authentication involves many considerations including password security, session
- **Authentication**: Who is this user? (Login/logout)
- **Authorization**: What can this user do? (Permissions/roles)
-TanStack Start provides the tools for both through server functions, sessions, and route protection.
+TanStack Start provides server functions, request and cookie utilities, and route protection. Session storage and authentication come from your application or a library you choose.
> Protect the data/API boundary first. Any server function, server route, or other API endpoint that returns or mutates private data must authorize the request itself. `beforeLoad` is useful for route UX: it keeps users out of screens they cannot use and avoids triggering work that would fail anyway. It is not the security boundary for the data. See [Authentication Server Primitives](./authentication-server-primitives.md) for the server-side pattern.
@@ -48,6 +48,7 @@ Server functions handle sensitive authentication logic securely on the server:
```tsx
import { createServerFn } from '@tanstack/solid-start'
import { redirect } from '@tanstack/solid-router'
+import { getAppSession } from '~/utils/session'
// Login server function
export const loginFn = createServerFn({ method: 'POST' })
@@ -61,11 +62,9 @@ export const loginFn = createServerFn({ method: 'POST' })
}
// Create session
- const session = await useAppSession()
- await session.update({
- userId: user.id,
- email: user.email,
- })
+ const session = await getAppSession()
+ session.userId = user.id
+ await session.save()
// Redirect to protected area
throw redirect({ to: '/dashboard' })
@@ -73,16 +72,16 @@ export const loginFn = createServerFn({ method: 'POST' })
// Logout server function
export const logoutFn = createServerFn({ method: 'POST' }).handler(async () => {
- const session = await useAppSession()
- await session.clear()
+ const session = await getAppSession()
+ session.destroy()
throw redirect({ to: '/' })
})
// Get current user
export const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(
async () => {
- const session = await useAppSession()
- const userId = session.get('userId')
+ const session = await getAppSession()
+ const userId = session.userId
if (!userId) {
return null
@@ -96,33 +95,53 @@ export const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(
### 2. Session Management
-TanStack Start provides secure HTTP-only cookie sessions:
+Start does not provide a session API. This guide uses iron-session for encrypted cookie sessions. Start's cookie helpers connect it to server functions, server routes, and request middleware.
+
+For encrypted cookie sessions, install [iron-session](https://github.com/vvo/iron-session):
+
+```sh
+pnpm add iron-session
+```
+
+This example uses iron-session 9's cookie adapter. Its Node runtime requires Node 22.13 or newer; check the library's runtime requirements for other deployment targets.
```tsx
-// utils/session.ts
-import { useSession } from '@tanstack/solid-start/server'
+// utils/session.ts — import only from server code
+import { getIronSession } from 'iron-session'
+import { getCookie, setCookie } from '@tanstack/solid-start/server'
type SessionData = {
- userId?: string
- email?: string
- role?: string
+ userId: string
+ oauthState: string
}
-export function useAppSession() {
- return useSession({
- // Session configuration
- name: 'app-session',
- password: process.env.SESSION_SECRET!, // At least 32 characters
- // Optional: customize cookie settings
- cookie: {
- secure: process.env.NODE_ENV === 'production',
- sameSite: 'lax',
- httpOnly: true,
+export function getAppSession(ttl = 7 * 24 * 60 * 60) {
+ const password = process.env.SESSION_SECRET
+ if (!password || password.length < 32) {
+ throw new Error('SESSION_SECRET must be at least 32 characters')
+ }
+
+ return getIronSession(
+ { read: getCookie, write: setCookie },
+ {
+ cookieName: 'app-session',
+ password,
+ ttl,
+ cookieOptions: {
+ secure: process.env.NODE_ENV === 'production',
+ sameSite: 'lax',
+ httpOnly: true,
+ path: '/',
+ },
},
- })
+ )
}
```
+Read fields directly from the returned session, change them, then `await session.save()` before returning or redirecting. Missing or expired sessions have no user ID. `session.destroy()` removes the browser cookie. Keep one session object for the operation; another call to `getAppSession()` reads the incoming request again. For middleware, pass that object through request context when downstream code needs the same mutations.
+
+The `getAppSession` helper belongs to your application. Start does not cache sessions, choose expiration rules, or synchronize concurrent writes. Keep secrets and session objects in server code, and read request-specific configuration inside the active request.
+
### 3. Authentication Context
Load the current user in your root route's `beforeLoad` so the initial server render and child routes receive the same authentication state. `useServerFn` returns a callable function, not an object with `data`, `isLoading`, or `refetch`. You can call a server function directly from `beforeLoad`.
@@ -254,8 +273,9 @@ export const registerFn = createServerFn({ method: 'POST' })
})
// Create session
- const session = await useAppSession()
- await session.update({ userId: user.id })
+ const session = await getAppSession()
+ session.userId = user.id
+ await session.save()
return { success: true, user: { id: user.id, email: user.email } }
})
@@ -323,8 +343,9 @@ export const initiateOAuthFn = createServerFn({ method: 'POST' })
const state = generateRandomState()
// Store state in session for CSRF protection
- const session = await useAppSession()
- await session.update({ oauthState: state })
+ const session = await getAppSession()
+ session.oauthState = state
+ await session.save()
// Generate OAuth URL
const authUrl = generateOAuthUrl(provider, state)
@@ -387,21 +408,9 @@ const hashedPassword = await bcrypt.hash(password, saltRounds)
### 2. Session Security
-```tsx
-// Use secure session configuration
-export function useAppSession() {
- return useSession({
- name: 'app-session',
- password: process.env.SESSION_SECRET!, // 32+ characters
- cookie: {
- secure: process.env.NODE_ENV === 'production', // HTTPS only in production
- sameSite: 'lax', // CSRF protection
- httpOnly: true, // XSS protection
- maxAge: 7 * 24 * 60 * 60, // 7 days
- },
- })
-}
-```
+Set the library's server-validated expiration as well as appropriate cookie attributes. In the iron-session example, `ttl` limits a sealed credential's lifetime from its latest save; saving again renews it. A numeric `cookieOptions.maxAge` controls browser retention. In iron-session 9, explicitly setting `maxAge: undefined` also disables seal expiry; omit the property to use the configured `ttl`. Use an application-validated timestamp or a server-side record if you also need an absolute lifetime that writes cannot extend.
+
+Use `httpOnly`, `sameSite`, and `path` deliberately, and require `secure: true` on HTTPS deployments. These cookie attributes complement server-side authorization and CSRF protections. Keep only the minimum session data and load current account permissions from their authoritative store. Logout removes a stateless cookie from the current browser; it cannot revoke a copy without server-side state.
### 3. Rate Limiting
@@ -581,16 +590,14 @@ export const loginFn = createServerFn({ method: 'POST' })
)
.handler(async ({ data }) => {
const user = await authenticateUser(data.email, data.password)
- if (!user) return { error: 'Invalid credentials' }
+ if (!user) {
+ return { error: 'Invalid credentials' }
+ }
- const session = await useAppSession()
- await session.update(
- { userId: user.id },
- {
- // Extend session if remember me is checked
- maxAge: data.rememberMe ? 30 * 24 * 60 * 60 : undefined, // 30 days vs session
- },
- )
+ const ttl = data.rememberMe ? 30 * 24 * 60 * 60 : 8 * 60 * 60
+ const session = await getAppSession(ttl)
+ session.userId = user.id
+ await session.save()
return { success: true }
})
@@ -610,7 +617,6 @@ If you're migrating from client-side authentication (localStorage, context only)
### From Other Frameworks
- **Next.js**: Replace API routes with server functions, migrate NextAuth sessions
-- **Remix**: Convert loaders/actions to server functions, adapt session patterns
- **SvelteKit**: Move form actions to server functions, update route protection
## Production Considerations
diff --git a/docs/start/framework/solid/migrate-from-release-candidate.md b/docs/start/framework/solid/migrate-from-release-candidate.md
new file mode 100644
index 0000000000..9f988a14fc
--- /dev/null
+++ b/docs/start/framework/solid/migrate-from-release-candidate.md
@@ -0,0 +1,8 @@
+---
+ref: docs/start/framework/react/migrate-from-release-candidate.md
+replace:
+ {
+ '@tanstack/react-start': '@tanstack/solid-start',
+ '@tanstack/react-router': '@tanstack/solid-router',
+ }
+---
diff --git a/e2e/react-router/basic-esbuild-file-based/src/esbuild.config.js b/e2e/react-router/basic-esbuild-file-based/src/esbuild.config.js
index 5f0f4fce03..954ddc026f 100644
--- a/e2e/react-router/basic-esbuild-file-based/src/esbuild.config.js
+++ b/e2e/react-router/basic-esbuild-file-based/src/esbuild.config.js
@@ -2,9 +2,5 @@ import { tanstackRouter } from '@tanstack/router-plugin/esbuild'
export default {
// ...
- plugins: [
- tanstackRouter({
- autoCodeSplitting: true,
- }),
- ],
+ plugins: [tanstackRouter()],
}
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 0d17f94eb0..83b504992f 100644
--- a/e2e/react-router/basic-file-based/src/routeTree.gen.ts
+++ b/e2e/react-router/basic-file-based/src/routeTree.gen.ts
@@ -1711,7 +1711,7 @@ declare module '@tanstack/react-router' {
'/(group)/_layout': {
id: '/(group)/_layout'
path: ''
- fullPath: ''
+ fullPath: '/'
preLoaderRoute: typeof groupLayoutRouteImport
parentRoute: typeof rootRouteImport
}
diff --git a/e2e/react-router/basic/package.json b/e2e/react-router/basic/package.json
index 667b016896..4ff68f5cda 100644
--- a/e2e/react-router/basic/package.json
+++ b/e2e/react-router/basic/package.json
@@ -17,7 +17,8 @@
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "catalog:",
- "tailwindcss": "^4.2.2"
+ "tailwindcss": "^4.2.2",
+ "zod": "catalog:"
},
"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 36e5106654..49fa054776 100644
--- a/e2e/react-router/basic/src/main.tsx
+++ b/e2e/react-router/basic/src/main.tsx
@@ -1,3 +1,5 @@
+import { useState } from 'react'
+import { createPortal } from 'react-dom'
import ReactDOM from 'react-dom/client'
import {
ErrorComponent,
@@ -9,12 +11,19 @@ import {
createRouter,
redirect,
} from '@tanstack/react-router'
-import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
+import {
+ TanStackRouterDevtoolsInProd as TanStackRouterDevtools,
+ TanStackRouterDevtoolsPanelInProd as TanStackRouterDevtoolsPanel,
+} from '@tanstack/react-router-devtools'
+import { z } from 'zod'
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 (
@@ -27,6 +36,8 @@ const rootRoute = createRootRoute({
})
function RootComponent() {
+ const { devtools } = rootRoute.useSearch()
+
return (
<>
@@ -86,12 +97,57 @@ 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
new file mode 100644
index 0000000000..b8a7e803e6
--- /dev/null
+++ b/e2e/react-router/basic/tests/devtools.spec.ts
@@ -0,0 +1,42 @@
+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/rspack-basic-file-based/package.json b/e2e/react-router/rspack-basic-file-based/package.json
index 4bff5e7801..5ec9ed9862 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.1.0",
+ "@rsbuild/core": "^2.3.1",
"@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 efd3f6e2c3..30c62d0af1 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.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
diff --git a/e2e/react-start/basic-auth/package.json b/e2e/react-start/basic-auth/package.json
index 5539513ff2..f7ff609e76 100644
--- a/e2e/react-start/basic-auth/package.json
+++ b/e2e/react-start/basic-auth/package.json
@@ -19,6 +19,7 @@
"@tanstack/react-router": "workspace:^",
"@tanstack/react-router-devtools": "workspace:^",
"@tanstack/react-start": "workspace:^",
+ "iron-session": "^9.0.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"redaxios": "catalog:",
diff --git a/e2e/react-start/basic-auth/src/routes/__root.tsx b/e2e/react-start/basic-auth/src/routes/__root.tsx
index 76e5f8b1d6..fb7868435d 100644
--- a/e2e/react-start/basic-auth/src/routes/__root.tsx
+++ b/e2e/react-start/basic-auth/src/routes/__root.tsx
@@ -14,18 +14,18 @@ import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary.js'
import { NotFound } from '~/components/NotFound.js'
import appCss from '~/styles/app.css?url'
import { seo } from '~/utils/seo.js'
-import { useAppSession } from '~/utils/session.js'
+import { getAppSession } from '~/utils/session.js'
const fetchUser = createServerFn({ method: 'GET' }).handler(async () => {
// We need to auth on the server so we have access to secure cookies
- const session = await useAppSession()
+ const session = await getAppSession()
- if (!session.data.userEmail) {
+ if (!session.userEmail) {
return null
}
return {
- email: session.data.userEmail,
+ email: session.userEmail,
}
})
diff --git a/e2e/react-start/basic-auth/src/routes/_authed.tsx b/e2e/react-start/basic-auth/src/routes/_authed.tsx
index 0d87cfbacb..fe73185136 100644
--- a/e2e/react-start/basic-auth/src/routes/_authed.tsx
+++ b/e2e/react-start/basic-auth/src/routes/_authed.tsx
@@ -3,7 +3,7 @@ import { createServerFn } from '@tanstack/react-start'
import { hashPassword, prismaClient } from '~/utils/prisma'
import { Login } from '~/components/Login'
-import { useAppSession } from '~/utils/session'
+import { getAppSession } from '~/utils/session'
export const loginFn = createServerFn({
method: 'POST',
@@ -37,12 +37,11 @@ export const loginFn = createServerFn({
}
// Create a session
- const session = await useAppSession()
+ const session = await getAppSession()
// Store the user's email in the session
- await session.update({
- userEmail: user.email,
- })
+ session.userEmail = user.email
+ await session.save()
})
export const Route = createFileRoute('/_authed')({
diff --git a/e2e/react-start/basic-auth/src/routes/logout.tsx b/e2e/react-start/basic-auth/src/routes/logout.tsx
index a08f9c737e..0f86b0d4e3 100644
--- a/e2e/react-start/basic-auth/src/routes/logout.tsx
+++ b/e2e/react-start/basic-auth/src/routes/logout.tsx
@@ -1,12 +1,12 @@
import { redirect, createFileRoute } from '@tanstack/react-router'
import { createServerFn } from '@tanstack/react-start'
-import { useAppSession } from '~/utils/session'
+import { getAppSession } from '~/utils/session'
const logoutFn = createServerFn({ method: 'POST' }).handler(async () => {
- const session = await useAppSession()
+ const session = await getAppSession()
- session.clear()
+ session.destroy()
throw redirect({
href: '/',
diff --git a/e2e/react-start/basic-auth/src/routes/signup.tsx b/e2e/react-start/basic-auth/src/routes/signup.tsx
index 817362dc05..d7d5d40129 100644
--- a/e2e/react-start/basic-auth/src/routes/signup.tsx
+++ b/e2e/react-start/basic-auth/src/routes/signup.tsx
@@ -4,7 +4,7 @@ import { createServerFn, useServerFn } from '@tanstack/react-start'
import { hashPassword, prismaClient } from '~/utils/prisma'
import { useMutation } from '~/hooks/useMutation'
import { Auth } from '~/components/Auth'
-import { useAppSession } from '~/utils/session'
+import { getAppSession } from '~/utils/session'
export const signupFn = createServerFn({
method: 'POST',
@@ -24,7 +24,7 @@ export const signupFn = createServerFn({
const password = await hashPassword(payload.password)
// Create a session
- const session = await useAppSession()
+ const session = await getAppSession()
if (found) {
if (found.password !== password) {
@@ -36,9 +36,8 @@ export const signupFn = createServerFn({
}
// Store the user's email in the session
- await session.update({
- userEmail: found.email,
- })
+ session.userEmail = found.email
+ await session.save()
// Redirect to the prev page stored in the "redirect" search param
throw redirect({
@@ -55,9 +54,8 @@ export const signupFn = createServerFn({
})
// Store the user's email in the session
- await session.update({
- userEmail: user.email,
- })
+ session.userEmail = user.email
+ await session.save()
// Redirect to the prev page stored in the "redirect" search param
throw redirect({
diff --git a/e2e/react-start/basic-auth/src/utils/session.ts b/e2e/react-start/basic-auth/src/utils/session.ts
index c38bac1e48..f1deacf85b 100644
--- a/e2e/react-start/basic-auth/src/utils/session.ts
+++ b/e2e/react-start/basic-auth/src/utils/session.ts
@@ -1,13 +1,25 @@
-// src/services/session.server.ts
-import { useSession } from '@tanstack/react-start/server'
+import { getIronSession } from 'iron-session'
+import { getCookie, setCookie } from '@tanstack/react-start/server'
import type { User } from '@prisma/client'
type SessionUser = {
userEmail: User['email']
}
-export function useAppSession() {
- return useSession({
- password: 'ChangeThisBeforeShippingToProdOrYouWillBeFired',
- })
+export function getAppSession() {
+ return getIronSession(
+ { read: getCookie, write: setCookie },
+ {
+ cookieName: 'test-auth-session',
+ // This fixture only runs locally with test credentials.
+ password: 'local-e2e-only-session-password-at-least-32-characters',
+ ttl: 60 * 60,
+ cookieOptions: {
+ httpOnly: true,
+ secure: false,
+ sameSite: 'lax',
+ path: '/',
+ },
+ },
+ )
}
diff --git a/e2e/react-start/basic-cloudflare/tests/app.spec.ts b/e2e/react-start/basic-cloudflare/tests/app.spec.ts
index add28cb73e..c9497070dd 100644
--- a/e2e/react-start/basic-cloudflare/tests/app.spec.ts
+++ b/e2e/react-start/basic-cloudflare/tests/app.spec.ts
@@ -1,3 +1,5 @@
+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'
@@ -29,3 +31,19 @@ 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/package.json b/e2e/react-start/basic-react-query/package.json
index 56af87c1bf..ee37b82ba6 100644
--- a/e2e/react-start/basic-react-query/package.json
+++ b/e2e/react-start/basic-react-query/package.json
@@ -32,7 +32,7 @@
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"tailwindcss": "^4.2.2",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
diff --git a/e2e/react-start/basic-tsr-config/package.json b/e2e/react-start/basic-tsr-config/package.json
index b3367d05d4..99e681ac9d 100644
--- a/e2e/react-start/basic-tsr-config/package.json
+++ b/e2e/react-start/basic-tsr-config/package.json
@@ -21,7 +21,7 @@
"@types/node": "^22.10.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/e2e/react-start/basic/package.json b/e2e/react-start/basic/package.json
index a729a0d532..3a1a4ea9c8 100644
--- a/e2e/react-start/basic/package.json
+++ b/e2e/react-start/basic/package.json
@@ -22,6 +22,7 @@
"@tanstack/react-start": "workspace:^",
"express": "^5.2.1",
"http-proxy-middleware": "^3.0.5",
+ "iron-session": "^9.0.1",
"js-cookie": "^3.0.5",
"react": "^19.0.0",
"react-dom": "^19.0.0",
@@ -30,7 +31,7 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
@@ -41,7 +42,7 @@
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
"combinate": "^1.1.11",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"tailwindcss": "^4.2.2",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
@@ -49,6 +50,18 @@
"zod": "^4.4.3"
},
"nx": {
+ "targets": {
+ "test:e2e--vite-spa--dev": {
+ "dependsOn": [
+ "^build"
+ ]
+ },
+ "test:e2e--rsbuild-spa--dev": {
+ "dependsOn": [
+ "^build"
+ ]
+ }
+ },
"metadata": {
"playwrightModes": [
{
@@ -59,6 +72,14 @@
"toolchain": "vite",
"mode": "spa"
},
+ {
+ "toolchain": "vite",
+ "mode": "spa",
+ "name": "dev",
+ "env": {
+ "E2E_DEV_SERVER": "true"
+ }
+ },
{
"toolchain": "vite",
"mode": "prerender",
@@ -86,6 +107,14 @@
"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 bdf5fd74ca..bb4c2cb761 100644
--- a/e2e/react-start/basic/playwright.config.ts
+++ b/e2e/react-start/basic/playwright.config.ts
@@ -5,6 +5,8 @@ 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}`
@@ -12,12 +14,26 @@ 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 commandByMode = mode === 'preview' ? previewCommand : 'pnpm start'
+const devCommand =
+ toolchain === 'rsbuild'
+ ? `pnpm dev:rsbuild --port ${PORT}`
+ : `pnpm dev:vite --port ${PORT}`
+const commandByMode = devServer
+ ? devCommand
+ : 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 d5416aa352..b6603dd01d 100644
--- a/e2e/react-start/basic/src/routeTree.gen.ts
+++ b/e2e/react-start/basic/src/routeTree.gen.ts
@@ -15,6 +15,8 @@ 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'
@@ -113,6 +115,16 @@ 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',
@@ -479,6 +491,8 @@ 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
@@ -551,6 +565,8 @@ 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
@@ -620,6 +636,8 @@ 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
@@ -697,6 +715,8 @@ export interface FileRouteTypes {
| '/auth-docs'
| '/client-only'
| '/deferred'
+ | '/execution-local'
+ | '/execution-rpc'
| '/inline-scripts'
| '/links'
| '/plain-ts-type-assertion'
@@ -769,6 +789,8 @@ export interface FileRouteTypes {
| '/auth-docs'
| '/client-only'
| '/deferred'
+ | '/execution-local'
+ | '/execution-rpc'
| '/inline-scripts'
| '/links'
| '/plain-ts-type-assertion'
@@ -837,6 +859,8 @@ export interface FileRouteTypes {
| '/auth-docs'
| '/client-only'
| '/deferred'
+ | '/execution-local'
+ | '/execution-rpc'
| '/inline-scripts'
| '/links'
| '/plain-ts-type-assertion'
@@ -914,6 +938,8 @@ 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
@@ -979,6 +1005,20 @@ 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'
@@ -1729,6 +1769,8 @@ 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 d8fc0d3b24..ed521817d6 100644
--- a/e2e/react-start/basic/src/routes/__root.tsx
+++ b/e2e/react-start/basic/src/routes/__root.tsx
@@ -197,6 +197,9 @@ 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
new file mode 100644
index 0000000000..f934015522
--- /dev/null
+++ b/e2e/react-start/basic/src/routes/execution-rpc.tsx
@@ -0,0 +1,18 @@
+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/auth-docs.ts b/e2e/react-start/basic/src/utils/auth-docs.ts
index c5f0f11645..22b36ee808 100644
--- a/e2e/react-start/basic/src/utils/auth-docs.ts
+++ b/e2e/react-start/basic/src/utils/auth-docs.ts
@@ -1,18 +1,29 @@
import { createServerFn } from '@tanstack/react-start'
import { redirect } from '@tanstack/react-router'
-import { useSession } from '@tanstack/react-start/server'
+import { getCookie, setCookie } from '@tanstack/react-start/server'
+import { getIronSession } from 'iron-session'
function getSession() {
- return useSession<{ email?: string }>({
- name: 'auth-docs-test',
- password: 'authentication-docs-browser-test-secret-only-2026',
- })
+ return getIronSession<{ email: string }>(
+ { read: getCookie, write: setCookie },
+ {
+ cookieName: 'auth-docs-test',
+ password: 'authentication-docs-browser-test-secret-only-2026',
+ ttl: 60 * 60,
+ cookieOptions: {
+ httpOnly: true,
+ secure: false,
+ sameSite: 'lax',
+ path: '/',
+ },
+ },
+ )
}
export const getCurrentUserFn = createServerFn({ method: 'GET' }).handler(
async () => {
const session = await getSession()
- return session.data.email ? { email: session.data.email } : null
+ return session.email ? { email: session.email } : null
},
)
@@ -27,20 +38,21 @@ export const loginFn = createServerFn({ method: 'POST' })
return { error: 'Invalid credentials' }
}
const session = await getSession()
- await session.update({ email: data.email })
+ session.email = data.email
+ await session.save()
throw redirect({ to: '/auth-docs/private' })
})
export const logoutFn = createServerFn({ method: 'POST' }).handler(async () => {
const session = await getSession()
- await session.clear()
+ session.destroy()
throw redirect({ to: '/auth-docs' })
})
export const getPrivateDataFn = createServerFn({ method: 'GET' }).handler(
async () => {
const session = await getSession()
- if (!session.data.email) {
+ if (!session.email) {
throw new Error('Unauthorized')
}
return 'Private account data'
diff --git a/e2e/react-start/basic/src/utils/execution-functions.ts b/e2e/react-start/basic/src/utils/execution-functions.ts
new file mode 100644
index 0000000000..97e66573d8
--- /dev/null
+++ b/e2e/react-start/basic/src/utils/execution-functions.ts
@@ -0,0 +1,5 @@
+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 a3b6f99442..299744f636 100644
--- a/e2e/react-start/basic/tests/client-only.spec.ts
+++ b/e2e/react-start/basic/tests/client-only.spec.ts
@@ -1,5 +1,6 @@
import { expect } from '@playwright/test'
import { test } from '@tanstack/router-e2e-utils'
+import { isSpaMode } from './utils/isSpaMode'
/**
* These tests verify the compiler optimization.
@@ -15,7 +16,15 @@ import { test } from '@tanstack/router-e2e-utils'
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
new file mode 100644
index 0000000000..410b1d999e
--- /dev/null
+++ b/e2e/react-start/basic/tests/environment-functions.spec.ts
@@ -0,0 +1,46 @@
+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
new file mode 100644
index 0000000000..d16ff0bb54
--- /dev/null
+++ b/e2e/react-start/basic/tests/setup/dev-server.setup.ts
@@ -0,0 +1,19 @@
+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
new file mode 100644
index 0000000000..f42195e762
--- /dev/null
+++ b/e2e/react-start/basic/tests/spa-shell.spec.ts
@@ -0,0 +1,53 @@
+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/package.json b/e2e/react-start/csp/package.json
index 341afdf406..fd8987bcef 100644
--- a/e2e/react-start/csp/package.json
+++ b/e2e/react-start/csp/package.json
@@ -22,7 +22,7 @@
"@types/node": "^22.10.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14"
diff --git a/e2e/react-start/css-inline/package.json b/e2e/react-start/css-inline/package.json
index 02371eab4e..6c5dd031c6 100644
--- a/e2e/react-start/css-inline/package.json
+++ b/e2e/react-start/css-inline/package.json
@@ -20,11 +20,11 @@
"express": "^5.2.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
- "srvx": "^0.11.9"
+ "srvx": "^1.0.0"
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
diff --git a/e2e/react-start/css-modules/.gitignore b/e2e/react-start/css-modules/.gitignore
index 229709a89d..a1fbca128d 100644
--- a/e2e/react-start/css-modules/.gitignore
+++ b/e2e/react-start/css-modules/.gitignore
@@ -3,3 +3,4 @@ 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
new file mode 100644
index 0000000000..e2bd5e13f1
--- /dev/null
+++ b/e2e/react-start/css-modules/cloudflare.config.ts
@@ -0,0 +1,11 @@
+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 3f730fc38d..25c11d7321 100644
--- a/e2e/react-start/css-modules/package.json
+++ b/e2e/react-start/css-modules/package.json
@@ -12,6 +12,8 @@
"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",
@@ -19,13 +21,16 @@
"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",
"test:e2e": "pnpm run test:e2e:dev && pnpm run test:e2e:prod",
"test:e2e:nitro": "pnpm run test:e2e:dev:nitro",
"test:e2e:basepath": "pnpm run test:e2e:dev:basepath",
- "_test:e2e:cloudflare": "echo 'Cloudflare dev mode disabled - React duplication issues' && exit 0"
+ "_test:e2e:cloudflare": "echo 'Cloudflare dev mode disabled - React duplication issues' && exit 0",
+ "build:rsbuild": "rsbuild build && tsc --noEmit"
},
"dependencies": {
"@tanstack/react-router": "workspace:*",
@@ -36,17 +41,36 @@
"devDependencies": {
"@cloudflare/vite-plugin": "^1.29.0",
"@playwright/test": "^1.61.0",
+ "@rsbuild/core": "^2.3.1",
+ "@rsbuild/plugin-react": "^2.0.0",
+ "@rsbuild/plugin-sass": "^2.0.1",
"@tanstack/router-e2e-utils": "workspace:*",
"@types/node": "^22.10.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
- "@vitejs/plugin-react": "^6.0.1",
- "nitro": "^3.0.260903-beta",
- "sass": "^1.97.2",
- "srvx": "^0.11.9",
"@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",
+ "srvx": "^1.0.0",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
"wrangler": "^4.74.0"
+ },
+ "nx": {
+ "metadata": {
+ "playwrightModes": [
+ {
+ "toolchain": "vite",
+ "mode": "ssr"
+ },
+ {
+ "toolchain": "rsbuild",
+ "mode": "ssr"
+ }
+ ]
+ }
}
}
diff --git a/e2e/react-start/css-modules/playwright.config.ts b/e2e/react-start/css-modules/playwright.config.ts
index fa55e9d054..7e7ad3d9b3 100644
--- a/e2e/react-start/css-modules/playwright.config.ts
+++ b/e2e/react-start/css-modules/playwright.config.ts
@@ -3,6 +3,7 @@ import { appServerReady } from '@tanstack/router-e2e-utils'
const mode = process.env.MODE ?? 'prod'
const isDev = mode === 'dev'
+const distDir = process.env.E2E_DIST_DIR
const viteConfig = process.env.VITE_CONFIG // 'nitro' | 'basepath' | 'cloudflare' | undefined
const PORT = Number(process.env.E2E_APP_PORT ?? 0)
@@ -17,6 +18,7 @@ const devCommand = viteConfig
export default defineConfig({
testDir: './tests',
+ testMatch: isDev ? '**/*.dev.spec.ts' : '**/*.prod.spec.ts',
workers: 1,
reporter: [['line']],
@@ -27,7 +29,11 @@ export default defineConfig({
},
webServer: {
- command: isDev ? devCommand : `pnpm build && PORT=${PORT} pnpm start`,
+ command: isDev
+ ? devCommand
+ : distDir
+ ? `pnpm exec srvx --prod --dir=. -s ${distDir}/client --entry ${distDir}/server/server.js`
+ : `pnpm build && PORT=${PORT} pnpm start`,
wait: appServerReady,
reuseExistingServer: false,
stdout: 'pipe',
diff --git a/e2e/react-start/css-modules/rsbuild.config.ts b/e2e/react-start/css-modules/rsbuild.config.ts
new file mode 100644
index 0000000000..499ed67ebc
--- /dev/null
+++ b/e2e/react-start/css-modules/rsbuild.config.ts
@@ -0,0 +1,63 @@
+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(),
+ ],
+ output: {
+ distPath: {
+ root: process.env.E2E_DIST_DIR ?? 'dist-rsbuild-ssr',
+ },
+ },
+ tools: {
+ rspack(config, { environment }) {
+ if (environment.name === 'ssr') {
+ config.output ??= {}
+ config.output.filename = 'server.js'
+ }
+ if (environment.name !== 'client') {
+ return
+ }
+ config.optimization ??= {}
+ // Extract the shared component and its helper into their own chunks so
+ // a route depends on a shared chunk that depends on another shared chunk.
+ config.optimization.splitChunks = {
+ cacheGroups: {
+ sharedHeader: {
+ test: /[\\/]src[\\/]components[\\/]/,
+ chunks: 'async',
+ minChunks: 2,
+ minSize: 0,
+ enforce: true,
+ name: 'shared-header',
+ },
+ sharedFormat: {
+ test: /[\\/]src[\\/]utils[\\/]/,
+ chunks: 'async',
+ minChunks: 2,
+ minSize: 0,
+ enforce: true,
+ name: 'shared-format',
+ },
+ },
+ }
+ },
+ },
+})
diff --git a/e2e/react-start/css-modules/src/components/Header.module.css b/e2e/react-start/css-modules/src/components/Header.module.css
new file mode 100644
index 0000000000..e6878a5410
--- /dev/null
+++ b/e2e/react-start/css-modules/src/components/Header.module.css
@@ -0,0 +1,14 @@
+.header {
+ --repro-shared-header: 1;
+ display: grid;
+ grid-template-columns: minmax(0, 1fr) auto;
+ align-items: center;
+ height: 64px;
+ padding-inline: 16px;
+ background: #e4f2e9;
+}
+
+.header h1 {
+ margin: 0;
+ font-size: 24px;
+}
diff --git a/e2e/react-start/css-modules/src/components/Header.tsx b/e2e/react-start/css-modules/src/components/Header.tsx
new file mode 100644
index 0000000000..f16b12e8ff
--- /dev/null
+++ b/e2e/react-start/css-modules/src/components/Header.tsx
@@ -0,0 +1,11 @@
+import { formatTitle } from '../utils/formatTitle'
+import styles from './Header.module.css'
+
+export function Header({ title }: { title: string }) {
+ return (
+
+ {formatTitle(title)}
+
+
+ )
+}
diff --git a/e2e/react-start/css-modules/src/routeTree.gen.ts b/e2e/react-start/css-modules/src/routeTree.gen.ts
index 822118990d..2789a3490a 100644
--- a/e2e/react-start/css-modules/src/routeTree.gen.ts
+++ b/e2e/react-start/css-modules/src/routeTree.gen.ts
@@ -10,6 +10,9 @@
import { Route as rootRouteImport } from './routes/__root'
import { Route as IndexRouteImport } from './routes/index'
+import { Route as AlphaRouteImport } from './routes/alpha'
+import { Route as BetaRouteImport } from './routes/beta'
+import { Route as GammaRouteImport } from './routes/gamma'
import { Route as ModulesRouteImport } from './routes/modules'
import { Route as QuotesRouteImport } from './routes/quotes'
import { Route as SassMixinRouteImport } from './routes/sass-mixin'
@@ -19,6 +22,21 @@ const IndexRoute = IndexRouteImport.update({
path: '/',
getParentRoute: () => rootRouteImport,
} as any)
+const AlphaRoute = AlphaRouteImport.update({
+ id: '/alpha',
+ path: '/alpha',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const BetaRoute = BetaRouteImport.update({
+ id: '/beta',
+ path: '/beta',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const GammaRoute = GammaRouteImport.update({
+ id: '/gamma',
+ path: '/gamma',
+ getParentRoute: () => rootRouteImport,
+} as any)
const ModulesRoute = ModulesRouteImport.update({
id: '/modules',
path: '/modules',
@@ -37,12 +55,18 @@ const SassMixinRoute = SassMixinRouteImport.update({
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
+ '/alpha': typeof AlphaRoute
+ '/beta': typeof BetaRoute
+ '/gamma': typeof GammaRoute
'/modules': typeof ModulesRoute
'/quotes': typeof QuotesRoute
'/sass-mixin': typeof SassMixinRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
+ '/alpha': typeof AlphaRoute
+ '/beta': typeof BetaRoute
+ '/gamma': typeof GammaRoute
'/modules': typeof ModulesRoute
'/quotes': typeof QuotesRoute
'/sass-mixin': typeof SassMixinRoute
@@ -50,20 +74,36 @@ export interface FileRoutesByTo {
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
+ '/alpha': typeof AlphaRoute
+ '/beta': typeof BetaRoute
+ '/gamma': typeof GammaRoute
'/modules': typeof ModulesRoute
'/quotes': typeof QuotesRoute
'/sass-mixin': typeof SassMixinRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
- fullPaths: '/' | '/modules' | '/quotes' | '/sass-mixin'
+ fullPaths:
+ '/' | '/alpha' | '/beta' | '/gamma' | '/modules' | '/quotes' | '/sass-mixin'
fileRoutesByTo: FileRoutesByTo
- to: '/' | '/modules' | '/quotes' | '/sass-mixin'
- id: '__root__' | '/' | '/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 {
IndexRoute: typeof IndexRoute
+ AlphaRoute: typeof AlphaRoute
+ BetaRoute: typeof BetaRoute
+ GammaRoute: typeof GammaRoute
ModulesRoute: typeof ModulesRoute
QuotesRoute: typeof QuotesRoute
SassMixinRoute: typeof SassMixinRoute
@@ -78,6 +118,27 @@ declare module '@tanstack/react-router' {
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
+ '/alpha': {
+ id: '/alpha'
+ path: '/alpha'
+ fullPath: '/alpha'
+ preLoaderRoute: typeof AlphaRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/beta': {
+ id: '/beta'
+ path: '/beta'
+ fullPath: '/beta'
+ preLoaderRoute: typeof BetaRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/gamma': {
+ id: '/gamma'
+ path: '/gamma'
+ fullPath: '/gamma'
+ preLoaderRoute: typeof GammaRouteImport
+ parentRoute: typeof rootRouteImport
+ }
'/modules': {
id: '/modules'
path: '/modules'
@@ -104,6 +165,9 @@ declare module '@tanstack/react-router' {
const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
+ AlphaRoute: AlphaRoute,
+ BetaRoute: BetaRoute,
+ GammaRoute: GammaRoute,
ModulesRoute: ModulesRoute,
QuotesRoute: QuotesRoute,
SassMixinRoute: SassMixinRoute,
diff --git a/e2e/react-start/css-modules/src/routes/alpha.tsx b/e2e/react-start/css-modules/src/routes/alpha.tsx
new file mode 100644
index 0000000000..e894cd758f
--- /dev/null
+++ b/e2e/react-start/css-modules/src/routes/alpha.tsx
@@ -0,0 +1,13 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { Header } from '../components/Header'
+import styles from '../styles/alpha.module.css'
+
+export const Route = createFileRoute('/alpha')({ component: Alpha })
+
+function Alpha() {
+ return (
+
+
+
+ )
+}
diff --git a/e2e/react-start/css-modules/src/routes/beta.tsx b/e2e/react-start/css-modules/src/routes/beta.tsx
new file mode 100644
index 0000000000..4f139ac41a
--- /dev/null
+++ b/e2e/react-start/css-modules/src/routes/beta.tsx
@@ -0,0 +1,13 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { Header } from '../components/Header'
+import styles from '../styles/beta.module.css'
+
+export const Route = createFileRoute('/beta')({ component: Beta })
+
+function Beta() {
+ return (
+
+
+
+ )
+}
diff --git a/e2e/react-start/css-modules/src/routes/gamma.tsx b/e2e/react-start/css-modules/src/routes/gamma.tsx
new file mode 100644
index 0000000000..a8e036b85f
--- /dev/null
+++ b/e2e/react-start/css-modules/src/routes/gamma.tsx
@@ -0,0 +1,8 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { formatTitle } from '../utils/formatTitle'
+
+export const Route = createFileRoute('/gamma')({ component: Gamma })
+
+function Gamma() {
+ return {formatTitle('Gamma')}
+}
diff --git a/e2e/react-start/css-modules/src/styles/alpha.module.css b/e2e/react-start/css-modules/src/styles/alpha.module.css
new file mode 100644
index 0000000000..12a606a8d3
--- /dev/null
+++ b/e2e/react-start/css-modules/src/styles/alpha.module.css
@@ -0,0 +1,4 @@
+.page {
+ --repro-alpha: 1;
+ border: 4px solid #226844;
+}
diff --git a/e2e/react-start/css-modules/src/styles/beta.module.css b/e2e/react-start/css-modules/src/styles/beta.module.css
new file mode 100644
index 0000000000..719686a76b
--- /dev/null
+++ b/e2e/react-start/css-modules/src/styles/beta.module.css
@@ -0,0 +1,4 @@
+.page {
+ --repro-beta: 1;
+ border: 4px solid #ac344c;
+}
diff --git a/e2e/react-start/css-modules/src/utils/formatTitle.ts b/e2e/react-start/css-modules/src/utils/formatTitle.ts
new file mode 100644
index 0000000000..d0325ac63e
--- /dev/null
+++ b/e2e/react-start/css-modules/src/utils/formatTitle.ts
@@ -0,0 +1,3 @@
+export function formatTitle(title: string) {
+ return `${title} (repro-format-title)`
+}
diff --git a/e2e/react-start/css-modules/tests/shared-css.prod.spec.ts b/e2e/react-start/css-modules/tests/shared-css.prod.spec.ts
new file mode 100644
index 0000000000..9a9595f819
--- /dev/null
+++ b/e2e/react-start/css-modules/tests/shared-css.prod.spec.ts
@@ -0,0 +1,94 @@
+import { expect } from '@playwright/test'
+import { test } from '@tanstack/router-e2e-utils'
+import type { Page } from '@playwright/test'
+
+test.skip(
+ process.env.VITE_CSS_CODE_SPLIT === 'false',
+ 'Route stylesheet isolation requires CSS code splitting',
+)
+test.use({ javaScriptEnabled: false })
+
+async function getStylesheetContent(page: Page) {
+ const hrefs = await page
+ .locator('link[rel="stylesheet"]')
+ .evaluateAll((links: Array) =>
+ links.map((link) => link.href),
+ )
+ expect(hrefs.length).toBeGreaterThan(0)
+ const stylesheets = await Promise.all(
+ hrefs.map(async (href) => {
+ const response = await page.request.get(href)
+ expect(response.ok()).toBe(true)
+ return response.text()
+ }),
+ )
+ return stylesheets.join('\n')
+}
+
+for (const route of ['alpha', 'beta']) {
+ test(`${route} has complete and isolated CSS without JavaScript`, async ({
+ page,
+ }) => {
+ await page.goto(`/${route}`)
+
+ const header = page.getByTestId('shared-header')
+ await expect(header).toHaveCSS('display', 'grid')
+ await expect(header).toHaveCSS('height', '64px')
+ await expect(page.getByTestId('route-page')).toHaveCSS(
+ `--repro-${route}`,
+ '1',
+ )
+
+ const css = await getStylesheetContent(page)
+ expect(css).toContain('--repro-shared-header')
+ expect(css).toContain(`--repro-${route}`)
+ expect(css).not.toContain(`--repro-${route === 'alpha' ? 'beta' : 'alpha'}`)
+ })
+}
+
+function getScriptPreloadHrefs(html: string) {
+ return Array.from(html.matchAll(/]*>/g), (match) => match[0])
+ .filter(
+ (tag) =>
+ /\brel="modulepreload"/.test(tag) ||
+ (/\brel="preload"/.test(tag) && /\bas="script"/.test(tag)),
+ )
+ .map((tag) => tag.match(/\bhref="([^"]+)"/)?.[1])
+ .filter((href): href is string => !!href)
+}
+
+test('alpha preloads the shared header chunk and the chunk it depends on', async ({
+ page,
+}) => {
+ const response = await page.request.get('/alpha')
+ expect(response.ok()).toBe(true)
+
+ const hrefs = getScriptPreloadHrefs(await response.text())
+ expect(hrefs.length).toBeGreaterThan(0)
+
+ const scripts = await Promise.all(
+ hrefs.map(async (href) => {
+ const script = await page.request.get(href)
+ expect(script.ok()).toBe(true)
+ return script.text()
+ }),
+ )
+
+ expect(scripts.some((code) => code.includes('shared-header'))).toBe(true)
+ expect(scripts.some((code) => code.includes('repro-format-title'))).toBe(true)
+})
+
+test('home does not load the shared header or route styles', async ({
+ page,
+}) => {
+ await page.goto('/')
+ await expect(page.getByTestId('global-styled')).toHaveCSS(
+ 'background-color',
+ 'rgb(59, 130, 246)',
+ )
+
+ const css = await getStylesheetContent(page)
+ expect(css).not.toContain('--repro-shared-header')
+ expect(css).not.toContain('--repro-alpha')
+ expect(css).not.toContain('--repro-beta')
+})
diff --git a/e2e/react-start/css-modules/vite.config.ts b/e2e/react-start/css-modules/vite.config.ts
index 9923ab3384..c9c27f7f9a 100644
--- a/e2e/react-start/css-modules/vite.config.ts
+++ b/e2e/react-start/css-modules/vite.config.ts
@@ -21,6 +21,7 @@ export default defineConfig(async () => {
port: 3000,
},
build: {
+ outDir: process.env.E2E_DIST_DIR ?? 'dist',
cssCodeSplit,
},
plugins: [
diff --git a/e2e/react-start/custom-basepath/package.json b/e2e/react-start/custom-basepath/package.json
index 45d39c3bbf..e93949eea2 100644
--- a/e2e/react-start/custom-basepath/package.json
+++ b/e2e/react-start/custom-basepath/package.json
@@ -29,7 +29,7 @@
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
"cross-env": "^10.0.0",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"tailwindcss": "^4.2.2",
"tsx": "^4.20.3",
"@typescript/native": "npm:typescript@^7.0.2",
diff --git a/e2e/react-start/custom-server-rsbuild/package.json b/e2e/react-start/custom-server-rsbuild/package.json
index de1a118d60..1c5b3af393 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.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tanstack/router-e2e-utils": "workspace:^",
@@ -30,7 +30,7 @@
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"cross-env": "^10.0.0",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"tailwindcss": "^4.2.2",
"tsx": "^4.20.3",
"@typescript/native": "npm:typescript@^7.0.2",
diff --git a/e2e/react-start/deferred-hydration/package.json b/e2e/react-start/deferred-hydration/package.json
index b5a8a85a09..5a33407435 100644
--- a/e2e/react-start/deferred-hydration/package.json
+++ b/e2e/react-start/deferred-hydration/package.json
@@ -26,14 +26,14 @@
"react-dom": "^19.0.0"
},
"devDependencies": {
- "@rsbuild/core": "^2.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14"
diff --git a/e2e/react-start/dev-ssr-styles/package.json b/e2e/react-start/dev-ssr-styles/package.json
index f4dbafe633..a5300e836e 100644
--- a/e2e/react-start/dev-ssr-styles/package.json
+++ b/e2e/react-start/dev-ssr-styles/package.json
@@ -41,7 +41,7 @@
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
"nitro": "^3.0.260903-beta",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14",
diff --git a/e2e/react-start/early-hints/package.json b/e2e/react-start/early-hints/package.json
index f8a72a7aa7..1615b99430 100644
--- a/e2e/react-start/early-hints/package.json
+++ b/e2e/react-start/early-hints/package.json
@@ -27,7 +27,7 @@
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
"node-forge": "^1.3.1",
- "srvx": "0.11.15",
+ "srvx": "^1.0.0",
"tsx": "4.20.3",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
diff --git a/e2e/react-start/early-hints/tests/early-hints-protocol.spec.ts b/e2e/react-start/early-hints/tests/early-hints-protocol.spec.ts
index 661b988281..6d2d31d836 100644
--- a/e2e/react-start/early-hints/tests/early-hints-protocol.spec.ts
+++ b/e2e/react-start/early-hints/tests/early-hints-protocol.spec.ts
@@ -103,7 +103,9 @@ test.describe('Early Hints - HTTP/2 Protocol', () => {
const response = await makeRequest(baseURL, '/')
const link = earlyHintsLinkHeader(response)
- expect(link).toMatch(/<[^>]+>;\s*rel=modulepreload;\s*as=script/)
+ expect(link).toMatch(
+ /<[^>]+>;\s*rel=modulepreload;\s*as=script;\s*fetchpriority=low/,
+ )
})
test('CSS module assets are included in early hints', async () => {
@@ -145,7 +147,7 @@ test.describe('Early Hints - HTTP/2 Protocol', () => {
const response = await makeRequest(baseURL, '/')
const link = linkHeader(response.finalHeaders)
- expect(link).toContain('rel=modulepreload; as=script')
+ expect(link).toContain('rel=modulepreload; as=script; fetchpriority=low')
expect(link).toContain('; rel=preconnect')
})
diff --git a/e2e/react-start/flamegraph-bench/package.json b/e2e/react-start/flamegraph-bench/package.json
index 0b8aa4fa89..72410b13e1 100644
--- a/e2e/react-start/flamegraph-bench/package.json
+++ b/e2e/react-start/flamegraph-bench/package.json
@@ -14,7 +14,7 @@
"@tanstack/react-start": "workspace:*",
"react": "^19.0.0",
"react-dom": "^19.0.0",
- "srvx": "^0.11.9"
+ "srvx": "^1.0.0"
},
"devDependencies": {
"@platformatic/flame": "latest",
diff --git a/e2e/react-start/hmr/package.json b/e2e/react-start/hmr/package.json
index 7a6dc23f76..76a5d86b1f 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.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tailwindcss/postcss": "^4.2.2",
"@tailwindcss/vite": "^4.2.2",
diff --git a/e2e/react-start/hmr/tests/app.spec.ts b/e2e/react-start/hmr/tests/app.spec.ts
index eedb4eed98..645c9b06f3 100644
--- a/e2e/react-start/hmr/tests/app.spec.ts
+++ b/e2e/react-start/hmr/tests/app.spec.ts
@@ -932,6 +932,7 @@ 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/import-protection-custom-config/package.json b/e2e/react-start/import-protection-custom-config/package.json
index 59ac648651..c088eff106 100644
--- a/e2e/react-start/import-protection-custom-config/package.json
+++ b/e2e/react-start/import-protection-custom-config/package.json
@@ -25,7 +25,7 @@
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14"
diff --git a/e2e/react-start/import-protection/package.json b/e2e/react-start/import-protection/package.json
index 5459b84437..ad06ba41ea 100644
--- a/e2e/react-start/import-protection/package.json
+++ b/e2e/react-start/import-protection/package.json
@@ -22,14 +22,14 @@
},
"devDependencies": {
"@playwright/test": "^1.61.0",
- "@rsbuild/core": "^2.1.0",
+ "@rsbuild/core": "^2.3.1",
"@rsbuild/plugin-react": "^2.0.0",
"@tanstack/router-e2e-utils": "workspace:^",
"@types/node": "^22.10.2",
"@types/react": "^19.0.8",
"@types/react-dom": "^19.0.3",
"@vitejs/plugin-react": "^6.0.1",
- "srvx": "^0.11.9",
+ "srvx": "^1.0.0",
"@typescript/native": "npm:typescript@^7.0.2",
"typescript": "npm:@typescript/typescript6@^6.0.2",
"vite": "^8.0.14"
diff --git a/e2e/react-start/import-protection/src/violations/cross-boundary-safe/session-util.ts b/e2e/react-start/import-protection/src/violations/cross-boundary-safe/session-util.ts
index ab44237539..d74bc6430b 100644
--- a/e2e/react-start/import-protection/src/violations/cross-boundary-safe/session-util.ts
+++ b/e2e/react-start/import-protection/src/violations/cross-boundary-safe/session-util.ts
@@ -6,7 +6,7 @@ import { getRequest } from '@tanstack/react-start/server'
// so the compiler should prune this import from the client bundle.
//
// This mirrors the real-world pattern of a session utility that wraps
-// `useSession` from `@tanstack/react-start/server`.
+// `getCookie` from `@tanstack/react-start/server`.
export function getSessionData() {
const req = getRequest()
return { method: req.method }
diff --git a/e2e/react-start/response-reconciliation/.gitignore b/e2e/react-start/response-reconciliation/.gitignore
new file mode 100644
index 0000000000..16187ac1de
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/.gitignore
@@ -0,0 +1,24 @@
+node_modules
+package-lock.json
+yarn.lock
+
+.DS_Store
+.cache
+.tanstack
+.env
+.vercel
+.output
+/build/
+/api/
+/server/build
+/public/build
+
+# Sentry Config File
+.env.sentry-build-plugin
+/test-results/
+/playwright-report/
+/blob-report/
+/playwright/.cache/
+/dist/
+/dist-*/
+/port-*.txt
diff --git a/e2e/react-start/response-reconciliation/.prettierignore b/e2e/react-start/response-reconciliation/.prettierignore
new file mode 100644
index 0000000000..40a96e8819
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/.prettierignore
@@ -0,0 +1,4 @@
+**/build
+**/public
+pnpm-lock.yaml
+routeTree.gen.ts
diff --git a/e2e/react-start/response-reconciliation/package.json b/e2e/react-start/response-reconciliation/package.json
new file mode 100644
index 0000000000..7ba0224962
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/package.json
@@ -0,0 +1,84 @@
+{
+ "name": "tanstack-react-start-e2e-response-reconciliation",
+ "private": true,
+ "sideEffects": false,
+ "type": "module",
+ "scripts": {
+ "dev": "pnpm dev:vite --port 3000",
+ "dev:e2e": "pnpm dev:vite",
+ "dev:vite": "vite dev",
+ "dev:rsbuild": "rsbuild dev",
+ "build": "pnpm build:vite",
+ "build:vite": "vite build && tsc --noEmit",
+ "build:rsbuild": "rsbuild build && tsc --noEmit",
+ "preview": "vite preview",
+ "start": "node server.js",
+ "test:e2e:local": "pnpm build && playwright test --project=chromium"
+ },
+ "dependencies": {
+ "@tanstack/react-router": "workspace:*",
+ "@tanstack/react-start": "workspace:*",
+ "react": "^19.2.3",
+ "react-dom": "^19.2.3"
+ },
+ "devDependencies": {
+ "@playwright/test": "^1.57.0",
+ "@rsbuild/core": "^2.3.1",
+ "@rsbuild/plugin-react": "^2.0.0",
+ "@tanstack/router-e2e-utils": "workspace:^",
+ "@types/node": "25.0.9",
+ "@types/react": "^19.2.8",
+ "@types/react-dom": "^19.2.3",
+ "@vitejs/plugin-react": "^6.0.1",
+ "srvx": "^1.0.0",
+ "typescript": "^6.0.2",
+ "vite": "^8.0.14"
+ },
+ "nx": {
+ "targets": {
+ "test:e2e": {
+ "parallelism": false
+ },
+ "test:e2e--vite-ssr": {
+ "parallelism": false
+ },
+ "test:e2e--vite-ssr--custom-entry": {
+ "parallelism": false
+ },
+ "test:e2e--rsbuild-ssr": {
+ "parallelism": false
+ },
+ "test:e2e--rsbuild-ssr--custom-entry": {
+ "parallelism": false
+ }
+ },
+ "metadata": {
+ "playwrightModes": [
+ {
+ "toolchain": "vite",
+ "mode": "ssr"
+ },
+ {
+ "toolchain": "vite",
+ "mode": "ssr",
+ "name": "custom-entry",
+ "env": {
+ "TSS_E2E_SERVER_ENTRY": "server-entry"
+ }
+ },
+ {
+ "toolchain": "rsbuild",
+ "mode": "ssr"
+ },
+ {
+ "toolchain": "rsbuild",
+ "mode": "ssr",
+ "name": "custom-entry",
+ "env": {
+ "TSS_E2E_SERVER_ENTRY": "server-entry"
+ }
+ }
+ ]
+ }
+ }
+}
diff --git a/e2e/react-start/response-reconciliation/playwright.config.ts b/e2e/react-start/response-reconciliation/playwright.config.ts
new file mode 100644
index 0000000000..d4c9c58f43
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/playwright.config.ts
@@ -0,0 +1,37 @@
+import { defineConfig, devices } from '@playwright/test'
+import { appServerReady } from '@tanstack/router-e2e-utils'
+
+const toolchain = process.env.E2E_TOOLCHAIN ?? 'vite'
+const distDir = process.env.E2E_DIST_DIR ?? 'dist'
+const serverEntry = process.env.TSS_E2E_SERVER_ENTRY ?? ''
+
+export const PORT = Number(process.env.E2E_APP_PORT ?? 0)
+const baseURL = `http://localhost:${PORT}`
+
+export default defineConfig({
+ testDir: './tests',
+ workers: 1,
+ reporter: [['line']],
+ use: {
+ baseURL,
+ },
+ webServer: {
+ command: `pnpm start`,
+ wait: appServerReady,
+ reuseExistingServer: false,
+ stdout: 'pipe',
+ env: {
+ PORT: String(PORT),
+ VITE_SERVER_PORT: String(PORT),
+ E2E_DIST_DIR: distDir,
+ E2E_TOOLCHAIN: toolchain,
+ TSS_E2E_SERVER_ENTRY: serverEntry,
+ },
+ },
+ projects: [
+ {
+ name: 'chromium',
+ use: { ...devices['Desktop Chrome'] },
+ },
+ ],
+})
diff --git a/e2e/react-start/response-reconciliation/rsbuild.config.ts b/e2e/react-start/response-reconciliation/rsbuild.config.ts
new file mode 100644
index 0000000000..38f44ef9fb
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/rsbuild.config.ts
@@ -0,0 +1,20 @@
+import { defineConfig } from '@rsbuild/core'
+import { pluginReact } from '@rsbuild/plugin-react'
+import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild'
+
+const serverEntry = process.env.TSS_E2E_SERVER_ENTRY
+const outDir = process.env.E2E_DIST_DIR ?? 'dist'
+
+export default defineConfig({
+ plugins: [
+ pluginReact(),
+ tanstackStart({
+ server: serverEntry ? { entry: serverEntry } : undefined,
+ }),
+ ],
+ output: {
+ distPath: {
+ root: outDir,
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/server.js b/e2e/react-start/response-reconciliation/server.js
new file mode 100644
index 0000000000..324a462bec
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/server.js
@@ -0,0 +1,62 @@
+import fs from 'node:fs'
+import path from 'node:path'
+import { spawn } from 'node:child_process'
+import { pathToFileURL } from 'node:url'
+
+const distDir = process.env.E2E_DIST_DIR || 'dist'
+
+function resolveDistClientDir() {
+ return path.resolve(distDir, 'client')
+}
+
+function resolveDistServerEntryPath() {
+ if (process.env.TSS_E2E_SERVER_ENTRY) {
+ const customEntryPath = path.resolve(
+ distDir,
+ 'server',
+ `${process.env.TSS_E2E_SERVER_ENTRY}.js`,
+ )
+ if (fs.existsSync(customEntryPath)) {
+ return customEntryPath
+ }
+ }
+
+ const serverJsPath = path.resolve(distDir, 'server', 'server.js')
+ if (fs.existsSync(serverJsPath)) {
+ return serverJsPath
+ }
+
+ const indexJsPath = path.resolve(distDir, 'server', 'index.js')
+ if (fs.existsSync(indexJsPath)) {
+ return indexJsPath
+ }
+
+ return serverJsPath
+}
+
+export function start() {
+ const child = spawn(
+ 'srvx',
+ ['--prod', '-s', resolveDistClientDir(), resolveDistServerEntryPath()],
+ {
+ stdio: 'inherit',
+ shell: process.platform === 'win32',
+ },
+ )
+
+ child.on('exit', (code, signal) => {
+ if (signal) {
+ process.kill(process.pid, signal)
+ return
+ }
+
+ process.exit(code ?? 0)
+ })
+}
+
+if (
+ process.argv[1] &&
+ import.meta.url === pathToFileURL(process.argv[1]).href
+) {
+ start()
+}
diff --git a/e2e/react-start/response-reconciliation/src/components/DefaultCatchBoundary.tsx b/e2e/react-start/response-reconciliation/src/components/DefaultCatchBoundary.tsx
new file mode 100644
index 0000000000..f3d691814f
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/components/DefaultCatchBoundary.tsx
@@ -0,0 +1,20 @@
+import { ErrorComponent, Link, useRouter } from '@tanstack/react-router'
+import type { ErrorComponentProps } from '@tanstack/react-router'
+
+export function DefaultCatchBoundary({ error }: ErrorComponentProps) {
+ const router = useRouter()
+
+ return (
+
+
+
+ Home
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/components/NotFound.tsx b/e2e/react-start/response-reconciliation/src/components/NotFound.tsx
new file mode 100644
index 0000000000..0b720f0e37
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/components/NotFound.tsx
@@ -0,0 +1,10 @@
+import { Link } from '@tanstack/react-router'
+
+export function NotFound({ children }: { children?: React.ReactNode }) {
+ return (
+
+ {children || The page you are looking for does not exist.
}
+ Start Over
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/response-wrapper.ts b/e2e/react-start/response-reconciliation/src/response-wrapper.ts
new file mode 100644
index 0000000000..db9733d5e6
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/response-wrapper.ts
@@ -0,0 +1,33 @@
+import { getRequestHeader } from '@tanstack/react-start/server'
+
+let installed = false
+
+/**
+ * Stand-in for libraries that wrap the global Response and pipe stream bodies,
+ * such as varlock's leak prevention: afterwards `new Response(stream).body` is
+ * a new stream that reads `stream`. Only requests that send
+ * `x-wrap-response: true` are affected.
+ */
+export function installResponseWrapper() {
+ if (installed) {
+ return
+ }
+ installed = true
+ globalThis.Response = new Proxy(globalThis.Response, {
+ construct(target, [body, init], newTarget) {
+ if (body instanceof ReadableStream && wrapsResponses()) {
+ body = body.pipeThrough(new TransformStream())
+ }
+ return Reflect.construct(target, [body, init], newTarget)
+ },
+ })
+}
+
+function wrapsResponses() {
+ try {
+ return getRequestHeader('x-wrap-response') === 'true'
+ } catch {
+ // Responses created outside a request are never wrapped.
+ return false
+ }
+}
diff --git a/e2e/react-start/response-reconciliation/src/routeTree.gen.ts b/e2e/react-start/response-reconciliation/src/routeTree.gen.ts
new file mode 100644
index 0000000000..3dbb6301c3
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routeTree.gen.ts
@@ -0,0 +1,625 @@
+/* eslint-disable */
+
+// @ts-nocheck
+
+// noinspection JSUnusedGlobalSymbols
+
+// 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.
+
+import { Route as rootRouteImport } from './routes/__root'
+import { Route as IndexRouteImport } from './routes/index'
+import { Route as ServerFunctionsRouteImport } from './routes/server-functions'
+import { Route as SsrRouteImport } from './routes/ssr'
+import { Route as StreamedRouteImport } from './routes/streamed'
+import { Route as ApiBaseRouteImport } from './routes/api/base'
+import { Route as ApiBulkHeadersRouteImport } from './routes/api/bulk-headers'
+import { Route as ApiClearReturnedHeadersRouteImport } from './routes/api/clear-returned-headers'
+import { Route as ApiDirectMutationVisibleRouteImport } from './routes/api/direct-mutation-visible'
+import { Route as ApiExplicitSetCookieHeaderRouteImport } from './routes/api/explicit-set-cookie-header'
+import { Route as ApiFramingErrorRouteImport } from './routes/api/framing-error'
+import { Route as ApiGetResponseHeaderHelperRouteImport } from './routes/api/get-response-header-helper'
+import { Route as ApiGetResponseHeadersHelperRouteImport } from './routes/api/get-response-headers-helper'
+import { Route as ApiMultipleCookiesRouteImport } from './routes/api/multiple-cookies'
+import { Route as ApiNullBodyStatusRouteImport } from './routes/api/null-body-status'
+import { Route as ApiReadonlyAfterNextRouteImport } from './routes/api/readonly-after-next'
+import { Route as ApiRedirectWithCookiesRouteImport } from './routes/api/redirect-with-cookies'
+import { Route as ApiRemoveReturnedHeaderRouteImport } from './routes/api/remove-returned-header'
+import { Route as ApiReplaceAfterDirectMutationRouteImport } from './routes/api/replace-after-direct-mutation'
+import { Route as ApiReplaceExplicitSetCookieRouteImport } from './routes/api/replace-explicit-set-cookie'
+import { Route as ApiRouteAfterNextRouteImport } from './routes/api/route-after-next'
+import { Route as ApiRouteBeforeNextRouteImport } from './routes/api/route-before-next'
+import { Route as ApiSameBoundaryConflictRouteImport } from './routes/api/same-boundary-conflict'
+import { Route as ApiStatusContractsRouteImport } from './routes/api/status-contracts'
+import { Route as ApiThrowAfterStatusRouteImport } from './routes/api/throw-after-status'
+import { Route as ApiTrackedStreamRouteImport } from './routes/api/tracked-stream'
+import { Route as ApiTrackedStreamStatusRouteImport } from './routes/api/tracked-stream-status'
+import { Route as ApiTwoReturnedResponsesRouteImport } from './routes/api/two-returned-responses'
+
+const IndexRoute = IndexRouteImport.update({
+ id: '/',
+ path: '/',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ServerFunctionsRoute = ServerFunctionsRouteImport.update({
+ id: '/server-functions',
+ path: '/server-functions',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const SsrRoute = SsrRouteImport.update({
+ id: '/ssr',
+ path: '/ssr',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const StreamedRoute = StreamedRouteImport.update({
+ id: '/streamed',
+ path: '/streamed',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiBaseRoute = ApiBaseRouteImport.update({
+ id: '/api/base',
+ path: '/api/base',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiBulkHeadersRoute = ApiBulkHeadersRouteImport.update({
+ id: '/api/bulk-headers',
+ path: '/api/bulk-headers',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiClearReturnedHeadersRoute = ApiClearReturnedHeadersRouteImport.update({
+ id: '/api/clear-returned-headers',
+ 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 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 ApiMultipleCookiesRoute = ApiMultipleCookiesRouteImport.update({
+ id: '/api/multiple-cookies',
+ path: '/api/multiple-cookies',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiNullBodyStatusRoute = ApiNullBodyStatusRouteImport.update({
+ id: '/api/null-body-status',
+ path: '/api/null-body-status',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiReadonlyAfterNextRoute = ApiReadonlyAfterNextRouteImport.update({
+ id: '/api/readonly-after-next',
+ path: '/api/readonly-after-next',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiRedirectWithCookiesRoute = ApiRedirectWithCookiesRouteImport.update({
+ id: '/api/redirect-with-cookies',
+ path: '/api/redirect-with-cookies',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiRemoveReturnedHeaderRoute = ApiRemoveReturnedHeaderRouteImport.update({
+ id: '/api/remove-returned-header',
+ 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 ApiRouteAfterNextRoute = ApiRouteAfterNextRouteImport.update({
+ id: '/api/route-after-next',
+ path: '/api/route-after-next',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiRouteBeforeNextRoute = ApiRouteBeforeNextRouteImport.update({
+ id: '/api/route-before-next',
+ path: '/api/route-before-next',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiSameBoundaryConflictRoute = ApiSameBoundaryConflictRouteImport.update({
+ id: '/api/same-boundary-conflict',
+ path: '/api/same-boundary-conflict',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiStatusContractsRoute = ApiStatusContractsRouteImport.update({
+ id: '/api/status-contracts',
+ path: '/api/status-contracts',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiThrowAfterStatusRoute = ApiThrowAfterStatusRouteImport.update({
+ id: '/api/throw-after-status',
+ path: '/api/throw-after-status',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiTrackedStreamRoute = ApiTrackedStreamRouteImport.update({
+ id: '/api/tracked-stream',
+ path: '/api/tracked-stream',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiTrackedStreamStatusRoute = ApiTrackedStreamStatusRouteImport.update({
+ id: '/api/tracked-stream-status',
+ path: '/api/tracked-stream-status',
+ getParentRoute: () => rootRouteImport,
+} as any)
+const ApiTwoReturnedResponsesRoute = ApiTwoReturnedResponsesRouteImport.update({
+ id: '/api/two-returned-responses',
+ path: '/api/two-returned-responses',
+ getParentRoute: () => rootRouteImport,
+} as any)
+
+export interface FileRoutesByFullPath {
+ '/': typeof IndexRoute
+ '/server-functions': typeof ServerFunctionsRoute
+ '/ssr': typeof SsrRoute
+ '/streamed': typeof StreamedRoute
+ '/api/base': typeof ApiBaseRoute
+ '/api/bulk-headers': typeof ApiBulkHeadersRoute
+ '/api/clear-returned-headers': typeof ApiClearReturnedHeadersRoute
+ '/api/direct-mutation-visible': typeof ApiDirectMutationVisibleRoute
+ '/api/explicit-set-cookie-header': typeof ApiExplicitSetCookieHeaderRoute
+ '/api/framing-error': typeof ApiFramingErrorRoute
+ '/api/get-response-header-helper': typeof ApiGetResponseHeaderHelperRoute
+ '/api/get-response-headers-helper': typeof ApiGetResponseHeadersHelperRoute
+ '/api/multiple-cookies': typeof ApiMultipleCookiesRoute
+ '/api/null-body-status': typeof ApiNullBodyStatusRoute
+ '/api/readonly-after-next': typeof ApiReadonlyAfterNextRoute
+ '/api/redirect-with-cookies': typeof ApiRedirectWithCookiesRoute
+ '/api/remove-returned-header': typeof ApiRemoveReturnedHeaderRoute
+ '/api/replace-after-direct-mutation': typeof ApiReplaceAfterDirectMutationRoute
+ '/api/replace-explicit-set-cookie': typeof ApiReplaceExplicitSetCookieRoute
+ '/api/route-after-next': typeof ApiRouteAfterNextRoute
+ '/api/route-before-next': typeof ApiRouteBeforeNextRoute
+ '/api/same-boundary-conflict': typeof ApiSameBoundaryConflictRoute
+ '/api/status-contracts': typeof ApiStatusContractsRoute
+ '/api/throw-after-status': typeof ApiThrowAfterStatusRoute
+ '/api/tracked-stream': typeof ApiTrackedStreamRoute
+ '/api/tracked-stream-status': typeof ApiTrackedStreamStatusRoute
+ '/api/two-returned-responses': typeof ApiTwoReturnedResponsesRoute
+}
+export interface FileRoutesByTo {
+ '/': typeof IndexRoute
+ '/server-functions': typeof ServerFunctionsRoute
+ '/ssr': typeof SsrRoute
+ '/streamed': typeof StreamedRoute
+ '/api/base': typeof ApiBaseRoute
+ '/api/bulk-headers': typeof ApiBulkHeadersRoute
+ '/api/clear-returned-headers': typeof ApiClearReturnedHeadersRoute
+ '/api/direct-mutation-visible': typeof ApiDirectMutationVisibleRoute
+ '/api/explicit-set-cookie-header': typeof ApiExplicitSetCookieHeaderRoute
+ '/api/framing-error': typeof ApiFramingErrorRoute
+ '/api/get-response-header-helper': typeof ApiGetResponseHeaderHelperRoute
+ '/api/get-response-headers-helper': typeof ApiGetResponseHeadersHelperRoute
+ '/api/multiple-cookies': typeof ApiMultipleCookiesRoute
+ '/api/null-body-status': typeof ApiNullBodyStatusRoute
+ '/api/readonly-after-next': typeof ApiReadonlyAfterNextRoute
+ '/api/redirect-with-cookies': typeof ApiRedirectWithCookiesRoute
+ '/api/remove-returned-header': typeof ApiRemoveReturnedHeaderRoute
+ '/api/replace-after-direct-mutation': typeof ApiReplaceAfterDirectMutationRoute
+ '/api/replace-explicit-set-cookie': typeof ApiReplaceExplicitSetCookieRoute
+ '/api/route-after-next': typeof ApiRouteAfterNextRoute
+ '/api/route-before-next': typeof ApiRouteBeforeNextRoute
+ '/api/same-boundary-conflict': typeof ApiSameBoundaryConflictRoute
+ '/api/status-contracts': typeof ApiStatusContractsRoute
+ '/api/throw-after-status': typeof ApiThrowAfterStatusRoute
+ '/api/tracked-stream': typeof ApiTrackedStreamRoute
+ '/api/tracked-stream-status': typeof ApiTrackedStreamStatusRoute
+ '/api/two-returned-responses': typeof ApiTwoReturnedResponsesRoute
+}
+export interface FileRoutesById {
+ __root__: typeof rootRouteImport
+ '/': typeof IndexRoute
+ '/server-functions': typeof ServerFunctionsRoute
+ '/ssr': typeof SsrRoute
+ '/streamed': typeof StreamedRoute
+ '/api/base': typeof ApiBaseRoute
+ '/api/bulk-headers': typeof ApiBulkHeadersRoute
+ '/api/clear-returned-headers': typeof ApiClearReturnedHeadersRoute
+ '/api/direct-mutation-visible': typeof ApiDirectMutationVisibleRoute
+ '/api/explicit-set-cookie-header': typeof ApiExplicitSetCookieHeaderRoute
+ '/api/framing-error': typeof ApiFramingErrorRoute
+ '/api/get-response-header-helper': typeof ApiGetResponseHeaderHelperRoute
+ '/api/get-response-headers-helper': typeof ApiGetResponseHeadersHelperRoute
+ '/api/multiple-cookies': typeof ApiMultipleCookiesRoute
+ '/api/null-body-status': typeof ApiNullBodyStatusRoute
+ '/api/readonly-after-next': typeof ApiReadonlyAfterNextRoute
+ '/api/redirect-with-cookies': typeof ApiRedirectWithCookiesRoute
+ '/api/remove-returned-header': typeof ApiRemoveReturnedHeaderRoute
+ '/api/replace-after-direct-mutation': typeof ApiReplaceAfterDirectMutationRoute
+ '/api/replace-explicit-set-cookie': typeof ApiReplaceExplicitSetCookieRoute
+ '/api/route-after-next': typeof ApiRouteAfterNextRoute
+ '/api/route-before-next': typeof ApiRouteBeforeNextRoute
+ '/api/same-boundary-conflict': typeof ApiSameBoundaryConflictRoute
+ '/api/status-contracts': typeof ApiStatusContractsRoute
+ '/api/throw-after-status': typeof ApiThrowAfterStatusRoute
+ '/api/tracked-stream': typeof ApiTrackedStreamRoute
+ '/api/tracked-stream-status': typeof ApiTrackedStreamStatusRoute
+ '/api/two-returned-responses': typeof ApiTwoReturnedResponsesRoute
+}
+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'
+ 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'
+ fileRoutesById: FileRoutesById
+}
+export interface RootRouteChildren {
+ IndexRoute: typeof IndexRoute
+ ServerFunctionsRoute: typeof ServerFunctionsRoute
+ SsrRoute: typeof SsrRoute
+ StreamedRoute: typeof StreamedRoute
+ ApiBaseRoute: typeof ApiBaseRoute
+ ApiBulkHeadersRoute: typeof ApiBulkHeadersRoute
+ ApiClearReturnedHeadersRoute: typeof ApiClearReturnedHeadersRoute
+ ApiDirectMutationVisibleRoute: typeof ApiDirectMutationVisibleRoute
+ ApiExplicitSetCookieHeaderRoute: typeof ApiExplicitSetCookieHeaderRoute
+ ApiFramingErrorRoute: typeof ApiFramingErrorRoute
+ ApiGetResponseHeaderHelperRoute: typeof ApiGetResponseHeaderHelperRoute
+ ApiGetResponseHeadersHelperRoute: typeof ApiGetResponseHeadersHelperRoute
+ ApiMultipleCookiesRoute: typeof ApiMultipleCookiesRoute
+ ApiNullBodyStatusRoute: typeof ApiNullBodyStatusRoute
+ ApiReadonlyAfterNextRoute: typeof ApiReadonlyAfterNextRoute
+ ApiRedirectWithCookiesRoute: typeof ApiRedirectWithCookiesRoute
+ ApiRemoveReturnedHeaderRoute: typeof ApiRemoveReturnedHeaderRoute
+ ApiReplaceAfterDirectMutationRoute: typeof ApiReplaceAfterDirectMutationRoute
+ ApiReplaceExplicitSetCookieRoute: typeof ApiReplaceExplicitSetCookieRoute
+ ApiRouteAfterNextRoute: typeof ApiRouteAfterNextRoute
+ ApiRouteBeforeNextRoute: typeof ApiRouteBeforeNextRoute
+ ApiSameBoundaryConflictRoute: typeof ApiSameBoundaryConflictRoute
+ ApiStatusContractsRoute: typeof ApiStatusContractsRoute
+ ApiThrowAfterStatusRoute: typeof ApiThrowAfterStatusRoute
+ ApiTrackedStreamRoute: typeof ApiTrackedStreamRoute
+ ApiTrackedStreamStatusRoute: typeof ApiTrackedStreamStatusRoute
+ ApiTwoReturnedResponsesRoute: typeof ApiTwoReturnedResponsesRoute
+}
+
+declare module '@tanstack/react-router' {
+ interface FileRoutesByPath {
+ '/': {
+ id: '/'
+ path: '/'
+ fullPath: '/'
+ preLoaderRoute: typeof IndexRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/server-functions': {
+ id: '/server-functions'
+ path: '/server-functions'
+ fullPath: '/server-functions'
+ preLoaderRoute: typeof ServerFunctionsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/ssr': {
+ id: '/ssr'
+ path: '/ssr'
+ fullPath: '/ssr'
+ preLoaderRoute: typeof SsrRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/streamed': {
+ id: '/streamed'
+ path: '/streamed'
+ fullPath: '/streamed'
+ preLoaderRoute: typeof StreamedRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/base': {
+ id: '/api/base'
+ path: '/api/base'
+ fullPath: '/api/base'
+ preLoaderRoute: typeof ApiBaseRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/bulk-headers': {
+ id: '/api/bulk-headers'
+ path: '/api/bulk-headers'
+ fullPath: '/api/bulk-headers'
+ preLoaderRoute: typeof ApiBulkHeadersRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/clear-returned-headers': {
+ id: '/api/clear-returned-headers'
+ path: '/api/clear-returned-headers'
+ fullPath: '/api/clear-returned-headers'
+ preLoaderRoute: typeof ApiClearReturnedHeadersRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/direct-mutation-visible': {
+ id: '/api/direct-mutation-visible'
+ path: '/api/direct-mutation-visible'
+ fullPath: '/api/direct-mutation-visible'
+ preLoaderRoute: typeof ApiDirectMutationVisibleRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/explicit-set-cookie-header': {
+ id: '/api/explicit-set-cookie-header'
+ path: '/api/explicit-set-cookie-header'
+ fullPath: '/api/explicit-set-cookie-header'
+ preLoaderRoute: typeof ApiExplicitSetCookieHeaderRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/framing-error': {
+ id: '/api/framing-error'
+ path: '/api/framing-error'
+ fullPath: '/api/framing-error'
+ preLoaderRoute: typeof ApiFramingErrorRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/get-response-header-helper': {
+ id: '/api/get-response-header-helper'
+ path: '/api/get-response-header-helper'
+ fullPath: '/api/get-response-header-helper'
+ preLoaderRoute: typeof ApiGetResponseHeaderHelperRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/get-response-headers-helper': {
+ id: '/api/get-response-headers-helper'
+ path: '/api/get-response-headers-helper'
+ fullPath: '/api/get-response-headers-helper'
+ preLoaderRoute: typeof ApiGetResponseHeadersHelperRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/multiple-cookies': {
+ id: '/api/multiple-cookies'
+ path: '/api/multiple-cookies'
+ fullPath: '/api/multiple-cookies'
+ preLoaderRoute: typeof ApiMultipleCookiesRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/null-body-status': {
+ id: '/api/null-body-status'
+ path: '/api/null-body-status'
+ fullPath: '/api/null-body-status'
+ preLoaderRoute: typeof ApiNullBodyStatusRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/readonly-after-next': {
+ id: '/api/readonly-after-next'
+ path: '/api/readonly-after-next'
+ fullPath: '/api/readonly-after-next'
+ preLoaderRoute: typeof ApiReadonlyAfterNextRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/redirect-with-cookies': {
+ id: '/api/redirect-with-cookies'
+ path: '/api/redirect-with-cookies'
+ fullPath: '/api/redirect-with-cookies'
+ preLoaderRoute: typeof ApiRedirectWithCookiesRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/remove-returned-header': {
+ id: '/api/remove-returned-header'
+ path: '/api/remove-returned-header'
+ fullPath: '/api/remove-returned-header'
+ preLoaderRoute: typeof ApiRemoveReturnedHeaderRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/replace-after-direct-mutation': {
+ id: '/api/replace-after-direct-mutation'
+ path: '/api/replace-after-direct-mutation'
+ fullPath: '/api/replace-after-direct-mutation'
+ preLoaderRoute: typeof ApiReplaceAfterDirectMutationRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/replace-explicit-set-cookie': {
+ id: '/api/replace-explicit-set-cookie'
+ path: '/api/replace-explicit-set-cookie'
+ fullPath: '/api/replace-explicit-set-cookie'
+ preLoaderRoute: typeof ApiReplaceExplicitSetCookieRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/route-after-next': {
+ id: '/api/route-after-next'
+ path: '/api/route-after-next'
+ fullPath: '/api/route-after-next'
+ preLoaderRoute: typeof ApiRouteAfterNextRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/route-before-next': {
+ id: '/api/route-before-next'
+ path: '/api/route-before-next'
+ fullPath: '/api/route-before-next'
+ preLoaderRoute: typeof ApiRouteBeforeNextRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/same-boundary-conflict': {
+ id: '/api/same-boundary-conflict'
+ path: '/api/same-boundary-conflict'
+ fullPath: '/api/same-boundary-conflict'
+ preLoaderRoute: typeof ApiSameBoundaryConflictRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/status-contracts': {
+ id: '/api/status-contracts'
+ path: '/api/status-contracts'
+ fullPath: '/api/status-contracts'
+ preLoaderRoute: typeof ApiStatusContractsRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/throw-after-status': {
+ id: '/api/throw-after-status'
+ path: '/api/throw-after-status'
+ fullPath: '/api/throw-after-status'
+ preLoaderRoute: typeof ApiThrowAfterStatusRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/tracked-stream': {
+ id: '/api/tracked-stream'
+ path: '/api/tracked-stream'
+ fullPath: '/api/tracked-stream'
+ preLoaderRoute: typeof ApiTrackedStreamRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/tracked-stream-status': {
+ id: '/api/tracked-stream-status'
+ path: '/api/tracked-stream-status'
+ fullPath: '/api/tracked-stream-status'
+ preLoaderRoute: typeof ApiTrackedStreamStatusRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ '/api/two-returned-responses': {
+ id: '/api/two-returned-responses'
+ path: '/api/two-returned-responses'
+ fullPath: '/api/two-returned-responses'
+ preLoaderRoute: typeof ApiTwoReturnedResponsesRouteImport
+ parentRoute: typeof rootRouteImport
+ }
+ }
+}
+
+const rootRouteChildren: RootRouteChildren = {
+ IndexRoute: IndexRoute,
+ ServerFunctionsRoute: ServerFunctionsRoute,
+ SsrRoute: SsrRoute,
+ StreamedRoute: StreamedRoute,
+ ApiBaseRoute: ApiBaseRoute,
+ ApiBulkHeadersRoute: ApiBulkHeadersRoute,
+ ApiClearReturnedHeadersRoute: ApiClearReturnedHeadersRoute,
+ ApiDirectMutationVisibleRoute: ApiDirectMutationVisibleRoute,
+ ApiExplicitSetCookieHeaderRoute: ApiExplicitSetCookieHeaderRoute,
+ ApiFramingErrorRoute: ApiFramingErrorRoute,
+ ApiGetResponseHeaderHelperRoute: ApiGetResponseHeaderHelperRoute,
+ ApiGetResponseHeadersHelperRoute: ApiGetResponseHeadersHelperRoute,
+ ApiMultipleCookiesRoute: ApiMultipleCookiesRoute,
+ ApiNullBodyStatusRoute: ApiNullBodyStatusRoute,
+ ApiReadonlyAfterNextRoute: ApiReadonlyAfterNextRoute,
+ ApiRedirectWithCookiesRoute: ApiRedirectWithCookiesRoute,
+ ApiRemoveReturnedHeaderRoute: ApiRemoveReturnedHeaderRoute,
+ ApiReplaceAfterDirectMutationRoute: ApiReplaceAfterDirectMutationRoute,
+ ApiReplaceExplicitSetCookieRoute: ApiReplaceExplicitSetCookieRoute,
+ ApiRouteAfterNextRoute: ApiRouteAfterNextRoute,
+ ApiRouteBeforeNextRoute: ApiRouteBeforeNextRoute,
+ ApiSameBoundaryConflictRoute: ApiSameBoundaryConflictRoute,
+ ApiStatusContractsRoute: ApiStatusContractsRoute,
+ ApiThrowAfterStatusRoute: ApiThrowAfterStatusRoute,
+ ApiTrackedStreamRoute: ApiTrackedStreamRoute,
+ ApiTrackedStreamStatusRoute: ApiTrackedStreamStatusRoute,
+ ApiTwoReturnedResponsesRoute: ApiTwoReturnedResponsesRoute,
+}
+export const routeTree = rootRouteImport
+ ._addFileChildren(rootRouteChildren)
+ ._addFileTypes()
+
+import type { getRouter } from './router.tsx'
+import type { startInstance } from './start.ts'
+declare module '@tanstack/react-start' {
+ interface Register {
+ ssr: true
+ router: Awaited>
+ config: Awaited>
+ }
+}
diff --git a/e2e/react-start/response-reconciliation/src/router.tsx b/e2e/react-start/response-reconciliation/src/router.tsx
new file mode 100644
index 0000000000..c5c2209e5a
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/router.tsx
@@ -0,0 +1,13 @@
+import { createRouter } from '@tanstack/react-router'
+import { routeTree } from './routeTree.gen'
+import { DefaultCatchBoundary } from './components/DefaultCatchBoundary'
+import { NotFound } from './components/NotFound'
+
+export function getRouter() {
+ return createRouter({
+ routeTree,
+ defaultErrorComponent: DefaultCatchBoundary,
+ defaultNotFoundComponent: () => ,
+ scrollRestoration: true,
+ })
+}
diff --git a/e2e/react-start/response-reconciliation/src/routes/__root.tsx b/e2e/react-start/response-reconciliation/src/routes/__root.tsx
new file mode 100644
index 0000000000..a562991887
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/__root.tsx
@@ -0,0 +1,57 @@
+///
+import * as React from 'react'
+import {
+ HeadContent,
+ Link,
+ Outlet,
+ Scripts,
+ createRootRoute,
+} from '@tanstack/react-router'
+import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary'
+import { NotFound } from '~/components/NotFound'
+import '~/styles/app.css'
+
+export const Route = createRootRoute({
+ head: () => ({
+ meta: [
+ { charSet: 'utf-8' },
+ { name: 'viewport', content: 'width=device-width, initial-scale=1' },
+ ],
+ }),
+ errorComponent: (props) => {
+ return (
+
+
+
+ )
+ },
+ notFoundComponent: () => ,
+ component: RootComponent,
+})
+
+function RootComponent() {
+ return (
+
+
+
+ )
+}
+
+function RootDocument({ children }: { children: React.ReactNode }) {
+ return (
+
+
+
+
+
+
+ {children}
+
+
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/-response.ts b/e2e/react-start/response-reconciliation/src/routes/api/-response.ts
new file mode 100644
index 0000000000..54082c10f6
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/-response.ts
@@ -0,0 +1,85 @@
+import { createMiddleware } from '@tanstack/react-start'
+import {
+ getResponseHeader,
+ setResponseHeader,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+
+function getScenario(request: Request) {
+ const url = new URL(request.url)
+ return url.pathname.split('/').pop() || ''
+}
+
+export function baseResponse(scenario: string) {
+ return new Response(scenario, {
+ headers: { 'x-handler': scenario, 'x-base': 'yes' },
+ })
+}
+
+export const routeBoundaryMiddleware = createMiddleware().server(
+ async ({ next, request }) => {
+ const scenario = getScenario(request)
+
+ if (scenario === 'route-before-next') {
+ setResponseHeader('x-route-before', 'yes')
+ setResponseStatus(234, 'route-before')
+ return next()
+ }
+
+ if (scenario === 'route-after-next') {
+ const result = await next()
+ setResponseHeader('x-route-after', 'yes')
+ setResponseStatus(233, 'route-after')
+ return result
+ }
+
+ if (scenario === 'direct-mutation-visible') {
+ const result = await next()
+ result.response.headers.set('x-direct-visible', 'yes')
+ setResponseHeader(
+ 'x-direct-read',
+ getResponseHeader('x-direct-visible') || 'missing',
+ )
+ return result
+ }
+
+ if (scenario === 'replace-after-direct-mutation') {
+ const result = await next()
+ result.response.headers.set('x-direct-a', 'yes')
+ setResponseHeader('x-helper-delta', 'yes')
+ return new Response('replacement', {
+ status: 202,
+ headers: { 'x-response-b': 'yes' },
+ })
+ }
+
+ if (scenario === 'two-returned-responses') {
+ await next()
+ setResponseHeader('x-helper-after-a', 'yes')
+ return new Response('response-b', {
+ headers: { 'x-response-b': 'yes' },
+ })
+ }
+
+ if (scenario === 'readonly-after-next') {
+ const result = await next()
+ setResponseHeader('x-readonly-after', 'yes')
+ return result
+ }
+
+ return next()
+ },
+)
+
+export const returnedResponseMiddleware = createMiddleware().server(
+ async ({ next, request }) => {
+ if (getScenario(request) === 'two-returned-responses') {
+ await next()
+ return new Response('response-a', {
+ headers: { 'x-response-a': 'yes' },
+ })
+ }
+
+ return next()
+ },
+)
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/-tracked-streams.ts b/e2e/react-start/response-reconciliation/src/routes/api/-tracked-streams.ts
new file mode 100644
index 0000000000..1ccde76367
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/-tracked-streams.ts
@@ -0,0 +1,2 @@
+// Ids of tracked response streams that were cancelled, kept by the server.
+export const cancelledStreams = new Set()
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/-upstream.ts b/e2e/react-start/response-reconciliation/src/routes/api/-upstream.ts
new file mode 100644
index 0000000000..0018376035
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/-upstream.ts
@@ -0,0 +1,14 @@
+// An upstream reply whose headers describe its own body and client. Start must
+// not copy them onto the error body it generates for this failure.
+export function createUpstreamFailure() {
+ return new Response('upstream
', {
+ status: 502,
+ headers: {
+ 'content-encoding': 'gzip',
+ 'content-length': '999',
+ 'content-type': 'text/html',
+ 'set-cookie': 'upstream-session=leaked; Path=/',
+ 'x-upstream': 'yes',
+ },
+ })
+}
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/base.ts b/e2e/react-start/response-reconciliation/src/routes/api/base.ts
new file mode 100644
index 0000000000..62f706a9f1
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/base.ts
@@ -0,0 +1,10 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { baseResponse } from './-response'
+
+export const Route = createFileRoute('/api/base')({
+ server: {
+ handlers: {
+ GET: () => baseResponse('base'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/bulk-headers.ts b/e2e/react-start/response-reconciliation/src/routes/api/bulk-headers.ts
new file mode 100644
index 0000000000..db7ded6c54
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/bulk-headers.ts
@@ -0,0 +1,19 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setResponseHeaders } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/bulk-headers')({
+ server: {
+ handlers: {
+ GET: () => {
+ const headers = new Headers({
+ 'x-bulk-one': '1',
+ 'x-bulk-two': '2',
+ })
+ headers.append('set-cookie', 'bulk-one=1; Path=/')
+ headers.append('set-cookie', 'bulk-two=2; Path=/')
+ setResponseHeaders(headers)
+ return new Response('bulk', { headers: { 'x-keep': 'yes' } })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/clear-returned-headers.ts b/e2e/react-start/response-reconciliation/src/routes/api/clear-returned-headers.ts
new file mode 100644
index 0000000000..fd3b88c172
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/clear-returned-headers.ts
@@ -0,0 +1,15 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { clearResponseHeaders } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/clear-returned-headers')({
+ server: {
+ handlers: {
+ GET: () => {
+ clearResponseHeaders()
+ return new Response('clear', {
+ headers: { 'x-clear-one': '1', 'x-clear-two': '2' },
+ })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/direct-mutation-visible.ts b/e2e/react-start/response-reconciliation/src/routes/api/direct-mutation-visible.ts
new file mode 100644
index 0000000000..96823887e5
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/direct-mutation-visible.ts
@@ -0,0 +1,11 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { baseResponse, routeBoundaryMiddleware } from './-response'
+
+export const Route = createFileRoute('/api/direct-mutation-visible')({
+ server: {
+ middleware: [routeBoundaryMiddleware],
+ handlers: {
+ GET: () => baseResponse('direct-mutation-visible'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/explicit-set-cookie-header.ts b/e2e/react-start/response-reconciliation/src/routes/api/explicit-set-cookie-header.ts
new file mode 100644
index 0000000000..3ea2bc6d75
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/explicit-set-cookie-header.ts
@@ -0,0 +1,16 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setResponseHeader } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/explicit-set-cookie-header')({
+ server: {
+ handlers: {
+ GET: () => {
+ setResponseHeader('set-cookie', [
+ 'explicit-one=1; Path=/',
+ 'explicit-two=2; Path=/',
+ ])
+ return new Response('explicit')
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/framing-error.ts b/e2e/react-start/response-reconciliation/src/routes/api/framing-error.ts
new file mode 100644
index 0000000000..baeab15780
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/framing-error.ts
@@ -0,0 +1,16 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setResponseHeader } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/framing-error')({
+ server: {
+ handlers: {
+ GET: async () => {
+ // Headers for a compressed file whose read then fails.
+ setResponseHeader('content-encoding', 'gzip')
+ setResponseHeader('content-length', '2')
+ await Promise.resolve()
+ throw new Error('File read failed')
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/get-response-header-helper.ts b/e2e/react-start/response-reconciliation/src/routes/api/get-response-header-helper.ts
new file mode 100644
index 0000000000..b597882ff6
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/get-response-header-helper.ts
@@ -0,0 +1,17 @@
+import { createFileRoute } from '@tanstack/react-router'
+import {
+ getResponseHeader,
+ setResponseHeader,
+} from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/get-response-header-helper')({
+ server: {
+ handlers: {
+ GET: () => {
+ setResponseHeader('x-helper-visible', 'yes')
+ const value = getResponseHeader('x-helper-visible') || 'missing'
+ return new Response(value, { headers: { 'x-read-after-set': value } })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/get-response-headers-helper.ts b/e2e/react-start/response-reconciliation/src/routes/api/get-response-headers-helper.ts
new file mode 100644
index 0000000000..168d38bad4
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/get-response-headers-helper.ts
@@ -0,0 +1,20 @@
+import { createFileRoute } from '@tanstack/react-router'
+import {
+ getResponseHeaders,
+ setResponseHeader,
+} from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/get-response-headers-helper')({
+ server: {
+ handlers: {
+ GET: () => {
+ setResponseHeader('x-headers-helper-visible', 'yes')
+ // Exercise an untyped caller mutating its detached snapshot.
+ const headers = getResponseHeaders() as Headers
+ const value = headers.get('x-headers-helper-visible') || 'missing'
+ headers.set('x-headers-snapshot-write', 'ignored')
+ return new Response(value, { headers: { 'x-headers-read': value } })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/multiple-cookies.ts b/e2e/react-start/response-reconciliation/src/routes/api/multiple-cookies.ts
new file mode 100644
index 0000000000..eebf7a167e
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/multiple-cookies.ts
@@ -0,0 +1,14 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setCookie } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/multiple-cookies')({
+ server: {
+ handlers: {
+ GET: () => {
+ setCookie('route-one', '1', { path: '/' })
+ setCookie('route-two', '2', { path: '/' })
+ return new Response('cookies')
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/null-body-status.ts b/e2e/react-start/response-reconciliation/src/routes/api/null-body-status.ts
new file mode 100644
index 0000000000..d11056e7a8
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/null-body-status.ts
@@ -0,0 +1,18 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setResponseStatus } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/null-body-status')({
+ server: {
+ handlers: {
+ GET: ({ request }) => {
+ const statusParam = new URL(request.url).searchParams.get('status')
+ const status =
+ statusParam === '205' ? 205 : statusParam === '304' ? 304 : 204
+ setResponseStatus(status)
+ return new Response('should-drop', {
+ headers: { 'x-null-body': 'yes' },
+ })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/readonly-after-next.ts b/e2e/react-start/response-reconciliation/src/routes/api/readonly-after-next.ts
new file mode 100644
index 0000000000..7b42955052
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/readonly-after-next.ts
@@ -0,0 +1,11 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { routeBoundaryMiddleware } from './-response'
+
+export const Route = createFileRoute('/api/readonly-after-next')({
+ server: {
+ middleware: [routeBoundaryMiddleware],
+ handlers: {
+ GET: () => fetch('data:text/plain,readonly'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/redirect-with-cookies.ts b/e2e/react-start/response-reconciliation/src/routes/api/redirect-with-cookies.ts
new file mode 100644
index 0000000000..5b0072f35a
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/redirect-with-cookies.ts
@@ -0,0 +1,18 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setCookie } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/redirect-with-cookies')({
+ server: {
+ handlers: {
+ GET: () => {
+ setCookie('redirect-one', '1', { path: '/' })
+ setCookie('redirect-two', '2', { path: '/' })
+ setCookie('redirect-three', '3', { path: '/' })
+ return new Response(null, {
+ status: 307,
+ headers: { Location: '/api/base' },
+ })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/remove-returned-header.ts b/e2e/react-start/response-reconciliation/src/routes/api/remove-returned-header.ts
new file mode 100644
index 0000000000..96f82bf98d
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/remove-returned-header.ts
@@ -0,0 +1,15 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { removeResponseHeader } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/remove-returned-header')({
+ server: {
+ handlers: {
+ GET: () => {
+ removeResponseHeader('x-remove-me')
+ return new Response('remove', {
+ headers: { 'x-remove-me': 'response', 'x-keep': 'yes' },
+ })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/replace-after-direct-mutation.ts b/e2e/react-start/response-reconciliation/src/routes/api/replace-after-direct-mutation.ts
new file mode 100644
index 0000000000..890280483d
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/replace-after-direct-mutation.ts
@@ -0,0 +1,11 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { baseResponse, routeBoundaryMiddleware } from './-response'
+
+export const Route = createFileRoute('/api/replace-after-direct-mutation')({
+ server: {
+ middleware: [routeBoundaryMiddleware],
+ handlers: {
+ GET: () => baseResponse('replace-after-direct-mutation'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/replace-explicit-set-cookie.ts b/e2e/react-start/response-reconciliation/src/routes/api/replace-explicit-set-cookie.ts
new file mode 100644
index 0000000000..97df27d915
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/replace-explicit-set-cookie.ts
@@ -0,0 +1,15 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setResponseHeader } from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/replace-explicit-set-cookie')({
+ server: {
+ handlers: {
+ GET: () => {
+ setResponseHeader('set-cookie', 'explicit-new=1; Path=/')
+ return new Response('explicit', {
+ headers: { 'set-cookie': 'explicit-old=1; Path=/' },
+ })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/route-after-next.ts b/e2e/react-start/response-reconciliation/src/routes/api/route-after-next.ts
new file mode 100644
index 0000000000..7d3650147f
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/route-after-next.ts
@@ -0,0 +1,11 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { baseResponse, routeBoundaryMiddleware } from './-response'
+
+export const Route = createFileRoute('/api/route-after-next')({
+ server: {
+ middleware: [routeBoundaryMiddleware],
+ handlers: {
+ GET: () => baseResponse('route-after-next'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/route-before-next.ts b/e2e/react-start/response-reconciliation/src/routes/api/route-before-next.ts
new file mode 100644
index 0000000000..b52c7642af
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/route-before-next.ts
@@ -0,0 +1,11 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { baseResponse, routeBoundaryMiddleware } from './-response'
+
+export const Route = createFileRoute('/api/route-before-next')({
+ server: {
+ middleware: [routeBoundaryMiddleware],
+ handlers: {
+ GET: () => baseResponse('route-before-next'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/same-boundary-conflict.ts b/e2e/react-start/response-reconciliation/src/routes/api/same-boundary-conflict.ts
new file mode 100644
index 0000000000..7ac086d652
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/same-boundary-conflict.ts
@@ -0,0 +1,21 @@
+import { createFileRoute } from '@tanstack/react-router'
+import {
+ setResponseHeader,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/same-boundary-conflict')({
+ server: {
+ handlers: {
+ GET: () => {
+ setResponseStatus(235, 'same-boundary')
+ setResponseHeader('x-conflict', 'helper')
+ return new Response('conflict', {
+ status: 201,
+ statusText: 'response-status',
+ headers: { 'x-conflict': 'response' },
+ })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/status-contracts.ts b/e2e/react-start/response-reconciliation/src/routes/api/status-contracts.ts
new file mode 100644
index 0000000000..43fd72ec07
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/status-contracts.ts
@@ -0,0 +1,42 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { setResponseStatus } from '@tanstack/react-start/server'
+import { createUpstreamFailure } from './-upstream'
+
+export const Route = createFileRoute('/api/status-contracts')({
+ server: {
+ handlers: {
+ GET: async ({ request }) => {
+ const scenario = new URL(request.url).searchParams.get('scenario')
+
+ if (scenario === 'invalid-status-return') {
+ setResponseStatus(999, 'Ignored')
+ return new Response('missing', {
+ status: 404,
+ statusText: 'Not Found',
+ })
+ }
+
+ if (scenario === 'invalid-status-throw') {
+ setResponseStatus(101)
+ throw new Error('Unexpected status contract failure')
+ }
+
+ if (scenario === 'slow') {
+ await new Promise((resolve) => setTimeout(resolve, 150))
+ return new Response('slow result')
+ }
+
+ if (scenario === 'helper-success-crash') {
+ setResponseStatus(201, 'Created')
+ throw new Error('Crash after a success status')
+ }
+
+ if (scenario === 'upstream-error-cause') {
+ throw new Error('Upstream failed', { cause: createUpstreamFailure() })
+ }
+
+ return new Response(`Unknown scenario: ${scenario}`, { status: 400 })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/throw-after-status.ts b/e2e/react-start/response-reconciliation/src/routes/api/throw-after-status.ts
new file mode 100644
index 0000000000..9d93d75b61
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/throw-after-status.ts
@@ -0,0 +1,26 @@
+import { createFileRoute } from '@tanstack/react-router'
+import {
+ setCookie,
+ setResponseHeader,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+
+export const Route = createFileRoute('/api/throw-after-status')({
+ server: {
+ handlers: {
+ GET: ({ request }) => {
+ const url = new URL(request.url)
+ setResponseStatus(401, 'Unauthorized')
+ setResponseHeader('x-error-helper', 'yes')
+ setCookie('throw-after-status', '1', { path: '/' })
+ if (url.searchParams.get('throw') === 'response') {
+ throw new Response('Unauthorized response', {
+ status: 200,
+ headers: { 'x-thrown-response': 'yes' },
+ })
+ }
+ throw new Error('Unauthorized route')
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/tracked-stream-status.ts b/e2e/react-start/response-reconciliation/src/routes/api/tracked-stream-status.ts
new file mode 100644
index 0000000000..1aaffd8d36
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/tracked-stream-status.ts
@@ -0,0 +1,13 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { cancelledStreams } from './-tracked-streams'
+
+export const Route = createFileRoute('/api/tracked-stream-status')({
+ server: {
+ handlers: {
+ GET: ({ request }) => {
+ const id = new URL(request.url).searchParams.get('id') ?? ''
+ return Response.json({ cancelled: cancelledStreams.has(id) })
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/tracked-stream.ts b/e2e/react-start/response-reconciliation/src/routes/api/tracked-stream.ts
new file mode 100644
index 0000000000..640074a035
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/tracked-stream.ts
@@ -0,0 +1,23 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { cancelledStreams } from './-tracked-streams'
+
+export const Route = createFileRoute('/api/tracked-stream')({
+ server: {
+ handlers: {
+ // A body that never ends, like a live feed. Only cancellation stops it.
+ GET: ({ request }) => {
+ const id = new URL(request.url).searchParams.get('id') ?? ''
+ return new Response(
+ new ReadableStream({
+ start(controller) {
+ controller.enqueue(new TextEncoder().encode('tracked'))
+ },
+ cancel() {
+ cancelledStreams.add(id)
+ },
+ }),
+ )
+ },
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/api/two-returned-responses.ts b/e2e/react-start/response-reconciliation/src/routes/api/two-returned-responses.ts
new file mode 100644
index 0000000000..f433778fd8
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/api/two-returned-responses.ts
@@ -0,0 +1,15 @@
+import { createFileRoute } from '@tanstack/react-router'
+import {
+ baseResponse,
+ returnedResponseMiddleware,
+ routeBoundaryMiddleware,
+} from './-response'
+
+export const Route = createFileRoute('/api/two-returned-responses')({
+ server: {
+ middleware: [routeBoundaryMiddleware, returnedResponseMiddleware],
+ handlers: {
+ GET: () => baseResponse('two-returned-responses'),
+ },
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/routes/index.tsx b/e2e/react-start/response-reconciliation/src/routes/index.tsx
new file mode 100644
index 0000000000..ab938397e9
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/index.tsx
@@ -0,0 +1,15 @@
+import { createFileRoute } from '@tanstack/react-router'
+
+export const Route = createFileRoute('/')({
+ headers: () => ({ 'x-route-header': 'present' }),
+ component: Home,
+})
+
+function Home() {
+ return (
+
+ Response Reconciliation E2E
+ This app contains HTTP-level regression tests.
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/routes/server-functions.tsx b/e2e/react-start/response-reconciliation/src/routes/server-functions.tsx
new file mode 100644
index 0000000000..580309b31e
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/server-functions.tsx
@@ -0,0 +1,285 @@
+import { ClientOnly, createFileRoute, redirect } from '@tanstack/react-router'
+import {
+ createMiddleware,
+ createServerFn,
+ useServerFn,
+} from '@tanstack/react-start'
+import * as React from 'react'
+import {
+ getResponseHeader,
+ setCookie,
+ setResponseHeader,
+ setResponseHeaders,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+
+const functionAfterNextMiddleware = createMiddleware({
+ type: 'function',
+}).server(async ({ next }) => {
+ const result = await next()
+ setResponseHeader('x-function-after', 'yes')
+ setResponseStatus(236, 'function-after')
+ return result
+})
+
+const rawResponseAfterNextMiddleware = createMiddleware({
+ type: 'function',
+}).server(async ({ next }) => {
+ const result = await next()
+ setResponseHeader('x-function-raw-after', 'yes')
+ setResponseStatus(237, 'function-raw-after')
+ return result
+})
+
+const throwStatusMiddleware = createMiddleware({
+ type: 'function',
+}).server(() => {
+ setResponseStatus(401, 'Unauthorized')
+ setResponseHeader('x-function-error-middleware', 'yes')
+ throw new Error('Unauthorized function middleware')
+})
+
+const replacementMiddleware = createMiddleware({
+ type: 'function',
+}).server(async ({ next }) => {
+ const result = await next()
+ const resultWithResponse = result as typeof result & { result?: unknown }
+ if (!(resultWithResponse.result instanceof Response)) {
+ throw new Error('Expected replacement test to observe a Response')
+ }
+ resultWithResponse.result.headers.set('x-function-a', 'yes')
+ setResponseHeader('x-function-helper-delta', 'yes')
+ // Function middleware types don't model raw Response replacement, but the
+ // middleware executor supports it; this fixture deliberately exercises that
+ // runtime path.
+ return new Response('function-b', {
+ headers: { 'x-function-b': 'yes' },
+ }) as never
+})
+
+const globalSerializedFn = createServerFn().handler(() => {
+ return { ok: true }
+})
+
+const functionAfterNextFn = createServerFn()
+ .middleware([functionAfterNextMiddleware])
+ .handler(() => {
+ return { ok: true }
+ })
+
+const rawResponseAfterNextFn = createServerFn()
+ .middleware([rawResponseAfterNextMiddleware])
+ .handler(() => {
+ return new Response('raw function body', {
+ headers: { 'x-function-raw': 'yes' },
+ })
+ })
+
+const replacementFn = createServerFn()
+ .middleware([replacementMiddleware])
+ .handler(() => {
+ return new Response('function-a')
+ })
+
+const multipleCookiesFn = createServerFn().handler(() => {
+ setCookie('fn-one', '1', { path: '/' })
+ setCookie('fn-two', '2', { path: '/' })
+ return { ok: true }
+})
+
+const rawMultipleCookiesFn = createServerFn().handler(() => {
+ setCookie('fn-raw-helper-one', '1', { path: '/' })
+ setCookie('fn-raw-helper-two', '2', { path: '/' })
+ const headers = new Headers()
+ headers.append('set-cookie', 'fn-raw-returned-one=1; Path=/')
+ headers.append('set-cookie', 'fn-raw-returned-two=2; Path=/')
+ return new Response('raw cookie body', { headers })
+})
+
+const explicitCookieHeaderFn = createServerFn().handler(() => {
+ setResponseHeader('set-cookie', [
+ 'fn-explicit-one=1; Path=/',
+ 'fn-explicit-two=2; Path=/',
+ ])
+ return { ok: true }
+})
+
+const throwAfterStatusFn = createServerFn().handler(() => {
+ setResponseStatus(401, 'Unauthorized')
+ setResponseHeader('x-function-error', 'yes')
+ throw new Error('Unauthorized function')
+})
+
+const throwAfterFramingFn = createServerFn().handler(async () => {
+ // Headers for a compressed file whose read then fails.
+ setResponseHeader('content-encoding', 'gzip')
+ setResponseHeader('content-length', '2')
+ await Promise.resolve()
+ throw new Error('File read failed')
+})
+
+const throwAfterMiddlewareStatusFn = createServerFn()
+ .middleware([throwStatusMiddleware])
+ .handler(() => {
+ return { ok: true }
+ })
+
+const transportProtectedFn = createServerFn().handler(() => {
+ setResponseHeaders(
+ new Headers({
+ 'content-type': 'text/plain',
+ 'x-tss-serialized': 'false',
+ 'x-user-header': 'yes',
+ }),
+ )
+ return { ok: true }
+})
+
+const readAfterSetFn = createServerFn().handler(() => {
+ setResponseHeader('x-read-after-set', 'yes')
+ setResponseHeader(
+ 'x-read-after-set-value',
+ getResponseHeader('x-read-after-set') || 'missing',
+ )
+ return { ok: true }
+})
+
+const returnRedirectFn = createServerFn().handler(() => {
+ setResponseStatus(302, 'Continue')
+ setResponseHeaders(
+ new Headers({
+ 'content-type': 'text/plain',
+ 'x-tss-raw': 'true',
+ 'x-tss-serialized': 'true',
+ location: '/middleware-target',
+ }),
+ )
+ setCookie('rpc-redirect', 'committed', { path: '/' })
+ return redirect({ to: '/' })
+})
+
+const throwRedirectFn = createServerFn().handler(() => {
+ setResponseStatus(302, 'Continue')
+ setResponseHeaders(
+ new Headers({
+ 'content-type': 'text/plain',
+ 'x-tss-raw': 'true',
+ 'x-tss-serialized': 'true',
+ location: '/middleware-target',
+ }),
+ )
+ setCookie('rpc-redirect', 'committed', { path: '/' })
+ throw redirect({ to: '/' })
+})
+
+const bodylessStatusFn = createServerFn().handler(() => {
+ setResponseStatus(204, 'No Content')
+ setResponseHeader('x-bodyless-status', 'ignored')
+ return { ok: true }
+})
+
+const throwZeroFn = createServerFn().handler(() => {
+ throw 0
+})
+
+const throwResponseFn = createServerFn().handler(() => {
+ throw new Response('teapot', { status: 418 })
+})
+
+const helperLocationFn = createServerFn().handler(() => {
+ setResponseStatus(302)
+ setResponseHeader('location', '/api/base')
+ return { ok: true }
+})
+
+export const Route = createFileRoute('/server-functions')({
+ component: ServerFunctions,
+})
+
+function ServerFunctions() {
+ return (
+
+ Server Functions
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+}
+
+function ServerFunctionButton({
+ name,
+ fn,
+}: {
+ name: string
+ fn: (...args: Array) => Promise
+}) {
+ const serverFn = useServerFn(fn)
+ const [result, setResult] = React.useState('idle')
+
+ return (
+
+
+
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/routes/ssr.tsx b/e2e/react-start/response-reconciliation/src/routes/ssr.tsx
new file mode 100644
index 0000000000..c0cb69c8ec
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/ssr.tsx
@@ -0,0 +1,29 @@
+import { createFileRoute } from '@tanstack/react-router'
+import { createServerFn } from '@tanstack/react-start'
+import {
+ setCookie,
+ setResponseHeader,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+
+const setSsrResponseFn = createServerFn().handler(() => {
+ setResponseStatus(238, 'ssr-loader')
+ setResponseHeader('x-ssr-loader', 'yes')
+ setCookie('ssr-one', '1', { path: '/' })
+ setCookie('ssr-two', '2', { path: '/' })
+ return { message: 'ssr response' }
+})
+
+export const Route = createFileRoute('/ssr')({
+ loader: () => setSsrResponseFn(),
+ component: SsrRoute,
+})
+
+function SsrRoute() {
+ const data = Route.useLoaderData()
+ return (
+
+ {data.message}
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/routes/streamed.tsx b/e2e/react-start/response-reconciliation/src/routes/streamed.tsx
new file mode 100644
index 0000000000..8d6a6227cd
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/routes/streamed.tsx
@@ -0,0 +1,25 @@
+import { Await, createFileRoute } from '@tanstack/react-router'
+import { Suspense } from 'react'
+
+export const Route = createFileRoute('/streamed')({
+ loader: () => ({
+ deferred: new Promise((resolve) =>
+ setTimeout(() => resolve('streamed after the shell'), 100),
+ ),
+ }),
+ component: StreamedRoute,
+})
+
+function StreamedRoute() {
+ const { deferred } = Route.useLoaderData()
+ return (
+
+ Streamed document
+ loading
}>
+
+ {(value) => {value}
}
+
+
+
+ )
+}
diff --git a/e2e/react-start/response-reconciliation/src/server-entry.ts b/e2e/react-start/response-reconciliation/src/server-entry.ts
new file mode 100644
index 0000000000..cbee8ad31a
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/server-entry.ts
@@ -0,0 +1,84 @@
+import {
+ createStartHandler,
+ defaultStreamHandler,
+ getResponseStatus,
+ handleStartError,
+} from '@tanstack/react-start/server'
+import handler, { createServerEntry } from '@tanstack/react-start/server-entry'
+
+const uncaughtFetch = createStartHandler(defaultStreamHandler)
+
+// Reproduce #7647's custom stream handler that preserves middleware status.
+const preserveStatusFetch = createStartHandler(async (ctx) => {
+ const result = await defaultStreamHandler(ctx)
+ const response = result instanceof Response ? result : result.response
+ const status = getResponseStatus()
+ if (status === response.status) {
+ return result
+ }
+
+ const headers = new Headers(response.headers)
+ headers.set('x-stream-response-rebuilt', 'yes')
+ const replacement = new Response(response.body, {
+ status,
+ statusText: response.statusText,
+ headers,
+ })
+ return result instanceof Response
+ ? replacement
+ : { ...result, response: replacement }
+})
+
+function markCustomServerEntry(response: Response): Response {
+ try {
+ response.headers.set('x-custom-server-entry', 'yes')
+ return response
+ } catch {
+ const headers = new Headers(response.headers)
+ headers.set('x-custom-server-entry', 'yes')
+ return new Response(response.body, {
+ status: response.status,
+ statusText: response.statusText,
+ headers,
+ })
+ }
+}
+
+export default createServerEntry({
+ async fetch(request, opts) {
+ if (request.headers.get('x-reconciliation-scenario') === 'issue-7647') {
+ return markCustomServerEntry(await preserveStatusFetch(request, opts))
+ }
+
+ if (request.headers.get('x-custom-handle-errors') === 'false') {
+ try {
+ return markCustomServerEntry(await uncaughtFetch(request, opts))
+ } catch (error) {
+ if (request.headers.get('x-custom-handle-start-error') === 'true') {
+ return markCustomServerEntry(handleStartError(error))
+ }
+ return markCustomServerEntry(
+ new Response(error instanceof Error ? error.message : 'error', {
+ status: 555,
+ headers: {
+ 'x-custom-entry-catch': 'yes',
+ },
+ }),
+ )
+ }
+ }
+
+ try {
+ return markCustomServerEntry(await handler.fetch(request, opts))
+ } catch (error) {
+ return markCustomServerEntry(
+ new Response(error instanceof Error ? error.message : 'error', {
+ status: 556,
+ headers: {
+ 'x-custom-entry-catch': 'unexpected',
+ },
+ }),
+ )
+ }
+ },
+})
diff --git a/e2e/react-start/response-reconciliation/src/start.ts b/e2e/react-start/response-reconciliation/src/start.ts
new file mode 100644
index 0000000000..2ac158b799
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/start.ts
@@ -0,0 +1,170 @@
+import { createMiddleware, createStart } from '@tanstack/react-start'
+import {
+ clearResponseHeaders,
+ setCookie,
+ getCookie,
+ setResponseHeader,
+ setResponseHeaders,
+ setResponseStatus,
+} from '@tanstack/react-start/server'
+import { createUpstreamFailure } from './routes/api/-upstream'
+import { installResponseWrapper } from './response-wrapper'
+
+const globalResponseMiddleware = createMiddleware().server(
+ async ({ next, request }) => {
+ if (request.headers.get('x-wrap-response') === 'true') {
+ installResponseWrapper()
+ }
+
+ const scenario =
+ request.headers.get('x-reconciliation-scenario') ||
+ getCookie('reconciliation-scenario')
+
+ if (scenario === 'issue-7647') {
+ setResponseStatus(418)
+ setResponseHeader('x-middleware-header', 'present')
+ setResponseHeader('cache-control', 'no-store')
+ return next()
+ }
+
+ if (scenario === 'global-before') {
+ setResponseHeaders(
+ new Headers({
+ 'x-global-before': 'yes',
+ 'x-global-common': 'before',
+ }),
+ )
+ setResponseStatus(231, 'global-before')
+ return next()
+ }
+
+ if (scenario === 'global-after') {
+ const result = await next()
+ setResponseHeader('x-global-after', 'yes')
+ setResponseHeader('x-global-common', 'after')
+ setResponseStatus(232, 'global-after')
+ return result
+ }
+
+ if (scenario === 'global-multiple-cookies') {
+ setCookie('global-one', '1', { path: '/' })
+ setCookie('global-two', '2', { path: '/' })
+ return next()
+ }
+
+ if (scenario === 'global-upstream-cause') {
+ throw new Error('Upstream failed', { cause: createUpstreamFailure() })
+ }
+
+ if (scenario === 'global-location-error') {
+ throw Object.assign(new Error('Moved error'), {
+ status: 302,
+ headers: { location: '/api/base' },
+ })
+ }
+
+ if (scenario === 'global-same-body-wrapper') {
+ const result = await next()
+ const wrapped = new Response(result.response.body, result.response)
+ clearResponseHeaders()
+ setResponseHeader('x-same-body-wrapper', 'yes')
+ return { ...result, response: wrapped }
+ }
+
+ if (scenario === 'global-copy') {
+ // Session middleware copies the response to add a header (#8627).
+ const result = await next()
+ const headers = new Headers(result.response.headers)
+ headers.set('x-global-copy', 'yes')
+ return {
+ ...result,
+ response: new Response(result.response.body, {
+ status: result.response.status,
+ statusText: result.response.statusText,
+ headers,
+ }),
+ }
+ }
+
+ if (scenario === 'global-piped-copy') {
+ const result = await next()
+ const response = new Response(
+ result.response.body!.pipeThrough(new TransformStream()),
+ result.response,
+ )
+ response.headers.set('x-global-piped-copy', 'yes')
+ return { ...result, response }
+ }
+
+ if (scenario === 'global-representation') {
+ // Representation metadata computed from the body, as by ETag middleware.
+ const result = await next()
+ const body = await result.response.text()
+ const response = new Response(body, result.response)
+ response.headers.set('x-body-length', String(body.length))
+ return { ...result, response }
+ }
+
+ if (scenario === 'global-assigned-transform-not-modified') {
+ // Transform the body in place, then answer an ETag match instead.
+ const result = await next()
+ result.response = new Response(
+ result.response.body!.pipeThrough(new TransformStream()),
+ result.response,
+ )
+ return new Response(null, { status: 304 })
+ }
+
+ if (scenario === 'global-timeout') {
+ // Keep working after next() while the handler the inner timeout
+ // abandoned is still running.
+ const result = await next()
+ await sleep(400)
+ return result
+ }
+
+ if (scenario === 'global-throw') {
+ setResponseStatus(401, 'Unauthorized')
+ setResponseHeader('x-global-error', 'yes')
+ throw new Error('Unauthorized global middleware')
+ }
+
+ if (scenario === 'global-throw-string') {
+ throw 'global string'
+ }
+
+ if (scenario === 'global-throw-response') {
+ throw Response.json({ denied: true }, { status: 403 })
+ }
+
+ return next()
+ },
+)
+
+const sleep = (ms: number) =>
+ new Promise((resolve) => setTimeout(resolve, ms))
+
+const globalTimeoutMiddleware = createMiddleware().server(
+ ({ next, request }) => {
+ const scenario =
+ request.headers.get('x-reconciliation-scenario') ||
+ getCookie('reconciliation-scenario')
+ if (scenario !== 'global-timeout') {
+ return next()
+ }
+ return Promise.race([
+ next(),
+ sleep(50).then(
+ () =>
+ new Response('timeout', {
+ status: 504,
+ headers: { 'x-timeout-fallback': 'yes' },
+ }),
+ ),
+ ])
+ },
+)
+
+export const startInstance = createStart(() => ({
+ requestMiddleware: [globalResponseMiddleware, globalTimeoutMiddleware],
+}))
diff --git a/e2e/react-start/response-reconciliation/src/styles/app.css b/e2e/react-start/response-reconciliation/src/styles/app.css
new file mode 100644
index 0000000000..a38fb439a6
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/src/styles/app.css
@@ -0,0 +1,12 @@
+html {
+ color-scheme: light dark;
+ font-family: system-ui, sans-serif;
+}
+
+body {
+ margin: 0;
+}
+
+main {
+ padding: 16px;
+}
diff --git a/e2e/react-start/response-reconciliation/tests/response-reconciliation.spec.ts b/e2e/react-start/response-reconciliation/tests/response-reconciliation.spec.ts
new file mode 100644
index 0000000000..728b0782c5
--- /dev/null
+++ b/e2e/react-start/response-reconciliation/tests/response-reconciliation.spec.ts
@@ -0,0 +1,1038 @@
+import { expect } from '@playwright/test'
+import { test } from '@tanstack/router-e2e-utils'
+import type { APIResponse, Page, Response } from '@playwright/test'
+
+type TestResponse = APIResponse | Response
+
+function header(response: TestResponse, name: string) {
+ return response.headers()[name.toLowerCase()] ?? null
+}
+
+async function setCookieValues(response: TestResponse) {
+ return (await Promise.resolve(response.headersArray()))
+ .filter((item) => item.name.toLowerCase() === 'set-cookie')
+ .map((item) => item.value)
+}
+
+function expectCookie(cookies: Array, name: string, value: string) {
+ expect(
+ cookies.filter((cookie) => cookie.startsWith(`${name}=${value};`)),
+ ).toHaveLength(1)
+}
+
+async function invokeServerFunction(
+ page: Page,
+ name: string,
+ scenario?: string,
+) {
+ await page.goto(
+ scenario
+ ? `/server-functions?scenario=${encodeURIComponent(scenario)}`
+ : '/server-functions',
+ )
+ await expect(page.getByTestId('server-functions-hydrated')).toBeAttached()
+ await page.evaluate((value) => {
+ document.cookie = value
+ ? `reconciliation-scenario=${value}; Path=/`
+ : 'reconciliation-scenario=; Max-Age=0; Path=/'
+ }, scenario)
+ const responsePromise = page.waitForResponse((response) =>
+ response.url().includes('/_serverFn/'),
+ )
+ await page.getByTestId(`server-function-${name}`).click()
+ const response = await responsePromise
+ await expect(
+ page.getByTestId(`server-function-${name}-result`),
+ ).not.toHaveText('pending')
+ return response
+}
+
+async function invokeJsonServerFunction(
+ page: Page,
+ name: string,
+ scenario?: string,
+) {
+ const response = await invokeServerFunction(page, name, scenario)
+ const request = response.request()
+ expect(request.headers()['x-tsr-serverfn']).toBe('true')
+ const postData = request.postData()
+ if (postData) {
+ expect(postData).not.toContain('x-reconciliation-scenario')
+ }
+ return response
+}
+
+async function expectServerFunctionResult(
+ page: Page,
+ name: string,
+ result: string | RegExp,
+) {
+ await expect(page.getByTestId(`server-function-${name}-result`)).toHaveText(
+ result,
+ )
+}
+
+test.describe('server routes', () => {
+ test('uses expected server entry mode', async ({ request }) => {
+ const response = await request.get('/api/base')
+
+ if (process.env.TSS_E2E_SERVER_ENTRY) {
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ } else {
+ expect(header(response, 'x-custom-server-entry')).toBe(null)
+ }
+ })
+
+ test('global request middleware cookies are preserved on server routes', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/base', {
+ headers: { 'x-reconciliation-scenario': 'global-multiple-cookies' },
+ })
+ const cookies = await setCookieValues(response)
+
+ expectCookie(cookies, 'global-one', '1')
+ expectCookie(cookies, 'global-two', '2')
+ })
+
+ test('regression #5407: global middleware setResponseHeaders and status apply before next', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/base', {
+ headers: { 'x-reconciliation-scenario': 'global-before' },
+ })
+
+ expect(response.status()).toBe(231)
+ expect(response.statusText()).toBe('global-before')
+ expect(header(response, 'x-global-before')).toBe('yes')
+ expect(header(response, 'x-global-common')).toBe('before')
+ expect(header(response, 'x-base')).toBe('yes')
+ })
+
+ test('global middleware helper changes apply after next', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/base', {
+ headers: { 'x-reconciliation-scenario': 'global-after' },
+ })
+
+ expect(response.status()).toBe(232)
+ expect(response.statusText()).toBe('global-after')
+ expect(header(response, 'x-global-after')).toBe('yes')
+ expect(header(response, 'x-global-common')).toBe('after')
+ expect(header(response, 'x-base')).toBe('yes')
+ })
+
+ test('route middleware helper changes apply before and after next', async ({
+ request,
+ }) => {
+ const before = await request.get('/api/route-before-next')
+ expect(before.status()).toBe(234)
+ expect(before.statusText()).toBe('route-before')
+ expect(header(before, 'x-route-before')).toBe('yes')
+ expect(header(before, 'x-handler')).toBe('route-before-next')
+
+ const after = await request.get('/api/route-after-next')
+ expect(after.status()).toBe(233)
+ expect(after.statusText()).toBe('route-after')
+ expect(header(after, 'x-route-after')).toBe('yes')
+ expect(header(after, 'x-handler')).toBe('route-after-next')
+ })
+
+ test('helper changes overlay same-boundary returned response conflicts', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/same-boundary-conflict')
+
+ expect(response.status()).toBe(235)
+ expect(response.statusText()).toBe('same-boundary')
+ expect(header(response, 'x-conflict')).toBe('helper')
+ await expect(response.text()).resolves.toBe('conflict')
+ })
+
+ test('setResponseHeaders accepts Headers and preserves multiple cookies', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/bulk-headers')
+ const cookies = await setCookieValues(response)
+
+ expect(header(response, 'x-bulk-one')).toBe('1')
+ expect(header(response, 'x-bulk-two')).toBe('2')
+ expect(header(response, 'x-keep')).toBe('yes')
+ expectCookie(cookies, 'bulk-one', '1')
+ expectCookie(cookies, 'bulk-two', '2')
+ })
+
+ test('remove and clear helpers can remove returned response headers', async ({
+ request,
+ }) => {
+ const removed = await request.get('/api/remove-returned-header')
+ expect(header(removed, 'x-remove-me')).toBe(null)
+ expect(header(removed, 'x-keep')).toBe('yes')
+
+ const cleared = await request.get('/api/clear-returned-headers')
+ expect(header(cleared, 'x-clear-one')).toBe(null)
+ expect(header(cleared, 'x-clear-two')).toBe(null)
+ })
+
+ test('getResponseHeader and getResponseHeaders read helper writes immediately', async ({
+ request,
+ }) => {
+ const headerResponse = await request.get('/api/get-response-header-helper')
+ expect(header(headerResponse, 'x-read-after-set')).toBe('yes')
+ await expect(headerResponse.text()).resolves.toBe('yes')
+
+ const headersResponse = await request.get(
+ '/api/get-response-headers-helper',
+ )
+ expect(header(headersResponse, 'x-headers-read')).toBe('yes')
+ expect(header(headersResponse, 'x-headers-snapshot-write')).toBe(null)
+ await expect(headersResponse.text()).resolves.toBe('yes')
+ })
+
+ test('getResponseHeader sees direct current response header mutation', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/direct-mutation-visible')
+
+ expect(header(response, 'x-direct-visible')).toBe('yes')
+ expect(header(response, 'x-direct-read')).toBe('yes')
+ })
+
+ test('response replacement carries helper deltas but not old response mutations', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/replace-after-direct-mutation')
+
+ expect(response.status()).toBe(202)
+ expect(header(response, 'x-direct-a')).toBe(null)
+ expect(header(response, 'x-helper-delta')).toBe('yes')
+ expect(header(response, 'x-response-b')).toBe('yes')
+ await expect(response.text()).resolves.toBe('replacement')
+ })
+
+ test('later returned response replaces earlier response metadata', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/two-returned-responses')
+
+ expect(header(response, 'x-response-a')).toBe(null)
+ expect(header(response, 'x-response-b')).toBe('yes')
+ expect(header(response, 'x-helper-after-a')).toBe('yes')
+ await expect(response.text()).resolves.toBe('response-b')
+ })
+
+ test('readonly responses reconcile through clone fallback', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/readonly-after-next')
+
+ expect(header(response, 'x-readonly-after')).toBe('yes')
+ await expect(response.text()).resolves.toBe('readonly')
+ })
+
+ for (const status of [204, 205, 304]) {
+ test(`null-body status ${status} drops the response body`, async ({
+ request,
+ }) => {
+ const response = await request.get(
+ `/api/null-body-status?status=${status}`,
+ )
+
+ expect(response.status()).toBe(status)
+ expect(header(response, 'x-null-body')).toBe('yes')
+ await expect(response.text()).resolves.toBe('')
+ })
+ }
+
+ test('out-of-range setResponseStatus keeps the returned status', async ({
+ request,
+ }) => {
+ const response = await request.get(
+ '/api/status-contracts?scenario=invalid-status-return',
+ )
+
+ expect(response.status()).toBe(404)
+ expect(response.statusText()).toBe('Not Found')
+ await expect(response.text()).resolves.toBe('missing')
+ })
+
+ test('out-of-range setResponseStatus keeps the uncaught error status', async ({
+ request,
+ }) => {
+ const response = await request.get(
+ '/api/status-contracts?scenario=invalid-status-throw',
+ )
+
+ expect(response.status()).toBe(500)
+ await expect(response.json()).resolves.toMatchObject({
+ status: 500,
+ unhandled: true,
+ })
+ })
+
+ test('a timeout fallback survives the handler it abandoned while an outer middleware awaits', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/status-contracts?scenario=slow', {
+ headers: { 'x-reconciliation-scenario': 'global-timeout' },
+ })
+
+ expect(response.status()).toBe(504)
+ expect(header(response, 'x-timeout-fallback')).toBe('yes')
+ await expect(response.text()).resolves.toBe('timeout')
+ })
+
+ test('a helper success status does not hide an uncaught error', async ({
+ request,
+ }) => {
+ const response = await request.get(
+ '/api/status-contracts?scenario=helper-success-crash',
+ )
+
+ expect(response.status()).toBe(500)
+ await expect(response.json()).resolves.toMatchObject({
+ status: 500,
+ unhandled: true,
+ })
+ })
+
+ test('errors caused by an upstream response adopt only its status', async ({
+ request,
+ }) => {
+ const response = await request.get(
+ '/api/status-contracts?scenario=upstream-error-cause',
+ )
+ const body = await response.body()
+
+ expect(response.status()).toBe(502)
+ expect(header(response, 'x-upstream')).toBeNull()
+ expect(header(response, 'content-type')).toContain('application/json')
+ expect(header(response, 'content-encoding')).toBeNull()
+ const contentLength = header(response, 'content-length')
+ if (contentLength !== null) {
+ expect(Number(contentLength)).toBe(body.byteLength)
+ }
+ expect(await setCookieValues(response)).toEqual([])
+ expect(JSON.parse(body.toString())).toMatchObject({ status: 502 })
+ })
+
+ test('regression #5107: thrown errors preserve explicit response status and headers', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/throw-after-status')
+
+ expect(response.status()).toBe(401)
+ expect(response.statusText()).toBe('Unauthorized')
+ expect(header(response, 'x-error-helper')).toBe('yes')
+ expect(header(response, 'content-type')).toContain('application/json')
+ if (process.env.TSS_E2E_SERVER_ENTRY) {
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ expect(header(response, 'x-custom-entry-catch')).toBe(null)
+ }
+ await expect(response.json()).resolves.toMatchObject({ status: 401 })
+ })
+
+ test('thrown responses preserve explicit response status and headers', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/throw-after-status?throw=response')
+
+ expect(response.status()).toBe(401)
+ expect(response.statusText()).toBe('Unauthorized')
+ expect(header(response, 'x-error-helper')).toBe('yes')
+ expect(header(response, 'x-thrown-response')).toBe('yes')
+ if (process.env.TSS_E2E_SERVER_ENTRY) {
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ expect(header(response, 'x-custom-entry-catch')).toBe(null)
+ }
+ await expect(response.text()).resolves.toBe('Unauthorized response')
+ })
+
+ test('custom server entry can opt out of automatic error responses', async ({
+ request,
+ }) => {
+ test.skip(!process.env.TSS_E2E_SERVER_ENTRY, 'custom server entry only')
+
+ const response = await request.get('/api/throw-after-status', {
+ headers: { 'x-custom-handle-errors': 'false' },
+ })
+
+ expect(response.status()).toBe(555)
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ expect(header(response, 'x-custom-entry-catch')).toBe('yes')
+ await expect(response.text()).resolves.toBe('Unauthorized route')
+ })
+
+ test('custom server entry can recover Start error response state', async ({
+ request,
+ }) => {
+ test.skip(!process.env.TSS_E2E_SERVER_ENTRY, 'custom server entry only')
+
+ const response = await request.get('/api/throw-after-status', {
+ headers: {
+ 'x-custom-handle-errors': 'false',
+ 'x-custom-handle-start-error': 'true',
+ },
+ })
+ const cookies = await setCookieValues(response)
+
+ expect(response.status()).toBe(401)
+ expect(response.statusText()).toBe('Unauthorized')
+ expect(header(response, 'x-error-helper')).toBe('yes')
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ expect(header(response, 'x-custom-entry-catch')).toBe(null)
+ expectCookie(cookies, 'throw-after-status', '1')
+ await expect(response.json()).resolves.toMatchObject({ status: 401 })
+ })
+
+ test('custom server entry can recover thrown response state', async ({
+ request,
+ }) => {
+ test.skip(!process.env.TSS_E2E_SERVER_ENTRY, 'custom server entry only')
+
+ const response = await request.get(
+ '/api/throw-after-status?throw=response',
+ {
+ headers: {
+ 'x-custom-handle-errors': 'false',
+ 'x-custom-handle-start-error': 'true',
+ },
+ },
+ )
+ const cookies = await setCookieValues(response)
+
+ expect(response.status()).toBe(401)
+ expect(response.statusText()).toBe('Unauthorized')
+ expect(header(response, 'x-error-helper')).toBe('yes')
+ expect(header(response, 'x-thrown-response')).toBe('yes')
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ expect(header(response, 'x-custom-entry-catch')).toBe(null)
+ expectCookie(cookies, 'throw-after-status', '1')
+ await expect(response.text()).resolves.toBe('Unauthorized response')
+ })
+
+ test('custom server entry can opt out of SSR request middleware error responses', async ({
+ request,
+ }) => {
+ test.skip(!process.env.TSS_E2E_SERVER_ENTRY, 'custom server entry only')
+
+ const response = await request.get('/ssr', {
+ headers: {
+ 'x-custom-handle-errors': 'false',
+ 'x-reconciliation-scenario': 'global-throw',
+ },
+ })
+
+ expect(response.status()).toBe(555)
+ expect(header(response, 'x-custom-server-entry')).toBe('yes')
+ expect(header(response, 'x-custom-entry-catch')).toBe('yes')
+ await expect(response.text()).resolves.toBe(
+ 'Unauthorized global middleware',
+ )
+ })
+
+ test('regression #5464: multiple Set-Cookie headers are preserved', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/multiple-cookies')
+ const cookies = await setCookieValues(response)
+
+ expectCookie(cookies, 'route-one', '1')
+ expectCookie(cookies, 'route-two', '2')
+ })
+
+ test('explicit Set-Cookie header values are preserved and replace response values', async ({
+ request,
+ }) => {
+ const explicit = await request.get('/api/explicit-set-cookie-header')
+ const explicitCookies = await setCookieValues(explicit)
+ expectCookie(explicitCookies, 'explicit-one', '1')
+ expectCookie(explicitCookies, 'explicit-two', '2')
+
+ const replaced = await request.get('/api/replace-explicit-set-cookie')
+ const replacedCookies = await setCookieValues(replaced)
+ expectCookie(replacedCookies, 'explicit-new', '1')
+ expect(
+ replacedCookies.some((cookie) => cookie.startsWith('explicit-old=1;')),
+ ).toBe(false)
+ })
+
+ test('cookies survive redirect responses', async ({ request }) => {
+ const response = await request.get('/api/redirect-with-cookies', {
+ maxRedirects: 0,
+ })
+ const cookies = await setCookieValues(response)
+
+ expect(response.status()).toBe(307)
+ expect(header(response, 'location')).toBe('/api/base')
+ expectCookie(cookies, 'redirect-one', '1')
+ expectCookie(cookies, 'redirect-two', '2')
+ expectCookie(cookies, 'redirect-three', '3')
+ })
+
+ test('generated errors drop framing headers that helpers set for the failed body', async ({
+ request,
+ }) => {
+ const response = await request.get('/api/framing-error')
+
+ expect(response.status()).toBe(500)
+ expect(header(response, 'content-encoding')).toBeNull()
+ expect(header(response, 'content-length')).not.toBe('2')
+ expect(await response.json()).toMatchObject({
+ status: 500,
+ unhandled: true,
+ })
+ })
+
+ test('HEAD keeps the body for middleware until the response leaves the pipeline', async ({
+ request,
+ }) => {
+ const headers = { 'x-reconciliation-scenario': 'global-representation' }
+ const get = await request.get('/api/base', { headers })
+ const head = await request.head('/api/base', { headers })
+
+ expect(head.status()).toBe(get.status())
+ expect(Number(header(get, 'x-body-length'))).toBeGreaterThan(0)
+ expect(header(head, 'x-body-length')).toBe(header(get, 'x-body-length'))
+ expect(await head.body()).toHaveLength(0)
+ })
+
+ test('a response that middleware assigned is disposed when it returns another', async ({
+ request,
+ }) => {
+ const id = crypto.randomUUID()
+ const response = await request.get(`/api/tracked-stream?id=${id}`, {
+ headers: {
+ 'x-reconciliation-scenario': 'global-assigned-transform-not-modified',
+ },
+ })
+
+ expect(response.status()).toBe(304)
+ await expect
+ .poll(async () =>
+ (await request.get(`/api/tracked-stream-status?id=${id}`)).json(),
+ )
+ .toEqual({ cancelled: true })
+ })
+})
+
+test.describe('SSR document responses', () => {
+ test('regression #7647: middleware status and headers survive alongside route headers', async ({
+ request,
+ }) => {
+ const response = await request.get('/', {
+ headers: {
+ accept: 'text/html',
+ 'x-reconciliation-scenario': 'issue-7647',
+ },
+ })
+
+ expect(response.status()).toBe(418)
+ expect(header(response, 'x-middleware-header')).toBe('present')
+ expect(header(response, 'cache-control')).toBe('no-store')
+ expect(header(response, 'x-route-header')).toBe('present')
+ expect(header(response, 'content-type')).toContain('text/html')
+ // Custom-entry modes must actually reconstruct the streamed response.
+ expect(header(response, 'x-stream-response-rebuilt')).toBe(
+ process.env.TSS_E2E_SERVER_ENTRY ? 'yes' : null,
+ )
+ const html = await response.text()
+ expect(html).toContain('Response Reconciliation E2E')
+ })
+
+ test('loader helper headers, status, and cookies reconcile onto document response', async ({
+ request,
+ }) => {
+ const response = await request.get('/ssr')
+ const cookies = await setCookieValues(response)
+
+ expect(response.status()).toBe(238)
+ expect(response.statusText()).toBe('ssr-loader')
+ expect(header(response, 'x-ssr-loader')).toBe('yes')
+ expect(header(response, 'content-type')).toContain('text/html')
+ expectCookie(cookies, 'ssr-one', '1')
+ expectCookie(cookies, 'ssr-two', '2')
+ await expect(response.text()).resolves.toContain('ssr response')
+ })
+
+ test('regression #5464: SSR document responses preserve multiple Set-Cookie headers', async ({
+ request,
+ }) => {
+ const response = await request.get('/ssr', {
+ headers: { 'x-reconciliation-scenario': 'global-multiple-cookies' },
+ })
+ const cookies = await setCookieValues(response)
+
+ expectCookie(cookies, 'global-one', '1')
+ expectCookie(cookies, 'global-two', '2')
+ expectCookie(cookies, 'ssr-one', '1')
+ expectCookie(cookies, 'ssr-two', '2')
+ })
+
+ test('global middleware after next reconciles onto document response', async ({
+ request,
+ }) => {
+ const response = await request.get('/ssr', {
+ headers: { 'x-reconciliation-scenario': 'global-after' },
+ })
+
+ expect(response.status()).toBe(232)
+ expect(response.statusText()).toBe('global-after')
+ expect(header(response, 'x-global-after')).toBe('yes')
+ expect(header(response, 'x-ssr-loader')).toBe('yes')
+ })
+
+ test('middleware can stream the document through a body transform', async ({
+ request,
+ }) => {
+ const response = await request.get('/streamed', {
+ headers: { 'x-reconciliation-scenario': 'global-piped-copy' },
+ })
+
+ expect(response.status()).toBe(200)
+ expect(header(response, 'x-global-piped-copy')).toBe('yes')
+ const html = await response.text()
+ expect(html).toContain('streamed after the shell')
+ expect(html).toContain('')
+ })
+
+ test('HEAD documents keep their body for middleware until the response leaves the pipeline', async ({
+ request,
+ }) => {
+ const headers = { 'x-reconciliation-scenario': 'global-representation' }
+ const get = await request.get('/', { headers })
+ const head = await request.head('/', { headers })
+
+ expect(head.status()).toBe(get.status())
+ expect(Number(header(get, 'x-body-length'))).toBeGreaterThan(0)
+ expect(header(head, 'x-body-length')).toBe(header(get, 'x-body-length'))
+ expect(await head.body()).toHaveLength(0)
+ })
+
+ test('regression #8627: middleware can copy the document when Response is wrapped', async ({
+ request,
+ }) => {
+ const response = await request.get('/streamed', {
+ headers: {
+ 'x-reconciliation-scenario': 'global-copy',
+ 'x-wrap-response': 'true',
+ },
+ })
+
+ expect(response.status()).toBe(200)
+ expect(header(response, 'x-global-copy')).toBe('yes')
+ const html = await response.text()
+ expect(html).toContain('streamed after the shell')
+ expect(html).toContain('