diff --git a/.agents/skills/bundle-size-optimization b/.agents/skills/bundle-size-optimization deleted file mode 120000 index 692e634b24..0000000000 --- a/.agents/skills/bundle-size-optimization +++ /dev/null @@ -1 +0,0 @@ -../../skills/bundle-size-optimization \ No newline at end of file diff --git a/.changeset/config.json b/.changeset/config.json deleted file mode 100644 index 9815b19762..0000000000 --- a/.changeset/config.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "$schema": "https://unpkg.com/@changesets/config@3.1.2/schema.json", - "changelog": [ - "@changesets/changelog-github", - { "repo": "TanStack/router", "disableThanks": true } - ], - "commit": false, - "access": "public", - "baseBranch": "main", - "updateInternalDependencies": "patch", - "fixed": [], - "linked": [], - "ignore": [], - "___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": { - "onlyUpdatePeerDependentsWhenOutOfRange": true - } -} diff --git a/.changeset/rsbuild-manifest-module-chunks-once.md b/.changeset/rsbuild-manifest-module-chunks-once.md deleted file mode 100644 index 02febd9d84..0000000000 --- a/.changeset/rsbuild-manifest-module-chunks-once.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@tanstack/start-plugin-core': patch ---- - -Rsbuild: the Start manifest pass that runs after every client compilation (builds and each dev update) reads an imported module's chunks once per compilation and counts the module once per importing chunk, instead of once per import connection. The manifest is unchanged; the pass takes about 40 % less time (on a 333-route app, tens of milliseconds less per HMR update). diff --git a/.changeset/rsbuild-manifest-own-chunks.md b/.changeset/rsbuild-manifest-own-chunks.md deleted file mode 100644 index 04e8e29928..0000000000 --- a/.changeset/rsbuild-manifest-own-chunks.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@tanstack/start-plugin-core': patch ---- - -Rsbuild: a route's client manifest entry lists only its own chunks and CSS. When two routes shared a module in a chunk of its own, each route's entry also listed the other route's chunk as a preload and its stylesheet. diff --git a/.changeset/rsbuild-rule-use-falsy-loaders.md b/.changeset/rsbuild-rule-use-falsy-loaders.md deleted file mode 100644 index a84a054fbd..0000000000 --- a/.changeset/rsbuild-rule-use-falsy-loaders.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@tanstack/start-plugin-core': patch ---- - -fix: the Rsbuild RSC integration skips falsy entries in a rule's `use` array (Rspack's conditionally disabled loaders) instead of treating them as loaders. diff --git a/.changeset/rsbuild-virtual-modules-build.md b/.changeset/rsbuild-virtual-modules-build.md deleted file mode 100644 index 01a0c5ee6e..0000000000 --- a/.changeset/rsbuild-virtual-modules-build.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@tanstack/start-plugin-core': patch ---- - -Rsbuild: fix the Rsbuild plugin build after two changes to its virtual modules crossed. Without this fix the package does not build, so no release could ship it. The Rsbuild dev manifest is written to its virtual module under the app's root. diff --git a/.changeset/rsbuild-virtual-modules-root.md b/.changeset/rsbuild-virtual-modules-root.md deleted file mode 100644 index 427043a712..0000000000 --- a/.changeset/rsbuild-virtual-modules-root.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@tanstack/start-plugin-core': patch ---- - -Rsbuild: Start writes its virtual modules under the app's root, not the working directory. An app built or served from another directory (`rsbuild build --root ` from a monorepo root) no longer fails with "Module not found" on the packages they import, such as RSC's serialization adapters. diff --git a/.changeset/rsc-security-floor.md b/.changeset/rsc-security-floor.md deleted file mode 100644 index 9c828f13b3..0000000000 --- a/.changeset/rsc-security-floor.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -'@tanstack/react-start-rsc': patch ---- - -Raise the minimum RSC bundler peer dependencies to versions with the React Server Components fixes for GHSA-xqc2-xf4c-x3h3 (CVE-2026-126187, unauthenticated RCE) and GHSA-h3gv-c5rc-p453 (server function DoS): - -- `@vitejs/plugin-rsc` to `>=0.5.38` (GHSA-59pf-q495-3c99), which vendors a fixed `react-server-dom-webpack`. -- `react-server-dom-rspack` to `>=0.1.1`, the first release built from React sources that include the fix. diff --git a/.changeset/start-server-fn-custom-id-check.md b/.changeset/start-server-fn-custom-id-check.md deleted file mode 100644 index 384f0ade06..0000000000 --- a/.changeset/start-server-fn-custom-id-check.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -'@tanstack/start-plugin-core': minor ---- - -A server function id that a custom `serverFns.generateFunctionId` returns and that never worked over HTTP now fails the build, with an error naming the file, the function and the id: whitespace, a control or non-ASCII character, any of `"`, `#`, `/`, `<`, `>`, `?`, `\`, `^`, `` ` ``, `{`, `}`, the ids `.` and `..`, and a percent-encoding the server reads as another id (`%41`, lowercase hex, `%2E`) or rejects. The client puts the id in the URL unencoded, so a `#` or `?` ended the path and a `/` cut the id short (the call silently ran another server function of the file or none), and the other characters reached the server percent-encoded and matched no function. An id embedding a non-ASCII `functionName` is one of these. One case did work and now fails the build: such an id on a server function only SSR code called. - -Ids with `%` or the other characters URLs allow (such as `:`, `@`, `+`, `=`, `,`, `;`, `!`, `*`, `(`, `)`, `&`, `'`, `|`, `[`, `]`) still build and reach their handler, with a deprecation warning (from the Vite plugin; the Rsbuild plugin does not print compiler warnings yet): the next major version rejects them, since proxies and servers may decode or rewrite them (hash the inputs instead, as the documented example does). An id with `'` no longer breaks the server bundle. diff --git a/.changeset/start-vite-root-library-discovery.md b/.changeset/start-vite-root-library-discovery.md deleted file mode 100644 index d4e8221c59..0000000000 --- a/.changeset/start-vite-root-library-discovery.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -'@tanstack/start-plugin-core': patch ---- - -Vite: Start finds the Start libraries it bundles in the SSR build from Vite's root, not the working directory. A `vite build ` run from another directory (a monorepo root, a script) no longer leaves them external and uncompiled, where their server fns returned `undefined`. diff --git a/.coderabbit.yaml b/.coderabbit.yaml deleted file mode 100644 index 21d884dbeb..0000000000 --- a/.coderabbit.yaml +++ /dev/null @@ -1,12 +0,0 @@ -# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json - -reviews: - request_changes_workflow: false - slop_detection: - enabled: true - -knowledge_base: - code_guidelines: - enabled: true - filePatterns: - - 'CONTRIBUTING.md' diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index a4c1d62013..0000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,7 +0,0 @@ -.github/ @TanStack/tanstack-core -.nx/ @TanStack/tanstack-core -nx.json @TanStack/tanstack-core -/scripts/nx @TanStack/tanstack-core -.changeset/config.json @TanStack/tanstack-core -scripts/ @TanStack/tanstack-core -.npmrc @TanStack/tanstack-core \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 9dd0def7bd..4de68113bd 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,39 +1,21 @@ -name: 🐛 Bug Report +name: '🐛 Bug report' description: Create a report to help us improve body: - type: markdown attributes: value: | - - Thank you for reporting an issue :pray:. - This issue tracker is for reporting bugs found in TanStack Router and/or Start. + This issue tracker is for reporting bugs found in `router` (https://github.com/tanstack/router). If you have a question about how to achieve something and are struggling, please post a question inside of `router` Discussions tab: https://github.com/tanstack/router/discussions Before submitting a new bug/issue, please check the links below to see if there is a solution or question posted there already: - - Issues tab: https://github.com/tanstack/router/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc - - closed issues tab: https://github.com/tanstack/router/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed - - Discussions tab: https://github.com/tanstack/router/discussions + - `router` Issues tab: https://github.com/tanstack/router/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc + - `router` closed issues tab: https://github.com/tanstack/router/issues?q=is%3Aissue+sort%3Aupdated-desc+is%3Aclosed + - `router` Discussions tab: https://github.com/tanstack/router/discussions The more information you fill in, the better the community can help you. - - type: dropdown - id: project - attributes: - label: Which project does this relate to? - description: If you are unsure, please leave this as "Router". - options: - - Router - - Start - validations: - required: true - type: textarea id: description attributes: @@ -44,22 +26,21 @@ body: - type: input id: link attributes: - label: Complete minimal reproducer + label: Your Example Website or App description: | - Bug reports need a complete minimal reproducer project. - The reproducer project must be - - either a Stackblitz project (use this pre-configured Stackblitz project ([file-based routes](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based?file=src%2Fmain.tsx)|[code-based routes](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart?file=src%2Fmain.tsx))) - - or a public git repo. - In case of a git repo, the issue must be reproducible **directly** after cloning and installing dependencies. - - If you dont supply a reproducer that meets the above requirements, this issue will be closed. + Which website or app were you using when the bug happened? + Note: + - Please provide a link via our pre-configured Stackblitz project ([file-based routes](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart-file-based?file=src%2Fmain.tsx)|[code-based routes](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/quickstart?file=src%2Fmain.tsx)) or a link to a repo that can reproduce the issue. + - Your bug will may get fixed much faster if we can run your code and it doesn't have dependencies other than the `router` npm package / dependency. + - To create a shareable code example you can use Stackblitz. Please no localhost URLs. + - Please read these tips for providing a minimal example: https://stackoverflow.com/help/mcve. placeholder: reproduction URL validations: required: true - type: textarea id: steps attributes: - label: Steps to Reproduce the Bug + label: Steps to Reproduce the Bug or Issue description: Describe the steps we have to take to reproduce the behavior. placeholder: | 1. Go to '...' @@ -92,12 +73,9 @@ body: attributes: label: Platform value: | - - Router / Start Version: [e.g. 1.121.0] - OS: [e.g. macOS, Windows, Linux] - Browser: [e.g. Chrome, Safari, Firefox] - - Browser Version: [e.g. 91.1] - - Bundler: [e.g. vite] - - Bundler Version: [e.g. 7.0.0] + - Version: [e.g. 91.1] validations: required: true - type: textarea diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml index 4e8226fb72..0fba2ad824 100644 --- a/.github/ISSUE_TEMPLATE/config.yml +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -1,11 +1,11 @@ blank_issues_enabled: false contact_links: - name: 🤔 Feature Requests & Questions - url: https://github.com/TanStack/router/discussions + url: https://github.com/tanstack/router/discussions about: Please ask and answer questions here. - name: 💬 Community Chat url: https://discord.gg/mQd7egN - about: A dedicated discord server hosted by TanStack - - name: 🦋 TanStack Bluesky - url: https://bsky.app/profile/tanstack.com + about: A dedicated discord server hosted by Tanner Linsley + - name: 💬 Tanstack Twitter + url: https://twitter.com/tan_stack about: Stay up to date with new releases of our libraries diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index a5ef10f1ff..0000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,22 +0,0 @@ -## 🎯 Changes - - - -## ✅ Checklist - -- [ ] I have followed the steps in the [Contributing guide](https://github.com/TanStack/router/blob/main/CONTRIBUTING.md). -- [ ] I have tested code changes locally with the relevant test commands, or tests do not apply to this pull request. -- [ ] I fully understand the code in this pull request, including any code generated with AI assistance. - -## 🚀 Release Impact - -- [ ] This change affects published code, and I have generated a [changeset](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md). -- [ ] This change is docs/CI/dev-only (no release). - - diff --git a/.github/renovate.json b/.github/renovate.json index 6fd5aa1c86..66367ceae5 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -3,7 +3,6 @@ "configMigration": true, "extends": [ "config:recommended", - "helpers:pinGitHubActionDigests", "group:allNonMajor", "schedule:weekly", ":approveMajorUpdates", @@ -28,11 +27,11 @@ "temp-react", "temp-react-dom", "typescript", + "typescript50", + "typescript51", "typescript52", "typescript53", "typescript54", - "typescript55", - "typescript56", "unplugin", "use-sync-external-store", "waku" diff --git a/.github/workflows/autofix.yml b/.github/workflows/autofix.yml index 78aea28c12..c69cd54fa6 100644 --- a/.github/workflows/autofix.yml +++ b/.github/workflows/autofix.yml @@ -2,6 +2,8 @@ name: autofix.ci # needed to securely identify the workflow on: pull_request: + push: + branches: [main, alpha, beta] concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} @@ -14,19 +16,14 @@ jobs: autofix: name: autofix runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} steps: - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false + uses: actions/checkout@v4.1.7 - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main + uses: tanstack/config/.github/setup@main - name: Fix formatting - run: pnpm format - - name: Generate labeler config - run: pnpm labeler-generate + run: pnpm prettier:write - name: Apply fixes - uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4 + uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c with: commit-message: 'ci: apply automated fixes' diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml deleted file mode 100644 index bbc3a1fa24..0000000000 --- a/.github/workflows/benchmarks.yml +++ /dev/null @@ -1,92 +0,0 @@ -# Setup taken from https://codspeed.io/docs/benchmarks/nodejs/vitest -name: Benchmarks - -on: - push: - # Broad on purpose: CodSpeed compares each PR against the run on its - # merge-base commit. Skipping main pushes that don't touch packages/** - # (pnpm config, CI, root tooling) leaves those commits without a baseline - # run, and CodSpeed silently falls back to an older, possibly outlier run — - # which then flags phantom regressions on every PR until the next eligible - # push. Only paths that cannot affect benchmark results are excluded. - branches: - - 'main' - paths-ignore: - - 'docs/**' - - 'examples/**' - - 'e2e/**' - pull_request: - paths: - - 'packages/**' - - '!packages/**/tests/**' - - '!packages/**/__tests__/**' - - '!packages/**/*.test.*' - - 'benchmarks/**' - - '.nvmrc' - workflow_dispatch: - -concurrency: - group: benchmarks-${{ github.ref }} - cancel-in-progress: false - queue: single - -permissions: - contents: read # required for actions/checkout - id-token: write # required for OIDC authentication with CodSpeed - -env: - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - SERVER_PRESET: 'node-server' - NX_NO_CLOUD: true - -jobs: - benchmarks: - name: Run ${{ matrix.benchmark }}:${{ matrix.framework }} CodSpeed benchmark - strategy: - fail-fast: false - matrix: - framework: - - react - - solid - - vue - benchmark: - - client-nav - - ssr - - memory-server - - memory-client - include: - - benchmark: client-nav - mode: simulation - - benchmark: ssr - mode: simulation - - benchmark: memory-server - mode: memory - - benchmark: memory-client - mode: memory - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main - - # Run the build outside of the CodSpeed action to avoid being slowed by intrumentation overhead. - # (and then run the task itself with --excludeTaskDependencies) - - name: Prepare ${{ matrix.benchmark }}:${{ matrix.framework }} benchmark - run: >- - pnpm nx run - @benchmarks/${{ matrix.benchmark }}:build:${{ matrix.framework }} - - - name: Run ${{ matrix.benchmark }}:${{ matrix.framework }} CodSpeed benchmark - uses: CodSpeedHQ/action@373d6868929f444bc08d901fd0eb0ad52a8875ea # v5.2.1 - timeout-minutes: 20 - with: - mode: ${{ matrix.mode }} - run: >- - WITH_INSTRUMENTATION=1 - pnpm nx run - @benchmarks/${{ matrix.benchmark }}:test:perf:${{ matrix.framework }} - --excludeTaskDependencies diff --git a/.github/workflows/bundle-size.yml b/.github/workflows/bundle-size.yml deleted file mode 100644 index 51ffa28e4c..0000000000 --- a/.github/workflows/bundle-size.yml +++ /dev/null @@ -1,152 +0,0 @@ -name: Bundle Size - -on: - # We use `pull_request` to split trust boundaries across jobs: - # - `benchmark-pr` checks out PR merge code and runs it as untrusted with read-only permissions. - # - `comment-pr` runs trusted base-repo code with limited write access to upsert the PR comment. - pull_request: - paths: - - '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: - group: ${{ github.workflow }}-${{ github.event.number || github.ref }} - cancel-in-progress: true - -permissions: - contents: read - -env: - NX_NO_CLOUD: true -jobs: - benchmark-pr: - name: Benchmark PR - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - outputs: - current_json_b64: ${{ steps.capture.outputs.current_json_b64 }} - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - ref: refs/pull/${{ github.event.pull_request.number }}/merge - fetch-depth: 0 - persist-credentials: false - - - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main - - - name: Measure Bundle Size - run: pnpm benchmark:bundle-size --outputStyle=stream --skipRemoteCache - - - name: Capture Benchmark Outputs - id: capture - run: | - { - echo "current_json_b64=$(base64 -w 0 < benchmarks/bundle-size/results/current.json)" - } >> "$GITHUB_OUTPUT" - - comment-pr: - name: Upsert PR Comment - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - needs: benchmark-pr - permissions: - contents: read - pull-requests: write - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Restore Benchmark Outputs - env: - CURRENT_JSON_B64: ${{ needs.benchmark-pr.outputs.current_json_b64 }} - run: | - mkdir -p benchmarks/bundle-size/results - node -e "const fs=require('node:fs'); fs.writeFileSync('benchmarks/bundle-size/results/current.json', Buffer.from(process.env.CURRENT_JSON_B64 || '', 'base64'))" - - - name: Read Historical Data (if available) - run: | - mkdir -p benchmarks/bundle-size/results - if git fetch --depth=1 origin gh-pages; then - if git show origin/gh-pages:benchmarks/bundle-size/data.js > benchmarks/bundle-size/results/history-data.js 2>/dev/null; then - echo "Loaded bundle-size history from gh-pages." - else - rm -f benchmarks/bundle-size/results/history-data.js - echo "No bundle-size history found on gh-pages yet." - fi - fi - - - name: Build PR Report - env: - BASE_SHA: ${{ github.event.pull_request.base.sha }} - REPOSITORY_NAME: ${{ github.event.repository.name }} - REPOSITORY_OWNER: ${{ github.repository_owner }} - run: | - node scripts/benchmarks/bundle-size/pr-report.mjs \ - --current benchmarks/bundle-size/results/current.json \ - --history benchmarks/bundle-size/results/history-data.js \ - --output benchmarks/bundle-size/results/pr-comment.md \ - --base-sha "$BASE_SHA" \ - --dashboard-url "https://${REPOSITORY_OWNER}.github.io/${REPOSITORY_NAME}/benchmarks/bundle-size/" - 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: | - node scripts/benchmarks/common/upsert-pr-comment.mjs \ - --pr "${{ github.event.pull_request.number }}" \ - --body-file benchmarks/bundle-size/results/pr-comment.md - - benchmark-main: - name: Publish Bundle Size History - if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' && github.repository_owner == 'TanStack' - runs-on: ubuntu-latest - permissions: - contents: write - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - persist-credentials: false - - - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main - - - name: Measure Bundle Size - run: pnpm benchmark:bundle-size --outputStyle=stream --skipRemoteCache - - name: Publish Benchmark Dashboard - uses: benchmark-action/github-action-benchmark@52576c92bccf6ac60c8223ec7eb2565637cae9ba # v1.22.1 - with: - tool: customSmallerIsBetter - name: Bundle Size (gzip) - output-file-path: benchmarks/bundle-size/results/benchmark-action.json - github-token: ${{ secrets.GITHUB_TOKEN }} - auto-push: true - gh-pages-branch: gh-pages - benchmark-data-dir-path: benchmarks/bundle-size - max-items-in-chart: 200 - summary-always: true - comment-on-alert: false - fail-on-alert: false diff --git a/.github/workflows/check-skills.yml b/.github/workflows/check-skills.yml deleted file mode 100644 index f00a11731b..0000000000 --- a/.github/workflows/check-skills.yml +++ /dev/null @@ -1,122 +0,0 @@ -# check-skills.yml — Drop this into your library repo's .github/workflows/ -# -# Validates intent skills on PRs. After a release or manual run, opens or -# updates one review PR when existing skills, artifact coverage, or workspace -# package coverage need review. -# -# Triggers: pull requests touching skills/artifacts, pushes to main affecting -# docs/source paths, new release published, or manual workflow_dispatch. -# -# intent-workflow-version: 4 -# -# Template variables (replaced by `intent setup`): -# @tanstack/router — e.g. @tanstack/query or my-workspace workspace - -name: Check Skills - -concurrency: - group: check-skills-${{ github.ref }} - cancel-in-progress: true - -on: - pull_request: - paths: - - 'skills/**' - - '**/skills/**' - - '_artifacts/**' - - '**/_artifacts/**' - push: - branches: [main] - paths: - - 'docs/**' - - 'packages/*/src/**' - release: - types: [published] - workflow_dispatch: {} - -permissions: {} - -jobs: - validate: - name: Validate intent skills - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - permissions: - contents: read - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - name: Setup Node - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 24 - package-manager-cache: false - - - name: Install intent - run: npm install -g @tanstack/intent - - - name: Validate skills - run: intent validate --github-summary - - review: - name: Check intent skill coverage - if: github.event_name != 'pull_request' - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - persist-credentials: true # review job pushes a generated branch - - - name: Setup Node - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 - with: - node-version: 24 - package-manager-cache: false - - - name: Install intent - run: npm install -g @tanstack/intent - - - name: Check skills - id: stale - run: | - intent stale --github-review --package-label "@tanstack/router" - - - name: Open or update review PR - if: steps.stale.outputs.has_review == 'true' - env: - BASE_BRANCH: ${{ github.event.repository.default_branch }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - VERSION: ${{ github.event.release.tag_name || 'manual' }} - run: | - BRANCH="skills/review-${VERSION}" - - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - git fetch origin "$BRANCH:refs/remotes/origin/$BRANCH" || true - if git show-ref --verify --quiet "refs/remotes/origin/$BRANCH"; then - git checkout -B "$BRANCH" "origin/$BRANCH" - else - git checkout -b "$BRANCH" - git commit --allow-empty -m "chore: review intent skills for ${VERSION}" - git push origin "$BRANCH" - fi - - PR_URL="$(gh pr list --head "$BRANCH" --json url --jq '.[0].url')" - if [ -n "$PR_URL" ]; then - gh pr edit "$PR_URL" --body-file pr-body.md - else - gh pr create \ - --title "Review intent skills (${VERSION})" \ - --body-file pr-body.md \ - --head "$BRANCH" \ - --base "$BASE_BRANCH" - fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..7ac58a7f22 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,51 @@ +name: ci + +on: + workflow_dispatch: + inputs: + tag: + description: override release tag + required: false + push: + branches: [main, alpha, beta] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +env: + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + +permissions: + contents: write + id-token: write + +jobs: + test-and-publish: + name: Test & Publish + if: github.repository_owner == 'TanStack' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.1.7 + with: + fetch-depth: 0 + - name: Start Nx Agents + run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" + - name: Setup Tools + uses: tanstack/config/.github/setup@main + - name: Run Tests + run: pnpm run test:ci --parallel=3 + - name: Stop Nx Agents + if: ${{ always() }} + run: npx nx-cloud stop-all-agents + - name: Publish + run: | + git config --global user.name 'Tanner Linsley' + git config --global user.email 'tannerlinsley@users.noreply.github.com' + npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}" + pnpm run cipublish + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + TAG: ${{ inputs.tag }} diff --git a/.github/workflows/compiler-platforms.yml b/.github/workflows/compiler-platforms.yml deleted file mode 100644 index ad70e39bb6..0000000000 --- a/.github/workflows/compiler-platforms.yml +++ /dev/null @@ -1,101 +0,0 @@ -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 deleted file mode 100644 index fde1100409..0000000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Labeler - -on: - pull_request: - -permissions: - contents: read - pull-requests: write - -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 - uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - configuration-path: labeler-config.yml diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index ae19b4f0d2..8bee4aac3e 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,4 +1,4 @@ -name: PR +name: pr on: pull_request: @@ -9,14 +9,6 @@ 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 @@ -25,57 +17,35 @@ jobs: test: name: Test runs-on: ubuntu-latest - env: - TSR_TMP_DIR: ./tmp steps: - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@v4.1.7 with: fetch-depth: 0 - persist-credentials: false - - name: Start Nx Workers - run: npx nx-cloud start-workers + - name: Start Nx Agents + run: npx nx-cloud start-ci-run --distribute-on=".nx/workflows/dynamic-changesets.yaml" - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main + uses: tanstack/config/.github/setup@main - name: Get base and head commits for `nx affected` - uses: nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5.0.1 + uses: nrwl/nx-set-shas@v4.0.6 with: main-branch-name: main - name: Run Checks run: pnpm run test:pr --parallel=3 - - name: Stop Nx Workers + - name: Stop Nx Agents if: ${{ always() }} - run: npx nx-cloud stop-all-workers + run: npx nx-cloud stop-all-agents preview: name: Preview runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write steps: - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + uses: actions/checkout@v4.1.7 with: fetch-depth: 0 - persist-credentials: false - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main + uses: tanstack/config/.github/setup@main - name: Build Packages run: pnpm run build:all - name: Publish Previews - run: pnpx pkg-pr-new publish --pnpm './packages/*' --template './examples/*/*' - version-preview: - name: Version Preview - runs-on: ubuntu-latest - permissions: - contents: read - pull-requests: write - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main - - name: Changeset Preview - uses: TanStack/config/.github/changeset-preview@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main + run: pnpx pkg-pr-new publish --pnpm --compact './packages/*' --template './examples/*/*' diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 115c3445e6..0000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: Release - -on: - push: - branches: [main, '*-pre', '*-maint'] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: false - -env: - NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} - SERVER_PRESET: 'node-server' - -permissions: - contents: write - id-token: write - pull-requests: write - -jobs: - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - fetch-depth: 0 - persist-credentials: true # changesets/action pushes Release PR commits - - name: Setup Tools - uses: TanStack/config/.github/setup@e4b48f16568324f76f467aa4c2aac2f05db632c3 # main - - name: Run Build - run: pnpm run build:all - - name: Enter Pre-Release Mode - if: "contains(github.ref_name, '-pre') && !hashFiles('.changeset/pre.json')" - run: pnpm changeset pre enter pre - - name: Determine dist-tag - id: dist-tag - run: | - BRANCH="${GITHUB_REF_NAME}" - if [[ "$BRANCH" == *-pre ]]; then - echo "prerelease=true" >> "$GITHUB_OUTPUT" - elif [[ "$BRANCH" == *-maint ]]; then - echo "tag=maint" >> "$GITHUB_OUTPUT" - else - echo "latest=true" >> "$GITHUB_OUTPUT" - fi - - name: Create Release Pull Request or Publish - id: changesets - uses: changesets/action@63a615b9cd06ba9a3e6d13796c7fbcb080a60a0b # v1.8.0 - with: - version: pnpm run changeset:version - publish: pnpm run changeset:publish ${{ steps.dist-tag.outputs.tag && format('--tag {0}', steps.dist-tag.outputs.tag) }} - title: 'ci: Version Packages' - commit: 'ci: changeset release' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_OPTIONS: --max-old-space-size=8192 - - name: Create GitHub Release - if: steps.changesets.outputs.published == 'true' - run: node scripts/create-github-release.mjs ${{ steps.dist-tag.outputs.prerelease == 'true' && '--prerelease' }} ${{ steps.dist-tag.outputs.latest == 'true' && '--latest' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/zizmor.yml b/.github/workflows/zizmor.yml deleted file mode 100644 index 55afe41cc7..0000000000 --- a/.github/workflows/zizmor.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: GitHub Actions Security Analysis - -on: - push: - branches: [main] - pull_request: - branches: ['**'] - -permissions: {} - -jobs: - zizmor: - name: Run zizmor - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - with: - persist-credentials: false - - - name: Run zizmor - uses: zizmorcore/zizmor-action@5f14fd08f7cf1cb1609c1e344975f152c7ee938d # v0.5.6 - with: - advanced-security: false - annotations: true diff --git a/.gitignore b/.gitignore index 70028b2860..ce8d7b7cd9 100644 --- a/.gitignore +++ b/.gitignore @@ -22,13 +22,6 @@ coverage # tests packages/router-generator/tests/**/*.gen.ts -packages/router-generator/tests/**/*.gen.js -**/port*.txt -**/test-results/** - -# Playwright artifacts -**/playwright-report/ -**/blob-report/ # misc .DS_Store @@ -59,38 +52,24 @@ ts-perf /examples/*/*/package-lock.json .netlify -.vercel nx-cloud.env +.vscode .nx/cache .nx/workspace-data -.nx/polygraph -.nx/self-healing -.nx/migrate-runs gpt/db.json -vite.config.timestamp-* +app.config.timestamp-* vite.config.js.timestamp-* vite.config.ts.timestamp-* +app.config.js.timestamp-* +app.config.ts.timestamp-* -vite.config.timestamp_* +app.config.timestamp_* vite.config.js.timestamp_* vite.config.ts.timestamp_* - +app.config.js.timestamp_* +app.config.ts.timestamp_* .idea *.vitest-temp.json - -# Handling VSCode settings -/.vscode/ -!/examples/react/**/.vscode/settings.json - -**/llms - -**/.tanstack - -# eslint-plugin-start perf fixtures -/e2e/eslint-plugin-start/src/perf/generated - -# local memory flame profiles -benchmarks/memory/**/.profiles/ diff --git a/.npmrc b/.npmrc index 268c392d3c..84aee8d998 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,3 @@ +link-workspace-packages=true +prefer-workspace-packages=true provenance=true diff --git a/.nvmrc b/.nvmrc index 63f87c20ef..b8e593f521 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -26.12.1 +20.15.1 diff --git a/.nx/ci-config.yaml b/.nx/ci-config.yaml deleted file mode 100644 index 2f0783feb4..0000000000 --- a/.nx/ci-config.yaml +++ /dev/null @@ -1,5 +0,0 @@ -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 new file mode 100644 index 0000000000..d3536f3ba7 --- /dev/null +++ b/.nx/workflows/dynamic-changesets.yaml @@ -0,0 +1,4 @@ +distribute-on: + small-changeset: 3 linux-medium-js + medium-changeset: 6 linux-medium-js + large-changeset: 10 linux-medium-js diff --git a/.nx/workflows/ultracache-config.yaml b/.nx/workflows/ultracache-config.yaml deleted file mode 100644 index b3ed223621..0000000000 --- a/.nx/workflows/ultracache-config.yaml +++ /dev/null @@ -1,124 +0,0 @@ -ignore-reads: - - e2e/.gitignore - - '**/src/routeTree.gen.ts' -ignore-writes: - - '**/src/routeTree.gen.ts' -task-exclusions: - - target: test:build - 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 - ignore-writes: - - e2e/react-start/deferred-hydration/src/routes/components.tsx - - project: tanstack-react-start-e2e-hmr - target: test:e2e - 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 - - e2e/react-start/hmr/src/routes/__root.tsx - - e2e/react-start/hmr/src/routes/child.tsx - - e2e/react-start/hmr/src/routes/component-hmr-inline-error-split.tsx - - e2e/react-start/hmr/src/routes/component-hmr-inline-nosplit.tsx - - e2e/react-start/hmr/src/routes/component-hmr-inline-split.tsx - - e2e/react-start/hmr/src/routes/component-hmr-lowercase-named-split.tsx - - e2e/react-start/hmr/src/routes/component-hmr-named-error-split.tsx - - e2e/react-start/hmr/src/routes/component-hmr-named-nosplit.tsx - - e2e/react-start/hmr/src/routes/component-hmr-named-split.tsx - - e2e/react-start/hmr/src/routes/index.tsx - - e2e/react-start/hmr/src/routes/inputs.tsx - - project: tanstack-react-start-e2e-hmr - target: test:e2e--vite-ssr - ignore-writes: *hmr-source-writes - - project: tanstack-react-start-e2e-hmr - target: test:e2e--vite-ssr--bundled-dev - ignore-writes: *hmr-source-writes - - project: tanstack-react-start-e2e-hmr - target: test:e2e--rsbuild-ssr - ignore-writes: *hmr-source-writes - - project: tanstack-react-start-e2e-rsbuild - target: test:e2e--rsbuild-ssr - ignore-writes: - - e2e/react-start/rsbuild/src/routes/index.tsx - - project: tanstack-react-start-e2e-server-functions - target: test:e2e - 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 - 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 - - packages/router-generator/tests/generator/custom-scaffolding/routes/index.tsx - # These reads are of scratch files created by the same test invocation. - - project: tanstack-solid-start-e2e-basic-auth - target: test:e2e - ignore-reads: - - e2e/solid-start/basic-auth/.tmp/dev.db - - project: tanstack-vue-start-e2e-basic-auth - target: test:e2e - ignore-reads: - - e2e/vue-start/basic-auth/.tmp/dev.db - - project: '@tanstack/router-generator' - target: test:unit - 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 - ignore-reads: - - e2e/react-start/basic-tsr-config/count.txt - ignore-writes: - - e2e/react-start/basic-tsr-config/count.txt - - project: tanstack-solid-start-e2e-basic-tsr-config - target: test:e2e - ignore-reads: - - e2e/solid-start/basic-tsr-config/count.txt - ignore-writes: - - e2e/solid-start/basic-tsr-config/count.txt - - project: tanstack-vue-start-e2e-basic-tsr-config - target: test:e2e - ignore-reads: - - e2e/vue-start/basic-tsr-config/count.txt - 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 - ignore-reads: - - e2e/react-start/i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-router-e2e-react-i18n-paraglide - target: build - ignore-reads: - - e2e/react-router/i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-react-start-e2e-i18n-paraglide - target: test:e2e - ignore-reads: - - e2e/react-start/i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-router-e2e-react-i18n-paraglide - target: test:e2e - ignore-reads: - - e2e/react-router/i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-router-i18n-paraglide - target: build - ignore-reads: - - examples/react/i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-start-i18n-paraglide - target: build - ignore-reads: - - examples/react/start-i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-router-solid-i18n-paraglide - target: build - ignore-reads: - - examples/solid/i18n-paraglide/project.inlang/cache/plugins/* - - project: tanstack-solid-start-i18n-paraglide - target: build - ignore-reads: - - examples/solid/start-i18n-paraglide/project.inlang/cache/plugins/* diff --git a/.prettierignore b/.prettierignore index de501452ad..210d68c1b1 100644 --- a/.prettierignore +++ b/.prettierignore @@ -7,17 +7,10 @@ pnpm-lock.yaml **/snapshots **/.vercel +**/.vinxi **/.output **/node_modules node_modules **/test-results -**/tests/generator/file-modification/routes/(test)/* -**/tests/generator/**/routeTree*.snapshot.ts -/.nx/workspace-data -**/src/routeTree.gen.ts -packages/router-plugin/tests/**/test-files/** -.nx/self-healing - -# Preserve the pinned upstream URL fixtures byte for byte. -packages/router-core/tests/fixtures/wpt-url/urltestdata*.json +**/tests/generator/file-modification/routes/(test)/* \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md deleted file mode 100644 index f47b5103e1..0000000000 --- a/AGENTS.md +++ /dev/null @@ -1,41 +0,0 @@ -# AGENTS.md - -## Scope - -- Read applicable nested `AGENTS.md` files before editing or testing a subtree. -- Shared routing belongs in `packages/router-core`; check React, Solid, and Vue bindings for shared changes. Shared Start runtime/build logic lives in `packages/start-*-core`. - -## 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 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-many -p -t --skipRemoteCache -``` - -- Run one Nx command at a time. For a ~20-second startup/graph stall, stop, run `pnpm nx reset`, and retry once, then escalate. Do not apply that timeout to running tests. -- For code changes, run affected packages' `test:unit`, `test:types`, and `test:eslint` where available, including affected consumers; use `test:e2e` for browser/app behavior and `test:build` for exports/build changes. Root `pnpm test` includes the full e2e suite. Published-code changes require `pnpm changeset`. - -## Runtime rules - -- Import `isServer` from `@tanstack/router-core/isServer`. Conditional exports select: `development` → `undefined`; server (`workerd`, `worker`, `deno`, `node`, `bun`) → `true` except `NODE_ENV=test` → `undefined`; browser/fallback → `false`. `development` wins; `NODE_ENV=development` alone does not select it. -- Keep `isServer ?? router.isServer` directly in each branch condition for dead-code elimination; negate the whole expression for client branches. Never extract it into a variable (e.g. `const serverRendering = isServer ?? router.isServer`) or helper. Without a router, inline `isServer ?? typeof window === 'undefined'` (or the existing `document` check). Keep the constant first and use `??`, never `||`. -- **Never create UI/router reactivity on the server, including development/tests.** Branch before reactive setup; use direct reads and core non-reactive stores. Required transport listeners are allowed only with request-scoped lifetimes and cleanup. -- Shared route definitions/build metadata must not acquire request/user data. Keep it on the request's Router, context, or QueryClient. -- HMR can replace code while caches and pending work survive. Invalidate derived state or bypass caching in development; reject stale async results while preserving intentional HMR identities/state. -- Gate developer diagnostics and message construction with direct `process.env.NODE_ENV !== 'production'` checks. Preserve required validation/throws in production (e.g. detailed development error, compact `invariant()` failure). `!== 'development'` also enables the guarded code in tests; preserve existing dev-server mode gates. - -## Performance and final bundle pass - -- For runtime/memory changes, compare identical baseline/candidate workloads using the relevant [benchmark guide](benchmarks/AGENTS.md): client navigation, Start SSR, or memory. Add coverage for unmeasured mechanisms. -- **Last phase for every change affecting emitted client JavaScript**, including core/build transforms: complete the full [bundle-size-optimization skill](.agents/skills/bundle-size-optimization/SKILL.md) after correctness and performance validation. The full workflow is mandatory. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4b6e808af1..3f5f96a71d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,160 +1,26 @@ -# Contributing to TanStack Router +# Contributing -TanStack Router is a community project. Contributions to both TanStack Router and TanStack Start are welcome. - -## Setup - -1. Clone the repository: - - ```sh - gh repo clone TanStack/router - ``` - -2. Install [Node.js](https://nodejs.org/en/) and [pnpm](https://pnpm.io/installation). This repository requires pnpm `11.x.x` or newer. -3. Install dependencies: - - ```sh - pnpm install - ``` - - This installs dependencies for the entire monorepo, including examples. Workspace dependencies are linked automatically. - -4. Install the Playwright browsers if you will run end-to-end tests: - - ```sh - pnpm exec playwright install - ``` - -5. Create a branch for your changes: - - ```sh - git checkout -b my-new-branch - ``` - -## Before you start - -- Search the [open and closed issues](https://github.com/TanStack/router/issues?q=is%3Aissue) before reporting a bug. If it has not already been reported, use the [bug report template](https://github.com/TanStack/router/issues/new?template=bug_report.yml). -- Search the [open and closed pull requests](https://github.com/TanStack/router/pulls?q=is%3Apr) before starting work to avoid duplicating an existing contribution. -- Pull requests that require API changes must first be proposed as an issue and receive maintainer sign-off before implementation begins. - -## Pull request guidelines - -Every pull request must follow the [TanStack Router pull request template](.github/pull_request_template.md). Complete its description and checklist without removing or bypassing the required sections. - -- Keep each pull request focused on one change or topic. Pull requests that combine unrelated changes will be closed with a request to split them into separately reviewable contributions. -- Write a concise description that clearly explains what changed and why. Follow the sections in the pull request template; a long, unstructured description makes a contribution harder to review. -- Every change that affects a published package must include a changeset. Create it with `pnpm changeset`; documentation, CI, examples, and development-only changes do not require one. - -## Development - -- `pnpm build:all` builds all packages. -- `pnpm build` runs the cached Nx build for affected packages. -- `pnpm dev` builds the packages and starts the development watcher. - -To run an example application, move into its directory and start its development server. For example: - -```sh -cd examples/react/basic -pnpm dev -``` - -## Testing and linting - -Run the checks relevant to your changes while developing: - -- `pnpm test:eslint` checks linting for affected packages. -- `pnpm test:types` checks types for affected packages. -- `pnpm test:unit` runs unit tests for affected packages. -- `pnpm test:build` checks builds for affected packages. -- `pnpm test:e2e` runs end-to-end tests and requires the Playwright browsers. - -Before opening a pull request, run at least: - -```sh -pnpm test:eslint -pnpm test:types -pnpm test:unit -``` - -To run the full CI test suite, use `pnpm test:ci`. For faster feedback, use an Nx target for a specific package or pass a test file or test name after `--`. For example: - -```sh -pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx -pnpm nx run @tanstack/react-router:test:unit -- tests/link.test.tsx -t "preloading" -``` - -Add appropriate unit tests for isolated behavior and end-to-end tests for browser or application workflows. Test relevant example applications when the change affects them. - -## Documentation - -Update the relevant documentation for user-facing changes. Documentation lives in the `docs/` directory, with separate sections for Router and Start. Use relative links within the `docs/` directory, such as `./guide/data-loading`. - -The documentation sites are hosted on [tanstack.com](https://tanstack.com), which is a [TanStack Start application](https://github.com/TanStack/tanstack.com). To preview documentation changes locally, clone both repositories as siblings: - -> [!NOTE] -> The website fetches the doc pages from GitHub in production, and searches for them at `../router/docs` in development. Your local clone of `TanStack/router` needs to be in the same directory as the local clone of `TanStack/tanstack.com`. - -You can follow these steps to set up the docs for local development: - -1. Make a new directory called `tanstack`. - -```sh -mkdir tanstack -``` - -2. Enter that directory and clone the [`TanStack/router`](https://github.com/TanStack/router) and [`TanStack/tanstack.com`](https://github.com/TanStack/tanstack.com) repos. - -```sh -cd tanstack -git clone git@github.com:TanStack/router.git -# We probably don't need all the branches and commit history -# from the `tanstack.com` repo, so let's just create a shallow -# clone of the latest version of the `main` branch. -# Read more about shallow clones here: -# https://github.blog/2020-12-21-get-up-to-speed-with-partial-clone-and-shallow-clone/#user-content-shallow-clones -git clone git@github.com:TanStack/tanstack.com.git --depth=1 --single-branch --branch=main -``` - -> [!NOTE] -> Your `tanstack` directory should look like this: -> -> ```text -> tanstack/ -> | -> +-- router/ (<-- this directory cannot be called anything else!) -> | -> +-- tanstack.com/ -> ``` - -3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode: - -```sh -cd tanstack.com -pnpm i -# The app will run on https://localhost:3000 by default -pnpm dev -``` - -4. Now you can visit http://localhost:3000/router/latest/docs/framework/react/overview in the browser and see the changes you make in `tanstack/router/docs` there. - -> [!WARNING] -> You will need to update the `docs/(router or start)config.json` file (in `TanStack/router`) if you add a new documentation page! - -## 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. -2. **Keep ownership of technical decisions**. Understand every change, verify its behavior with the appropriate tests and documentation, and be ready to explain it during review. -3. **Do not paste LLM output verbatim into the codebase or a contribution**. Treat generated text and code as a draft: check its claims, adapt it to the repository, and remove anything you cannot justify. Issues or pull requests that appear to contain unreviewed LLM output may be closed without further review. -4. **Do not mass-submit unrelated or low-quality AI-generated pull requests**. We treat that behavior as spam and may close the pull requests, block the contributor, and report the GitHub account. - -AI-assisted contributions follow the same standards for correctness, testing, documentation, and review as every other contribution. +- Clone the repo + - `gh repo clone TanStack/router` +- Ensure `node` is installed + - https://nodejs.org/en/ +- Ensure `pnpm` is installed + - https://pnpm.io/installation + - Why? We use `pnpm` to manage workspace dependencies. It's easily the best monorepo/workspace experience available as of when this was written. +- Install dependencies + - `pnpm install` + - This installs dependencies for all of the packages in the monorepo, even examples! + - Dependencies inside of the packages and examples are automatically linked together as local/dynamic dependencies. +- Run the build or dev watcher + - `pnpm build:all` (build all packages) or + - `pnpm build` (cached build with [nx affected](https://nx.dev/nx-api/nx/documents/affected)) or + - `pnpm dev` +- Navigate to an example + - `cd examples/react/basic` +- Run the example + - `pnpm dev` +- Make changes to the code + - If you ran `pnpm dev` the dev watcher will automatically rebuild the code that has changed +- Changes to the docs + - Be sure that internal links are written always relative to `docs` folder. + E.g. `./guide/data-loading` diff --git a/DEBUGGING.md b/DEBUGGING.md deleted file mode 100644 index b29605b2fb..0000000000 --- a/DEBUGGING.md +++ /dev/null @@ -1,334 +0,0 @@ -# Debugging & Testing Guide - -_A practical guide for debugging complex issues and running tests effectively, learned from investigating production regressions in large codebases._ - -## Quick Start Debugging Checklist - -When you encounter a bug report or failing test: - -1. **Reproduce first** - Create a minimal test case that demonstrates the exact issue -2. **Establish baseline** - Run existing tests to see what currently works/breaks -3. **Add targeted logging** - Insert debug output at key decision points -4. **Trace the data flow** - Follow the path from input to unexpected output -5. **Check recent changes** - Look for version changes mentioned in bug reports -6. **Test your hypothesis** - Make small, targeted changes and validate each step - -## Essential Testing Commands - -### Monorepo with Nx - -```bash -# Run all tests for a package -npx nx test:unit @package-name - -# Run specific test file -npx nx test:unit @package-name -- --run path/to/test.test.tsx - -# Run tests matching a pattern -npx nx test:unit @package-name -- --run "pattern-in-test-name" - -# Run with verbose output -npx nx test:unit @package-name -- --run --verbose -``` - -### Standard npm/yarn projects - -```bash -# Run specific test file -npm test -- --run path/to/test.test.tsx -yarn test path/to/test.test.tsx - -# Run tests matching pattern -npm test -- --grep "test pattern" -``` - -### Useful test flags - -```bash -# Run only (don't watch for changes) ---run - -# Show full output including console.logs ---verbose - -# Run in specific environment ---environment=jsdom -``` - -## Effective Debugging Strategies - -### 1. Strategic Logging - -```javascript -// Use distinctive prefixes for easy filtering -console.log('[DEBUG useNavigate] from:', from, 'to:', to) -console.log('[DEBUG router] current location:', state.location.pathname) - -// Log both input and output of functions -console.log('[DEBUG buildLocation] input:', dest) -// ... function logic ... -console.log('[DEBUG buildLocation] output:', result) -``` - -**Pro tip:** Use `[DEBUG componentName]` prefixes so you can easily filter logs in browser dev tools. - -### 2. Reproduction Test Pattern - -```javascript -test('should reproduce the exact issue from bug report', async () => { - // Set up the exact scenario described - const router = createRouter({ - /* exact config from bug report */ - }) - - // Perform the exact user actions - await navigate({ to: '/initial-route' }) - await navigate({ to: '.', search: { param: 'value' } }) - - // Assert the expected vs actual behavior - expect(router.state.location.pathname).toBe('/expected') - // This should fail initially, proving reproduction -}) -``` - -### 3. Data Flow Tracing - -``` -User Action → Hook Call → Router Logic → State Update → UI Update - ↓ ↓ ↓ ↓ ↓ - onClick() → useNavigate() → buildLocation() → setState() → re-render -``` - -Add logging at each step to see where the flow diverges from expectations. - -## Common Pitfalls & Solutions - -### React Testing Issues - -**Problem:** State updates not reflected in tests - -```javascript -// ❌ Bad - missing act() wrapper -fireEvent.click(button) -expect(component.state).toBe(newValue) - -// ✅ Good - wrapped in act() -act(() => { - fireEvent.click(button) -}) -expect(component.state).toBe(newValue) -``` - -**Problem:** Async operations not completing - -```javascript -// ❌ Bad - not waiting for async -const result = await someAsyncOperation() -expect(result).toBe(expected) - -// ✅ Good - ensuring completion -await act(async () => { - await someAsyncOperation() -}) -expect(result).toBe(expected) -``` - -### React Router Specific Issues - -**Context vs Location confusion:** - -- `useMatch({ strict: false })` returns the **component's route context** -- `router.state.location.pathname` returns the **current URL** -- These can be different when components are rendered by parent routes - -```javascript -// Component rendered by parent route "/" but URL is "/child" -const match = useMatch({ strict: false }) // Returns "/" context -const location = router.state.location.pathname // Returns "/child" -``` - -## Search & Investigation Commands - -### Finding relevant code - -```bash -# Search for specific patterns in TypeScript/JavaScript files -grep -r "navigate.*to.*\." --include="*.ts" --include="*.tsx" . - -# Find files related to a feature -find . -name "*navigate*" -type f - -# Search with ripgrep (faster) -rg "useNavigate" --type typescript -``` - -### Git investigation - -```bash -# Find when a specific line was changed -git blame path/to/file.ts - -# See recent changes to a file -git log --oneline -10 path/to/file.ts - -# Search commit messages -git log --grep="navigation" --oneline -``` - -## Testing Best Practices - -### Test Structure - -```javascript -describe('Feature', () => { - beforeEach(() => { - // Reset state for each test - cleanup() - history = createBrowserHistory() - }) - - test('should handle specific scenario', async () => { - // Arrange - set up the test conditions - const router = createRouter(config) - - // Act - perform the action being tested - await act(async () => { - navigate({ to: '/target' }) - }) - - // Assert - verify the results - expect(router.state.location.pathname).toBe('/target') - }) -}) -``` - -### Multiple Assertions - -```javascript -test('navigation should update both path and search', async () => { - await navigate({ to: '/page', search: { q: 'test' } }) - - // Test multiple aspects - expect(router.state.location.pathname).toBe('/page') - expect(router.state.location.search).toEqual({ q: 'test' }) - expect(router.state.matches).toHaveLength(2) -}) -``` - -## Architecture Investigation Process - -### 1. Map the System - -``` -User Input → Component → Hook → Core Logic → State → UI -``` - -Identify each layer and what it's responsible for. - -### 2. Find the Divergence Point - -Use logging to identify exactly where expected behavior diverges: - -```javascript -console.log('Input received:', input) -// ... processing ... -console.log('After step 1:', intermediate) -// ... more processing ... -console.log('Final output:', output) // Is this what we expected? -``` - -### 3. Check Assumptions - -Common false assumptions: - -- "This hook returns the current route" (might return component context) -- "State updates are synchronous" (often async in React) -- "This worked before" (check if tests actually covered this case) - -## Regression Investigation - -### Version Comparison - -```bash -# Check what changed between versions -git diff v1.120.13..v1.121.34 -- packages/react-router/ - -# Look for specific changes -git log v1.120.13..v1.121.34 --oneline --grep="navigate" -``` - -### Bisecting Issues - -```bash -# Start bisect to find breaking commit -git bisect start -git bisect bad HEAD -git bisect good v1.120.13 - -# Test each commit until you find the breaking change -``` - -## When to Stop & Reconsider - -**Stop changing code when:** - -- Your fix breaks multiple existing tests -- You're changing fundamental assumptions -- The solution feels hacky or overly complex - -**Consider instead:** - -- Adding a new API rather than changing existing behavior -- Documenting the current behavior if it's actually correct -- Creating a more targeted fix for the specific use case - -## Advanced Debugging Techniques - -### React DevTools - -- Inspect component tree to understand render context -- Check props and state at each level -- Use Profiler to identify performance issues - -### Browser DevTools - -```javascript -// Add global debugging helpers -window.debugRouter = router -window.debugState = () => console.log(router.state) - -// Use conditional breakpoints -if (router.state.location.pathname === '/problematic-route') { - debugger -} -``` - -### Test Isolation - -```javascript -// Run only one test to isolate issues -test.only('this specific failing test', () => { - // ... -}) - -// Skip problematic tests temporarily -test.skip('temporarily disabled', () => { - // ... -}) -``` - -## Key Takeaways - -1. **Reproduction beats theory** - A failing test that demonstrates the issue is worth more than understanding the problem in theory - -2. **Existing tests are protection** - If your fix breaks many existing tests, you're probably changing the wrong thing - -3. **Context matters** - Especially in React, understanding where components are rendered and what context they have access to is crucial - -4. **Small changes, frequent validation** - Make small, targeted changes and test each one rather than large refactors - -5. **Sometimes the answer is "don't change it"** - Not every reported issue needs a code change; sometimes documentation or a new API is the right solution - ---- - -_This guide was developed while investigating a navigation regression in TanStack Router, where `navigate({ to: "." })` unexpectedly redirected to the root instead of staying on the current route._ diff --git a/README.md b/README.md index 736715b12a..3c0a17ba71 100644 --- a/README.md +++ b/README.md @@ -1,203 +1,84 @@ - - - - - -
+![TanStack Router Header](https://github.com/tanstack/router/raw/main/media/header.png) - - - - TanStack Router - +🤖 Type-safe router w/ built-in caching & URL state management for React! -## TanStack Router + + #TanStack + + + + + + + + semantic-release + + Join the discussion on Github +Best of JS + + + + + + -A modern router designed for type safety, data‑driven navigation, and seamless developer experience. +Enjoy this library? Try the entire [TanStack](https://tanstack.com)! [React Query](https://github.com/tannerlinsley/react-query), [React Table](https://github.com/tanstack/react-table), [React Charts](https://github.com/tannerlinsley/react-charts), [React Virtual](https://github.com/tannerlinsley/react-virtual) -- End‑to-end type safety (routes, params, loaders) -- Schema‑driven search params with validation -- Built‑in caching, prefetching & invalidation -- Nested layouts, transitions & error boundaries - -### [Read the Router Docs →](https://tanstack.com/router) - - - - - - - TanStack Start - - -## TanStack Start - -A full‑stack framework built on Router, designed for server rendering, streaming, and production‑ready deployments. - -- Full‑document SSR & streaming -- Server functions & end‑to‑end type safety -- Deployment‑ready bundling & builds -- All the power of TanStack Router, plus full‑stack features - -### [Read the Start Docs →](https://tanstack.com/start) - -
- -
- -

- npm downloads GitHub stars Bundle size -

-

- semantic-release Best of JS Follow @TanStack -

- -
- -### [Become a Sponsor!](https://github.com/sponsors/tannerlinsley/) - -
- -## Get Involved - -- We welcome issues and pull requests! -- Participate in [GitHub discussions](https://github.com/TanStack/router/discussions) -- Chat with the community on [Discord](https://discord.com/invite/WrRKjPJ) -- See [CONTRIBUTING.md](./CONTRIBUTING.md) for setup instructions +## Visit [tanstack.com/router](https://tanstack.com/router) for docs, guides, API and more! ## Partners - - - - - - - - - - - - - - - - -
- - - - - CodeRabbit - - - - - - - - Cloudflare - - - - - - - - Netlify - - -
- - - - - Neon - - - - - - - - Clerk - - - - - - - - Convex - - -
- - - - - Sentry - - - - - - - - Prisma - - - - - - - - Strapi - - -
+
+

+

+

+

+

-
+## Quick Features -## Explore the TanStack Ecosystem +- 100% TypeSafe + - Route Defs + - Navigation + - Relative Navigation + - Search Params + - Path Params + - Loaders +- 1st Class Search Params + - Schemas + Validation + - Parsing + Serialization + - Immutable + - Structural Sharing + - Pre/Post Processing +- Built-in Caching + - Stale-While-Revalidate + - Max-Age + - Auto Garbage Collection + - Invalidation +- Prefetching +- Automatic Prefetching +- Transitions +- Error Boundaries +- Code Splitting +- Layout Routes +- Easy Integration w/ external caches and storage (eg. React Query, Apollo, SWR, RTKQuery) -- TanStack Config – Tooling for JS/TS packages -- TanStack DB – Reactive sync client store -- TanStack DevTools – Unified devtools panel -- TanStack Form – Type‑safe form state -- TanStack Pacer – Debouncing, throttling, batching
-- TanStack Query – Async state & caching -- TanStack Ranger – Range & slider primitives -- TanStack Store – Reactive data store -- TanStack Table – Headless datagrids -- TanStack Virtual – Virtualized rendering +## Example Usage -… and more at TanStack.com » +To run example React projects with Tanstack Router, see [CONTRIBUTING.md](./CONTRIBUTING.md) - + diff --git a/_artifacts/domain_map.yaml b/_artifacts/domain_map.yaml deleted file mode 100644 index 0b2672f0c6..0000000000 --- a/_artifacts/domain_map.yaml +++ /dev/null @@ -1,1093 +0,0 @@ -# domain_map.yaml -# Generated by skill-domain-discovery -# Library: TanStack Router -# Version: 1.166.2 -# Date: 2026-03-07 -# Status: reviewed - -library: - name: '@tanstack/react-router' - version: '1.166.2' - repository: 'https://github.com/TanStack/router' - description: >- - Type-safe router for React and Solid with built-in SWR caching, - JSON-first search params, file-based route generation, and - end-to-end type inference. - primary_framework: 'React' - -domains: - - name: 'Defining Routes' - slug: 'defining-routes' - description: >- - Setting up route trees via file-based, code-based, or virtual - file routes, configuring the router instance, and registering - types for end-to-end inference. - - - name: 'Navigating' - slug: 'navigating' - description: >- - Moving between routes using Links, imperative navigation, - redirects, preloading, active states, and navigation blocking. - - - name: 'Managing URL State' - slug: 'managing-url-state' - description: >- - Reading and writing search params and path params with - validation, serialization, middlewares, and type-safe adapters. - - - name: 'Loading Data' - slug: 'loading-data' - description: >- - Fetching data via route loaders, coordinating external caches, - managing SWR caching, deferred loading, and error/pending states. - - - name: 'Protecting Routes' - slug: 'protecting-routes' - description: >- - Authentication guards, authorization checks, RBAC patterns, - and redirect-based access control via beforeLoad. - - - name: 'Rendering and Layout' - slug: 'rendering-and-layout' - description: >- - Outlets, nested layouts, pathless layouts, code splitting, - error boundaries, not-found handling, route masking, scroll - restoration, and document head management. - - - name: 'Type Safety' - slug: 'type-safety' - description: >- - Router type registration, inference patterns, narrowing with - from, TypeScript performance, and avoiding unnecessary type - annotations. - - - name: 'Server-Side Rendering' - slug: 'server-side-rendering' - description: >- - Non-streaming and streaming SSR setup, hydration, data - serialization, and isomorphic router creation. - -skills: - # ── Defining Routes ────────────────────────────────────────────── - - name: 'Route Setup' - slug: 'route-setup' - domain: 'defining-routes' - description: >- - Set up a TanStack Router project with file-based, code-based, - or virtual file routes, configure the router instance, and - register types. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - - '@tanstack/router-plugin' - - '@tanstack/router-generator' - - '@tanstack/router-cli' - - '@tanstack/virtual-file-routes' - - '@tanstack/eslint-plugin-router' - covers: - - createRouter - - createRootRoute - - createRootRouteWithContext - - createRoute - - createFileRoute - - createLazyFileRoute - - addChildren - - routeTree.gen.ts - - declare module Register - - TanStackRouter bundler plugin - - tsr.config.json - - virtual file routes API - - file naming conventions - - route matching and sorting - tasks: - - 'Scaffold a new TanStack Router project' - - 'Configure file-based routing with Vite plugin' - - 'Set up code-based route tree manually' - - 'Configure virtual file routes for custom conventions' - - 'Register router types via module declaration' - - 'Set up ESLint plugin for route property ordering' - reference_candidates: - - topic: 'file naming conventions' - reason: '>10 distinct conventions (dot separator, $ token, _ prefix/suffix, () groups, [] escaping, index, route.tsx, __root)' - failure_modes: - - mistake: 'Missing router type registration' - mechanism: >- - Without declare module Register, top-level exports like - Link, useNavigate, useParams have no type safety. Code - compiles but all route paths are untyped strings. - wrong_pattern: | - const router = createRouter({ routeTree }) - // no declare module — Link to="" has no autocomplete - correct_pattern: | - const router = createRouter({ routeTree }) - declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } - } - source: 'docs/router/guide/creating-a-router.md' - priority: CRITICAL - status: active - skills: ['route-setup', 'type-safety'] - - - mistake: 'Not committing routeTree.gen.ts' - mechanism: >- - routeTree.gen.ts is runtime code, not a build artifact. - Without it in version control, other developers cannot - build or run the project. - source: 'docs/router/faq.md' - priority: HIGH - status: active - - - mistake: 'Wrong route property order breaks type inference' - mechanism: >- - Properties like beforeLoad must come before loader in - createRoute/createFileRoute calls. Incorrect order causes - context types to not flow into loader. - wrong_pattern: | - createFileRoute('/posts')({ - loader: ({ context }) => - context.queryClient.query({ ...postsQuery, staleTime: 'static' }), - beforeLoad: ({ context }) => ({ queryClient: context.queryClient }), - }) - correct_pattern: | - createFileRoute('/posts')({ - beforeLoad: ({ context }) => ({ queryClient: context.queryClient }), - loader: ({ context }) => - context.queryClient.query({ ...postsQuery, staleTime: 'static' }), - }) - source: 'docs/router/eslint/create-route-property-order.md' - priority: HIGH - status: active - - - mistake: 'Placing TanStackRouter plugin after framework plugin' - mechanism: >- - The TanStackRouter Vite plugin must be listed before the - React/Solid plugin in the Vite config. Wrong order causes - route generation to fail silently. - wrong_pattern: | - plugins: [react(), TanStackRouterVite()] - correct_pattern: | - plugins: [TanStackRouterVite(), react()] - source: 'docs/router/installation/with-vite.md' - priority: HIGH - status: active - - - mistake: 'Using getParentRoute incorrectly in code-based routing' - mechanism: >- - Every non-root route must reference its correct parent via - getParentRoute. Wrong parent breaks type inference for - context, search params, and path params from ancestors. - source: 'docs/router/decisions-on-dx.md' - priority: HIGH - status: active - - compositions: - - library: '@tanstack/eslint-plugin-router' - skill: null - - # ── Navigating ─────────────────────────────────────────────────── - - name: 'Navigation' - slug: 'navigation' - domain: 'navigating' - description: >- - Navigate between routes using Link, useNavigate, Navigate - component, and router.navigate. Configure preloading, active - link states, and navigation blocking. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - Link component - - useNavigate hook - - Navigate component - - router.navigate - - ToOptions / NavigateOptions / LinkOptions - - from / to relative navigation - - activeOptions / activeProps / inactiveProps - - preload (intent / viewport / render) - - preloadDelay / defaultPreloadDelay - - useBlocker hook - - Block component - - createLink (custom link components) - - linkOptions helper - - MatchRoute component - - scroll restoration - tasks: - - 'Create type-safe links between routes' - - 'Navigate programmatically after an action' - - 'Set up link preloading on hover intent' - - 'Style active and inactive links' - - 'Block navigation for unsaved changes' - - 'Create custom link components with createLink' - - 'Build reusable navigation options with linkOptions' - - 'Configure scroll restoration' - failure_modes: - - mistake: 'Interpolating params into the to string' - mechanism: >- - Agents build paths like to={`/posts/${id}`} instead of - using the params option. Breaks type safety and param - encoding. - wrong_pattern: | - Post - correct_pattern: | - Post - source: 'docs/router/guide/navigation.md' - priority: CRITICAL - status: active - skills: ['navigation', 'type-safety'] - - - mistake: 'Using useNavigate instead of Link for user-clickable elements' - mechanism: >- - Link renders a real with href, supports cmd/ctrl+click - and preloading. useNavigate produces no accessible element. - source: 'docs/router/guide/navigation.md' - priority: MEDIUM - status: active - - - mistake: 'Not providing from for relative navigation' - mechanism: >- - Without from, the router assumes navigation from root. - Only absolute paths are autocompleted. Relative paths - like ".." resolve from root instead of current route. - wrong_pattern: | - Back - correct_pattern: | - Back - source: 'docs/router/guide/navigation.md' - priority: HIGH - status: active - - - mistake: 'Using search as object instead of function loses existing params' - mechanism: >- - search={{ page: 2 }} replaces all search params. - Must use function form to preserve existing params. - wrong_pattern: | - Page 2 - correct_pattern: | - ({ ...prev, page: 2 })}>Page 2 - source: 'docs/router/how-to/navigate-with-search-params.md' - priority: HIGH - status: active - skills: ['navigation', 'search-params'] - - # ── Managing URL State ─────────────────────────────────────────── - - name: 'Search Params' - slug: 'search-params' - domain: 'managing-url-state' - description: >- - Validate, read, write, and transform search params with - schema validation, adapters, middlewares, and custom - serialization. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - - '@tanstack/zod-adapter' - - '@tanstack/valibot-adapter' - - '@tanstack/arktype-adapter' - covers: - - validateSearch - - useSearch hook - - Route.useSearch - - getRouteApi().useSearch - - search middlewares - - retainSearchParams - - stripSearchParams - - custom serialization (parseSearch / stringifySearch) - - zod adapter / valibot adapter / arktype adapter - - search param inheritance from parent routes - - structural sharing for search params - tasks: - - 'Add validated search params to a route' - - 'Read search params in components' - - 'Update search params while preserving others' - - 'Share search params across parent and child routes' - - 'Set up search param middlewares for retention/stripping' - - 'Configure custom search param serialization' - - 'Handle arrays, objects, and dates in search params' - subsystems: - - name: 'Zod adapter' - package: '@tanstack/zod-adapter' - config_surface: 'zodValidator, fallback() wrapper for .catch/.default type correctness' - - name: 'Valibot adapter' - package: '@tanstack/valibot-adapter' - config_surface: 'Standard Schema compliant, requires valibot 1.0' - - name: 'ArkType adapter' - package: '@tanstack/arktype-adapter' - config_surface: 'Standard Schema compliant, requires arktype 2.0-rc, pass directly to validateSearch' - reference_candidates: - - topic: 'search param validation patterns' - reason: '>10 distinct patterns (basic, optional, arrays, objects, dates, discriminated unions, transforms, conditional, cross-route inheritance, middleware chaining)' - failure_modes: - - mistake: 'Using zod .catch() instead of adapter fallback()' - mechanism: >- - Zod .catch() makes the output type unknown, losing type - safety. The @tanstack/zod-adapter fallback() preserves - the correct inferred type. - wrong_pattern: | - z.object({ page: z.number().catch(1) }) - correct_pattern: | - import { fallback } from '@tanstack/zod-adapter' - z.object({ page: fallback(z.number(), 1) }) - source: 'docs/router/guide/search-params.md' - priority: HIGH - status: active - - - mistake: 'Returning entire search object from loaderDeps' - mechanism: >- - loaderDeps: ({ search }) => search causes loader to - re-run on ANY search param change, not just relevant ones. - Deep equality comparison fires on every unrelated change. - wrong_pattern: | - loaderDeps: ({ search }) => search - correct_pattern: | - loaderDeps: ({ search }) => ({ page: search.page }) - source: 'docs/router/guide/data-loading.md' - priority: HIGH - status: active - skills: ['search-params', 'data-loading'] - - - mistake: 'Passing Date objects in search params' - mechanism: >- - Date objects serialize to [object Object] in URLs. - Must convert to ISO strings for correct serialization. - wrong_pattern: | - - correct_pattern: | - - source: 'docs/router/how-to/arrays-objects-dates-search-params.md' - priority: HIGH - status: active - - - mistake: 'Parent route missing validateSearch blocks inheritance' - mechanism: >- - Child routes cannot access shared search params unless - the parent route defines validateSearch. Without it, - the types and runtime values are not available. - source: 'docs/router/how-to/share-search-params-across-routes.md' - priority: MEDIUM - status: active - - - name: 'Path Params' - slug: 'path-params' - domain: 'managing-url-state' - description: >- - Define and consume dynamic path segments, splat routes, - optional params, and prefix/suffix patterns. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - '$paramName dynamic segments' - - '$ splat / _splat' - - '{-$paramName} optional params' - - '{$paramName} prefix/suffix patterns' - - useParams hook - - params.parse / params.stringify - - pathParamsAllowedCharacters - tasks: - - 'Define routes with dynamic path parameters' - - 'Use splat routes for catch-all matching' - - 'Set up optional path parameters for i18n' - - 'Navigate with type-safe path params' - failure_modes: - - mistake: 'Interpolating path params into to string' - mechanism: >- - Same as navigation failure mode — agents build template - literal paths instead of using params option. - source: 'docs/router/guide/navigation.md' - priority: CRITICAL - status: active - skills: ['path-params', 'navigation'] - - - mistake: 'Using * for splat routes instead of $' - mechanism: >- - TanStack Router uses $ for splat routes, not * like some - other routers. The captured value is under _splat key, - not * (though * works in v1 for backwards compat, removed in v2). - source: 'docs/router/routing/routing-concepts.md' - priority: MEDIUM - status: 'fixed-but-legacy-risk' - version_context: '* works in v1 for compat but will be removed in v2' - - - mistake: 'Using curly braces for basic dynamic segments' - mechanism: >- - Basic dynamic segments use $postId (no braces). Curly - braces are only for prefix/suffix patterns like {$postId}.txt - or optional params {-$locale}. - source: 'docs/router/guide/path-params.md' - priority: MEDIUM - status: active - - # ── Loading Data ───────────────────────────────────────────────── - - name: 'Data Loading' - slug: 'data-loading' - domain: 'loading-data' - description: >- - Load data via route loaders with built-in SWR caching, - configure staleTime/gcTime, use loaderDeps for cache keys, - handle pending and error states, and inject dependencies - via router context. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - loader option - - loaderDeps - - staleTime / gcTime / defaultPreloadStaleTime - - pendingComponent / pendingMs / pendingMinMs - - errorComponent / onError / onCatch - - beforeLoad - - router context / createRootRouteWithContext - - router.invalidate - - Await component - - deferred data loading - tasks: - - 'Add a data loader to a route' - - 'Configure cache timing (staleTime, gcTime)' - - 'Set up loader dependencies for search-param-driven data' - - 'Show pending UI during slow loads' - - 'Handle loader errors with error boundaries' - - 'Inject dependencies via router context' - - 'Defer non-critical data with unawaited promises' - - 'Invalidate cached data after mutations' - failure_modes: - - mistake: 'Assuming loaders only run on the server' - mechanism: >- - TanStack Router is client-first. Loaders run on the client - by default (and also on the server if using TanStack Start). - Agents trained on Remix/Next assume loaders are server-only - and put server-only code (DB queries, fs access) in them. - source: 'maintainer interview' - priority: CRITICAL - status: active - skills: ['data-loading', 'ssr'] - - - mistake: 'Not understanding staleTime default is 0' - mechanism: >- - Default staleTime is 0, meaning data is always considered - stale and reloads in background on every route re-match. - Agents may not set staleTime, causing excessive refetching. - source: 'docs/router/guide/data-loading.md' - priority: MEDIUM - status: active - - - mistake: 'Using reset() instead of router.invalidate() in error components' - mechanism: >- - For loader errors, reset() only resets the error boundary - but does not re-run the loader. Must use router.invalidate() - to coordinate both reload and boundary reset. - wrong_pattern: | - function PostErrorComponent({ error, reset }) { - return - } - correct_pattern: | - function PostErrorComponent({ error, reset }) { - const router = useRouter() - return - } - source: 'docs/router/guide/data-loading.md' - priority: HIGH - status: active - - - mistake: 'Double parentheses missing on createRootRouteWithContext' - mechanism: >- - createRootRouteWithContext() is a factory — it returns - a function. Must call it twice: createRootRouteWithContext()(routeOptions). - Missing second call is a common error. - wrong_pattern: | - const rootRoute = createRootRouteWithContext<{ auth: AuthState }>({ - component: RootComponent, - }) - correct_pattern: | - const rootRoute = createRootRouteWithContext<{ auth: AuthState }>()({ - component: RootComponent, - }) - source: 'docs/router/guide/data-loading.md' - priority: HIGH - status: active - - - mistake: 'Using React hooks in beforeLoad or loader' - mechanism: >- - beforeLoad and loader are not React components — hooks - cannot be called in them. Must extract hook state in a - wrapper component and pass via router context. - source: 'docs/router/guide/router-context.md' - priority: HIGH - status: active - - compositions: - - library: '@tanstack/react-query' - skill: 'external-data-loading' - - - name: 'External Data Loading' - slug: 'external-data-loading' - domain: 'loading-data' - description: >- - Integrate TanStack Query (or other external caches) with - Router for coordinated data loading, SSR dehydration/hydration, - and streaming. - type: composition - packages: - - '@tanstack/react-router' - - '@tanstack/react-router-ssr-query' - covers: - - External cache coordination pattern - - "queryClient.query with staleTime: 'static' in loader" - - useSuspenseQuery in components - - setupRouterSsrQueryIntegration - - defaultPreloadStaleTime - - dehydrate / hydrate router options - - QueryClient per-request isolation - - Wrap router option for providers - tasks: - - 'Set up TanStack Query with Router' - - 'Preload query data in route loaders' - - 'Configure SSR dehydration/hydration with Query' - - 'Stream query data during SSR' - failure_modes: - - mistake: 'Not setting defaultPreloadStaleTime to 0 with external caches' - mechanism: >- - Router's built-in preload cache (30s default) prevents - external library from controlling freshness. Set - defaultPreloadStaleTime: 0 to let Query manage caching. - wrong_pattern: | - createRouter({ routeTree }) - correct_pattern: | - createRouter({ routeTree, defaultPreloadStaleTime: 0 }) - source: 'docs/router/guide/external-data-loading.md' - priority: HIGH - status: active - - - mistake: 'Creating QueryClient outside createRouter for SSR' - mechanism: >- - For SSR, QueryClient must be created inside createRouter - to ensure per-request isolation. A shared singleton leaks - data between requests. - wrong_pattern: | - const queryClient = new QueryClient() - const router = createRouter({ routeTree, context: { queryClient } }) - correct_pattern: | - function createAppRouter() { - const queryClient = new QueryClient() - return createRouter({ routeTree, context: { queryClient } }) - } - source: 'docs/router/guide/external-data-loading.md' - priority: HIGH - status: active - - - mistake: 'Awaiting a fire-and-forget query in loader blocks rendering' - mechanism: >- - For streaming/deferred patterns, start a query without awaiting - it and handle failures with catch(noop) — it starts fetching on - the server and streams without blocking. Awaiting defeats the purpose. - source: 'docs/router/integrations/query.md' - priority: MEDIUM - status: active - - # ── Protecting Routes ──────────────────────────────────────────── - - name: 'Auth and Guards' - slug: 'auth-and-guards' - domain: 'protecting-routes' - description: >- - Protect routes with authentication checks, authorization - guards, and RBAC patterns using beforeLoad redirects and - layout routes. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - beforeLoad for auth checks - - redirect() / throw redirect() - - isRedirect helper - - Authenticated layout routes (_authenticated) - - Non-redirect auth (inline login) - - RBAC with roles and permissions - - Auth provider integration (Auth0, Clerk, Supabase) - - Router context for auth state - tasks: - - 'Protect routes with authentication checks' - - 'Redirect unauthenticated users to login' - - 'Implement role-based access control' - - 'Integrate third-party auth providers' - - 'Pass auth state through router context' - failure_modes: - - mistake: 'Auth check in component instead of beforeLoad' - mechanism: >- - Component-level auth checks cause protected content to - flash before redirect. beforeLoad runs before any - component rendering and prevents the flash entirely. - wrong_pattern: | - component: () => { - const auth = useAuth() - if (!auth.isAuthenticated) return - return - } - correct_pattern: | - beforeLoad: ({ context }) => { - if (!context.auth.isAuthenticated) { - throw redirect({ to: '/login' }) - } - } - source: 'docs/router/how-to/setup-authentication.md' - priority: HIGH - status: active - - - mistake: 'Not re-throwing redirects in try/catch' - mechanism: >- - redirect() works by throwing. If beforeLoad has a try/catch - for error handling, the redirect gets swallowed unless - re-thrown via isRedirect() check. - wrong_pattern: | - beforeLoad: async ({ context }) => { - try { - await validateSession(context.auth) - } catch (e) { - // swallows redirect! - console.error(e) - } - } - correct_pattern: | - beforeLoad: async ({ context }) => { - try { - await validateSession(context.auth) - } catch (e) { - if (isRedirect(e)) throw e - console.error(e) - } - } - source: 'docs/router/guide/authenticated-routes.md' - priority: HIGH - status: active - - - mistake: 'Trying to conditionally render root route component' - mechanism: >- - Root route is always rendered regardless of auth state. - Use a pathless layout route (_authenticated) with - beforeLoad for conditional rendering. - source: 'docs/router/faq.md' - priority: MEDIUM - status: active - - # ── Rendering and Layout ───────────────────────────────────────── - - name: 'Code Splitting' - slug: 'code-splitting' - domain: 'rendering-and-layout' - description: >- - Split route code into lazy-loaded chunks using automatic - code splitting, .lazy.tsx files, or code-based lazy loading. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-plugin' - covers: - - autoCodeSplitting plugin option - - .lazy.tsx file convention - - createLazyFileRoute - - createLazyRoute - - lazyRouteComponent - - getRouteApi for code-split components - - codeSplitGroupings per-route override - - splitBehavior programmatic config - - Critical vs non-critical route properties - tasks: - - 'Enable automatic code splitting' - - 'Manually split a route with .lazy.tsx' - - 'Access typed hooks from code-split components' - - 'Customize which properties are split per route' - failure_modes: - - mistake: 'Exporting route property functions prevents code splitting' - mechanism: >- - Exported functions from route files are included in the - main bundle even with auto code splitting. Component - functions must NOT be exported. - wrong_pattern: | - export function PostsComponent() { return
Posts
} - correct_pattern: | - function PostsComponent() { return
Posts
} - source: 'docs/router/guide/automatic-code-splitting.md' - priority: HIGH - status: active - - - mistake: 'Trying to code-split the root route' - mechanism: >- - __root.tsx does not support code splitting — it is always - rendered regardless of current route. - source: 'docs/router/guide/code-splitting.md' - priority: MEDIUM - status: active - - - mistake: 'Splitting the loader adds double async cost' - mechanism: >- - Loader is already async. Splitting it requires fetching - the chunk AND then executing the loader, adding latency. - Loaders should stay in the main bundle unless there is - a specific reason to split them. - source: 'docs/router/guide/code-splitting.md' - priority: MEDIUM - status: active - - - mistake: 'Importing Route in code-split files for typed hooks' - mechanism: >- - Importing the Route object in a lazy-loaded file pulls - the route config into the lazy chunk, defeating code - splitting. Use getRouteApi('/path') instead. - wrong_pattern: | - import { Route } from './posts.tsx' - const data = Route.useLoaderData() - correct_pattern: | - import { getRouteApi } from '@tanstack/react-router' - const route = getRouteApi('/posts') - const data = route.useLoaderData() - source: 'docs/router/guide/code-splitting.md' - priority: HIGH - status: active - - - name: 'Not Found and Errors' - slug: 'not-found-and-errors' - domain: 'rendering-and-layout' - description: >- - Handle not-found routes, missing resources, and route-level - errors with notFound(), notFoundComponent, errorComponent, - and CatchBoundary. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - notFound() function - - notFoundComponent - - defaultNotFoundComponent - - notFoundMode (fuzzy / root) - - errorComponent - - onError / onCatch - - CatchBoundary component - - NotFoundRoute (deprecated) - tasks: - - 'Add a 404 page for unmatched routes' - - 'Throw not-found for missing resources in loaders' - - 'Configure error boundaries per route' - - 'Target specific routes with notFound()' - failure_modes: - - mistake: 'Using deprecated NotFoundRoute' - mechanism: >- - NotFoundRoute is deprecated. When present, notFound() and - notFoundComponent will NOT work. Must remove NotFoundRoute - and use notFoundComponent instead. - source: 'docs/router/guide/not-found-errors.md' - priority: HIGH - status: 'fixed-but-legacy-risk' - version_context: 'NotFoundRoute deprecated, will be removed in next major' - - - mistake: 'Expecting useLoaderData to work in notFoundComponent' - mechanism: >- - When notFoundComponent renders, the route's loader may - not have completed. useLoaderData() may return undefined. - Use useParams, useSearch, or useRouteContext instead. - source: 'docs/router/guide/not-found-errors.md' - priority: MEDIUM - status: active - - - mistake: 'Leaf route cannot handle not-found errors' - mechanism: >- - Routes without children never render Outlet and therefore - cannot catch not-found errors. Only routes with children - (or the root route) can have notFoundComponent. - source: 'docs/router/guide/not-found-errors.md' - priority: MEDIUM - status: active - - - name: 'Route Masking' - slug: 'route-masking' - domain: 'rendering-and-layout' - description: >- - Mask the browser URL while navigating to a different internal - route, with configurable unmask behavior. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - mask option on Link / navigate - - createRouteMask - - routeMasks router option - - unmaskOnReload - - location.maskedLocation - - location.state.__tempLocation - tasks: - - 'Show a modal route with a clean URL' - - 'Configure declarative route masks' - - 'Control unmask behavior on page reload' - failure_modes: - - mistake: 'Expecting masked URLs to survive sharing' - mechanism: >- - Masking data is stored in browser history state. When a - URL is shared or opened in a new tab, masking data is - lost and the visible URL is used directly. - source: 'docs/router/guide/route-masking.md' - priority: MEDIUM - status: active - - # ── Type Safety ────────────────────────────────────────────────── - - name: 'Type Safety' - slug: 'type-safety' - domain: 'type-safety' - description: >- - Leverage TanStack Router's fully inferred type system. - Avoid unnecessary type annotations, narrow routes with from, - and optimize TypeScript performance. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - Full type inference philosophy - - Register module declaration - - from narrowing on hooks and Link - - strict false for shared components - - getRouteApi for code-split typed access - - addChildren with object syntax for TS perf - - LinkProps / ValidateLinkOptions type utilities - - as const satisfies pattern - tasks: - - 'Register router types for global type safety' - - 'Narrow route types with from parameter' - - 'Use getRouteApi in code-split components' - - 'Optimize TypeScript performance in large route trees' - - 'Build type-safe link option utilities' - failure_modes: - - mistake: 'Adding type annotations or casts to inferred values' - mechanism: >- - TanStack Router is fully type-safe with full inference. - Adding as Type, generic type parameters, satisfies, or - explicit type annotations is unnecessary and can mask - real type errors or break the inference chain. - wrong_pattern: | - const search = useSearch({ from: '/posts' }) as { page: number } - correct_pattern: | - const search = useSearch({ from: '/posts' }) - // search.page is already typed as number - source: 'maintainer interview' - priority: CRITICAL - status: active - - - mistake: 'Using un-narrowed LinkProps type' - mechanism: >- - LinkProps without generics is an extremely large union type. - Using it as a variable type causes severe TS performance - degradation. Use as const satisfies or narrow with generics. - wrong_pattern: | - const props: LinkProps = { to: '/posts' } - correct_pattern: | - const props = { to: '/posts' } as const satisfies LinkProps - source: 'docs/router/guide/type-safety.md' - priority: HIGH - status: active - - - mistake: 'Not narrowing Link/useNavigate with from' - mechanism: >- - Without from, search resolves to a union of ALL routes - search params. TypeScript check time grows linearly with - route count. Always provide from to narrow. - wrong_pattern: | - - correct_pattern: | - - source: 'docs/router/guide/type-safety.md' - priority: HIGH - status: active - - # ── Server-Side Rendering ──────────────────────────────────────── - - name: 'SSR' - slug: 'ssr' - domain: 'server-side-rendering' - description: >- - Set up server-side rendering with non-streaming or streaming - approaches, manage hydration, and handle document head. - type: core - packages: - - '@tanstack/react-router' - - '@tanstack/router-core' - covers: - - RouterClient / RouterServer - - renderRouterToString / renderRouterToStream - - createRequestHandler - - defaultRenderHandler / defaultStreamHandler - - HeadContent / Scripts components - - head route option (meta, links, styles, scripts) - - ScriptOnce component - - Automatic loader dehydration/hydration - - Memory history on server - - Data serialization (Date, Error, FormData, undefined) - tasks: - - 'Set up non-streaming SSR with Express' - - 'Set up streaming SSR' - - 'Configure document head management' - - 'Handle hydration mismatches' - failure_modes: - - mistake: 'Using browser APIs in loaders without environment check' - mechanism: >- - Loaders run on both client and server when using SSR. - Browser-only APIs (window, document, localStorage) will - throw on the server. - source: 'docs/router/guide/ssr.md' - priority: HIGH - status: active - skills: ['ssr', 'data-loading'] - - - mistake: 'Using hash fragments for server-rendered content' - mechanism: >- - Hash fragments are client-only — browsers never send them - to the server. Using hash for conditional rendering causes - hydration mismatches during SSR. - source: 'docs/router/guide/navigation.md' - priority: MEDIUM - status: active - - - mistake: 'Generating Next.js or Remix SSR patterns' - mechanism: >- - Agents trained on Next.js generate getServerSideProps, - App Router patterns, or server components. Agents trained - on Remix generate server-only loader exports. TanStack - Router has its own SSR API (RouterClient/RouterServer). - source: 'maintainer interview' - priority: CRITICAL - status: active - skills: ['ssr', 'route-setup', 'data-loading'] - - # ── Migration ──────────────────────────────────────────────────── - - name: 'Migrate from React Router' - slug: 'migrate-from-react-router' - domain: 'defining-routes' - description: >- - Step-by-step migration from React Router v7 to TanStack Router, - covering route definitions, navigation, search params, and - data loading. - type: lifecycle - packages: - - '@tanstack/react-router' - - '@tanstack/router-plugin' - covers: - - Migration checklist - - Route definition conversion - - Link / useNavigate API differences - - useSearchParams to validateSearch + useSearch - - useParams with from - - Outlet replacement - - Loader conversion - - Code splitting differences - tasks: - - 'Migrate routes from React Router to TanStack Router' - - 'Convert React Router Links and navigation' - - 'Replace useSearchParams with validated search params' - - 'Convert React Router loaders' - failure_modes: - - mistake: 'Leaving React Router imports alongside TanStack Router' - mechanism: >- - React Router and TanStack Router share similar API names - (Link, useNavigate, Outlet). Leftover React Router imports - cause context errors ("cannot use useNavigate outside of - context"). Uninstall react-router-dom to surface these. - source: 'docs/router/how-to/migrate-from-react-router.md' - priority: HIGH - status: active - - - mistake: 'Using React Router useSearchParams pattern' - mechanism: >- - React Router uses useSearchParams() returning URLSearchParams. - TanStack Router uses validateSearch schema + useSearch() - returning typed objects. Agents may generate the RR pattern. - wrong_pattern: | - const [searchParams, setSearchParams] = useSearchParams() - const page = Number(searchParams.get('page')) - correct_pattern: | - // In route definition: - validateSearch: z.object({ page: fallback(z.number(), 1) }) - // In component: - const { page } = Route.useSearch() - source: 'docs/router/installation/migrate-from-react-router.md' - priority: HIGH - status: active - -tensions: - - name: 'Type safety strictness vs rapid prototyping' - skills: ['type-safety', 'route-setup'] - description: >- - Full type inference requires proper setup (Register, correct - property order, getParentRoute). This upfront cost conflicts - with quick prototyping where developers want to skip setup. - implication: >- - Agents skip Register declaration or use type casts to silence - errors, producing code that compiles but has no type safety. - - - name: 'Client-first loaders vs SSR expectations' - skills: ['data-loading', 'ssr'] - description: >- - Loaders are client-first by design but agents assume they are - server-only (Remix/Next mental model). This tension means - browser APIs work in loaders by default but break under SSR. - implication: >- - Agents either put server-only code in client loaders or avoid - browser APIs unnecessarily, depending on which framework mental - model they default to. - - - name: 'Built-in SWR cache vs external cache coordination' - skills: ['data-loading', 'external-data-loading'] - description: >- - Router has built-in caching with staleTime/gcTime defaults. - When using an external cache like React Query, the built-in - cache must be bypassed (defaultPreloadStaleTime: 0) or it - conflicts with the external library's freshness management. - implication: >- - Agents use both caches simultaneously without disabling the - built-in one, causing stale data or double-fetching. - - - name: 'Code splitting granularity vs loader performance' - skills: ['code-splitting', 'data-loading'] - description: >- - Splitting more aggressively reduces initial bundle but splitting - the loader adds a network round-trip before data can be fetched. - The optimal split point differs per route. - implication: >- - Agents split everything including loaders, adding latency to - data loading without understanding the tradeoff. - -cross_references: - - from: 'route-setup' - to: 'type-safety' - reason: 'Register declaration and property order are prerequisites for type inference' - - from: 'navigation' - to: 'search-params' - reason: 'Link search prop and navigate search option directly interact with search param validation' - - from: 'data-loading' - to: 'search-params' - reason: 'loaderDeps consumes validated search params as cache keys' - - from: 'data-loading' - to: 'external-data-loading' - reason: 'Understanding built-in caching is prerequisite for coordinating with external caches' - - from: 'auth-and-guards' - to: 'data-loading' - reason: 'beforeLoad runs before loader — auth context flows into loader via route context' - - from: 'code-splitting' - to: 'data-loading' - reason: 'Loader splitting decisions affect data loading performance' - - from: 'ssr' - to: 'data-loading' - reason: 'SSR changes where loaders execute — must handle both environments' - - from: 'ssr' - to: 'external-data-loading' - reason: 'SSR dehydration/hydration requires special setup for Query integration' - - from: 'not-found-and-errors' - to: 'data-loading' - reason: 'notFound() thrown in loaders interacts with error boundaries and loader data availability' - - from: 'migrate-from-react-router' - to: 'route-setup' - reason: 'Migration requires understanding TanStack Router route setup to replace RR patterns' - -gaps: [] diff --git a/_artifacts/skill_spec.md b/_artifacts/skill_spec.md deleted file mode 100644 index 7eb9554a42..0000000000 --- a/_artifacts/skill_spec.md +++ /dev/null @@ -1,193 +0,0 @@ -# TanStack Router — Skill Spec - -TanStack Router is a type-safe router for React and Solid applications with built-in SWR caching, JSON-first search params, file-based route generation, and end-to-end type inference. It is client-first/isomorphic — loaders run on the client by default and additionally on the server when used with TanStack Start. - -## Domains - -| Domain | Description | Skills | -| --------------------- | ------------------------------------------------------------------- | --------------------------------------------------- | -| Defining Routes | Setting up route trees, configuring the router, registering types | route-setup, migrate-from-react-router | -| Navigating | Links, imperative navigation, preloading, blocking | navigation | -| Managing URL State | Search params and path params with validation and serialization | search-params, path-params | -| Loading Data | Route loaders, SWR caching, external cache coordination, context/DI | data-loading, external-data-loading | -| Protecting Routes | Auth guards, RBAC, beforeLoad redirects | auth-and-guards | -| Rendering and Layout | Code splitting, error/not-found handling, route masking | code-splitting, not-found-and-errors, route-masking | -| Type Safety | Inference patterns, narrowing, TS performance | type-safety | -| Server-Side Rendering | SSR setup, hydration, head management | ssr | - -## Skill Inventory - -| Skill | Type | Domain | What it covers | Failure modes | -| ------------------------- | ----------- | --------------------- | ------------------------------------------------------------------------------------ | ------------- | -| route-setup | core | defining-routes | createRouter, file/code/virtual routing, Register, plugin config, ESLint | 5 | -| navigation | core | navigating | Link, useNavigate, Navigate, preloading, blocking, active states, scroll restoration | 4 | -| search-params | core | managing-url-state | validateSearch, useSearch, middlewares, serialization, adapters | 4 | -| path-params | core | managing-url-state | $params, splats, optional params, prefix/suffix patterns | 3 | -| data-loading | core | loading-data | loader, loaderDeps, staleTime/gcTime, pending/error, context/DI, deferred | 5 | -| external-data-loading | composition | loading-data | TanStack Query integration, SSR dehydration/hydration, streaming | 3 | -| auth-and-guards | core | protecting-routes | beforeLoad redirects, layout auth, RBAC, provider integration | 3 | -| code-splitting | core | rendering-and-layout | autoCodeSplitting, .lazy.tsx, getRouteApi, split groupings | 4 | -| not-found-and-errors | core | rendering-and-layout | notFound(), notFoundComponent, errorComponent, CatchBoundary | 3 | -| route-masking | core | rendering-and-layout | mask option, createRouteMask, unmaskOnReload | 1 | -| type-safety | core | type-safety | Register, from narrowing, TS perf, type utilities | 3 | -| ssr | core | server-side-rendering | RouterClient/Server, streaming, hydration, head management | 3 | -| migrate-from-react-router | lifecycle | defining-routes | Migration checklist, API mapping, search params conversion | 2 | - -## Failure Mode Inventory - -### route-setup (5 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ------------------------------------------------------ | -------- | --------------------------------------- | ------------ | -| 1 | Missing router type registration | CRITICAL | docs/guide/creating-a-router | type-safety | -| 2 | Not committing routeTree.gen.ts | HIGH | docs/faq | — | -| 3 | Wrong route property order breaks type inference | HIGH | docs/eslint/create-route-property-order | — | -| 4 | Placing TanStackRouter plugin after framework plugin | HIGH | docs/installation/with-vite | — | -| 5 | Using getParentRoute incorrectly in code-based routing | HIGH | docs/decisions-on-dx | — | - -### navigation (4 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | -------------------------------------------------------- | -------- | --------------------------------------- | ------------- | -| 1 | Interpolating params into the to string | CRITICAL | docs/guide/navigation | type-safety | -| 2 | Using useNavigate instead of Link for clickable elements | MEDIUM | docs/guide/navigation | — | -| 3 | Not providing from for relative navigation | HIGH | docs/guide/navigation | — | -| 4 | Using search as object instead of function loses params | HIGH | docs/how-to/navigate-with-search-params | search-params | - -### search-params (4 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ------------------------------------------------------ | -------- | -------------------------------- | ------------ | -| 1 | Using zod .catch() instead of adapter fallback() | HIGH | docs/guide/search-params | — | -| 2 | Returning entire search object from loaderDeps | HIGH | docs/guide/data-loading | data-loading | -| 3 | Passing Date objects in search params | HIGH | docs/how-to/arrays-objects-dates | — | -| 4 | Parent route missing validateSearch blocks inheritance | MEDIUM | docs/how-to/share-search-params | — | - -### path-params (3 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | --------------------------------------------- | -------- | ----------------------------- | ------------ | -| 1 | Interpolating path params into `to` string | CRITICAL | docs/guide/navigation | navigation | -| 2 | Using \* for splat routes instead of $ | MEDIUM | docs/routing/routing-concepts | — | -| 3 | Using curly braces for basic dynamic segments | MEDIUM | docs/guide/path-params | — | - -### data-loading (5 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ---------------------------------------------------------------- | -------- | ------------------------- | ------------ | -| 1 | Assuming loaders only run on the server | CRITICAL | maintainer interview | ssr | -| 2 | Not understanding staleTime default is 0 | MEDIUM | docs/guide/data-loading | — | -| 3 | Using reset() instead of router.invalidate() in error components | HIGH | docs/guide/data-loading | — | -| 4 | Double parentheses missing on createRootRouteWithContext | HIGH | docs/guide/data-loading | — | -| 5 | Using React hooks in beforeLoad or loader | HIGH | docs/guide/router-context | — | - -### external-data-loading (3 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ----------------------------------------------------------- | -------- | -------------------------------- | ------------ | -| 1 | Not setting defaultPreloadStaleTime to 0 | HIGH | docs/guide/external-data-loading | — | -| 2 | Creating QueryClient outside createRouter for SSR | HIGH | docs/guide/external-data-loading | — | -| 3 | Awaiting a fire-and-forget query in loader blocks rendering | MEDIUM | docs/integrations/query | — | - -### auth-and-guards (3 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | --------------------------------------------------- | -------- | -------------------------------- | ------------ | -| 1 | Auth check in component instead of beforeLoad | HIGH | docs/how-to/setup-authentication | — | -| 2 | Not re-throwing redirects in try/catch | HIGH | docs/guide/authenticated-routes | — | -| 3 | Trying to conditionally render root route component | MEDIUM | docs/faq | — | - -### code-splitting (4 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ---------------------------------------------------------- | -------- | ----------------------------------- | ------------ | -| 1 | Exporting route property functions prevents code splitting | HIGH | docs/guide/automatic-code-splitting | — | -| 2 | Trying to code-split the root route | MEDIUM | docs/guide/code-splitting | — | -| 3 | Splitting the loader adds double async cost | MEDIUM | docs/guide/code-splitting | — | -| 4 | Importing Route in code-split files for typed hooks | HIGH | docs/guide/code-splitting | — | - -### not-found-and-errors (3 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ---------------------------------------------------- | -------- | --------------------------- | ------------ | -| 1 | Using deprecated NotFoundRoute | HIGH | docs/guide/not-found-errors | — | -| 2 | Expecting useLoaderData to work in notFoundComponent | MEDIUM | docs/guide/not-found-errors | — | -| 3 | Leaf route cannot handle not-found errors | MEDIUM | docs/guide/not-found-errors | — | - -### route-masking (1 failure mode) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ---------------------------------------- | -------- | ------------------------ | ------------ | -| 1 | Expecting masked URLs to survive sharing | MEDIUM | docs/guide/route-masking | — | - -### type-safety (3 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | --------------------------------------------------- | -------- | ---------------------- | ------------ | -| 1 | Adding type annotations or casts to inferred values | CRITICAL | maintainer interview | — | -| 2 | Using un-narrowed LinkProps type | HIGH | docs/guide/type-safety | — | -| 3 | Not narrowing Link/useNavigate with from | HIGH | docs/guide/type-safety | — | - -### ssr (3 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ------------------------------------------------------- | -------- | --------------------- | ------------------------- | -| 1 | Using browser APIs in loaders without environment check | HIGH | docs/guide/ssr | data-loading | -| 2 | Using hash fragments for server-rendered content | MEDIUM | docs/guide/navigation | — | -| 3 | Generating Next.js or Remix SSR patterns | CRITICAL | maintainer interview | route-setup, data-loading | - -### migrate-from-react-router (2 failure modes) - -| # | Mistake | Priority | Source | Cross-skill? | -| --- | ------------------------------------------------------ | -------- | ------------------------------------------- | ------------ | -| 1 | Leaving React Router imports alongside TanStack Router | HIGH | docs/how-to/migrate-from-react-router | — | -| 2 | Using React Router useSearchParams pattern | HIGH | docs/installation/migrate-from-react-router | — | - -## Tensions - -| Tension | Skills | Agent implication | -| ------------------------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------- | -| Type safety strictness vs rapid prototyping | type-safety ↔ route-setup | Agents skip Register declaration or use type casts to silence errors | -| Client-first loaders vs SSR expectations | data-loading ↔ ssr | Agents put server-only code in client loaders or avoid browser APIs unnecessarily | -| Built-in SWR cache vs external cache coordination | data-loading ↔ external-data-loading | Agents use both caches simultaneously causing stale data or double-fetching | -| Code splitting granularity vs loader performance | code-splitting ↔ data-loading | Agents split everything including loaders, adding latency | - -## Cross-References - -| From | To | Reason | -| ------------------------- | --------------------- | ---------------------------------------------------------------------------------- | -| route-setup | type-safety | Register declaration and property order are prerequisites for type inference | -| navigation | search-params | Link search prop directly interacts with search param validation | -| data-loading | search-params | loaderDeps consumes validated search params as cache keys | -| data-loading | external-data-loading | Understanding built-in caching is prerequisite for external cache coordination | -| auth-and-guards | data-loading | beforeLoad runs before loader — auth context flows into loader via route context | -| code-splitting | data-loading | Loader splitting decisions affect data loading performance | -| ssr | data-loading | SSR changes where loaders execute — must handle both environments | -| ssr | external-data-loading | SSR dehydration/hydration requires special Query setup | -| not-found-and-errors | data-loading | notFound() in loaders interacts with error boundaries and loader data availability | -| migrate-from-react-router | route-setup | Migration requires understanding TanStack Router route setup | - -## Subsystems & Reference Candidates - -| Skill | Subsystems | Reference candidates | -| ------------- | --------------------------------------------- | -------------------------------------------------------- | -| route-setup | — | file naming conventions (>10 distinct conventions) | -| search-params | Zod adapter, Valibot adapter, ArkType adapter | search param validation patterns (>10 distinct patterns) | -| All others | — | — | - -## Recommended Skill File Structure - -- **Core skills:** route-setup, navigation, search-params, path-params, data-loading, code-splitting, not-found-and-errors, route-masking, type-safety, ssr, auth-and-guards -- **Framework skills:** None needed separately — React and Solid share the same core API surface. Framework-specific notes belong inline. -- **Lifecycle skills:** migrate-from-react-router -- **Composition skills:** external-data-loading (TanStack Query) -- **Reference files:** search-params (validation patterns), route-setup (file naming conventions) - -## Composition Opportunities - -| Library | Integration points | Composition skill needed? | -| --------------------- | --------------------------------------------------------- | ------------------------------------------ | -| @tanstack/react-query | Loader coordination, SSR dehydration/hydration, streaming | Yes — external-data-loading | -| Zod | Search param validation | No — covered as subsystem in search-params | -| Valibot | Search param validation | No — covered as subsystem in search-params | -| ArkType | Search param validation | No — covered as subsystem in search-params | diff --git a/_artifacts/skill_tree.yaml b/_artifacts/skill_tree.yaml deleted file mode 100644 index 6f7c4c8742..0000000000 --- a/_artifacts/skill_tree.yaml +++ /dev/null @@ -1,278 +0,0 @@ -# skills/_artifacts/skill_tree.yaml -library: - name: '@tanstack/router' - version: '1.166.2' - repository: 'https://github.com/TanStack/router' - description: >- - Type-safe router for React and Solid with built-in SWR caching, - JSON-first search params, and end-to-end type inference. -generated_from: - domain_map: '_artifacts/domain_map.yaml' - skill_spec: '_artifacts/skill_spec.md' -generated_at: '2026-03-07' - -skills: - # ── Router Core Skills ─────────────────────────────────────────── - - name: 'Router Core' - slug: 'router-core' - type: 'core' - domain: 'defining-routes' - path: 'skills/router-core/SKILL.md' - package: 'packages/router-core' - description: >- - Framework-agnostic core concepts for TanStack Router: route trees, - createRouter, createRoute, createRootRoute, createRootRouteWithContext, - addChildren, Register type declaration, route matching, route sorting, - file naming conventions. Entry point for all router skills. - sources: - - 'TanStack/router:docs/router/overview.md' - - 'TanStack/router:docs/router/routing/routing-concepts.md' - - 'TanStack/router:docs/router/routing/route-trees.md' - - 'TanStack/router:docs/router/routing/route-matching.md' - - 'TanStack/router:docs/router/guide/creating-a-router.md' - - 'TanStack/router:docs/router/decisions-on-dx.md' - - 'TanStack/router:packages/router-core/src' - - - name: 'Search Params' - slug: 'router-core/search-params' - type: 'sub-skill' - domain: 'managing-url-state' - path: 'skills/router-core/search-params/SKILL.md' - package: 'packages/router-core' - description: >- - validateSearch, search param validation with Zod/Valibot/ArkType adapters, - fallback(), search middlewares (retainSearchParams, stripSearchParams), - custom serialization (parseSearch, stringifySearch), search param - inheritance, loaderDeps for cache keys, reading and writing search params. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/search-params.md' - - 'TanStack/router:docs/router/how-to/setup-basic-search-params.md' - - 'TanStack/router:docs/router/how-to/validate-search-params.md' - - 'TanStack/router:docs/router/how-to/navigate-with-search-params.md' - - 'TanStack/router:docs/router/how-to/share-search-params-across-routes.md' - - 'TanStack/router:docs/router/how-to/arrays-objects-dates-search-params.md' - - 'TanStack/router:docs/router/guide/custom-search-param-serialization.md' - subsystems: - - 'Zod adapter' - - 'Valibot adapter' - - 'ArkType adapter' - references: - - 'references/validation-patterns.md' - - - name: 'Path Params' - slug: 'router-core/path-params' - type: 'sub-skill' - domain: 'managing-url-state' - path: 'skills/router-core/path-params/SKILL.md' - package: 'packages/router-core' - description: >- - Dynamic path segments ($paramName), splat routes ($ / _splat), - optional params ({-$paramName}), prefix/suffix patterns ({$param}.ext), - useParams, params.parse/stringify, pathParamsAllowedCharacters, - i18n locale patterns. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/path-params.md' - - 'TanStack/router:docs/router/guide/internationalization-i18n.md' - - 'TanStack/router:docs/router/routing/routing-concepts.md' - - - name: 'Navigation' - slug: 'router-core/navigation' - type: 'sub-skill' - domain: 'navigating' - path: 'skills/router-core/navigation/SKILL.md' - package: 'packages/router-core' - description: >- - Link component, useNavigate, Navigate component, router.navigate, - ToOptions/NavigateOptions/LinkOptions, from/to relative navigation, - activeOptions/activeProps, preloading (intent/viewport/render), - preloadDelay, navigation blocking (useBlocker, Block), createLink, - linkOptions helper, scroll restoration, MatchRoute. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/navigation.md' - - 'TanStack/router:docs/router/guide/preloading.md' - - 'TanStack/router:docs/router/guide/navigation-blocking.md' - - 'TanStack/router:docs/router/guide/link-options.md' - - 'TanStack/router:docs/router/guide/custom-link.md' - - 'TanStack/router:docs/router/guide/scroll-restoration.md' - - - name: 'Data Loading' - slug: 'router-core/data-loading' - type: 'sub-skill' - domain: 'loading-data' - path: 'skills/router-core/data-loading/SKILL.md' - package: 'packages/router-core' - description: >- - Route loader option, loaderDeps for cache keys, staleTime/gcTime/ - defaultPreloadStaleTime SWR caching, pendingComponent/pendingMs/ - pendingMinMs, errorComponent/onError/onCatch, beforeLoad, router - context and createRootRouteWithContext DI pattern, router.invalidate, - Await component, deferred data loading with unawaited promises. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/data-loading.md' - - 'TanStack/router:docs/router/guide/deferred-data-loading.md' - - 'TanStack/router:docs/router/guide/router-context.md' - - 'TanStack/router:docs/router/guide/data-mutations.md' - - - name: 'Auth and Guards' - slug: 'router-core/auth-and-guards' - type: 'sub-skill' - domain: 'protecting-routes' - path: 'skills/router-core/auth-and-guards/SKILL.md' - package: 'packages/router-core' - description: >- - Route protection with beforeLoad, redirect()/throw redirect(), - isRedirect helper, authenticated layout routes (_authenticated), - non-redirect auth (inline login), RBAC with roles and permissions, - auth provider integration (Auth0, Clerk, Supabase), router context - for auth state. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/authenticated-routes.md' - - 'TanStack/router:docs/router/how-to/setup-authentication.md' - - 'TanStack/router:docs/router/how-to/setup-auth-providers.md' - - 'TanStack/router:docs/router/how-to/setup-rbac.md' - - - name: 'Code Splitting' - slug: 'router-core/code-splitting' - type: 'sub-skill' - domain: 'rendering-and-layout' - path: 'skills/router-core/code-splitting/SKILL.md' - package: 'packages/router-core' - description: >- - Automatic code splitting (autoCodeSplitting), .lazy.tsx convention, - createLazyFileRoute, createLazyRoute, lazyRouteComponent, getRouteApi - for typed hooks in split files, codeSplitGroupings per-route override, - splitBehavior programmatic config, critical vs non-critical properties. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/code-splitting.md' - - 'TanStack/router:docs/router/guide/automatic-code-splitting.md' - - - name: 'Not Found and Errors' - slug: 'router-core/not-found-and-errors' - type: 'sub-skill' - domain: 'rendering-and-layout' - path: 'skills/router-core/not-found-and-errors/SKILL.md' - package: 'packages/router-core' - description: >- - notFound() function, notFoundComponent, defaultNotFoundComponent, - notFoundMode (fuzzy/root), errorComponent, onError/onCatch, - CatchBoundary, NotFoundRoute (deprecated), route masking (mask - option, createRouteMask, unmaskOnReload). - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/not-found-errors.md' - - 'TanStack/router:docs/router/guide/route-masking.md' - - - name: 'Type Safety' - slug: 'router-core/type-safety' - type: 'sub-skill' - domain: 'type-safety' - path: 'skills/router-core/type-safety/SKILL.md' - package: 'packages/router-core' - description: >- - Full type inference philosophy (never cast, never annotate inferred - values), Register module declaration, from narrowing on hooks and - Link, strict:false for shared components, getRouteApi for code-split - typed access, addChildren with object syntax for TS perf, LinkProps - and ValidateLinkOptions type utilities, as const satisfies pattern. - requires: - - 'router-core' - sources: - - 'TanStack/router:docs/router/guide/type-safety.md' - - 'TanStack/router:docs/router/guide/type-utilities.md' - - 'TanStack/router:docs/router/guide/render-optimizations.md' - - - name: 'SSR' - slug: 'router-core/ssr' - type: 'sub-skill' - domain: 'server-side-rendering' - path: 'skills/router-core/ssr/SKILL.md' - package: 'packages/router-core' - description: >- - Non-streaming and streaming SSR, RouterClient/RouterServer, - renderRouterToString/renderRouterToStream, createRequestHandler, - defaultRenderHandler/defaultStreamHandler, HeadContent/Scripts - components, head route option (meta/links/styles/scripts), - ScriptOnce, automatic loader dehydration/hydration, memory - history on server, data serialization, document head management. - requires: - - 'router-core' - - 'router-core/data-loading' - sources: - - 'TanStack/router:docs/router/guide/ssr.md' - - 'TanStack/router:docs/router/guide/document-head-management.md' - - 'TanStack/router:docs/router/how-to/setup-ssr.md' - - # ── React Router Skills ────────────────────────────────────────── - - name: 'React Router' - slug: 'react-router' - type: 'framework' - domain: 'defining-routes' - path: 'skills/react-router/SKILL.md' - package: 'packages/react-router' - description: >- - React bindings for TanStack Router: RouterProvider, useRouter, - useRouterState, useMatch, useMatches, useLocation, useSearch, - useParams, useNavigate, useLoaderData, useLoaderDeps, - useRouteContext, useBlocker, useCanGoBack, Link, Navigate, - Outlet, CatchBoundary, ErrorComponent. React-specific patterns - for hooks, providers, SSR hydration, and createLink with - forwardRef. - requires: - - 'router-core' - sources: - - 'TanStack/router:packages/react-router/src' - - 'TanStack/router:docs/router/guide/creating-a-router.md' - - 'TanStack/router:docs/router/installation/manual.md' - - # ── Composition Skills ─────────────────────────────────────────── - - name: 'External Data Loading (TanStack Query)' - slug: 'compositions/router-query' - type: 'composition' - domain: 'loading-data' - path: 'skills/compositions/router-query/SKILL.md' - package: 'packages/react-router' - description: >- - Integrating TanStack Router with TanStack Query: queryClient - in router context, static queries and fire-and-forget queries in loaders, - useSuspenseQuery in components, defaultPreloadStaleTime: 0, - setupRouterSsrQueryIntegration for SSR dehydration/hydration - and streaming, per-request QueryClient isolation. - requires: - - 'router-core' - - 'router-core/data-loading' - - 'react-router' - sources: - - 'TanStack/router:docs/router/guide/external-data-loading.md' - - 'TanStack/router:docs/router/integrations/query.md' - - # ── Lifecycle Skills ───────────────────────────────────────────── - - name: 'Migrate from React Router' - slug: 'lifecycle/migrate-from-react-router' - type: 'lifecycle' - domain: 'defining-routes' - path: 'skills/lifecycle/migrate-from-react-router/SKILL.md' - package: 'packages/react-router' - description: >- - Step-by-step migration from React Router v7 to TanStack Router: - route definition conversion, Link/useNavigate API differences, - useSearchParams to validateSearch + useSearch, useParams with from, - Outlet replacement, loader conversion, code splitting differences. - requires: - - 'router-core' - - 'react-router' - sources: - - 'TanStack/router:docs/router/how-to/migrate-from-react-router.md' - - 'TanStack/router:docs/router/installation/migrate-from-react-router.md' diff --git a/_artifacts/start_domain_map.yaml b/_artifacts/start_domain_map.yaml deleted file mode 100644 index a557901075..0000000000 --- a/_artifacts/start_domain_map.yaml +++ /dev/null @@ -1,482 +0,0 @@ -# domain_map.yaml -# Generated by skill-domain-discovery -# Library: TanStack Start -# Version: 1.166.2 -# Date: 2026-03-07 -# Status: reviewed - -library: - name: '@tanstack/react-start' - version: '1.166.2' - repository: 'https://github.com/TanStack/router' - description: >- - Full-stack React framework built on TanStack Router and Vite. Adds - SSR, streaming, server functions (type-safe RPCs), middleware, - server routes, and universal deployment. Isomorphic by default — - all code runs in both environments unless explicitly constrained. - primary_framework: 'React' - -domains: - - name: 'Project Setup' - slug: 'project-setup' - description: >- - Scaffolding a Start project, configuring Vite plugin, router - setup with getRouter(), root route with document shell, client - and server entry points. - - - name: 'Server Functions' - slug: 'server-functions' - description: >- - Creating type-safe RPCs with createServerFn, input validation, - calling from loaders/components/other server functions, error - handling, streaming responses. - - - name: 'Middleware and Context' - slug: 'middleware-and-context' - description: >- - Request middleware, server function middleware, context passing - with sendContext, global middleware via createStart, middleware - factories, fetch override precedence. - - - name: 'Execution Model' - slug: 'execution-model' - description: >- - Isomorphic code execution, environment functions - (createServerFn, createServerOnlyFn, createClientOnlyFn, - createIsomorphicFn), import protection, dead code elimination, - environment variable safety. - - - name: 'Server Routes' - slug: 'server-routes' - description: >- - Server-side API endpoints defined in routes, HTTP method - handlers, handler middleware, request/response patterns. - - - name: 'Deployment and Rendering' - slug: 'deployment-and-rendering' - description: >- - Hosting providers (Cloudflare, Netlify, Vercel, Node/Docker), - selective SSR, SPA mode, static prerendering, ISR with - Cache-Control headers, SEO and head management. - -skills: - # ── Project Setup ──────────────────────────────────────────────── - - name: 'Start Setup' - slug: 'start-setup' - domain: 'project-setup' - description: >- - Scaffold a TanStack Start project, configure Vite plugin with - tanstackStart(), set up router with getRouter(), create root - route with document shell (HeadContent, Scripts, Outlet), - configure client and server entry points. - type: core - packages: - - '@tanstack/react-start' - - '@tanstack/start-plugin-core' - covers: - - tanstackStart Vite plugin - - getRouter() factory pattern - - Root route document shell - - HeadContent / Scripts / Outlet - - Client entry point (optional) - - Server entry point (optional) - - routeTree.gen.ts - - tsconfig configuration - tasks: - - 'Scaffold a new TanStack Start project' - - 'Configure the Vite plugin' - - 'Set up the router factory' - - 'Customize client/server entry points' - failure_modes: - - mistake: 'React plugin before Start plugin in Vite config' - mechanism: >- - Start's Vite plugin must come before React's plugin. - Wrong order causes route generation and server function - compilation to fail. - wrong_pattern: | - plugins: [react(), tanstackStart()] - correct_pattern: | - plugins: [tanstackStart(), react()] - source: 'docs/start/framework/react/build-from-scratch.md' - priority: CRITICAL - status: active - - - mistake: 'Enabling verbatimModuleSyntax in tsconfig' - mechanism: >- - verbatimModuleSyntax causes server bundles to leak into - client bundles. Must be disabled. - source: 'docs/start/framework/react/build-from-scratch.md' - priority: HIGH - status: active - - - mistake: 'Missing Scripts component in root route' - mechanism: >- - The Scripts component must be rendered in the body of - the root route for proper hydration and functionality. - Without it, client-side JavaScript does not load. - source: 'docs/start/framework/react/guide/routing.md' - priority: HIGH - status: active - - # ── Server Functions ───────────────────────────────────────────── - - name: 'Server Functions' - slug: 'server-functions' - domain: 'server-functions' - description: >- - Create type-safe RPCs with createServerFn, validate inputs - with Zod or plain functions, call from loaders/components/ - event handlers, handle errors/redirects/notFound, stream - responses with ReadableStream or async generators. - type: core - packages: - - '@tanstack/react-start' - - '@tanstack/start-client-core' - - '@tanstack/start-server-core' - covers: - - createServerFn (GET/POST) - - validator (Zod or function) - - useServerFn hook - - Server context utilities (getRequest, getRequestHeader, setResponseHeader, setResponseStatus) - - Error handling (throw errors, redirect, notFound) - - Streaming (ReadableStream, async generators) - - File organization (.functions.ts, .server.ts) - - FormData handling - tasks: - - 'Create a server function for data fetching' - - 'Validate server function inputs' - - 'Call server functions from components' - - 'Stream data from server functions' - - 'Handle errors in server functions' - failure_modes: - - mistake: 'Putting server-only code in loaders instead of server functions' - mechanism: >- - Loaders are ISOMORPHIC — they run on both client and server. - Database queries, file system access, and secret API keys - in loaders will either fail on the client or leak to the - client bundle. Use createServerFn for server-only logic. - wrong_pattern: | - export const Route = createFileRoute('/posts')({ - loader: async () => { - const posts = await db.query('SELECT * FROM posts') - return { posts } - }, - }) - correct_pattern: | - const getPosts = createServerFn({ method: 'GET' }) - .handler(async () => { - const posts = await db.query('SELECT * FROM posts') - return { posts } - }) - - export const Route = createFileRoute('/posts')({ - loader: () => getPosts(), - }) - source: 'maintainer interview' - priority: CRITICAL - status: active - skills: ['server-functions', 'execution-model'] - - - mistake: 'Using dynamic imports for server functions' - mechanism: >- - Dynamic imports of server functions can cause bundler - issues. Static imports are safe — the build process - replaces server implementations with RPC stubs. - wrong_pattern: | - const { getUser } = await import('~/utils/users.functions') - correct_pattern: | - import { getUser } from '~/utils/users.functions' - source: 'docs/start/framework/react/guide/server-functions.md' - priority: HIGH - status: active - - - mistake: 'Generating Next.js or Remix server patterns' - mechanism: >- - Agents generate getServerSideProps, "use server" directives, - or Remix-style loader exports. TanStack Start uses - createServerFn for server-only code. - wrong_pattern: | - 'use server' - export async function getUser() { ... } - correct_pattern: | - const getUser = createServerFn({ method: 'GET' }) - .handler(async () => { ... }) - source: 'maintainer interview' - priority: CRITICAL - status: active - - # ── Middleware and Context ─────────────────────────────────────── - - name: 'Middleware' - slug: 'middleware' - domain: 'middleware-and-context' - description: >- - Request middleware and server function middleware with - createMiddleware, context passing via next(), sendContext - for client-server transfer, global middleware via createStart - in src/start.ts, middleware factories, fetch override - precedence, header merging. - type: core - packages: - - '@tanstack/react-start' - - '@tanstack/start-client-core' - - '@tanstack/start-server-core' - covers: - - createMiddleware - - Request middleware (.server only) - - Server function middleware (.client + .server) - - Context passing via next({ context }) - - sendContext for client-server transfer - - Global middleware (createStart in src/start.ts) - - Middleware factories - - Fetch override precedence - - Header merging - - Method order enforcement (middleware → validator → client → server) - tasks: - - 'Add authentication middleware' - - 'Pass context through middleware chain' - - 'Configure global request middleware' - - 'Create reusable middleware factories' - failure_modes: - - mistake: 'Trusting client context without server validation' - mechanism: >- - Client context via sendContext is NOT validated by default. - Dynamic user-generated data must be validated in server-side - middleware before use. - source: 'docs/start/framework/react/guide/middleware.md' - priority: HIGH - status: active - - - mistake: 'Wrong middleware method order' - mechanism: >- - TypeScript enforces method order: middleware → validator - → client → server. Wrong order causes type errors and - runtime failures. - source: 'docs/start/framework/react/guide/middleware.md' - priority: MEDIUM - status: active - - - mistake: 'Confusing request vs server function middleware' - mechanism: >- - Request middleware runs on ALL server requests (SSR, server - routes, server functions). Server function middleware runs - only for server functions and has .client() method. Using - the wrong type causes unexpected scope. - source: 'docs/start/framework/react/guide/middleware.md' - priority: MEDIUM - status: active - - # ── Execution Model ────────────────────────────────────────────── - - name: 'Execution Model' - slug: 'execution-model' - domain: 'execution-model' - description: >- - Isomorphic code execution model, environment boundary functions - (createServerFn, createServerOnlyFn, createClientOnlyFn, - createIsomorphicFn), import protection, dead code elimination, - environment variable safety (VITE_ prefix), useHydrated hook. - type: core - packages: - - '@tanstack/react-start' - - '@tanstack/start-client-core' - - '@tanstack/start-server-core' - covers: - - Isomorphic-by-default principle - - createServerFn (RPC boundary) - - createServerOnlyFn (throws on client) - - createClientOnlyFn (throws on server) - - createIsomorphicFn (different impl per env) - - ClientOnly component - - useHydrated hook - - Import protection (experimental) - - Environment variables (VITE_ prefix, process.env) - - Dead code elimination / tree shaking - tasks: - - 'Protect server-only code from client bundles' - - 'Use environment-specific implementations' - - 'Handle environment variables safely' - - 'Debug import protection violations' - failure_modes: - - mistake: 'Assuming loaders are server-only' - mechanism: >- - ALL code in TanStack Start is isomorphic by default. - Loaders run on BOTH server and client. Server-only - operations must use createServerFn, createServerOnlyFn, - or server routes. - wrong_pattern: | - export const Route = createFileRoute('/dashboard')({ - loader: async () => { - const secret = process.env.API_SECRET - return fetch(`https://api.example.com/data`, { - headers: { Authorization: secret } - }) - }, - }) - correct_pattern: | - const getData = createServerFn({ method: 'GET' }) - .handler(async () => { - const secret = process.env.API_SECRET - return fetch(`https://api.example.com/data`, { - headers: { Authorization: secret } - }) - }) - - export const Route = createFileRoute('/dashboard')({ - loader: () => getData(), - }) - source: 'docs/start/framework/react/guide/execution-model.md' - priority: CRITICAL - status: active - skills: ['execution-model', 'server-functions'] - - - mistake: 'Exposing secrets via module-level process.env' - mechanism: >- - Module-level process.env access runs in both environments. - The variable value leaks into the client bundle. Access - secrets only inside createServerFn or createServerOnlyFn. - wrong_pattern: | - const apiKey = process.env.SECRET_KEY - export function fetchData() { ... } - correct_pattern: | - const fetchData = createServerFn({ method: 'GET' }) - .handler(async () => { - const apiKey = process.env.SECRET_KEY - return fetch(url, { headers: { Authorization: apiKey } }) - }) - source: 'docs/start/framework/react/guide/execution-model.md' - priority: CRITICAL - status: active - - - mistake: 'Using VITE_ prefix for server secrets' - mechanism: >- - VITE_ prefixed variables are exposed to the client bundle. - Server secrets must NOT have the VITE_ prefix. Access - them via process.env inside server functions only. - source: 'docs/start/framework/react/guide/environment-variables.md' - priority: CRITICAL - status: active - - # ── Server Routes ──────────────────────────────────────────────── - - name: 'Server Routes' - slug: 'server-routes' - domain: 'server-routes' - description: >- - Define server-side API endpoints alongside app routes using - the server property with HTTP method handlers, per-handler - middleware via createHandlers, request/response patterns. - type: core - packages: - - '@tanstack/react-start' - - '@tanstack/start-server-core' - covers: - - server property on createFileRoute - - handlers object (GET, POST, PUT, DELETE) - - createHandlers for per-handler middleware - - Handler context (request, params, context) - - Request body parsing (json, text, formData) - - Response helpers (Response.json) - - File naming for API routes - tasks: - - 'Create a REST API endpoint' - - 'Add middleware to server route handlers' - - 'Handle different HTTP methods' - failure_modes: - - mistake: 'Duplicate path resolution for server routes' - mechanism: >- - Each route can only have a single handler file. Having - both users.ts and users/index.ts causes errors. - source: 'docs/start/framework/react/guide/server-routes.md' - priority: MEDIUM - status: active - - # ── Deployment and Rendering ───────────────────────────────────── - - name: 'Deployment' - slug: 'deployment' - domain: 'deployment-and-rendering' - description: >- - Deploy TanStack Start to Cloudflare Workers, Netlify, Vercel, - Node.js/Docker, Bun, Railway. Configure selective SSR, SPA - mode, static prerendering, ISR with Cache-Control headers. - type: core - packages: - - '@tanstack/react-start' - - '@tanstack/start-plugin-core' - covers: - - Cloudflare Workers deployment - - Netlify deployment - - Vercel / Railway deployment - - Node.js / Docker deployment - - Bun deployment - - Selective SSR (ssr option per route) - - SPA mode configuration - - Static prerendering (prerender option) - - ISR with Cache-Control headers - - SEO (head property, structured data) - tasks: - - 'Deploy to Cloudflare Workers' - - 'Deploy to Netlify' - - 'Configure selective SSR per route' - - 'Enable SPA mode' - - 'Set up static prerendering' - - 'Configure ISR with cache headers' - failure_modes: - - mistake: 'Bun deployment with React 18' - mechanism: >- - Bun-specific deployment only works with React 19. - For React 18, use Node.js deployment guidelines. - source: 'docs/start/framework/react/guide/hosting.md' - priority: MEDIUM - status: active - - - mistake: 'Missing nodejs_compat flag for Cloudflare Workers' - mechanism: >- - Cloudflare Workers requires compatibility_flags: - ["nodejs_compat"] in wrangler config. Without it, - Node.js APIs used by Start fail at runtime. - source: 'docs/start/framework/react/guide/hosting.md' - priority: HIGH - status: active - - - mistake: 'Child route loosening parent SSR config' - mechanism: >- - SSR config inherits from parent and can only become MORE - restrictive (true → data-only → false). A child cannot - set ssr: true if parent has ssr: false. - source: 'docs/start/framework/react/guide/selective-ssr.md' - priority: MEDIUM - status: active - -tensions: - - name: 'Isomorphic defaults vs server-only expectations' - skills: ['execution-model', 'server-functions'] - description: >- - All code runs everywhere by default. Agents trained on - Next.js/Remix assume loaders and route code are server-only. - implication: >- - Agents put secrets, DB queries, and file system access in - loaders instead of server functions, causing client-side - failures or security leaks. - - - name: 'Simplicity of isomorphic code vs security boundaries' - skills: ['execution-model', 'middleware'] - description: >- - The isomorphic model makes code easy to write but requires - explicit boundaries for security. Agents don't realize they - need to actively constrain execution environment. - implication: >- - Agents expose secrets via module-level process.env or - forget to validate sendContext data in middleware. - -cross_references: - - from: 'server-functions' - to: 'execution-model' - reason: 'Server functions ARE the isomorphic boundary — understanding the execution model is prerequisite' - - from: 'server-functions' - to: 'middleware' - reason: 'Server function middleware chains compose with server functions' - - from: 'middleware' - to: 'server-routes' - reason: 'Server routes use the same middleware system' - - from: 'deployment' - to: 'execution-model' - reason: 'Deployment target affects which environment code runs in' - -gaps: [] diff --git a/_artifacts/start_skill_tree.yaml b/_artifacts/start_skill_tree.yaml deleted file mode 100644 index 4d221068fd..0000000000 --- a/_artifacts/start_skill_tree.yaml +++ /dev/null @@ -1,158 +0,0 @@ -# skills/_artifacts/start_skill_tree.yaml -library: - name: '@tanstack/react-start' - version: '1.166.2' - repository: 'https://github.com/TanStack/router' - description: >- - Full-stack React framework built on TanStack Router and Vite. - Adds SSR, streaming, server functions (type-safe RPCs), middleware, - server routes, and universal deployment. Isomorphic by default — - all code runs in both environments unless explicitly constrained. -generated_from: - domain_map: '_artifacts/start_domain_map.yaml' -generated_at: '2026-03-07' - -skills: - # ── Start Core Skills ─────────────────────────────────────────── - - name: 'Start Core' - slug: 'start-core' - type: 'core' - domain: 'project-setup' - path: 'skills/start-core/SKILL.md' - package: 'packages/start-client-core' - description: >- - Core overview for TanStack Start: tanstackStart() Vite plugin, - getRouter() factory, root route document shell (HeadContent, - Scripts, Outlet), client/server entry points, routeTree.gen.ts, - tsconfig configuration. Entry point for all Start skills. - sources: - - 'TanStack/router:docs/start/framework/react/build-from-scratch.md' - - 'TanStack/router:docs/start/framework/react/quick-start.md' - - 'TanStack/router:docs/start/framework/react/guide/routing.md' - - - name: 'Server Functions' - slug: 'start-core/server-functions' - type: 'sub-skill' - domain: 'server-functions' - path: 'skills/start-core/server-functions/SKILL.md' - package: 'packages/start-client-core' - description: >- - createServerFn (GET/POST), validator (Zod or function), - useServerFn hook, server context utilities (getRequest, - getRequestHeader, setResponseHeader, setResponseStatus), error - handling (throw errors, redirect, notFound), streaming - (ReadableStream, async generators), FormData handling, file - organization (.functions.ts, .server.ts). - requires: - - 'start-core' - sources: - - 'TanStack/router:docs/start/framework/react/guide/server-functions.md' - - - name: 'Middleware' - slug: 'start-core/middleware' - type: 'sub-skill' - domain: 'middleware-and-context' - path: 'skills/start-core/middleware/SKILL.md' - package: 'packages/start-client-core' - description: >- - createMiddleware, request middleware (.server only), server - function middleware (.client + .server), context passing via - next({ context }), sendContext for client-server transfer, - global middleware via createStart in src/start.ts, middleware - factories, method order enforcement. - requires: - - 'start-core' - - 'start-core/server-functions' - sources: - - 'TanStack/router:docs/start/framework/react/guide/middleware.md' - - - name: 'Execution Model' - slug: 'start-core/execution-model' - type: 'sub-skill' - domain: 'execution-model' - path: 'skills/start-core/execution-model/SKILL.md' - package: 'packages/start-client-core' - description: >- - Isomorphic-by-default principle, environment boundary functions - (createServerFn, createServerOnlyFn, createClientOnlyFn, - createIsomorphicFn), ClientOnly component, useHydrated hook, - import protection, dead code elimination, environment variable - safety (VITE_ prefix, process.env). - requires: - - 'start-core' - sources: - - 'TanStack/router:docs/start/framework/react/guide/execution-model.md' - - 'TanStack/router:docs/start/framework/react/guide/environment-variables.md' - - - name: 'Server Routes' - slug: 'start-core/server-routes' - type: 'sub-skill' - domain: 'server-routes' - path: 'skills/start-core/server-routes/SKILL.md' - package: 'packages/start-client-core' - description: >- - Server-side API endpoints using the server property on - createFileRoute, HTTP method handlers (GET, POST, PUT, DELETE), - createHandlers for per-handler middleware, handler context - (request, params, context), request body parsing, response - helpers, file naming for API routes. - requires: - - 'start-core' - sources: - - 'TanStack/router:docs/start/framework/react/guide/server-routes.md' - - - name: 'Deployment' - slug: 'start-core/deployment' - type: 'sub-skill' - domain: 'deployment-and-rendering' - path: 'skills/start-core/deployment/SKILL.md' - package: 'packages/start-client-core' - description: >- - Deploy to Cloudflare Workers, Netlify, Vercel, Node.js/Docker, - Bun, Railway. Selective SSR (ssr option per route), SPA mode, - static prerendering, ISR with Cache-Control headers, SEO and - head management. - requires: - - 'start-core' - sources: - - 'TanStack/router:docs/start/framework/react/guide/hosting.md' - - 'TanStack/router:docs/start/framework/react/guide/selective-ssr.md' - - 'TanStack/router:docs/start/framework/react/guide/static-prerendering.md' - - 'TanStack/router:docs/start/framework/react/guide/full-stack-seo.md' - - # ── React Start Skills ────────────────────────────────────────── - - name: 'React Start' - slug: 'react-start' - type: 'framework' - domain: 'project-setup' - path: 'skills/react-start/SKILL.md' - package: 'packages/react-start' - description: >- - React bindings for TanStack Start: createStart, StartClient, - StartServer, React-specific imports, re-exports from - @tanstack/react-router, full project setup with React. - requires: - - 'start-core' - sources: - - 'TanStack/router:packages/react-start/src' - - 'TanStack/router:docs/start/framework/react/build-from-scratch.md' - - # ── Lifecycle Skills ──────────────────────────────────────────── - - name: 'Migrate from Next.js' - slug: 'lifecycle/migrate-from-nextjs' - type: 'lifecycle' - domain: 'project-setup' - path: 'skills/lifecycle/migrate-from-nextjs/SKILL.md' - package: 'packages/react-start' - description: >- - Step-by-step migration from Next.js App Router to TanStack - Start: route definition conversion, API mapping, server - function conversion from Server Actions, middleware conversion, - data fetching pattern changes. - requires: - - 'start-core' - - 'react-start' - sources: - - 'TanStack/router:docs/start/framework/react/guide/server-functions.md' - - 'TanStack/router:docs/start/framework/react/guide/middleware.md' - - 'TanStack/router:docs/start/framework/react/guide/execution-model.md' diff --git a/benchmarks/AGENTS.md b/benchmarks/AGENTS.md deleted file mode 100644 index 9d56a2411a..0000000000 --- a/benchmarks/AGENTS.md +++ /dev/null @@ -1,15 +0,0 @@ -# Benchmarks - -Read the relevant README before running benchmarks. Compare baseline and candidate with the same workload and production builds; add a focused case when existing scenarios miss the changed mechanism. Keep workloads and benchmark names stable for historical comparisons. - -| Changed behavior | Guide | Nx project | -| ------------------------------------------ | ---------------------------------- | -------------------------------------------------------- | -| Standalone Router navigation/rendering CPU | [client-nav](client-nav/README.md) | `@benchmarks/client-nav` | -| Start request/SSR CPU | [ssr](ssr/README.md) | `@benchmarks/ssr` | -| Client/server retention and allocations | [memory](memory/README.md) | `@benchmarks/memory-client`, `@benchmarks/memory-server` | - -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 deleted file mode 100644 index 94d2f31802..0000000000 --- a/benchmarks/README.md +++ /dev/null @@ -1,88 +0,0 @@ -# CPU simulation benchmarks - -`client-nav` measures navigation, mounting, and React/Solid hydration in -Node/jsdom; `ssr` measures server requests. -Both suites run through the CodSpeed Vitest integration in CPU simulation mode. - -## Worker runtime - -Every CPU benchmark project includes `cpuSimulationExecArgv()` from -[`cpu-simulation.ts`](./cpu-simulation.ts). It augments CodSpeed's worker flags -only during CPU simulation, including the legacy `instrumentation` mode. - -The pinned CodSpeed integration supplies `--no-opt`. In Node 24 this is an alias -for `--no-turbofan`, so Maglev can still optimize and inline hot functions. The -additional `--no-maglev` keeps the optimizing compiler out of the simulation. -`--always-sparkplug` compiles baseline code on first use, so warmup does not leave -functions approaching a later tier-up or batch-compilation threshold. The worker -regression test checks that even a once-called function receives baseline code. -The integration also omits the old `--no-scavenge-task` flag on Node 20 and -newer, where V8 renamed it to `--no-minor-gc-task`. Supplying the renamed flag -keeps minor GC tied to allocation pressure instead of scheduled foreground -tasks. Both flags follow the fixes in -[CodSpeed's Node 24 support](https://github.com/CodSpeedHQ/codspeed-node/commit/e3224e7872). - -`--initial-old-space-size=512` fixes the initial/minimum old-generation -allocation budget at 512 MiB. Removing only this override after worker isolation -left two Vue SSR scenarios with same-commit spreads above 2% in five full-suite -repetitions. The paired default-heap comparison with stock incremental-marking -tasks also exceeded 2%. Runtime comparisons and tested alternatives are recorded in -[PR #8248](https://github.com/TanStack/router/pull/8248). - -This is a GC-policy tradeoff. Minor collections and allocation work remain -measured, and CodSpeed still explicitly collects before measurement. However, -V8 can skip automatic full collections below this old-generation budget, so the -benchmark can omit some eventual full-GC CPU cost from increased object -retention. Repeatability does not establish representative production GC -frequency. The flag does not preallocate 512 MiB; the existing 4096 MiB maximum -remains. See [V8's initial/minimum heap configuration](https://github.com/nodejs/node/blob/v24.8.0/deps/v8/src/heap/heap.cc#L5071). - -The configuration preserves CodSpeed's incremental-marking task settings; the -additional `--no-incremental-marking-task` from the initial stabilization proposal -has been removed. - -The flags are intentionally absent from ordinary Vitest timing and walltime runs. - -Changing simulation compiler settings changes the measurement baseline. Compare -repeatability within each configuration before interpreting performance changes -between configurations as router improvements or regressions. - -## Worker isolation - -Keep one SSR workload in each `speed*.bench.ts` file. These projects explicitly -enable Vitest isolation; CodSpeed uses the forks pool, so every file receives a -fresh worker. Multiple workloads in one file share the worker's runtime state, -even though CodSpeed collects before each measurement. Later control cases -remained noisy after the runtime flag corrections. Running the React plain -dehydration and linked-CSS controls alone reduced their observed three-run spreads -to 0.09% and 0.02% respectively. - -Variant files keep their workload names, request counts, concurrency, payloads -and assertions. CodSpeed includes the file path in a benchmark's identity, so -moved variants start a new history. The first workload keeps `speed.bench.ts`; -the additional variants have descriptive file names alongside it. Type-check -includes cover all of these files. - -## Streaming workload - -Deferred payloads in the SSR streaming scenario resolve after two task turns on -Node. A real 1 ms timer lets elapsed host time decide which concurrent requests -resolve together. Counted turns preserve the initial loading render and deferred -payloads; the existing HTML assertions check both. These benchmarks execute in -Node and use `setImmediate` directly. - -## Repeatability checks - -Dispatch the existing `Benchmarks` workflow against an unchanged branch: - -```sh -gh workflow run benchmarks.yml --ref -``` - -Wait for each workflow run to finish before dispatching the next repetition at -the same commit. The workflow also runs memory benchmarks; exclude those results -when assessing CPU repeatability. Check that every repetition has all expected -CPU results (currently 134), rather than inherited results from an earlier run. -Compare each benchmark's minimum and maximum across repetitions; keep input data, -navigation/request counts, builds, dependencies and Node version fixed when -testing runtime configuration changes. diff --git a/benchmarks/bundle-size/.gitignore b/benchmarks/bundle-size/.gitignore deleted file mode 100644 index bd05a98cee..0000000000 --- a/benchmarks/bundle-size/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -dist -dist-debug -scenarios/*/src/routeTree.gen.ts - -results/*.json -results/*.md -results/*.js -results/*.log -results/runs/ -!results/.gitkeep diff --git a/benchmarks/bundle-size/README.md b/benchmarks/bundle-size/README.md deleted file mode 100644 index 2185d6b43f..0000000000 --- a/benchmarks/bundle-size/README.md +++ /dev/null @@ -1,172 +0,0 @@ -# Bundle Size Benchmarks - -This workspace contains deterministic bundle-size fixtures for: - -- `@tanstack/react-router` -- `@tanstack/solid-router` -- `@tanstack/vue-router` -- `@tanstack/react-start` -- `@tanstack/solid-start` - -Each package has `minimal` and `full` scenarios: - -- `minimal`: Small route app with `__root` + index route that renders `hello world` -- `full`: Same route shape plus a broad root-level harness that imports/uses the full hooks/components surface -- Start `full` scenarios also exercise `createServerFn`, `createMiddleware`, and `useServerFn` -- Start `deferred-hydration` scenarios match the minimal route shape and wrap the index route content in `Hydrate` - -## Design Notes - -- Scenarios use file-based routing as the default app style. -- Router scenarios use `@tanstack/router-plugin/vite` with `autoCodeSplitting: true`. -- Start Vite scenarios use `@tanstack/-start/plugin/vite` with router code-splitting enabled. -- React Start also includes Rsbuild scenarios using `@tanstack/react-start/plugin/rsbuild`. -- Full-surface coverage is manually maintained (no strict export-coverage gate). -- Primary metrics measure all emitted client JS chunks and are reported as raw/gzip/brotli bytes. -- Initial-load JS graph metrics are also recorded as `initialRawBytes`, `initialGzipBytes`, and `initialBrotliBytes` for context. -- Gzip for all emitted client JS is the primary tracking signal for PR deltas and historical charting. - -## Local Run - -```bash -pnpm benchmark:bundle-size:run -``` - -Run one or more scenarios during local optimization: - -```bash -pnpm benchmark:bundle-size:run --scenario react-router.minimal -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: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: - -```bash -pnpm benchmark:bundle-size:run --scenario react-router.minimal --skip-package-builds -``` - -This writes: - -- `benchmarks/bundle-size/results/measurements.json` -- `benchmarks/bundle-size/results/current.json` -- `benchmarks/bundle-size/results/benchmark-action.json` -- `benchmarks/bundle-size/results/measure.log` - -`current.json` includes run status, selected package build projects, per-scenario totals, per-file sizes, and the emitted JS files used for measurement. Dist paths use `scenarioDir`/`outDir`, e.g. `react-router.minimal` maps to `benchmarks/bundle-size/dist/react-router-minimal/`. - -The runner sets `CI=1` and `NX_DAEMON=false`. Successful runs print log locations and the existing `query` or `diff` summary. -If a step fails, the runner stops with a nonzero exit code. It prints the last 40 log lines, limited to 8,000 characters. -Full stdout and stderr stay in the log files. A positive bundle-size delta does not cause failure. - -For agent runs, use `pnpm --silent benchmark:bundle-size:run ...` to omit the package-manager command echo. - -### Phase Timings - -To diagnose measurement time, request a fresh run: - -```bash -pnpm benchmark:bundle-size:run --scenario react-router.minimal --analysis --timings -``` - -The runner directly executes `measure.mjs` on every invocation, rebuilding the selected scenarios and recording fresh timings in `measure.log`. Its package-build step still uses Nx and may restore cached packages. Use `--skip-package-builds` only when those packages are already built and unchanged. - -`measure.mjs` also accepts `--timings` directly. Alternatively, set `BUNDLE_SIZE_TIMINGS=1`. Timing lines go to stderr with the prefix `[bundle-size:timing]` followed by JSON containing `phase`, `durationMs`, and, for scenario phases, `scenario`. They are diagnostics only and do not add fields to the size metrics. - -The cached `pnpm benchmark:bundle-size` / Nx build path can replay terminal output from an earlier execution, including old timing lines. Setting `BUNDLE_SIZE_TIMINGS=1` does not invalidate that cache or guarantee fresh timings. Use the direct runner above for timing investigations; refreshing `current.json` after a cache hit does not remeasure build time. - -- `package-builds`: elapsed time for the package-build invocation, including Nx startup/cache handling; omitted when package builds are skipped. -- `scenario-build`: elapsed time for each scenario's build and cleanup. -- `manifest-resolution`: manifest discovery, parsing, entry selection, and collection of all/initial JS file lists. -- `gzip` / `brotli`: accumulated codec time across distinct files for each scenario, using Node's default compression settings. File reads and summation are excluded; initial files reuse already measured sizes. -- `analysis`: source attribution, when `--analysis` is enabled. -- `overall`: measurement execution through report/history writing. Module imports, process startup, and the outer runner's tests/report command are excluded. - -Phases that start also report elapsed work on failure; compression reports partial accumulated times before propagating the error. Timing records alone do not indicate success. `overall` contains the other phases, so nested timings must not be added to it. The phase breakdown also excludes overhead such as file reads and result writing, so its sum is not expected to equal `overall`. - -## Compare Optimization Candidates - -Before you change the implementation, save a named baseline: - -```bash -pnpm benchmark:bundle-size:run --name baseline --scenario react-router.minimal,react-router.full -``` - -After you change the implementation, compare a candidate against that baseline: - -```bash -pnpm benchmark:bundle-size:run --name candidate --baseline baseline \ - --scenario react-router.minimal,react-router.full \ - --test-projects @tanstack/router-core,@tanstack/react-router \ - -- tests/path.test.ts tests/link.test.tsx -``` - -`--test-projects` runs the selected Nx unit-test targets before measurement. Arguments after `--` go only to those tests. -Tests and measurement run sequentially. Failed tests stop the runner before measurement, so old results cannot produce a misleading diff. -Without `--test-projects`, the runner only measures bundles. Type tests, performance benchmarks, and e2e tests remain separate commands. - -Named runs store their metrics and logs in `benchmarks/bundle-size/results/runs//`. Existing named results cannot be overwritten. -Without `--name`, runs replace `current.json` and the logs for the steps they run. -Emitted bundles still use the shared `dist/` directory. To retain emitted bundles for a candidate, pass a separate `--dist-dir`. - -`--baseline` accepts a run name or a JSON file path, such as `--baseline ./baseline.json`. -With `--scenario`, the comparison reports only the scenarios measured in the current run, even when the baseline contains more scenarios. Selected scenarios missing from the baseline remain visible with `n/a` for their baseline and deltas. -Without `--scenario`, comparisons include scenarios from either result file. -`--results-dir
` changes the results root, including the location of named runs. -Use the same scenario selection and measurement flags for the baseline and candidate. - -For command reference, run: - -```bash -pnpm benchmark:bundle-size:run --help -``` - -## Local Query Tools - -```bash -pnpm benchmark:bundle-size:query --id react-router.minimal -pnpm benchmark:bundle-size:diff --baseline /tmp/base-current.json --id react-router.minimal -pnpm benchmark:bundle-size:history --id react-router.minimal --top-deltas 20 -``` - -Use `pnpm benchmark:bundle-size:diff --baseline /tmp/base-current.json --current-only` to compare only scenarios present in the current results. This applies to both text and `--json` output; an explicit `--id` takes precedence. - -For source attribution, run an analysis build. This uses hidden source maps and writes source estimates into `current.json`; those estimates are for investigation only, not tracking. - -```bash -pnpm benchmark:bundle-size:run --scenario react-router.minimal --analysis -pnpm benchmark:bundle-size:analyze --id react-router.minimal --top-sources 30 -``` - -For a named run, pass `--current benchmarks/bundle-size/results/runs//current.json` to `query`, `diff`, or `analyze`. - -## CI Reporting - -- PR workflow generates a sticky comment with: - - current gzip, initial gzip, raw, and Brotli values - - per-metric deltas from the `main` baseline - - inline sparkline trend -- Pushes to `main` publish historical chart data to GitHub Pages via `benchmark-action/github-action-benchmark`. - -## Manual Update Policy - -When router/start public hooks/components evolve, update the corresponding `*-full/src/routes/__root.tsx` harness to keep full scenarios representative. - -## Backfill Readiness - -The measurement script supports optional interfaces for historical backfilling: - -- `--sha` -- `--measured-at` -- `--append-history` -- `--scenario` -- `--analysis` -- `--sourcemap` -- `--skip-package-builds` - -These are intended for one-off scripts that replay historical commits and append results to the same history dataset shape used for chart generation. -If `--append-history` points at a `data.js` file, output is written as `window.BENCHMARK_DATA = ...` for direct GitHub Pages compatibility. diff --git a/benchmarks/bundle-size/package.json b/benchmarks/bundle-size/package.json deleted file mode 100644 index ca34cd6cd7..0000000000 --- a/benchmarks/bundle-size/package.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "name": "@benchmarks/bundle-size", - "private": true, - "type": "module", - "scripts": { - "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": { - "measure": { - "cache": true, - "inputs": [ - "buildProduction", - "^buildProduction", - "dependentTaskOutputs", - "{workspaceRoot}/scripts/benchmarks/bundle-size/measure.mjs", - "{workspaceRoot}/scripts/benchmarks/bundle-size/compress.mjs", - "{workspaceRoot}/scripts/benchmarks/bundle-size/timings.mjs", - "{workspaceRoot}/scripts/benchmarks/bundle-size/report.mjs", - { - "runtime": "node --version" - } - ], - "outputs": [ - "{projectRoot}/dist", - "{projectRoot}/results/measurements.json", - "{projectRoot}/results/benchmark-action.json" - ], - "dependsOn": [ - { - "projects": [ - "@tanstack/react-router", - "@tanstack/react-router-ssr-query", - "@tanstack/react-start", - "@tanstack/router-plugin", - "@tanstack/solid-router", - "@tanstack/solid-start", - "@tanstack/vue-router", - "@tanstack/vue-start" - ], - "target": "build" - } - ] - }, - "test:unit": { - "dependsOn": [], - "inputs": [ - "default", - "^production", - "{workspaceRoot}/scripts/benchmarks/bundle-size/*.mjs" - ] - } - } - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-ssr-query": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/vue-router": "workspace:^", - "@tanstack/react-start": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "@tanstack/vue-start": "workspace:^", - "@tanstack/react-query": "catalog:", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "solid-js": "^1.9.10", - "vue": "^3.5.16" - }, - "devDependencies": { - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-react": "^2.0.0", - "@tanstack/router-plugin": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "@vitejs/plugin-vue": "^6.0.5", - "@vitejs/plugin-vue-jsx": "^5.1.5", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/benchmarks/bundle-size/results/.gitkeep b/benchmarks/bundle-size/results/.gitkeep deleted file mode 100644 index 8b13789179..0000000000 --- a/benchmarks/bundle-size/results/.gitkeep +++ /dev/null @@ -1 +0,0 @@ - diff --git a/benchmarks/bundle-size/scenarios/react-router-full/index.html b/benchmarks/bundle-size/scenarios/react-router-full/index.html deleted file mode 100644 index 1117e75467..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-full/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - react-router-full - - -
- - - diff --git a/benchmarks/bundle-size/scenarios/react-router-full/src/main.tsx b/benchmarks/bundle-size/scenarios/react-router-full/src/main.tsx deleted file mode 100644 index ce55e38d84..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-full/src/main.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ - routeTree, - scrollRestoration: true, -}) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element `#app` not found') -} -if (!rootElement.innerHTML) { - ReactDOM.createRoot(rootElement).render() -} diff --git a/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx deleted file mode 100644 index d8948fdb7e..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-full/src/routes/__root.tsx +++ /dev/null @@ -1,185 +0,0 @@ -import { - Asset, - Await, - Block, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - HeadContent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScriptOnce, - Scripts, - ScrollRestoration, - createLink, - createRootRoute, - linkOptions, - useAwaited, - useBlocker, - useCanGoBack, - useElementScrollRestoration, - useHydrated, - useLinkProps, - useLoaderData, - useLoaderDeps, - useLocation, - useMatch, - useMatchRoute, - useMatches, - useNavigate, - useParams, - useParentMatches, - useChildMatches, - useRouteContext, - useRouter, - useRouterState, - useSearch, - useTags, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - const router = useRouter() - const hydrated = useHydrated() - const awaited = useAwaited({ promise: Promise.resolve('ready') }) - const linkProps = useLinkProps({ to: '/' } as any) - const matchRoute = useMatchRoute() - const matches = useMatches() - const parentMatches = useParentMatches() - const childMatches = useChildMatches() - const match = useMatch({ strict: false, shouldThrow: false } as any) - const loaderDeps = useLoaderDeps({ strict: false } as any) - const loaderData = useLoaderData({ strict: false } as any) - const params = useParams({ strict: false } as any) - const search = useSearch({ strict: false } as any) - const routeContext = useRouteContext({ strict: false } as any) - const routerState = useRouterState({ select: (state) => state.status } as any) - const location = useLocation() - const canGoBack = useCanGoBack() - const navigate = useNavigate() - const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() - - useBlocker({ - shouldBlockFn: () => false, - disabled: true, - withResolver: false, - }) - - const linkFactoryResult = linkOptions({ to: '/' } as any) - const routeMatchResult = matchRoute({ to: '/' } as any) - const SvgLink = createLink('svg') - - const hooksAndComponents = [ - useAwaited, - useHydrated, - useLinkProps, - useMatchRoute, - useMatches, - useParentMatches, - useChildMatches, - useMatch, - useLoaderDeps, - useLoaderData, - useBlocker, - useNavigate, - useParams, - useSearch, - useRouteContext, - useRouter, - useRouterState, - useLocation, - useCanGoBack, - useElementScrollRestoration, - useTags, - Await, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScrollRestoration, - Block, - ScriptOnce, - Asset, - HeadContent, - Scripts, - ] - - ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = { - hooksAndComponents, - } - - void awaited - void linkFactoryResult - void matches - void parentMatches - void childMatches - void match - void loaderDeps - void loaderData - void params - void search - void routeContext - void routerState - void location - void canGoBack - void navigate - void scrollEntry - void tags - void routeMatchResult - - return ( - <> - - {'window.__tsr_bundle_size = true'} - - home - - - - {() => } - }> - - - - {() => } - - false} disabled withResolver={false}> - {() => } - - }> - - - - - - - - -
-
hello world
-
- - ) -} diff --git a/benchmarks/bundle-size/scenarios/react-router-full/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-router-full/src/routes/index.tsx deleted file mode 100644 index aeea465e04..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-full/src/routes/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { - createFileRoute, - retainSearchParams, - stripSearchParams, -} from '@tanstack/react-router' - -const defaultSearch = { page: 1 } - -export const Route = createFileRoute('/')({ - search: { - middlewares: [ - retainSearchParams>(['persist']), - stripSearchParams(defaultSearch), - ], - }, - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/react-router-full/vite.config.ts b/benchmarks/bundle-size/scenarios/react-router-full/vite.config.ts deleted file mode 100644 index 45838fe281..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-full/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - }), - react(), - ], -}) diff --git a/benchmarks/bundle-size/scenarios/react-router-minimal/index.html b/benchmarks/bundle-size/scenarios/react-router-minimal/index.html deleted file mode 100644 index 5de4e4e509..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-minimal/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - react-router-minimal - - -
- - - diff --git a/benchmarks/bundle-size/scenarios/react-router-minimal/src/main.tsx b/benchmarks/bundle-size/scenarios/react-router-minimal/src/main.tsx deleted file mode 100644 index 667de2cdc7..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-minimal/src/main.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ routeTree }) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element `#app` not found') -} -if (!rootElement.innerHTML) { - ReactDOM.createRoot(rootElement).render() -} diff --git a/benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/index.tsx deleted file mode 100644 index 76fb363538..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-minimal/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/react-router-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/react-router-minimal/vite.config.ts deleted file mode 100644 index 45838fe281..0000000000 --- a/benchmarks/bundle-size/scenarios/react-router-minimal/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - }), - react(), - ], -}) diff --git a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/router.tsx b/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/router.tsx deleted file mode 100644 index 9d87d8748b..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/routes/index.tsx deleted file mode 100644 index a462508abd..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/src/routes/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Hydrate } from '@tanstack/react-start' -import { visible } from '@tanstack/react-start/hydration' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( - -
hello world
-
- ) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/vite.config.ts b/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/vite.config.ts deleted file mode 100644 index d4e4cd980d..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-deferred-hydration/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import viteReact from '@vitejs/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), viteReact()], -}) diff --git a/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts b/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts deleted file mode 100644 index 349e11bec1..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-full/rsbuild.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginReact } from '@rsbuild/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild' - -const outDir = process.env.BUNDLE_SIZE_DIST_DIR ?? 'dist-rsbuild' - -export default defineConfig({ - logLevel: 'silent', - plugins: [pluginReact(), tanstackStart()], - output: { - distPath: { - root: outDir, - }, - cleanDistPath: true, - minify: true, - sourceMap: false, - }, - performance: { - printFileSize: false, - }, - environments: { - client: { - output: { - manifest: { - filename: 'manifest.json', - prefix: false, - }, - }, - }, - ssr: { - output: { - manifest: false, - }, - }, - }, -}) diff --git a/benchmarks/bundle-size/scenarios/react-start-full/src/router.tsx b/benchmarks/bundle-size/scenarios/react-start-full/src/router.tsx deleted file mode 100644 index 9d87d8748b..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-full/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx deleted file mode 100644 index 07fd3a40be..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-full/src/routes/__root.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import { - Asset, - Await, - Block, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - HeadContent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScriptOnce, - Scripts, - ScrollRestoration, - createLink, - createRootRoute, - linkOptions, - useAwaited, - useBlocker, - useCanGoBack, - useElementScrollRestoration, - useHydrated, - useLinkProps, - useLoaderData, - useLoaderDeps, - useLocation, - useMatch, - useMatchRoute, - useMatches, - useNavigate, - useParams, - useParentMatches, - useChildMatches, - useRouteContext, - useRouter, - useRouterState, - useSearch, - useTags, -} from '@tanstack/react-router' -import { - createMiddleware, - createServerFn, - useServerFn, -} from '@tanstack/react-start' - -const requestMiddleware = createMiddleware().server(async ({ next }) => { - return next() -}) - -const functionMiddleware = createMiddleware({ type: 'function' }) - .client(async ({ next }) => { - return next() - }) - .server(async ({ next }) => { - return next() - }) - -const helloServerFn = createServerFn({ method: 'GET' }) - .middleware([requestMiddleware, functionMiddleware]) - .handler(async () => { - return 'hello from server fn' - }) - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - const router = useRouter() - const hydrated = useHydrated() - const awaited = useAwaited({ promise: Promise.resolve('ready') }) - const linkProps = useLinkProps({ to: '/' } as any) - const matchRoute = useMatchRoute() - const matches = useMatches() - const parentMatches = useParentMatches() - const childMatches = useChildMatches() - const match = useMatch({ strict: false, shouldThrow: false } as any) - const loaderDeps = useLoaderDeps({ strict: false } as any) - const loaderData = useLoaderData({ strict: false } as any) - const params = useParams({ strict: false } as any) - const search = useSearch({ strict: false } as any) - const routeContext = useRouteContext({ strict: false } as any) - const routerState = useRouterState({ select: (state) => state.status } as any) - const location = useLocation() - const canGoBack = useCanGoBack() - const navigate = useNavigate() - const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() - const invokeServerFn = useServerFn(helloServerFn) - - useBlocker({ - shouldBlockFn: () => false, - disabled: true, - withResolver: false, - }) - - const linkFactoryResult = linkOptions({ to: '/' } as any) - const routeMatchResult = matchRoute({ to: '/' } as any) - const SvgLink = createLink('svg') - - const startSurface = [createMiddleware, createServerFn, useServerFn] - const hooksAndComponents = [ - useAwaited, - useHydrated, - useLinkProps, - useMatchRoute, - useMatches, - useParentMatches, - useChildMatches, - useMatch, - useLoaderDeps, - useLoaderData, - useBlocker, - useNavigate, - useParams, - useSearch, - useRouteContext, - useRouter, - useRouterState, - useLocation, - useCanGoBack, - useElementScrollRestoration, - useTags, - Await, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScrollRestoration, - Block, - ScriptOnce, - Asset, - HeadContent, - Scripts, - ] - - ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = { - hooksAndComponents, - startSurface, - } - - void awaited - void linkFactoryResult - void matches - void parentMatches - void childMatches - void match - void loaderDeps - void loaderData - void params - void search - void routeContext - void routerState - void location - void canGoBack - void navigate - void scrollEntry - void tags - void routeMatchResult - void invokeServerFn - - return ( - - - - - - {'window.__tsr_bundle_size = true'} - - home - - - - {() => } - }> - - - - {() => } - - false} disabled withResolver={false}> - {() => } - - }> - - - - - - - - -
-
hello world
-
- - - ) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-full/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-start-full/src/routes/index.tsx deleted file mode 100644 index 76fb363538..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-full/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/react-start-full/vite.config.ts b/benchmarks/bundle-size/scenarios/react-start-full/vite.config.ts deleted file mode 100644 index d4e4cd980d..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-full/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import viteReact from '@vitejs/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), viteReact()], -}) diff --git a/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts b/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts deleted file mode 100644 index 7d27421d4d..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-minimal/rsbuild.config.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginReact } from '@rsbuild/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild' - -const outDir = process.env.BUNDLE_SIZE_DIST_DIR ?? 'dist-rsbuild' -const clientOutput = process.env.BUNDLE_SIZE_RSB_CLIENT_OUTPUT -const startOptions = clientOutput - ? { - rsbuild: { - client: { - output: clientOutput as 'module' | 'iife', - }, - }, - } - : undefined - -export default defineConfig({ - logLevel: 'silent', - plugins: [pluginReact(), tanstackStart(startOptions)], - output: { - distPath: { - root: outDir, - }, - cleanDistPath: true, - minify: true, - sourceMap: false, - }, - performance: { - printFileSize: false, - }, - environments: { - client: { - output: { - manifest: { - filename: 'manifest.json', - prefix: false, - }, - }, - }, - ssr: { - output: { - manifest: false, - }, - }, - }, -}) diff --git a/benchmarks/bundle-size/scenarios/react-start-minimal/src/router.tsx b/benchmarks/bundle-size/scenarios/react-start-minimal/src/router.tsx deleted file mode 100644 index 9d87d8748b..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-minimal/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/index.tsx deleted file mode 100644 index 76fb363538..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-minimal/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/react-start-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/react-start-minimal/vite.config.ts deleted file mode 100644 index d4e4cd980d..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-minimal/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import viteReact from '@vitejs/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), viteReact()], -}) diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/router.tsx b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/router.tsx deleted file mode 100644 index 93b95f3148..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { QueryClient } from '@tanstack/react-query' -import { createRouter } from '@tanstack/react-router' -import { setupRouterSsrQueryIntegration } from '@tanstack/react-router-ssr-query' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - const queryClient = new QueryClient() - const router = createRouter({ - routeTree, - context: { queryClient }, - scrollRestoration: true, - }) - - setupRouterSsrQueryIntegration({ router, queryClient }) - - return router -} diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/index.tsx deleted file mode 100644 index 76fb363538..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-query-integration/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/react-start-query-integration/vite.config.ts b/benchmarks/bundle-size/scenarios/react-start-query-integration/vite.config.ts deleted file mode 100644 index d4e4cd980d..0000000000 --- a/benchmarks/bundle-size/scenarios/react-start-query-integration/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import viteReact from '@vitejs/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), viteReact()], -}) diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/index.html b/benchmarks/bundle-size/scenarios/solid-router-full/index.html deleted file mode 100644 index 80ef4474ee..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-full/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - solid-router-full - - -
- - - diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx b/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx deleted file mode 100644 index 505f79aee0..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-full/src/main.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ - routeTree, - scrollRestoration: true, -}) - -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element `#app` not found') -} -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx deleted file mode 100644 index f4c2906016..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/__root.tsx +++ /dev/null @@ -1,185 +0,0 @@ -import { - Asset, - Await, - Block, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - HeadContent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScriptOnce, - Scripts, - ScrollRestoration, - createLink, - createRootRoute, - linkOptions, - useAwaited, - useBlocker, - useCanGoBack, - useChildMatches, - useElementScrollRestoration, - useHydrated, - useLinkProps, - useLoaderData, - useLoaderDeps, - useLocation, - useMatch, - useMatchRoute, - useMatches, - useNavigate, - useParams, - useParentMatches, - useRouteContext, - useRouter, - useRouterState, - useSearch, - useTags, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - const router = useRouter() - const hydrated = useHydrated() - const [awaited] = useAwaited({ promise: Promise.resolve('ready') }) - const linkProps = useLinkProps({ to: '/' } as any) - const matchRoute = useMatchRoute() - const matches = useMatches() - const parentMatches = useParentMatches() - const childMatches = useChildMatches() - const match = useMatch({ strict: false, shouldThrow: false } as any) - const loaderDeps = useLoaderDeps({ strict: false } as any) - const loaderData = useLoaderData({ strict: false } as any) - const params = useParams({ strict: false } as any) - const search = useSearch({ strict: false } as any) - const routeContext = useRouteContext({ strict: false } as any) - const routerState = useRouterState({ select: (state) => state.status } as any) - const location = useLocation() - const canGoBack = useCanGoBack() - const navigate = useNavigate() - const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() - - useBlocker({ - shouldBlockFn: () => false, - disabled: true, - withResolver: false, - }) - - const linkFactoryResult = linkOptions({ to: '/' } as any) - const routeMatchResult = matchRoute({ to: '/' } as any) - const SvgLink = createLink('svg') - - const hooksAndComponents = [ - useAwaited, - useHydrated, - useLinkProps, - useMatchRoute, - useMatches, - useParentMatches, - useChildMatches, - useMatch, - useLoaderDeps, - useLoaderData, - useBlocker, - useNavigate, - useParams, - useSearch, - useRouteContext, - useRouter, - useRouterState, - useLocation, - useCanGoBack, - useElementScrollRestoration, - useTags, - Await, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScrollRestoration, - Block, - ScriptOnce, - Asset, - HeadContent, - Scripts, - ] - - ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = { - hooksAndComponents, - } - - void awaited - void linkFactoryResult - void matches() - void parentMatches() - void childMatches() - void match() - void loaderDeps() - void loaderData() - void params() - void search() - void routeContext() - void routerState() - void location() - void canGoBack() - void navigate - void scrollEntry - void tags() - void routeMatchResult() - - return ( - <> - - {'window.__tsr_bundle_size = true'} - - home - - - - {() => } - }> - - - - {() => } - - false} disabled withResolver={false}> - {() => } - - }> - - - - {() => } - - - - -
-
hello world
-
- - ) -} diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/index.tsx deleted file mode 100644 index de52291cac..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-full/src/routes/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { - createFileRoute, - retainSearchParams, - stripSearchParams, -} from '@tanstack/solid-router' - -const defaultSearch = { page: 1 } - -export const Route = createFileRoute('/')({ - search: { - middlewares: [ - retainSearchParams>(['persist']), - stripSearchParams(defaultSearch), - ], - }, - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts deleted file mode 100644 index 9729ada0e8..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-full/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'solid', - autoCodeSplitting: true, - }), - solid(), - ], -}) diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/index.html b/benchmarks/bundle-size/scenarios/solid-router-minimal/index.html deleted file mode 100644 index 29c6fbd787..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-minimal/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - solid-router-minimal - - -
- - - diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx b/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx deleted file mode 100644 index 210120b3f1..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/main.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ routeTree }) - -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element `#app` not found') -} -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/index.tsx deleted file mode 100644 index 01d3b701ae..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-minimal/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts deleted file mode 100644 index 9729ada0e8..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-router-minimal/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'solid', - autoCodeSplitting: true, - }), - solid(), - ], -}) diff --git a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/router.tsx b/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/router.tsx deleted file mode 100644 index aa7ead6752..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/routes/index.tsx deleted file mode 100644 index 80362386b2..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/src/routes/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Hydrate } from '@tanstack/solid-start' -import { visible } from '@tanstack/solid-start/hydration' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( - -
hello world
-
- ) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts deleted file mode 100644 index 0bd21e64f4..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-deferred-hydration/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), solid({ ssr: true })], -}) diff --git a/benchmarks/bundle-size/scenarios/solid-start-full/src/router.tsx b/benchmarks/bundle-size/scenarios/solid-start-full/src/router.tsx deleted file mode 100644 index aa7ead6752..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-full/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx deleted file mode 100644 index 3daa0019c0..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/__root.tsx +++ /dev/null @@ -1,225 +0,0 @@ -import { - Asset, - Await, - Block, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - HeadContent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScriptOnce, - Scripts, - ScrollRestoration, - createLink, - createRootRoute, - linkOptions, - useAwaited, - useBlocker, - useCanGoBack, - useChildMatches, - useElementScrollRestoration, - useHydrated, - useLinkProps, - useLoaderData, - useLoaderDeps, - useLocation, - useMatch, - useMatchRoute, - useMatches, - useNavigate, - useParams, - useParentMatches, - useRouteContext, - useRouter, - useRouterState, - useSearch, - useTags, -} from '@tanstack/solid-router' -import { - createMiddleware, - createServerFn, - useServerFn, -} from '@tanstack/solid-start' - -type BundleSizeKeep = { - hooksAndComponents: ReadonlyArray - startSurface: ReadonlyArray -} - -declare global { - var __TANSTACK_BUNDLE_SIZE_KEEP__: BundleSizeKeep | undefined -} - -const requestMiddleware = createMiddleware().server(async ({ next }) => { - return next() -}) - -const functionMiddleware = createMiddleware({ type: 'function' }) - .client(async ({ next }) => { - return next() - }) - .server(async ({ next }) => { - return next() - }) - -const helloServerFn = createServerFn({ method: 'GET' }) - .middleware([requestMiddleware, functionMiddleware]) - .handler(async () => { - return 'hello from server fn' - }) - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - const router = useRouter() - const hydrated = useHydrated() - const [awaited] = useAwaited({ promise: Promise.resolve('ready') }) - const linkProps = useLinkProps({ to: '/' }) - const matchRoute = useMatchRoute() - const matches = useMatches() - const parentMatches = useParentMatches() - const childMatches = useChildMatches() - const match = useMatch({ strict: false, shouldThrow: false }) - const loaderDeps = useLoaderDeps({ strict: false }) - const loaderData = useLoaderData({ strict: false }) - const params = useParams({ strict: false }) - const search = useSearch({ strict: false }) - const routeContext = useRouteContext({ strict: false }) - const routerState = useRouterState({ select: (state) => state.status }) - const location = useLocation() - const canGoBack = useCanGoBack() - const navigate = useNavigate() - const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() - const invokeServerFn = useServerFn(helloServerFn) - - useBlocker({ - shouldBlockFn: () => false, - disabled: true, - withResolver: false, - }) - - const linkFactoryResult = linkOptions({ to: '/' }) - const routeMatchResult = matchRoute({ to: '/' }) - const SvgLink = createLink('svg') - - const startSurface = [createMiddleware, createServerFn, useServerFn] - const hooksAndComponents = [ - useAwaited, - useHydrated, - useLinkProps, - useMatchRoute, - useMatches, - useParentMatches, - useChildMatches, - useMatch, - useLoaderDeps, - useLoaderData, - useBlocker, - useNavigate, - useParams, - useSearch, - useRouteContext, - useRouter, - useRouterState, - useLocation, - useCanGoBack, - useElementScrollRestoration, - useTags, - Await, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScrollRestoration, - Block, - ScriptOnce, - Asset, - HeadContent, - Scripts, - ] - - globalThis.__TANSTACK_BUNDLE_SIZE_KEEP__ = { - hooksAndComponents, - startSurface, - } - - void awaited - void linkFactoryResult - void matches() - void parentMatches() - void childMatches() - void match() - void loaderDeps() - void loaderData() - void params() - void search() - void routeContext() - void routerState() - void location() - void canGoBack() - void navigate - void scrollEntry - void tags() - void routeMatchResult() - void invokeServerFn - - return ( - - - - - - {'window.__tsr_bundle_size = true'} - - home - - - - {() => } - }> - - - - {() => } - - false} disabled withResolver={false}> - {() => } - - }> - - - - {() => } - - - - -
-
hello world
-
- - - ) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/index.tsx deleted file mode 100644 index 01d3b701ae..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-full/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts deleted file mode 100644 index 0bd21e64f4..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-full/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), solid({ ssr: true })], -}) diff --git a/benchmarks/bundle-size/scenarios/solid-start-minimal/src/router.tsx b/benchmarks/bundle-size/scenarios/solid-start-minimal/src/router.tsx deleted file mode 100644 index aa7ead6752..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-minimal/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/index.tsx deleted file mode 100644 index 01d3b701ae..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-minimal/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts deleted file mode 100644 index 0bd21e64f4..0000000000 --- a/benchmarks/bundle-size/scenarios/solid-start-minimal/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), solid({ ssr: true })], -}) diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/index.html b/benchmarks/bundle-size/scenarios/vue-router-full/index.html deleted file mode 100644 index 583379e36c..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-full/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - vue-router-full - - -
- - - diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/src/main.tsx b/benchmarks/bundle-size/scenarios/vue-router-full/src/main.tsx deleted file mode 100644 index 84d5f29df5..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-full/src/main.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createApp } from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ - routeTree, - scrollRestoration: true, -}) - -declare module '@tanstack/vue-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element `#app` not found') -} -if (!rootElement.innerHTML) { - createApp({ - setup() { - return () => - }, - }).mount('#app') -} diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx deleted file mode 100644 index 0ff40aebfc..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/__root.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { defineComponent } from 'vue' -import { - Asset, - Await, - Block, - Body, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - HeadContent, - Html, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScriptOnce, - Scripts, - ScrollRestoration, - createLink, - createRootRoute, - linkOptions, - useAwaited, - useBlocker, - useCanGoBack, - useChildMatches, - useElementScrollRestoration, - useLinkProps, - useLoaderData, - useLoaderDeps, - useLocation, - useMatch, - useMatchRoute, - useMatches, - useNavigate, - useParams, - useParentMatches, - useRouteContext, - useRouter, - useRouterState, - useSearch, - useTags, -} from '@tanstack/vue-router' - -const RootComponent = defineComponent({ - setup() { - const router = useRouter() - const [awaited] = useAwaited({ promise: Promise.resolve('ready') }) - const linkProps = useLinkProps({ to: '/' } as any) - const matchRoute = useMatchRoute() - const matches = useMatches() - const parentMatches = useParentMatches() - const childMatches = useChildMatches() - const match = useMatch({ strict: false, shouldThrow: false } as any) - const loaderDeps = useLoaderDeps({ strict: false } as any) - const loaderData = useLoaderData({ strict: false } as any) - const params = useParams({ strict: false } as any) - const search = useSearch({ strict: false } as any) - const routeContext = useRouteContext({ strict: false } as any) - const routerState = useRouterState({ - select: (state) => state.status, - } as any) - const location = useLocation() - const canGoBack = useCanGoBack() - const navigate = useNavigate() - const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() - - useBlocker({ - shouldBlockFn: () => false, - disabled: true, - withResolver: false, - }) - - const linkFactoryResult = linkOptions({ to: '/' } as any) - const routeMatchResult = matchRoute({ to: '/' } as any) - const SvgLink = createLink('svg') - - const hooksAndComponents = [ - useAwaited, - useLinkProps, - useMatchRoute, - useMatches, - useParentMatches, - useChildMatches, - useMatch, - useLoaderDeps, - useLoaderData, - useBlocker, - useNavigate, - useParams, - useSearch, - useRouteContext, - useRouter, - useRouterState, - useLocation, - useCanGoBack, - useElementScrollRestoration, - useTags, - Await, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScrollRestoration, - Block, - ScriptOnce, - Asset, - HeadContent, - Scripts, - Body, - Html, - ] - - ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = { - hooksAndComponents, - } - - return () => { - void awaited - void linkFactoryResult - void matches.value - void parentMatches.value - void childMatches.value - void match.value - void loaderDeps.value - void loaderData.value - void params.value - void search.value - void routeContext.value - void routerState.value - void location.value - void canGoBack.value - void navigate - void scrollEntry - void tags() - void routeMatchResult.value - - return ( - <> - - {'window.__tsr_bundle_size = true'} - - home - - - - - {() => } - - }> - - - } - /> - false} disabled withResolver={false}> - {() => } - - }> - - - - - - - - -
-
hello world
-
- - ) - } - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/index.tsx deleted file mode 100644 index bf165a33b5..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-full/src/routes/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { - createFileRoute, - retainSearchParams, - stripSearchParams, -} from '@tanstack/vue-router' - -const defaultSearch = { page: 1 } - -export const Route = createFileRoute('/')({ - search: { - middlewares: [ - retainSearchParams>(['persist']), - stripSearchParams(defaultSearch), - ], - }, - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/vue-router-full/vite.config.ts b/benchmarks/bundle-size/scenarios/vue-router-full/vite.config.ts deleted file mode 100644 index 5556bfaa07..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-full/vite.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'vue', - autoCodeSplitting: true, - }), - vue(), - vueJsx(), - ], -}) diff --git a/benchmarks/bundle-size/scenarios/vue-router-minimal/index.html b/benchmarks/bundle-size/scenarios/vue-router-minimal/index.html deleted file mode 100644 index e3fe534a21..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-minimal/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - vue-router-minimal - - -
- - - diff --git a/benchmarks/bundle-size/scenarios/vue-router-minimal/src/main.tsx b/benchmarks/bundle-size/scenarios/vue-router-minimal/src/main.tsx deleted file mode 100644 index 1fc66c27b1..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-minimal/src/main.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createApp } from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ routeTree }) - -declare module '@tanstack/vue-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element `#app` not found') -} -if (!rootElement.innerHTML) { - createApp({ - setup() { - return () => - }, - }).mount('#app') -} diff --git a/benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/index.tsx deleted file mode 100644 index 3899022bdd..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-minimal/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/vue-router-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/vue-router-minimal/vite.config.ts deleted file mode 100644 index 5556bfaa07..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-router-minimal/vite.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'vue', - autoCodeSplitting: true, - }), - vue(), - vueJsx(), - ], -}) diff --git a/benchmarks/bundle-size/scenarios/vue-start-full/src/router.tsx b/benchmarks/bundle-size/scenarios/vue-start-full/src/router.tsx deleted file mode 100644 index 9b893112b4..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-full/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx deleted file mode 100644 index 8e8870a2ce..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/__root.tsx +++ /dev/null @@ -1,227 +0,0 @@ -import { defineComponent } from 'vue' -import { - Asset, - Await, - Block, - Body, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - HeadContent, - Html, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScriptOnce, - Scripts, - ScrollRestoration, - createLink, - createRootRoute, - linkOptions, - useAwaited, - useBlocker, - useCanGoBack, - useChildMatches, - useElementScrollRestoration, - useLinkProps, - useLoaderData, - useLoaderDeps, - useLocation, - useMatch, - useMatchRoute, - useMatches, - useNavigate, - useParams, - useParentMatches, - useRouteContext, - useRouter, - useRouterState, - useSearch, - useTags, -} from '@tanstack/vue-router' -import { - createMiddleware, - createServerFn, - useServerFn, -} from '@tanstack/vue-start' - -const requestMiddleware = createMiddleware().server(async ({ next }) => { - return next() -}) - -const functionMiddleware = createMiddleware({ type: 'function' }) - .client(async ({ next }) => { - return next() - }) - .server(async ({ next }) => { - return next() - }) - -const helloServerFn = createServerFn({ method: 'GET' }) - .middleware([requestMiddleware, functionMiddleware]) - .handler(async () => { - return 'hello from server fn' - }) - -const RootComponent = defineComponent({ - setup() { - const router = useRouter() - const [awaited] = useAwaited({ promise: Promise.resolve('ready') }) - const linkProps = useLinkProps({ to: '/' } as any) - const matchRoute = useMatchRoute() - const matches = useMatches() - const parentMatches = useParentMatches() - const childMatches = useChildMatches() - const match = useMatch({ strict: false, shouldThrow: false } as any) - const loaderDeps = useLoaderDeps({ strict: false } as any) - const loaderData = useLoaderData({ strict: false } as any) - const params = useParams({ strict: false } as any) - const search = useSearch({ strict: false } as any) - const routeContext = useRouteContext({ strict: false } as any) - const routerState = useRouterState({ - select: (state) => state.status, - } as any) - const location = useLocation() - const canGoBack = useCanGoBack() - const navigate = useNavigate() - const scrollEntry = useElementScrollRestoration({ id: 'root-scroll' }) - const tags = useTags() - const invokeServerFn = useServerFn(helloServerFn) - - useBlocker({ - shouldBlockFn: () => false, - disabled: true, - withResolver: false, - }) - - const linkFactoryResult = linkOptions({ to: '/' } as any) - const routeMatchResult = matchRoute({ to: '/' } as any) - const SvgLink = createLink('svg') - - const startSurface = [createMiddleware, createServerFn, useServerFn] - const hooksAndComponents = [ - useAwaited, - useLinkProps, - useMatchRoute, - useMatches, - useParentMatches, - useChildMatches, - useMatch, - useLoaderDeps, - useLoaderData, - useBlocker, - useNavigate, - useParams, - useSearch, - useRouteContext, - useRouter, - useRouterState, - useLocation, - useCanGoBack, - useElementScrollRestoration, - useTags, - Await, - CatchBoundary, - CatchNotFound, - ClientOnly, - DefaultGlobalNotFound, - ErrorComponent, - Link, - Match, - MatchRoute, - Matches, - Navigate, - Outlet, - RouterContextProvider, - ScrollRestoration, - Block, - ScriptOnce, - Asset, - HeadContent, - Scripts, - Body, - Html, - ] - - ;(globalThis as any).__TANSTACK_BUNDLE_SIZE_KEEP__ = { - hooksAndComponents, - startSurface, - } - - return () => { - void awaited - void linkFactoryResult - void matches.value - void parentMatches.value - void childMatches.value - void match.value - void loaderDeps.value - void loaderData.value - void params.value - void search.value - void routeContext.value - void routerState.value - void location.value - void canGoBack.value - void navigate - void scrollEntry - void tags() - void routeMatchResult.value - void invokeServerFn - - return ( - - - - - - {'window.__tsr_bundle_size = true'} - - home - - - - - {() => } - - }> - - - } - /> - false} disabled withResolver={false}> - {() => } - - }> - - - - - - - - -
-
hello world
-
- - - ) - } - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/index.tsx deleted file mode 100644 index 3899022bdd..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-full/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/vue-start-full/vite.config.ts b/benchmarks/bundle-size/scenarios/vue-start-full/vite.config.ts deleted file mode 100644 index 3005d7504b..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-full/vite.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), vue(), vueJsx()], -}) diff --git a/benchmarks/bundle-size/scenarios/vue-start-minimal/src/router.tsx b/benchmarks/bundle-size/scenarios/vue-start-minimal/src/router.tsx deleted file mode 100644 index 9b893112b4..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-minimal/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/benchmarks/bundle-size/scenarios/vue-start-minimal/src/routes/__root.tsx b/benchmarks/bundle-size/scenarios/vue-start-minimal/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-minimal/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/bundle-size/scenarios/vue-start-minimal/src/routes/index.tsx b/benchmarks/bundle-size/scenarios/vue-start-minimal/src/routes/index.tsx deleted file mode 100644 index 3899022bdd..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-minimal/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
hello world
-} diff --git a/benchmarks/bundle-size/scenarios/vue-start-minimal/vite.config.ts b/benchmarks/bundle-size/scenarios/vue-start-minimal/vite.config.ts deleted file mode 100644 index 3005d7504b..0000000000 --- a/benchmarks/bundle-size/scenarios/vue-start-minimal/vite.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' - -export default defineConfig({ - plugins: [tanstackStart(), vue(), vueJsx()], -}) diff --git a/benchmarks/bundle-size/tsconfig.json b/benchmarks/bundle-size/tsconfig.json deleted file mode 100644 index ec9f5c598c..0000000000 --- a/benchmarks/bundle-size/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "target": "ESNext", - "module": "ESNext", - "moduleResolution": "Bundler", - "jsx": "preserve", - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/benchmarks/client-nav/README.md b/benchmarks/client-nav/README.md deleted file mode 100644 index ec34ecc0c1..0000000000 --- a/benchmarks/client-nav/README.md +++ /dev/null @@ -1,307 +0,0 @@ -# Client Navigation Benchmarks - -Cross-framework client-side CPU benchmarks for: - -- `@tanstack/react-router` -- `@tanstack/solid-router` -- `@tanstack/vue-router` - -The benchmarks run in jsdom against production builds of real apps, and are -tracked in CI by CodSpeed (simulation mode). - -> **Scope:** these benchmarks cover the client router. The hydration -> scenarios also cover DOM hydration and the Router state-restoration path -> used by Start. Start-specific entry-point initialization, streamed payload -> arrival and client server-function calls are not included. Server request work -> is covered by `benchmarks/ssr`. - -## Layout - -- `react/`, `solid/`, `vue/` - baseline benchmark (mixed navigation loop) + Vitest config -- `vitest.react.config.ts`, `vitest.solid.config.ts`, `vitest.vue.config.ts` - per-framework aggregate configs that run the baseline first, then scenario projects -- `scenarios/harness.ts` - shared scenario runner (mount, link-click steps, `onRendered` synchronization) -- `scenarios//shared.ts` - framework-agnostic scenario definition (workload data, step sequence, assertions, bench options) -- `scenarios///` - isolated scenario apps - -Scenario app layout: - -```text -scenarios/// - vite.config.ts - speed.bench.ts - speed.flame.ts - setup.ts - project.json - tsconfig.json - src/ - main.tsx - routeTree.gen.ts - routes/ -``` - -Navigation scenario apps use file-based routing (`@tanstack/router-plugin`) with a -generated `routeTree.gen.ts`, like a regular user app. Each scenario uses one -app per framework instead of sharing routes in the baseline app. This keeps -route-tree size and router options isolated so one scenario cannot shift -another scenario's numbers. The existing baseline apps and bench names stay -stable for CodSpeed continuity. - -## Scenario Responsibilities - -Each scenario isolates one client-side responsibility so benchmark changes can -be attributed to a specific feature area. - -| Scenario | Client-side responsibility | -| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| `react/`, `solid/`, `vue/` baseline apps | Mixed navigation loop: path params, search params, route context, and `useParams`/`useSearch`/`useLoaderData` selector subscriptions. | -| `async-pipeline` | The router's async pipeline via counted 0ms timer hops: async loaders (transition-held navigation), async `beforeLoad` context, and parallel nested async loaders. Component-level `Await`/Suspense is excluded: React 19 throttles Suspense reveals by ~300ms wall-clock, which is inherently non-deterministic to benchmark. | -| `control-flow` | Loader-thrown `redirect` (including a 2-hop chain), `notFound()` with `notFoundComponent`, loader errors with `errorComponent`, and boundary reset on recovery navigation. | -| `head` | `HeadContent` per-navigation work: nested route `head()` evaluation, title/meta/link dedupe across matches, and head tag DOM updates during navigation. | -| `history` | History push/replace/back/forward traversal, location masking, registered-but-never-blocking `useBlocker`, and `useCanGoBack`/`useLocation` subscriptions. | -| `hydration` | Initial DOM hydration: execute the SSR payload, restore `beforeLoad` context and loader data, and hydrate 192 ordinary and eight hash-sensitive Links through their follow-up effects in React and Solid. | -| `link-churn` | Links that depart, stay and mount: 30 `/hub` layout Links stay while 100 `/hub/list` leaf Links leave (alone, or with the layout to `/other`) and remount on return; a search-only change rebuilds updater and `to="."` Links. Unlike `links`, whose root-layout Links never depart. | -| `links` | Per-navigation cost of ~200 mounted ``s: link prop building, active-state recompute across `activeOptions` variants, `activeProps` swaps, and `useMatchRoute` probes (the `MatchRoute` component is avoided: vue-router's implementation leaks one subscription per render). | -| `loaders` | Client loader dispatch: always-stale re-runs (`staleTime: 0`), cached revisits (re-run once per lap by the `invalidate` step), `loaderDeps`-keyed caching, `router.invalidate()`, and `useLoaderData` selectors. | -| `mount` | Cold start: `createRouter` (route-tree processing) + first render + initial `router.load()` + unmount, with a fresh router per mount. | -| `nested-params` | Deep nesting (8 dynamic levels): per-level `params.parse`/`stringify`, `beforeLoad` context accumulation across matches, and per-level `useParams`/`useRouteContext` subscriptions. Param values include characters requiring percent-encoding (as do `route-tree-scale`'s), so segment encode/decode paths run on every navigation. | -| `preload` | Intent preloading from hover events, programmatic `router.preloadRoute`, deterministic preload cache behavior (`defaultPreloadStaleTime: 0`), and commit-time cache maintenance. | -| `rewrites` | Composed client-side location rewrites: router `basepath` plus a locale input/output rewrite pair, running on every href build and location parse (the client analog of the SSR `rewrites` scenario). | -| `route-tree-scale` | Route matching and link-target resolution on a wide (~40 route) tree mixing static, dynamic, prefixed-param, splat, pathless-layout, and route-group paths, with `autoCodeSplitting` enabled so navigations also resolve lazy route chunks. | -| `search-params` | `validateSearch` execution, search middlewares (`retainSearchParams`/`stripSearchParams`), functional search updaters, structural sharing, and `useSearch` selector subscriptions. | - -## Conventions - -The hydration scenario has the separate lifecycle described below. The other -scenarios follow these navigation/mount conventions: - -- Apps are built with `NODE_ENV=production` (`minify: false`) into `dist/app.js`; benches import the built bundle, so production package builds and production JSX output are measured, not dev transforms. -- 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). - -## Run - -Run all benchmarks through Nx so dependency builds are part of the graph: - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf --outputStyle=stream --skipRemoteCache -``` - -Run framework-specific benchmarks (baseline + all scenarios): - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:react --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:solid --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:perf:vue --outputStyle=stream --skipRemoteCache -``` - -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 --mode benchmark --config ./scenarios///vite.config.ts -``` - -Run framework-specific flame benchmarks (10 second loop, profiled with `@platformatic/flame`, forced to `NODE_ENV=production`): - -```bash -# baseline -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:react --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:solid --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:flame:vue --outputStyle=stream --skipRemoteCache -# scenarios -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav--:test:flame --outputStyle=stream --skipRemoteCache -``` - -Typecheck benchmark sources (baseline + scenarios): - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav:test:types --outputStyle=stream --skipRemoteCache -``` - -## Hydration - -`scenarios/hydration/{react,solid}` provide the same initial-hydration -workload: 192 ordinary Links, eight hash-sensitive Links, and three matched -routes with three `beforeLoad` contexts and two loader results. The server URL -has no fragment; the client URL has `#details`, matching half of the hash-sensitive Links. - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-hydration-react:test:perf --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-hydration-react:test:unit --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/client-nav-hydration-react:test:types:client --outputStyle=stream --skipRemoteCache -``` - -Replace `react` with `solid` to run the other adapter. - -The build generates static HTML and its real Router SSR bootstrap scripts once -with `createRequestHandler` and the adapter's streaming renderer. Generation -fully consumes the response and runs outside the CodSpeed action. The measured -worker only reads these artifacts; it does not import a server renderer or start a server. - -Each invocation uses a fresh jsdom window and a fresh evaluation of the complete -production client bundle in that window's realm. HTML parsing, bundle evaluation, -and the initial document lifecycle finish in untimed setup. This resets module -state as well as the DOM, avoiding cached hydration promises and cross-realm -payload objects. The bundle and bootstrap scripts are compiled once, so this -measures a fresh application with warm code, not JavaScript download/parse cost. - -The timed region executes the serialized payload, creates the router and its -small code-based route tree, calls the public client `hydrate` API, and hydrates -the existing DOM with the framework's native renderer: - -- **React:** a separate completion component signals from its post-hydration - effect, after the same snapshot transition as hash-sensitive Links. The harness - awaits that signal and two idle React scheduler turns, then checks the expected - active links. The window's `performance.now()` is frozen, so React's - scheduler yields only to paint after commits, not after 5 ms of wall time, which CPU - instrumentation stretches by a runner-dependent factor. Each sample therefore - uses the same number of scheduler tasks. `Date.now()` is unchanged. A - 60-second watchdog fails a sample that never settles. -- **Solid:** execute the native hydration bootstrap and retain the server's - component/key hierarchy. Wait for mount, the router's rendered event, active-link - effects, and two idle turns. DOM identity assertions include every workload - element so template fallback cannot silently replace server nodes. - -Solid bounds settlement to 100 turns. Ending at the hydration call or the -first mount would miss post-hydration Link updates. -Timer turns use `setImmediate`; scrolling is a no-op -because this is CPU simulation rather than browser layout/paint measurement. - -Untimed assertions verify restored contexts and every loader row, zero client -`beforeLoad`/loader calls, expected hrefs/active state, original DOM-node identity, -working event handlers, and absence of hydration errors. Root unmount, pending -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. - -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 -hydration optimization. Regenerate each revision's artifacts with identical -fixture data and dependencies; do not pin an old hydration wire format forever. - -## Isolated route-tree construction - -`scenarios/route-tree-scale` measures navigation over an existing tree, not -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 --reporter=json --outputFile=/tmp/route-tree-construction.json -``` - -It covers 100, 1,000, and 10,000 static, dynamic, nested, or mixed routes. -The processing-only case creates fresh route objects in an untimed -`beforeEach`, then measures `processRouteTree` and `route.init`. A separate -case includes route-object creation. Neither case measures first interpolation -or navigation. Remove the name filter to run all sizes. Compare identical -benchmark sources in separate checkouts and repeat fresh processes; a cached -router or repeatedly initialized tree is not a construction baseline. - -## Opt-in React Link performance suite - -`link-performance/` contains additional client-navigation and SSR workloads for -focused Link work. They are **not included** in the regular client-nav/SSR -aggregate projects or their CodSpeed build dependencies; they only run through -the dedicated `@benchmarks/react-link-performance` targets below. Use `-t` to -narrow a run to specific cases. - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:client --outputStyle=stream --skipRemoteCache -- --run -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" --reporter=json --outputFile=/tmp/link-perf.json -``` - -The cases cover repeated versus unique destination params, updater functions, -relative/inherited values, search middleware chains, param stringification, -optional and splat segments, encoding, masks, basepath/rewrites, and active -props with structured search. These exercise different costs: cache hits and -misses, parameter cloning, callbacks, middleware traversal, URI encoding, -building masked/public locations, active-state comparisons, and prop merging. -Existing preload, mount, and route-tree-scale scenarios remain responsible for -those separate workloads. - -- **Client:** 200 persistent measured Links, four control Links, and eight - completed navigations per timed batch. The existing client harness checks - hrefs and active state during its untimed warm-up lap. Control navigations - replace the history entry, keeping history size constant. Post-measurement - assertions also check that the measured anchors stayed mounted. -- **SSR:** four fresh-router requests per timed batch, each rendering 200 - measured Links through `RouterProvider` and `renderToString`. Router creation, - `router.load()`, rendering, and history cleanup are included. This isolates - Router SSR Link work, not Start HTTP handling, dehydration, or streaming. - HTML assertions run outside the timed batch. -- Both use the same code-based workload definitions and production JSX/library - builds. The regular Vitest entry points use at least 100 warm-up iterations, - one second of warm-up time, and five-second measurement windows. The client - and server bundles assert their resolved `isServer` environment. React and - React DOM remain external so comparisons can share the same renderer runtime. - These bundles are Node-hosted (jsdom for client mode), not browser deployments. - -Run the gate tests and typecheck separately: - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:unit --outputStyle=stream --skipRemoteCache -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:types --outputStyle=stream --skipRemoteCache -``` - -For before/after comparisons, use identical benchmark files and dependencies -on both refs, build each ref through its Nx targets, and alternate fresh -Vitest processes. Report the actual refs, per-case means and relative margins -of error; rerun noisy or borderline results with `-t` rather than interpreting -a small difference as a proven speedup. Client and SSR times have different -batch units and should not be compared directly. - -### Stable paired comparisons - -For regression decisions, prefer the paired runner over a whole-file Vitest -run. It starts a fresh process for every case and repetition, avoiding JIT -feedback from earlier cases. Inside each process, both revisions share the -same production React installation but have separate router/app modules and -router instances. Initialization order alternates between repetitions. -Built snapshots are staged under `node_modules/.cache` so the TypeScript -harness loader does not transpile their emitted JavaScript a second time. - -```bash -# Build the baseline using these same benchmark sources in its own checkout. -# --baseline points to that checkout's link-performance/dist directory. -pnpm nx run @benchmarks/react-link-performance:test:perf:stable -- \ - --baseline /path/to/baseline/benchmarks/client-nav/link-performance/dist \ - --outputJson /tmp/paired-links.json - -# Narrow a comparison, or increase independent process repetitions. -pnpm nx run @benchmarks/react-link-performance:test:perf:stable -- \ - --baseline /path/to/baseline/benchmarks/client-nav/link-performance/dist \ - --mode ssr -t "middleware|unique-params" --repeats 6 \ - --outputJson /tmp/paired-links-ssr.json -``` - -The runner requires Node with `process.threadCpuUsage` (Node 24 works). -It fixes V8 random/hash seeds, warms each variant for at least two seconds -and 100 batches, then alternates ABBA/BAAB blocks calibrated to roughly 500 ms. -Both variants do exactly the same number of batches per block. It records -main-thread CPU time, wall time, and whole-process CPU time; GC during -measurement is not disabled or discarded. - -The default is four independent process repetitions. Reported 95% intervals -use their paired log-ratios, not the many correlated batches as independent -samples. A faster/slower verdict requires CPU and wall intervals to agree. -Intervals overlapping zero or disagreeing metrics are inconclusive; narrow -intervals entirely inside +/-2% are reported separately. - -An A/A calibration uses the current `dist` directory as `--baseline`. Its -intervals should contain zero before trusting similarly sized A/B differences. -Shared-machine contention can still make small changes unresolved. Do not -interpret a point estimate alone, or an inconclusive result, as proof that -a workload is unchanged. diff --git a/benchmarks/client-nav/jsdom.ts b/benchmarks/client-nav/jsdom.ts deleted file mode 100644 index 855c2a2316..0000000000 --- a/benchmarks/client-nav/jsdom.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { JSDOM } from 'jsdom' - -const dom = new JSDOM('', { - url: 'http://localhost/', -}) - -const { window } = dom - -function setGlobal(name: string, value: unknown) { - Object.defineProperty(globalThis, name, { - value, - configurable: true, - writable: true, - }) -} - -setGlobal('window', window) -setGlobal('document', window.document) -setGlobal('self', window) -setGlobal('navigator', window.navigator) -setGlobal('location', window.location) -setGlobal('history', window.history) -setGlobal('HTMLElement', window.HTMLElement) -setGlobal('Element', window.Element) -setGlobal('SVGElement', window.SVGElement) -setGlobal('DocumentFragment', window.DocumentFragment) -setGlobal('Node', window.Node) -setGlobal('MouseEvent', window.MouseEvent) -setGlobal('MutationObserver', window.MutationObserver) -setGlobal('sessionStorage', window.sessionStorage) -setGlobal('localStorage', window.localStorage) -setGlobal('getComputedStyle', window.getComputedStyle.bind(window)) -setGlobal('addEventListener', window.addEventListener.bind(window)) -setGlobal('removeEventListener', window.removeEventListener.bind(window)) -setGlobal('dispatchEvent', window.dispatchEvent.bind(window)) -setGlobal('CustomEvent', window.CustomEvent) -setGlobal('Event', window.Event) - -setGlobal( - 'requestAnimationFrame', - window.requestAnimationFrame?.bind(window) ?? - ((callback: (time: number) => void) => - setTimeout(() => callback(performance.now()), 16)), -) - -setGlobal( - 'cancelAnimationFrame', - window.cancelAnimationFrame?.bind(window) ?? - ((handle: number) => clearTimeout(handle)), -) - -window.scrollTo = () => {} -setGlobal('scrollTo', () => {}) - -export { window } diff --git a/benchmarks/client-nav/link-performance/cases.ts b/benchmarks/client-nav/link-performance/cases.ts deleted file mode 100644 index a25eac563b..0000000000 --- a/benchmarks/client-nav/link-performance/cases.ts +++ /dev/null @@ -1,360 +0,0 @@ -export const LINK_CASES = [ - { - id: 'shared-params', - label: 'Shared string params', - description: '200 persistent Links reuse 40 string parameter values.', - }, - { - id: 'unique-params', - label: 'Unique string params', - description: '200 distinct parameter values exceed the 128-result cache.', - }, - { - id: 'param-updaters', - label: 'Parameter updaters', - description: 'Parameter functions derive destinations from current params.', - }, - { - id: 'location-updaters', - label: 'Search, hash and state updaters', - description: - 'Functions derive search, hash and history state from the source.', - }, - { - id: 'relative', - label: 'Relative targets', - description: 'Parent and child targets inherit current params and search.', - }, - { - id: 'middleware', - label: 'Search middleware chain', - description: - 'Retain a tenant, strip a default page and normalize a filter.', - }, - { - id: 'numeric-params', - label: 'Numeric params', - description: 'Parse numbers, update them numerically and stringify them.', - }, - { - id: 'optional-params', - label: 'Optional segments', - description: 'Set, inherit and explicitly clear an optional path segment.', - }, - { - id: 'splats', - label: 'Splat params', - description: 'Empty, multi-segment and encoded splat values.', - }, - { - id: 'encoding', - label: 'Allowed path characters', - description: 'Preserve allowed @, : and + while encoding other characters.', - }, - { - id: 'masks', - label: 'Explicit route masks', - description: - 'Build a different public path and search for each destination.', - }, - { - id: 'rewrites', - label: 'Basepath and rewrites', - description: 'Compose /app with input/output locale path rewrites.', - }, - { - id: 'active', - label: 'Active props and structured search', - description: - 'Exact, fuzzy and search matching with props and render children.', - }, -] as const - -export type LinkCaseId = (typeof LINK_CASES)[number]['id'] - -export const LINK_COUNT = 200 -export const NAVIGATION_STATES = [1, 2, 3, 0] as const -export const LOCALES = ['en', 'fr', 'de', 'es'] as const - -export interface Filter { - tag: string - flags: { open: boolean } - tags: Array -} - -export interface LinkSearch { - page?: number - tenant?: string - filter?: Filter -} - -export function sourceFilter(index: number): Filter { - return { - tag: `group-${index}`, - flags: { open: index % 2 === 0 }, - tags: ['links', `state-${index}`], - } -} - -export function sourceSearch( - caseId: LinkCaseId, - stateIndex: number, -): Partial { - switch (caseId) { - case 'location-updaters': - case 'relative': - case 'middleware': - case 'active': - return { - page: stateIndex + 1, - tenant: `tenant-${stateIndex}`, - filter: sourceFilter(stateIndex), - } - case 'rewrites': - return { tenant: LOCALES[stateIndex] } - default: - return {} - } -} - -export function optionalCategory(stateIndex: number) { - return stateIndex % 2 === 0 ? `category-${stateIndex}` : undefined -} - -export function splatValue(index: number) { - switch (index % 4) { - case 0: - return '' - case 1: - return `folder/sub/file-${index % 40}` - case 2: - return 'a b/100%/caf\u00e9?#' - default: - return 'literal%2F/\u{1f680}' - } -} - -export function encodedValue(index: number) { - return `user-${index % 40}@mail.test:tag+value /?#% caf\u00e9` -} - -function url(pathname: string, search: Partial = {}, hash = '') { - const result = new URL(pathname, 'http://localhost') - for (const [key, value] of Object.entries( - search, - )) { - if (value !== undefined) { - result.searchParams.set( - key, - typeof value === 'object' ? JSON.stringify(value) : String(value), - ) - } - } - result.hash = hash - return result.pathname + result.search + result.hash -} - -function sourcePath(caseId: LinkCaseId, stateIndex: number) { - switch (caseId) { - case 'relative': - return `/teams/team-${stateIndex}/item-${stateIndex}` - case 'numeric-params': - return `/numbers/${stateIndex}` - case 'optional-params': { - const category = optionalCategory(stateIndex) - return `/optional/${category ? `${category}/` : ''}item-${stateIndex}` - } - case 'splats': - return `/files/source/state-${stateIndex}` - case 'encoding': - return `/encoded/source-${stateIndex}` - case 'active': - return `/items/item-${stateIndex}/details` - default: - return `/items/item-${stateIndex}` - } -} - -export function getSourceUrl(caseId: LinkCaseId, stateIndex: number): string { - if (!Number.isInteger(stateIndex) || stateIndex < 0 || stateIndex > 3) { - throw new Error(`Invalid Link performance state: ${stateIndex}`) - } - const pathname = sourcePath(caseId, stateIndex) - if (caseId === 'rewrites') { - return `/app/${LOCALES[stateIndex]}${pathname}` - } - return url( - pathname, - sourceSearch(caseId, stateIndex), - caseId === 'location-updaters' ? `source-${stateIndex}` : '', - ) -} - -// These expectations use fixture values and platform encoding, not router APIs. -function expectedHref(caseId: LinkCaseId, stateIndex: number, index: number) { - const itemId = `item-${index % 40}` - switch (caseId) { - case 'shared-params': - return `/items/${itemId}` - case 'unique-params': - return `/items/item-${index}` - case 'param-updaters': - return `/items/item-${stateIndex}-related-${index % 40}` - case 'location-updaters': - return url( - `/items/item-${stateIndex}`, - { - ...sourceSearch(caseId, stateIndex), - page: stateIndex + 2 + (index % 5), - }, - `source-${stateIndex}-link-${index % 5}`, - ) - case 'relative': - return url( - index % 2 === 0 - ? `/teams/team-${stateIndex}` - : `/teams/team-${stateIndex}/item-${stateIndex}/details`, - sourceSearch(caseId, stateIndex), - ) - case 'middleware': - return url(`/filtered/${itemId}`, { - tenant: `tenant-${stateIndex}`, - page: index % 2 === 0 ? undefined : 2, - filter: { ...sourceFilter(index % 4), tag: `LABEL-${index % 40}` }, - }) - case 'numeric-params': - return `/numbers/${stateIndex + (index % 40)}` - case 'optional-params': { - const category = - index % 3 === 0 - ? 'fixed' - : index % 3 === 1 - ? optionalCategory(stateIndex) - : undefined - return `/optional/${category ? `${category}/` : ''}${itemId}` - } - case 'splats': { - const value = splatValue(index) - return `/files${value ? `/${value.split('/').map(encodeURIComponent).join('/')}` : ''}` - } - case 'encoding': { - const value = encodeURIComponent(encodedValue(index)) - .replaceAll('%40', '@') - .replaceAll('%3A', ':') - .replaceAll('%2B', '+') - return `/encoded/${value}` - } - case 'masks': - return url(`/public/display-${index % 40}`, { - tenant: `mask-${index % 4}`, - }) - case 'rewrites': - return url(`/app/${LOCALES[index % 4]}/items/${itemId}`, { - page: (index % 3) + 1, - }) - case 'active': { - const item = Math.floor(index / 5) - const variant = index % 5 - const search = - variant < 3 - ? { filter: sourceFilter(item % 4) } - : { - ...sourceSearch('active', item % 4), - ...(variant === 4 ? { filter: undefined } : {}), - } - return url(`/items/item-${item}${variant < 2 ? '' : '/details'}`, search) - } - } -} - -function assertUrl( - actualHref: string | null, - expectedHref: string, - label: string, -) { - if (actualHref === null) { - throw new Error(`${label}: missing href`) - } - const actual = new URL(actualHref, 'http://localhost') - const expected = new URL(expectedHref, 'http://localhost') - // Query ordering and the platform's '+' versus '%20' are immaterial here. - const query = (value: URL) => - JSON.stringify([...value.searchParams.entries()].sort()) - if ( - actual.origin !== expected.origin || - actual.pathname !== expected.pathname || - actual.hash !== expected.hash || - query(actual) !== query(expected) - ) { - throw new Error( - `${label}: expected ${expectedHref}, received ${actualHref}`, - ) - } -} - -export function assertScenario( - caseId: LinkCaseId, - stateIndex: number, - root: ParentNode, -): void { - const source = root.querySelector('[data-testid="source-path"]') - if (source?.textContent !== sourcePath(caseId, stateIndex)) { - throw new Error( - `${caseId}/${stateIndex}: unexpected source path ${source?.textContent}`, - ) - } - const links = root.querySelectorAll('a[data-perf-link]') - if (links.length !== LINK_COUNT) { - throw new Error( - `${caseId}: expected ${LINK_COUNT} Links, got ${links.length}`, - ) - } - for (const [index, link] of links.entries()) { - const label = `${caseId}/${stateIndex}/link-${index}` - if (link.getAttribute('data-perf-link') !== String(index)) { - throw new Error(`${label}: unexpected Link order`) - } - assertUrl( - link.getAttribute('href'), - expectedHref(caseId, stateIndex, index), - label, - ) - let active: boolean | undefined - if (caseId === 'shared-params') { - active = index % 40 === stateIndex - } else if (caseId === 'unique-params') { - active = index === stateIndex - } else if (caseId === 'active') { - active = - Math.floor(index / 5) === stateIndex && [0, 2, 3].includes(index % 5) - if ( - link.textContent !== `${index}:${active ? 'active' : 'inactive'}` || - link.getAttribute('title') !== (active ? 'active' : 'inactive') || - !link.classList.contains(active ? 'perf-active' : 'perf-inactive') || - link.style.color !== (active ? 'green' : 'gray') || - link.style.opacity !== '0.8' - ) { - throw new Error( - `${label}: active props or render children are incorrect`, - ) - } - } - if ( - active !== undefined && - (link.getAttribute('data-status') === 'active') !== active - ) { - throw new Error(`${label}: expected active=${active}`) - } - } - for (let state = 0; state < 4; state++) { - const control = root.querySelector(`[data-testid="go-state-${state}"]`) - if (!control || control.hasAttribute('data-perf-link')) { - throw new Error(`${caseId}: missing or measured control Link ${state}`) - } - assertUrl( - control.getAttribute('href'), - getSourceUrl(caseId, state), - `${caseId}/control-${state}`, - ) - } -} diff --git a/benchmarks/client-nav/link-performance/client.bench.ts b/benchmarks/client-nav/link-performance/client.bench.ts deleted file mode 100644 index f819fab52b..0000000000 --- a/benchmarks/client-nav/link-performance/client.bench.ts +++ /dev/null @@ -1,30 +0,0 @@ -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' - -const appModulePath = './dist/client/app.js' -const app: typeof App = await import(/* @vite-ignore */ appModulePath) -if (app.serverEnvironment !== false) { - throw new Error('Link client benchmarks must use the production client build') -} - -for (const { id, label } of LINK_CASES) { - test(label, async ({ bench }) => { - const scenario = createClientScenario(app, id) - function finish() { - try { - scenario.check() - } finally { - scenario.teardown() - } - } - - await bench( - `client Links: ${id}`, - benchLifecycle({ before: scenario.setup, after: finish }), - scenario.batch, - ).run(samplingOptions) - }) -} diff --git a/benchmarks/client-nav/link-performance/config.test.ts b/benchmarks/client-nav/link-performance/config.test.ts deleted file mode 100644 index 1a468a3169..0000000000 --- a/benchmarks/client-nav/link-performance/config.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { afterEach, describe, expect, test, vi } from 'vitest' -import { createLinkPerformanceConfig } from './config' - -afterEach(() => vi.unstubAllEnvs()) - -describe.each(['client', 'ssr'] as const)('%s configuration', (target) => { - test('discovers only the requested suite', () => { - const config = createLinkPerformanceConfig(target) - expect(config.test?.benchmark?.include).toEqual([`${target}.bench.ts`]) - }) - - test('builds production code for the correct environment', () => { - const config = createLinkPerformanceConfig(target) - expect(config.define?.['process.env.NODE_ENV']).toBe('"production"') - expect(config.resolve?.conditions).toContain( - target === 'ssr' ? 'node' : 'browser', - ) - expect(config.build?.ssr).toBe(target === 'ssr') - expect(config.build?.outDir).toBe(`./dist/${target}`) - expect(config.build?.rolldownOptions?.platform).toBe('node') - expect(config.build?.rolldownOptions?.external).toEqual([ - 'node:module', - 'module', - /^react(?:\/|$)/, - /^react-dom(?:\/|$)/, - ]) - }) - - test('does not retransform built bundles in the test environment', () => { - vi.stubEnv('VITEST', 'true') - const config = createLinkPerformanceConfig(target) - expect(config.ssr?.noExternal).toBeUndefined() - expect(config.test?.server?.deps?.external).toEqual([ - /\/link-performance\/dist\//, - ]) - }) - - test('bundles router dependencies when building app snapshots', () => { - vi.stubEnv('VITEST', undefined) - expect(createLinkPerformanceConfig(target).ssr?.noExternal).toBe(true) - }) -}) diff --git a/benchmarks/client-nav/link-performance/config.ts b/benchmarks/client-nav/link-performance/config.ts deleted file mode 100644 index 416b027057..0000000000 --- a/benchmarks/client-nav/link-performance/config.ts +++ /dev/null @@ -1,69 +0,0 @@ -import { fileURLToPath } from 'node:url' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import type { UserConfig } from 'vite' - -const root = fileURLToPath(new URL('.', import.meta.url)) - -export function createLinkPerformanceConfig( - target: 'client' | 'ssr', -): UserConfig { - const server = target === 'ssr' - - return { - root, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - resolve: { - conditions: [server ? 'node' : 'browser', 'production'], - }, - ssr: { - noExternal: process.env.VITEST ? undefined : true, - resolve: { - conditions: ['node', 'production'], - }, - }, - build: { - outDir: `./dist/${target}`, - emptyOutDir: true, - minify: false, - ssr: server, - lib: { - entry: `${root}src/${target}.tsx`, - formats: ['es'], - fileName: 'app', - }, - rolldownOptions: { - platform: 'node', - external: [ - 'node:module', - 'module', - /^react(?:\/|$)/, - /^react-dom(?:\/|$)/, - ], - output: { entryFileNames: 'app.js' }, - }, - }, - test: { - name: `react-link-performance-${target}`, - watch: false, - environment: server ? 'node' : 'jsdom', - setupFiles: server ? [] : ['../vitest.setup.ts'], - server: { - deps: { - external: [/\/link-performance\/dist\//], - }, - }, - include: [], - benchmark: { - include: [`${target}.bench.ts`], - }, - }, - } -} diff --git a/benchmarks/client-nav/link-performance/project.json b/benchmarks/client-nav/link-performance/project.json deleted file mode 100644 index fd1751c081..0000000000 --- a/benchmarks/client-nav/link-performance/project.json +++ /dev/null @@ -1,103 +0,0 @@ -{ - "name": "@benchmarks/react-link-performance", - "projectType": "application", - "tags": ["optional-benchmark"], - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config ./link-performance/vite.client.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config ./link-performance/vite.ssr.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:perf:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./link-performance/vite.client.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:perf:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:ssr"], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./link-performance/vite.ssr.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:perf:stable": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client", "build:ssr"], - "options": { - "command": "NODE_ENV=production node --import=@swc-node/register/esm-register benchmarks/client-nav/link-performance/stable-runner.ts" - } - }, - "test:unit": { - "executor": "nx:run-commands", - "inputs": [ - "...", - "{workspaceRoot}/benchmarks/client-nav/scenarios/harness.ts", - "{workspaceRoot}/benchmarks/client-nav/scenarios/links/shared.ts", - "{workspaceRoot}/benchmarks/client-nav/setup-helpers.ts", - "{workspaceRoot}/benchmarks/client-nav/tsconfig.json" - ], - "dependsOn": [ - { - "projects": ["@tanstack/history"], - "target": "build" - } - ], - "options": { - "command": "vitest run --config ./link-performance/vitest.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:types": { - "executor": "nx:run-commands", - "inputs": [ - "...", - "{workspaceRoot}/benchmarks/client-nav/jsdom.ts", - "{workspaceRoot}/benchmarks/client-nav/scenarios/harness.ts", - "{workspaceRoot}/benchmarks/client-nav/scenarios/links/shared.ts", - "{workspaceRoot}/benchmarks/client-nav/setup-helpers.ts", - "{workspaceRoot}/benchmarks/client-nav/tsconfig.json", - "{workspaceRoot}/benchmarks/client-nav/vitest.setup.ts" - ], - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p ./link-performance/tsconfig.json --noEmit", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/link-performance/scenario.ts b/benchmarks/client-nav/link-performance/scenario.ts deleted file mode 100644 index f1a3fb6df7..0000000000 --- a/benchmarks/client-nav/link-performance/scenario.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { JSDOM } from 'jsdom' -import { createScenarioSetup } from '../scenarios/harness' -import { ticksPerIteration } from '../scenarios/links/shared' -import { NAVIGATION_STATES, assertScenario, getSourceUrl } from './cases' -import type { LinkCaseId } from './cases' -import type * as ClientApp from './src/client' -import type * as SsrApp from './src/ssr' - -export interface LinkScenario { - setup: () => Promise - batch: () => Promise - check: () => void - teardown: () => void -} - -export const samplingOptions = { - warmupIterations: 100, - warmupTime: 1_000, - time: 5_000, - throws: true, -} - -export function createClientScenario( - app: typeof ClientApp, - id: LinkCaseId, -): LinkScenario { - let mounted: ReturnType | undefined - let container: HTMLElement | undefined - let anchors: Array = [] - const test = createScenarioSetup({ - frameworkLabel: 'React', - mount: (element, history) => { - container = element - mounted = app.mountTestApp(element, history, id) - return mounted - }, - initialUrl: getSourceUrl(id, 0), - steps: NAVIGATION_STATES.map((state) => `go-state-${state}`), - assertAfterStep: (index, element) => { - assertScenario(id, NAVIGATION_STATES[index]!, element) - if (!mounted) { - throw new Error('Link benchmark app was not mounted') - } - mounted.assertStateUpdates() - }, - }) - - return { - async setup() { - await test.before() - if (!container) { - throw new Error('Link benchmark container was not created') - } - anchors = [...container.querySelectorAll('a[data-perf-link]')] - }, - async batch() { - for (let index = 0; index < ticksPerIteration; index++) { - await test.tick() - } - await test.finishBatch() - }, - check() { - if (!container || !mounted) { - throw new Error('Link benchmark app was not mounted') - } - assertScenario(id, 0, container) - mounted.assertStateUpdates() - if (mounted.router.history.length !== 1) { - throw new Error('Link benchmark history must remain bounded') - } - const current = container.querySelectorAll('a[data-perf-link]') - if (anchors.some((anchor, index) => current[index] !== anchor)) { - throw new Error('Measured Links must stay mounted across navigations') - } - }, - teardown: test.after, - } -} - -export function createSsrScenario( - app: typeof SsrApp, - id: LinkCaseId, -): LinkScenario { - let html = '' - let state = 0 - function check() { - const dom = new JSDOM(html) - try { - assertScenario(id, state, dom.window.document) - } finally { - dom.window.close() - } - } - - return { - async setup() { - for (const nextState of NAVIGATION_STATES) { - state = nextState - html = await app.renderScenario(id, state, true) - check() - } - }, - async batch() { - for (const nextState of NAVIGATION_STATES) { - state = nextState - html = await app.renderScenario(id, state) - } - }, - check, - teardown() { - html = '' - }, - } -} diff --git a/benchmarks/client-nav/link-performance/src/client.tsx b/benchmarks/client-nav/link-performance/src/client.tsx deleted file mode 100644 index a187ee8c15..0000000000 --- a/benchmarks/client-nav/link-performance/src/client.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { isServer } from '@tanstack/router-core/isServer' -import { createRoot } from 'react-dom/client' -import { assertStateUpdates, createLinkRouter } from './workload' -import type { LinkRouter } from './workload' -import type { RouterHistory } from '@tanstack/history' -import type { LinkCaseId } from '../cases' - -export const serverEnvironment: boolean | undefined = isServer - -export function mountTestApp( - container: HTMLElement, - history: RouterHistory, - caseId: LinkCaseId, -): { - router: LinkRouter - unmount: () => void - assertStateUpdates: () => void -} { - const router = createLinkRouter(caseId, history, false) - const root = createRoot(container) - root.render() - - return { - router, - unmount: () => root.unmount(), - assertStateUpdates: () => assertStateUpdates(router), - } -} diff --git a/benchmarks/client-nav/link-performance/src/ssr.tsx b/benchmarks/client-nav/link-performance/src/ssr.tsx deleted file mode 100644 index 491191b1f9..0000000000 --- a/benchmarks/client-nav/link-performance/src/ssr.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { RouterProvider, createMemoryHistory } from '@tanstack/react-router' -import { isServer } from '@tanstack/router-core/isServer' -import { renderToString } from 'react-dom/server' -import { getSourceUrl } from '../cases' -import { assertStateUpdates, createLinkRouter } from './workload' -import type { LinkCaseId } from '../cases' - -export const serverEnvironment: boolean | undefined = isServer - -export async function renderScenario( - caseId: LinkCaseId, - stateIndex: number, - verify = false, -) { - const history = createMemoryHistory({ - initialEntries: [getSourceUrl(caseId, stateIndex)], - }) - const router = createLinkRouter(caseId, history, true) - try { - await router.load() - const html = renderToString() - if (verify) { - assertStateUpdates(router) - } - return html - } finally { - history.destroy() - } -} diff --git a/benchmarks/client-nav/link-performance/src/workload.tsx b/benchmarks/client-nav/link-performance/src/workload.tsx deleted file mode 100644 index 8315b85b8b..0000000000 --- a/benchmarks/client-nav/link-performance/src/workload.tsx +++ /dev/null @@ -1,506 +0,0 @@ -import { - Link, - Outlet, - createRootRouteWithContext, - createRoute, - createRouter, - linkOptions, - retainSearchParams, - stripSearchParams, - useLocation, -} from '@tanstack/react-router' -import { - LINK_COUNT, - LOCALES, - encodedValue, - optionalCategory, - sourceFilter, - sourceSearch, - splatValue, -} from '../cases' -import type { RouterHistory } from '@tanstack/history' -import type { SearchSchemaInput } from '@tanstack/react-router' -import type { Filter, LinkCaseId, LinkSearch } from '../cases' - -interface StateUpdates { - calls: number - verifiedCalls: number - input: number - output: number - offset: number -} - -interface WorkloadContext { - caseId: LinkCaseId - stateUpdates: StateUpdates -} - -function isFilter(value: unknown): value is Filter { - return ( - typeof value === 'object' && - value !== null && - 'tag' in value && - typeof value.tag === 'string' && - 'flags' in value && - typeof value.flags === 'object' && - value.flags !== null && - 'open' in value.flags && - typeof value.flags.open === 'boolean' && - 'tags' in value && - Array.isArray(value.tags) && - value.tags.every((tag: unknown) => typeof tag === 'string') - ) -} - -const rootRoute = createRootRouteWithContext()({ - validateSearch: ( - search: Record & SearchSchemaInput, - ): LinkSearch => ({ - page: typeof search.page === 'number' ? search.page : undefined, - tenant: typeof search.tenant === 'string' ? search.tenant : undefined, - filter: isFilter(search.filter) ? search.filter : undefined, - }), - component: RootLayout, -}) - -const itemsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'items/$itemId', -}) -const detailsRoute = createRoute({ - getParentRoute: () => itemsRoute, - path: 'details', -}) -const teamRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'teams/$teamId', -}) -const teamItemRoute = createRoute({ - getParentRoute: () => teamRoute, - path: '$itemId', -}) -const teamDetailsRoute = createRoute({ - getParentRoute: () => teamItemRoute, - path: 'details', -}) -const filteredRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'filtered/$itemId', - search: { - middlewares: [ - retainSearchParams(['tenant']), - stripSearchParams({ page: 1 }), - ({ search, next }) => { - const result = next(search) - return { - ...result, - filter: result.filter - ? { ...result.filter, tag: result.filter.tag.trim().toUpperCase() } - : undefined, - } - }, - ], - }, -}) -const numericRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'numbers/$number', - params: { - parse: ({ number }) => { - const value = Number(number) - if (!Number.isFinite(value)) { - throw new Error(`Invalid number: ${number}`) - } - return { number: value } - }, - stringify: ({ number }) => ({ number: String(number) }), - }, -}) -const optionalRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'optional/{-$category}/$itemId', -}) -const splatRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'files/$', -}) -const encodedRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'encoded/$value', -}) -const publicRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'public/$itemId', -}) - -const routeTree = rootRoute.addChildren([ - itemsRoute.addChildren([detailsRoute]), - teamRoute.addChildren([teamItemRoute.addChildren([teamDetailsRoute])]), - filteredRoute, - numericRoute, - optionalRoute, - splatRoute, - encodedRoute, - publicRoute, -]) - -const localeRewrite = { - input: ({ url }: { url: URL }) => { - const match = /^\/(en|fr|de|es)(\/.*)$/.exec(url.pathname) - if (match) { - url.pathname = match[2]! - url.searchParams.set('tenant', match[1]!) - } - return url - }, - output: ({ url }: { url: URL }) => { - const locale = url.searchParams.get('tenant') - if (locale) { - url.searchParams.delete('tenant') - url.pathname = `/${locale}${url.pathname}` - } - return url - }, -} - -export function createLinkRouter( - caseId: LinkCaseId, - history: RouterHistory, - isServer: boolean, -) { - const context: WorkloadContext = { - caseId, - stateUpdates: { - calls: 0, - verifiedCalls: 0, - input: 0, - output: 0, - offset: 0, - }, - } - return createRouter({ - routeTree, - history, - isServer, - context, - scrollRestoration: false, - defaultPreload: false, - trailingSlash: 'never', - pathParamsAllowedCharacters: - caseId === 'encoding' ? ['@', ':', '+'] : undefined, - ...(caseId === 'rewrites' - ? { basepath: '/app', rewrite: localeRewrite } - : {}), - }) -} - -export type LinkRouter = ReturnType - -declare module '@tanstack/react-router' { - interface Register { - router: LinkRouter - } -} - -declare module '@tanstack/history' { - interface HistoryState { - linkPerfState?: number - } -} - -// Call alongside DOM assertions, outside the timed loop, after each sample. -export function assertStateUpdates(router: LinkRouter): void { - const { caseId, stateUpdates } = router.options.context - if (caseId !== 'location-updaters') { - return - } - const input = router.state.location.state.linkPerfState ?? 0 - if ( - stateUpdates.calls - stateUpdates.verifiedCalls < LINK_COUNT || - stateUpdates.input !== input || - stateUpdates.output !== input + stateUpdates.offset || - stateUpdates.offset < 1 || - stateUpdates.offset > 40 - ) { - throw new Error( - 'Link history-state updaters did not run with current state', - ) - } - stateUpdates.verifiedCalls = stateUpdates.calls -} - -function sourceOptions(caseId: LinkCaseId, stateIndex: number) { - const itemId = `item-${stateIndex}` - const common = { - search: sourceSearch(caseId, stateIndex), - hash: caseId === 'location-updaters' ? `source-${stateIndex}` : '', - state: { linkPerfState: stateIndex + 10 }, - } - switch (caseId) { - case 'relative': - return linkOptions({ - ...common, - to: '/teams/$teamId/$itemId', - params: { teamId: `team-${stateIndex}`, itemId }, - }) - case 'numeric-params': - return linkOptions({ - ...common, - to: '/numbers/$number', - params: { number: stateIndex }, - }) - case 'optional-params': - return linkOptions({ - ...common, - to: '/optional/{-$category}/$itemId', - params: { category: optionalCategory(stateIndex), itemId }, - }) - case 'splats': - return linkOptions({ - ...common, - to: '/files/$', - params: { _splat: `source/state-${stateIndex}` }, - }) - case 'encoding': - return linkOptions({ - ...common, - to: '/encoded/$value', - params: { value: `source-${stateIndex}` }, - }) - case 'active': - return linkOptions({ - ...common, - to: '/items/$itemId/details', - params: { itemId }, - }) - default: - return linkOptions({ - ...common, - to: '/items/$itemId', - params: { itemId }, - }) - } -} - -const indexes = Array.from({ length: LINK_COUNT }, (_, index) => index) -const controls = [0, 1, 2, 3] as const - -function SourcePath() { - const pathname = useLocation({ select: (location) => location.pathname }) - return {pathname} -} - -function RootLayout() { - const context = rootRoute.useRouteContext() - return ( - <> - - -
- {indexes.map((index) => measuredLink(context, index))} -
- - - ) -} - -function measuredLink( - { caseId, stateUpdates }: WorkloadContext, - index: number, -) { - const common = { - key: index, - 'data-perf-link': index, - preload: false, - children: `Link ${index}`, - } as const - const itemId = `item-${index % 40}` - switch (caseId) { - case 'shared-params': - case 'unique-params': - return ( - - ) - case 'param-updaters': - return ( - ({ - itemId: `${previous.itemId}-related-${index % 40}`, - })} - /> - ) - case 'location-updaters': - return ( - ({ - ...previous, - page: (previous.page ?? 1) + 1 + (index % 5), - })} - hash={(previous) => `${previous}-link-${index % 5}`} - state={(previous) => { - const input = previous.linkPerfState ?? 0 - const offset = (index % 40) + 1 - const output = input + offset - stateUpdates.calls++ - stateUpdates.input = input - stateUpdates.output = output - stateUpdates.offset = offset - return { ...previous, linkPerfState: output } - }} - /> - ) - case 'relative': - return ( - - ) - case 'middleware': - return ( - - ) - case 'numeric-params': - return ( - ({ number: previous.number + (index % 40) })} - /> - ) - case 'optional-params': - return ( - - ) - case 'splats': - return ( - - ) - case 'encoding': - return ( - - ) - case 'masks': - return ( - - ) - case 'rewrites': - return ( - - ) - case 'active': { - const item = Math.floor(index / 5) - const variant = index % 5 - return ( - ({ - className: 'perf-active', - title: 'active', - style: { color: 'green' }, - })} - inactiveProps={() => ({ - className: 'perf-inactive', - title: 'inactive', - style: { color: 'gray' }, - })} - > - {({ isActive }) => `${index}:${isActive ? 'active' : 'inactive'}`} - - ) - } - } -} diff --git a/benchmarks/client-nav/link-performance/ssr.bench.ts b/benchmarks/client-nav/link-performance/ssr.bench.ts deleted file mode 100644 index c30084e510..0000000000 --- a/benchmarks/client-nav/link-performance/ssr.bench.ts +++ /dev/null @@ -1,30 +0,0 @@ -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' - -const appUrl = new URL('./dist/ssr/app.js', import.meta.url).href -const app: typeof App = await import(/* @vite-ignore */ appUrl) -if (app.serverEnvironment !== true) { - throw new Error('Link SSR benchmarks must use the production server build') -} - -for (const { id, label } of LINK_CASES) { - test(label, async ({ bench }) => { - const scenario = createSsrScenario(app, id) - function finish() { - try { - scenario.check() - } finally { - scenario.teardown() - } - } - - await bench( - `SSR Links: ${id}`, - benchLifecycle({ before: scenario.setup, after: finish }), - scenario.batch, - ).run(samplingOptions) - }) -} diff --git a/benchmarks/client-nav/link-performance/stable-runner.ts b/benchmarks/client-nav/link-performance/stable-runner.ts deleted file mode 100644 index 59ccfa3cb4..0000000000 --- a/benchmarks/client-nav/link-performance/stable-runner.ts +++ /dev/null @@ -1,269 +0,0 @@ -import { fork } from 'node:child_process' -import { createHash } from 'node:crypto' -import { - copyFileSync, - mkdirSync, - readFileSync, - rmSync, - writeFileSync, -} from 'node:fs' -import { dirname, resolve } from 'node:path' -import { fileURLToPath } from 'node:url' -import { parseArgs } from 'node:util' -import { LINK_CASES } from './cases' -import { createStagingDirectory } from './staging' -import { classify, mean, summarizeRatios } from './statistics' -import type { LinkCaseId } from './cases' -import type { - BlockSample, - Mode, - Variant, - WorkerRequest, - WorkerResponse, -} from './worker-protocol' - -const projectRoot = fileURLToPath(new URL('.', import.meta.url)) -const workspaceRoot = resolve(projectRoot, '../../..') - -function startWorker() { - const child = fork( - fileURLToPath(new URL('./stable-worker.ts', import.meta.url)), - { - cwd: workspaceRoot, - env: { ...process.env, NODE_ENV: 'production' }, - execArgv: [ - '--import=@swc-node/register/esm-register', - '--random-seed=42', - '--hash-seed=42', - ], - stdio: ['ignore', 'ignore', 'pipe', 'ipc'], - }, - ) - let stderr = '' - child.stderr?.on('data', (data: Buffer) => { - stderr = (stderr + data.toString()).slice(-4_096) - }) - - function request(message: WorkerRequest): Promise { - return new Promise((resolveResponse, reject) => { - const timeout = setTimeout(() => { - finish( - new Error(`Sampling worker timed out: ${message.kind}\n${stderr}`), - ) - }, 60_000) - const onExit = (code: number | null) => - finish(new Error(`Sampling worker exited (${code})\n${stderr}`)) - const onError = (error: Error) => finish(error) - const onMessage = (response: WorkerResponse) => { - if (response.kind === 'error') { - finish(new Error(response.message)) - } else { - finish(undefined, response) - } - } - function finish(error?: Error, response?: WorkerResponse) { - clearTimeout(timeout) - child.off('message', onMessage) - child.off('error', onError) - child.off('exit', onExit) - if (error) { - reject(error) - } else if (response) { - resolveResponse(response) - } - } - child.once('message', onMessage) - child.once('error', onError) - child.once('exit', onExit) - child.send(message, (error) => { - if (error) { - finish(error) - } - }) - }) - } - - return { - request, - kill: () => child.kill(), - } -} - -async function sampleReplica( - mode: Mode, - caseId: LinkCaseId, - baseline: string, - current: string, - replica: number, -) { - const worker = startWorker() - const samples: Array> = [[], []] - const ratios: Array<{ cpu: number; wall: number }> = [] - try { - const starts: Array = [] - // Balance module initialization and which variant finishes warming last. - const startupOrder: Array = replica % 2 ? [1, 0] : [0, 1] - for (const index of startupOrder) { - const ready = await worker.request({ - kind: 'init', - mode, - caseId, - bundle: index === 0 ? baseline : current, - variant: index, - }) - if (ready.kind !== 'ready') { - throw new Error('Expected a ready sampling worker') - } - starts[index] = ready.batchMs - } - const iterations = Math.max(1, Math.ceil(500 / Math.min(...starts))) - for (let round = 0; round < 2; round++) { - const block: Array> = [[], []] - const order: Array = - (round + replica) % 2 ? [1, 0, 0, 1] : [0, 1, 1, 0] - for (const index of order) { - const result = await worker.request({ - kind: 'measure', - iterations, - variant: index, - }) - if (result.kind !== 'sample') { - throw new Error('Expected a block measurement') - } - samples[index]!.push(result.sample) - block[index]!.push(result.sample) - } - ratios.push({ - cpu: - mean(block[1]!.map((s) => s.cpuMs)) / - mean(block[0]!.map((s) => s.cpuMs)), - wall: - mean(block[1]!.map((s) => s.wallMs)) / - mean(block[0]!.map((s) => s.wallMs)), - }) - } - const response = await worker.request({ kind: 'stop' }) - if (response.kind !== 'stopped') { - throw new Error('Expected successful post-measurement assertions') - } - return { - iterations, - baseline: samples[0]!, - current: samples[1]!, - cpuRatio: Math.exp(mean(ratios.map((r) => Math.log(r.cpu)))), - wallRatio: Math.exp(mean(ratios.map((r) => Math.log(r.wall)))), - } - } finally { - worker.kill() - } -} - -async function main() { - const { values } = parseArgs({ - options: { - baseline: { type: 'string' }, - current: { type: 'string', default: resolve(projectRoot, 'dist') }, - mode: { type: 'string', default: 'all' }, - repeats: { type: 'string', default: '4' }, - outputJson: { type: 'string' }, - testNamePattern: { type: 'string', short: 't' }, - }, - }) - if (!values.baseline || !values.outputJson) { - throw new Error( - 'Specify --baseline and --outputJson ', - ) - } - const repeats = Number(values.repeats) - if (!Number.isInteger(repeats) || repeats < 3 || repeats > 11) { - throw new Error('--repeats must be an integer between 3 and 11') - } - if (!['all', 'client', 'ssr'].includes(values.mode)) { - throw new Error('--mode must be all, client, or ssr') - } - const modes: Array = - values.mode === 'all' - ? ['client', 'ssr'] - : values.mode === 'client' - ? ['client'] - : ['ssr'] - const pattern = values.testNamePattern - ? new RegExp(values.testNamePattern) - : undefined - const cases = LINK_CASES.filter( - (c) => !pattern || pattern.test(`${c.label} ${c.id}`), - ) - if (!cases.length) { - throw new Error('No Link workloads match the requested pattern') - } - const report: { - protocol: string - node: string - complete: boolean - results: Array<{ - mode: Mode - caseId: LinkCaseId - baselineSha256: string - currentSha256: string - replicas: Array>> - cpu: ReturnType - wall: ReturnType - verdict: ReturnType - }> - } = { - protocol: - 'fresh process per case/replica; shared React runtime; separately loaded router variants; 2 ABBA/BAAB rounds; ~500ms calibrated fixed-work blocks; >=2s/100 batches warmup; main-thread CPU and wall time; fixed V8 random/hash seeds', - node: process.version, - complete: false, - results: [], - } - const output = resolve(values.outputJson) - mkdirSync(dirname(output), { recursive: true }) - const staging = createStagingDirectory() - try { - for (const mode of modes) { - const baselineInput = resolve(values.baseline, mode, 'app.js') - const currentInput = resolve(values.current, mode, 'app.js') - // Both snapshots resolve React from the same package installation. - const baseline = resolve(staging, `baseline-${mode}.mjs`) - const current = resolve(staging, `current-${mode}.mjs`) - copyFileSync(baselineInput, baseline) - copyFileSync(currentInput, current) - const digest = (file: string) => - createHash('sha256').update(readFileSync(file)).digest('hex') - const baselineSha256 = digest(baseline) - const currentSha256 = digest(current) - for (const { id } of cases) { - const replicas = [] - for (let replica = 0; replica < repeats; replica++) { - replicas.push( - await sampleReplica(mode, id, baseline, current, replica), - ) - } - const cpu = summarizeRatios(replicas.map((r) => r.cpuRatio)) - const wall = summarizeRatios(replicas.map((r) => r.wallRatio)) - const verdict = classify(cpu, wall) - report.results.push({ - mode, - caseId: id, - baselineSha256, - currentSha256, - replicas, - cpu, - wall, - verdict, - }) - writeFileSync(output, JSON.stringify(report, null, 2)) - console.log( - `${mode} ${id}: CPU ${cpu.changePercent.toFixed(2)}% [${cpu.low95.toFixed(2)}, ${cpu.high95.toFixed(2)}], wall ${wall.changePercent.toFixed(2)}% [${wall.low95.toFixed(2)}, ${wall.high95.toFixed(2)}] ${verdict}`, - ) - } - } - report.complete = true - writeFileSync(output, JSON.stringify(report, null, 2)) - } finally { - rmSync(staging, { recursive: true }) - } -} - -await main() diff --git a/benchmarks/client-nav/link-performance/stable-worker.test.ts b/benchmarks/client-nav/link-performance/stable-worker.test.ts deleted file mode 100644 index 087b32414a..0000000000 --- a/benchmarks/client-nav/link-performance/stable-worker.test.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { fork } from 'node:child_process' -import { rmdirSync, unlinkSync, writeFileSync } from 'node:fs' -import { join } from 'node:path' -import { fileURLToPath } from 'node:url' -import { expect, test } from 'vitest' -import { createStagingDirectory } from './staging' -import type { WorkerResponse } from './worker-protocol' - -test('loads emitted JavaScript without retranspiling it through SWC', async () => { - const directory = createStagingDirectory() - const bundle = join(directory, 'app.mjs') - const definition = 'function untouched ( ) { return 1 }' - writeFileSync( - bundle, - `${definition}\nawait Promise.resolve()\nthrow new Error(untouched.toString())`, - ) - const worker = fork( - fileURLToPath(new URL('./stable-worker.ts', import.meta.url)), - { - cwd: fileURLToPath(new URL('../../../', import.meta.url)), - execArgv: ['--import=@swc-node/register/esm-register'], - env: { ...process.env, NODE_ENV: 'production' }, - stdio: ['ignore', 'ignore', 'pipe', 'ipc'], - }, - ) - let stderr = '' - worker.stderr?.on('data', (data: Buffer) => { - stderr += data.toString() - }) - let timeout: ReturnType | undefined - try { - const result = new Promise((resolve, reject) => { - worker.once('message', (message: WorkerResponse) => resolve(message)) - worker.once('error', reject) - worker.once('exit', (code) => { - reject(new Error(`Worker exited (${code}): ${stderr}`)) - }) - timeout = setTimeout(() => { - reject(new Error(`Worker timed out: ${stderr}`)) - }, 5_000) - }) - worker.send({ - kind: 'init', - mode: 'ssr', - caseId: 'shared-params', - bundle, - variant: 0, - }) - const response = await result - expect(response.kind).toBe('error') - if (response.kind === 'error') { - expect(response.message).toContain(`Error: ${definition}`) - } - } finally { - clearTimeout(timeout) - worker.kill() - unlinkSync(bundle) - rmdirSync(directory) - } -}) diff --git a/benchmarks/client-nav/link-performance/stable-worker.ts b/benchmarks/client-nav/link-performance/stable-worker.ts deleted file mode 100644 index d98679dc15..0000000000 --- a/benchmarks/client-nav/link-performance/stable-worker.ts +++ /dev/null @@ -1,112 +0,0 @@ -import { pathToFileURL } from 'node:url' -import { createClientScenario, createSsrScenario } from './scenario' -import type { LinkScenario } from './scenario' -import type { WorkerRequest, WorkerResponse } from './worker-protocol' -import type * as ClientApp from './src/client' -import type * as SsrApp from './src/ssr' - -const scenarios: Array = [] -const creationOrder: Array = [] -let closeWindow = () => {} - -function reply(response: WorkerResponse) { - if (!process.send) { - throw new Error('The Link sampling worker requires an IPC parent') - } - process.send(response) -} - -async function handle(request: WorkerRequest) { - if (request.kind === 'init') { - if (typeof process.threadCpuUsage !== 'function') { - throw new Error( - 'Stable sampling requires Node.js with process.threadCpuUsage', - ) - } - if (scenarios[request.variant]) { - throw new Error('A worker must only initialize each variant once') - } - let scenario: LinkScenario - const bundleUrl = pathToFileURL(request.bundle) - bundleUrl.searchParams.set('linkPerfVariant', String(request.variant)) - if (request.mode === 'client') { - const { window } = await import('../jsdom') - closeWindow = () => window.close() - const app: typeof ClientApp = await import(bundleUrl.href) - if (app.serverEnvironment !== false) { - throw new Error('Expected a production client bundle') - } - scenario = createClientScenario(app, request.caseId) - } else { - const app: typeof SsrApp = await import(bundleUrl.href) - if (app.serverEnvironment !== true) { - throw new Error('Expected a production SSR bundle') - } - scenario = createSsrScenario(app, request.caseId) - } - scenarios[request.variant] = scenario - creationOrder.push(scenario) - await scenario.setup() - const start = performance.now() - let iterations = 0 - do { - await scenario.batch() - iterations++ - } while (iterations < 100 || performance.now() - start < 2_000) - reply({ - kind: 'ready', - batchMs: (performance.now() - start) / iterations, - }) - return - } - if (request.kind === 'measure') { - const scenario = scenarios[request.variant] - if (!scenario) { - throw new Error('The sampling worker has not been initialized') - } - if (!Number.isInteger(request.iterations) || request.iterations < 1) { - throw new Error('Expected a positive batch count') - } - const cpuStart = process.threadCpuUsage() - const processStart = process.cpuUsage() - const start = performance.now() - for (let index = 0; index < request.iterations; index++) { - await scenario.batch() - } - const wallMs = performance.now() - start - const cpu = process.threadCpuUsage(cpuStart) - const processCpu = process.cpuUsage(processStart) - reply({ - kind: 'sample', - sample: { - iterations: request.iterations, - wallMs: wallMs / request.iterations, - cpuMs: (cpu.user + cpu.system) / 1_000 / request.iterations, - processCpuMs: - (processCpu.user + processCpu.system) / 1_000 / request.iterations, - }, - }) - return - } - try { - for (const scenario of creationOrder) { - scenario.check() - } - } finally { - for (const scenario of creationOrder.reverse()) { - scenario.teardown() - } - closeWindow() - } - reply({ kind: 'stopped' }) -} - -process.on('message', (request: WorkerRequest) => { - void handle(request).catch((error: unknown) => { - reply({ - kind: 'error', - message: - error instanceof Error ? error.stack || error.message : String(error), - }) - }) -}) diff --git a/benchmarks/client-nav/link-performance/staging.ts b/benchmarks/client-nav/link-performance/staging.ts deleted file mode 100644 index ac07d34c29..0000000000 --- a/benchmarks/client-nav/link-performance/staging.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { mkdirSync, mkdtempSync } from 'node:fs' -import { resolve } from 'node:path' -import { fileURLToPath } from 'node:url' - -export function createStagingDirectory() { - // SWC skips node_modules, leaving the emitted benchmark JavaScript intact. - const root = fileURLToPath(new URL('./node_modules/.cache/', import.meta.url)) - mkdirSync(root, { recursive: true }) - return mkdtempSync(resolve(root, 'link-performance-')) -} diff --git a/benchmarks/client-nav/link-performance/statistics.test.ts b/benchmarks/client-nav/link-performance/statistics.test.ts deleted file mode 100644 index 8f5f37413b..0000000000 --- a/benchmarks/client-nav/link-performance/statistics.test.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { expect, test } from 'vitest' -import { classify, mean, summarizeRatios } from './statistics' - -test('summarizes multiplicative paired changes across process replicas', () => { - const result = summarizeRatios([0.9, 0.9, 0.9, 0.9]) - expect(result.changePercent).toBeCloseTo(-10) - expect(result.low95).toBeCloseTo(-10) - expect(result.high95).toBeCloseTo(-10) - expect(result.replicas).toBe(4) -}) - -test('does not turn opposite noisy runs into a conclusive result', () => { - const result = summarizeRatios([0.9, 1.1, 0.95, 1.05]) - expect(result.low95).toBeLessThan(0) - expect(result.high95).toBeGreaterThan(0) - expect(classify(result, result)).toBe('inconclusive') -}) - -test('requires CPU and wall time to corroborate a direction', () => { - const slower = summarizeRatios([1.08, 1.09, 1.08, 1.09]) - const faster = summarizeRatios([0.9, 0.91, 0.9, 0.91]) - expect(classify(slower, slower)).toBe('slower') - expect(classify(faster, faster)).toBe('faster') - expect(classify(slower, faster)).toBe('inconclusive') - expect(classify(summarizeRatios([1, 1, 1]), summarizeRatios([1, 1, 1]))).toBe( - 'within-2%', - ) -}) - -test('rejects incomplete or invalid sampling data', () => { - expect(() => summarizeRatios([1])).toThrow() - expect(() => summarizeRatios([0, 1])).toThrow() - expect(() => summarizeRatios([NaN, 1])).toThrow() - expect(() => mean([])).toThrow() - expect(() => mean([Infinity])).toThrow() -}) diff --git a/benchmarks/client-nav/link-performance/statistics.ts b/benchmarks/client-nav/link-performance/statistics.ts deleted file mode 100644 index 469bdaf65a..0000000000 --- a/benchmarks/client-nav/link-performance/statistics.ts +++ /dev/null @@ -1,57 +0,0 @@ -const critical95 = [ - 12.7062, 4.3027, 3.1824, 2.7764, 2.5706, 2.4469, 2.3646, 2.306, 2.2622, - 2.2281, -] - -export function mean(values: ReadonlyArray) { - if (!values.length || values.some((value) => !Number.isFinite(value))) { - throw new Error('Expected finite, nonempty samples') - } - return values.reduce((sum, value) => sum + value, 0) / values.length -} - -export function summarizeRatios(ratios: ReadonlyArray) { - if ( - ratios.length < 2 || - ratios.length > 11 || - ratios.some((value) => value <= 0) - ) { - throw new Error('Expected 2-11 independent positive process-replica ratios') - } - const logs = ratios.map(Math.log) - const center = mean(logs) - const variance = - logs.reduce((sum, value) => sum + (value - center) ** 2, 0) / - (logs.length - 1) - // Replicas, not the many correlated batches inside a worker, are the samples. - const margin = - critical95[logs.length - 2]! * Math.sqrt(variance / logs.length) - const percent = (value: number) => (Math.exp(value) - 1) * 100 - return { - changePercent: percent(center), - low95: percent(center - margin), - high95: percent(center + margin), - replicas: ratios.length, - } -} - -export function classify( - cpu: ReturnType, - wall: ReturnType, -) { - if (cpu.low95 > 0 && wall.low95 > 0) { - return 'slower' - } - if (cpu.high95 < 0 && wall.high95 < 0) { - return 'faster' - } - if ( - cpu.low95 >= -2 && - cpu.high95 <= 2 && - wall.low95 >= -2 && - wall.high95 <= 2 - ) { - return 'within-2%' - } - return 'inconclusive' -} diff --git a/benchmarks/client-nav/link-performance/tsconfig.json b/benchmarks/client-nav/link-performance/tsconfig.json deleted file mode 100644 index fbf230c977..0000000000 --- a/benchmarks/client-nav/link-performance/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "./**/*.ts", - "./**/*.tsx", - "../scenarios/harness.ts", - "../setup-helpers.ts", - "../vitest.setup.ts" - ] -} diff --git a/benchmarks/client-nav/link-performance/vite.client.config.ts b/benchmarks/client-nav/link-performance/vite.client.config.ts deleted file mode 100644 index 1cd45fc45e..0000000000 --- a/benchmarks/client-nav/link-performance/vite.client.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { createLinkPerformanceConfig } from './config' - -export default createLinkPerformanceConfig('client') diff --git a/benchmarks/client-nav/link-performance/vite.ssr.config.ts b/benchmarks/client-nav/link-performance/vite.ssr.config.ts deleted file mode 100644 index f59148eaf6..0000000000 --- a/benchmarks/client-nav/link-performance/vite.ssr.config.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { createLinkPerformanceConfig } from './config' - -export default createLinkPerformanceConfig('ssr') diff --git a/benchmarks/client-nav/link-performance/vitest.config.ts b/benchmarks/client-nav/link-performance/vitest.config.ts deleted file mode 100644 index f8454c819d..0000000000 --- a/benchmarks/client-nav/link-performance/vitest.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - root: fileURLToPath(new URL('.', import.meta.url)), - test: { - watch: false, - environment: 'node', - include: ['*.test.ts'], - }, -}) diff --git a/benchmarks/client-nav/link-performance/worker-protocol.ts b/benchmarks/client-nav/link-performance/worker-protocol.ts deleted file mode 100644 index 474858a529..0000000000 --- a/benchmarks/client-nav/link-performance/worker-protocol.ts +++ /dev/null @@ -1,28 +0,0 @@ -import type { LinkCaseId } from './cases' - -export type Mode = 'client' | 'ssr' -export type Variant = 0 | 1 - -export type WorkerRequest = - | { - kind: 'init' - mode: Mode - caseId: LinkCaseId - bundle: string - variant: Variant - } - | { kind: 'measure'; iterations: number; variant: Variant } - | { kind: 'stop' } - -export interface BlockSample { - wallMs: number - cpuMs: number - processCpuMs: number - iterations: number -} - -export type WorkerResponse = - | { kind: 'ready'; batchMs: number } - | { kind: 'sample'; sample: BlockSample } - | { kind: 'stopped' } - | { kind: 'error'; message: string } diff --git a/benchmarks/client-nav/package.json b/benchmarks/client-nav/package.json deleted file mode 100644 index 1f878adc67..0000000000 --- a/benchmarks/client-nav/package.json +++ /dev/null @@ -1,245 +0,0 @@ -{ - "name": "@benchmarks/client-nav", - "private": true, - "type": "module", - "scripts": { - "build:react": "NODE_ENV=production vite build --config ./react/vite.config.ts", - "build:solid": "NODE_ENV=production vite build --config ./solid/vite.config.ts", - "build:vue": "NODE_ENV=production vite build --config ./vue/vite.config.ts", - "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 --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", - "test:types:vue": "tsc -p ./vue/tsconfig.json --noEmit" - }, - "dependencies": { - "@tanstack/history": "workspace:^", - "@tanstack/react-router": "workspace:^", - "@tanstack/router-core": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/vue-router": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "solid-js": "^1.9.10", - "vue": "^3.5.16" - }, - "devDependencies": { - "@platformatic/flame": "^1.6.0", - "@codspeed/vitest-plugin": "^6.0.1", - "@tanstack/router-plugin": "workspace:^", - "@testing-library/react": "^16.2.0", - "@vitejs/plugin-react": "^6.0.1", - "@vitejs/plugin-vue": "^6.0.5", - "@vitejs/plugin-vue-jsx": "^5.1.5", - "@types/jsdom": "28.0.0", - "@types/react": "catalog:", - "@types/react-dom": "catalog:", - "@typescript/native": "npm:typescript@^7.0.2", - "jsdom": "^29.1.1", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "vitest": "catalog:" - }, - "nx": { - "targets": { - "build:react": { - "cache": false, - "dependsOn": [ - { - "projects": [ - "@tanstack/react-router" - ], - "target": "build" - }, - { - "projects": [ - "@benchmarks/client-nav-async-pipeline-react", - "@benchmarks/client-nav-control-flow-react", - "@benchmarks/client-nav-head-react", - "@benchmarks/client-nav-history-react", - "@benchmarks/client-nav-hydration-react", - "@benchmarks/client-nav-link-churn-react", - "@benchmarks/client-nav-links-react", - "@benchmarks/client-nav-loaders-react", - "@benchmarks/client-nav-mount-react", - "@benchmarks/client-nav-nested-params-react", - "@benchmarks/client-nav-preload-react", - "@benchmarks/client-nav-rewrites-react", - "@benchmarks/client-nav-route-tree-scale-react", - "@benchmarks/client-nav-search-params-react" - ], - "target": "build:client" - } - ] - }, - "build:solid": { - "cache": false, - "dependsOn": [ - { - "projects": [ - "@tanstack/solid-router" - ], - "target": "build" - }, - { - "projects": [ - "@benchmarks/client-nav-async-pipeline-solid", - "@benchmarks/client-nav-control-flow-solid", - "@benchmarks/client-nav-head-solid", - "@benchmarks/client-nav-history-solid", - "@benchmarks/client-nav-hydration-solid", - "@benchmarks/client-nav-link-churn-solid", - "@benchmarks/client-nav-links-solid", - "@benchmarks/client-nav-loaders-solid", - "@benchmarks/client-nav-mount-solid", - "@benchmarks/client-nav-nested-params-solid", - "@benchmarks/client-nav-preload-solid", - "@benchmarks/client-nav-rewrites-solid", - "@benchmarks/client-nav-route-tree-scale-solid", - "@benchmarks/client-nav-search-params-solid" - ], - "target": "build:client" - } - ] - }, - "build:vue": { - "cache": false, - "dependsOn": [ - { - "projects": [ - "@tanstack/vue-router" - ], - "target": "build" - }, - { - "projects": [ - "@benchmarks/client-nav-async-pipeline-vue", - "@benchmarks/client-nav-control-flow-vue", - "@benchmarks/client-nav-head-vue", - "@benchmarks/client-nav-history-vue", - "@benchmarks/client-nav-link-churn-vue", - "@benchmarks/client-nav-links-vue", - "@benchmarks/client-nav-loaders-vue", - "@benchmarks/client-nav-mount-vue", - "@benchmarks/client-nav-nested-params-vue", - "@benchmarks/client-nav-preload-vue", - "@benchmarks/client-nav-rewrites-vue", - "@benchmarks/client-nav-route-tree-scale-vue", - "@benchmarks/client-nav-search-params-vue" - ], - "target": "build:client" - } - ] - }, - "test:perf": { - "cache": false, - "dependsOn": [ - "build:react", - "build:solid", - "build:vue" - ] - }, - "test:flame:react": { - "cache": false, - "dependsOn": [ - "build:react" - ] - }, - "test:flame:solid": { - "cache": false, - "dependsOn": [ - "build:solid" - ] - }, - "test:flame:vue": { - "cache": false, - "dependsOn": [ - "build:vue" - ] - }, - "test:perf:react": { - "cache": false, - "dependsOn": [ - "build:react" - ] - }, - "test:perf:solid": { - "cache": false, - "dependsOn": [ - "build:solid" - ] - }, - "test:perf:vue": { - "cache": false, - "dependsOn": [ - "build:vue" - ] - }, - "test:types": { - "inputs": [ - "default", - "^production", - "{workspaceRoot}/eslint.config.js", - "{workspaceRoot}/benchmarks/cpu-simulation.ts", - "dependentTaskOutputs" - ], - "dependsOn": [ - "^build", - { - "projects": [ - "@benchmarks/client-nav-async-pipeline-react", - "@benchmarks/client-nav-async-pipeline-solid", - "@benchmarks/client-nav-async-pipeline-vue", - "@benchmarks/client-nav-control-flow-react", - "@benchmarks/client-nav-control-flow-solid", - "@benchmarks/client-nav-control-flow-vue", - "@benchmarks/client-nav-head-react", - "@benchmarks/client-nav-head-solid", - "@benchmarks/client-nav-head-vue", - "@benchmarks/client-nav-history-react", - "@benchmarks/client-nav-history-solid", - "@benchmarks/client-nav-history-vue", - "@benchmarks/client-nav-hydration-react", - "@benchmarks/client-nav-hydration-solid", - "@benchmarks/client-nav-link-churn-react", - "@benchmarks/client-nav-links-react", - "@benchmarks/client-nav-link-churn-solid", - "@benchmarks/client-nav-links-solid", - "@benchmarks/client-nav-link-churn-vue", - "@benchmarks/client-nav-links-vue", - "@benchmarks/client-nav-loaders-react", - "@benchmarks/client-nav-loaders-solid", - "@benchmarks/client-nav-loaders-vue", - "@benchmarks/client-nav-mount-react", - "@benchmarks/client-nav-mount-solid", - "@benchmarks/client-nav-mount-vue", - "@benchmarks/client-nav-nested-params-react", - "@benchmarks/client-nav-nested-params-solid", - "@benchmarks/client-nav-nested-params-vue", - "@benchmarks/client-nav-preload-react", - "@benchmarks/client-nav-preload-solid", - "@benchmarks/client-nav-preload-vue", - "@benchmarks/client-nav-rewrites-react", - "@benchmarks/client-nav-route-tree-scale-react", - "@benchmarks/client-nav-rewrites-solid", - "@benchmarks/client-nav-route-tree-scale-solid", - "@benchmarks/client-nav-rewrites-vue", - "@benchmarks/client-nav-route-tree-scale-vue", - "@benchmarks/client-nav-search-params-react", - "@benchmarks/client-nav-search-params-solid", - "@benchmarks/client-nav-search-params-vue" - ], - "target": "test:types:client" - } - ] - } - } - } -} diff --git a/benchmarks/client-nav/react/app.tsx b/benchmarks/client-nav/react/app.tsx deleted file mode 100644 index cad766e26c..0000000000 --- a/benchmarks/client-nav/react/app.tsx +++ /dev/null @@ -1,385 +0,0 @@ -import { - Link, - Outlet, - RouterProvider, - createMemoryHistory, - createRootRoute, - createRoute, - createRouter, - useParams, - useSearch, -} from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' - -function runPerfSelectorComputation(seed: number) { - let value = Math.trunc(seed) | 0 - - for (let index = 0; index < 40; index++) { - value = (value * 1664525 + 1013904223 + index) >>> 0 - } - - return value -} - -function normalizePage(value: unknown) { - const page = Number(value) - return Number.isFinite(page) && page > 0 ? Math.trunc(page) : 1 -} - -function normalizeFilter(value: unknown) { - return typeof value === 'string' && value.length > 0 ? value : 'all' -} - -const noop = () => {} -const rootSelectors = Array.from({ length: 10 }, (_, index) => index) -const routeSelectors = Array.from({ length: 6 }, (_, index) => index) -const linkGroups = Array.from({ length: 4 }, (_, index) => index) - -function RootParamsSubscriber() { - const params = useParams({ - strict: false, - select: (params) => runPerfSelectorComputation(Number(params.id ?? 0)), - }) - - void runPerfSelectorComputation(params) - return null -} - -function RootSearchSubscriber() { - const search = useSearch({ - strict: false, - select: (search) => runPerfSelectorComputation(Number(search.page ?? 0)), - }) - - void runPerfSelectorComputation(search) - return null -} - -function LinkPanel() { - return ( - <> - {linkGroups.map((groupIndex) => { - const itemsId = groupIndex === 0 ? 1 : groupIndex + 2 - const ctxId = groupIndex + 1 - - return ( -
- - {`Items ${itemsId}`} - - - {`Items 2 alt ${groupIndex}`} - - - {`Search ${groupIndex}`} - - - {`Context ${ctxId}`} - - ({ - page: prev.page + groupIndex + 1, - filter: prev.filter, - junk: `updater-${groupIndex}`, - })} - activeOptions={{ includeSearch: true }} - > - {({ isActive }) => - isActive - ? `Search updater active ${groupIndex}` - : `Search updater inactive ${groupIndex}` - } - -
- ) - })} - - ) -} - -function Root() { - return ( - <> - {rootSelectors.map((selector) => ( - - ))} - {rootSelectors.map((selector) => ( - - ))} - - - - ) -} - -const rootRoute = createRootRoute({ - component: Root, -}) - -const itemsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/items/$id', - params: { - parse: (params) => ({ - ...params, - id: normalizePage(params.id), - }), - stringify: (params) => ({ - ...params, - id: `${params.id}`, - }), - }, - onEnter: noop, - onStay: noop, - onLeave: noop, - component: ItemsPage, -}) - -const itemDetailsRoute = createRoute({ - getParentRoute: () => itemsRoute, - path: 'details', - component: ItemDetailsPage, -}) - -const searchRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/search', - validateSearch: (search: Record) => ({ - page: normalizePage(search.page), - filter: normalizeFilter(search.filter), - }), - search: { - middlewares: [ - ({ search, next }) => { - const result = next(search) - return { - page: result.page, - filter: result.filter, - } - }, - ], - }, - loaderDeps: ({ search }) => ({ - page: search.page, - filter: search.filter, - }), - loader: ({ deps }) => ({ - seed: deps.page * 31 + deps.filter.length, - checksum: deps.page * 17 + deps.filter.length, - }), - staleTime: 60_000, - gcTime: 60_000, - component: SearchPage, -}) - -const contextRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/ctx/$id', - beforeLoad: ({ params }) => ({ - sectionSeed: Number(params.id) * 13 + 1, - }), - component: ContextPage, -}) - -function ItemParamsSubscriber() { - const params = itemsRoute.useParams({ - select: (params) => runPerfSelectorComputation(params.id), - }) - - void runPerfSelectorComputation(params) - return null -} - -function SearchStateSubscriber() { - const search = searchRoute.useSearch({ - select: (search) => - runPerfSelectorComputation(search.page + search.filter.length), - }) - - void runPerfSelectorComputation(search) - return null -} - -function SearchLoaderDepsSubscriber() { - const loaderDeps = searchRoute.useLoaderDeps({ - select: (loaderDeps) => - runPerfSelectorComputation(loaderDeps.page + loaderDeps.filter.length), - }) - - void runPerfSelectorComputation(loaderDeps) - return null -} - -function SearchLoaderDataSubscriber() { - const loaderData = searchRoute.useLoaderData({ - select: (loaderData) => - runPerfSelectorComputation(loaderData.seed + loaderData.checksum), - }) - - void runPerfSelectorComputation(loaderData) - return null -} - -function ContextParamsSubscriber() { - const params = contextRoute.useParams({ - select: (params) => runPerfSelectorComputation(Number(params.id)), - }) - - void runPerfSelectorComputation(params) - return null -} - -function ContextRouteSubscriber() { - const context = contextRoute.useRouteContext({ - select: (context) => runPerfSelectorComputation(context.sectionSeed), - }) - - void runPerfSelectorComputation(context) - return null -} - -function ItemsPage() { - return ( - <> - {routeSelectors.map((selector) => ( - - ))} - - Details - - - Preserve search on item - - - - ) -} - -function ItemDetailsPage() { - return ( - <> - {routeSelectors.map((selector) => ( - - ))} - - Back to item - - - ) -} - -function SearchPage() { - return ( - <> - {routeSelectors.map((selector) => ( - - ))} - {routeSelectors.map((selector) => ( - - ))} - {routeSelectors.map((selector) => ( - - ))} - ({ - page: prev.page + 1, - filter: prev.filter, - junk: 'local-updater', - })} - activeOptions={{ includeSearch: true }} - activeProps={{ className: 'active-link' }} - inactiveProps={{ className: 'inactive-link' }} - > - Next page - - - ) -} - -function ContextPage() { - return ( - <> - {routeSelectors.map((selector) => ( - - ))} - {routeSelectors.map((selector) => ( - - ))} - - ) -} - -export function mountTestApp(container: Element) { - const router = createRouter({ - history: createMemoryHistory({ - initialEntries: ['/items/0'], - }), - scrollRestoration: true, - routeTree: rootRoute.addChildren([ - itemsRoute.addChildren([itemDetailsRoute]), - searchRoute, - contextRoute, - ]), - }) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/react/setup.ts b/benchmarks/client-nav/react/setup.ts deleted file mode 100644 index 11541383ec..0000000000 --- a/benchmarks/client-nav/react/setup.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { NavigateOptions } from '@tanstack/router-core' -import type * as App from './app' -import { getRequiredLink, waitForRequiredLink } from '../setup-helpers' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - if (process.env.NODE_ENV !== 'production') { - console.warn( - 'client-nav benchmark is running without NODE_ENV=production; React dev overhead will dominate results.', - ) - } - - let container: HTMLDivElement | undefined = undefined - let unmount: (() => void) | undefined = undefined - let unsub = () => {} - let stepIndex = 0 - let next: () => Promise = () => Promise.reject('Test not initialized') - - async function before() { - stepIndex = 0 - container = document.createElement('div') - document.body.append(container) - - const { router, unmount: dispose } = mountTestApp(container) - unmount = dispose - - let resolveRendered: () => void = () => {} - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - const navigate = (opts: NavigateOptions) => - new Promise((resolveNext) => { - resolveRendered = resolveNext - router.navigate(opts) - }) - - const click = (testId: string, cache?: Map) => - new Promise((resolveNext) => { - resolveRendered = resolveNext - - getRequiredLink(container!, testId, cache).dispatchEvent( - new MouseEvent('click', { - bubbles: true, - cancelable: true, - button: 0, - }), - ) - }) - - await router.load() - - const cachedLinks = new Map() - for (const testId of ['go-items-1', 'go-items-2', 'go-search', 'go-ctx']) { - await waitForRequiredLink(container, testId, cachedLinks) - } - - const steps = [ - () => click('go-items-1', cachedLinks), - () => click('items-details'), - () => - navigate({ - to: '/items/$id/details', - params: { id: 2 }, - replace: true, - }), - () => click('items-parent'), - () => click('go-search', cachedLinks), - () => click('search-next-page'), - () => - navigate({ - to: '/search', - search: { page: 1, filter: 'all' }, - replace: true, - }), - () => click('go-ctx', cachedLinks), - () => - navigate({ - to: '/ctx/$id', - params: { id: 2 }, - replace: true, - }), - () => click('go-items-2', cachedLinks), - ] as const - - next = () => { - const step = steps[stepIndex % steps.length]! - stepIndex += 1 - return step() - } - } - - function after() { - unmount?.() - container?.remove() - unsub() - } - - function tick() { - return next() - } - - return { - before, - tick, - after, - } -} diff --git a/benchmarks/client-nav/react/speed.bench.ts b/benchmarks/client-nav/react/speed.bench.ts deleted file mode 100644 index 944f182734..0000000000 --- a/benchmarks/client-nav/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { setup } from './setup' - -test('client-nav', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-side navigation loop (react)', - { beforeAll: scenario.before, afterAll: scenario.after }, - async () => { - for (let i = 0; i < 10; i++) { - await scenario.tick() - } - }, - ).run({ - warmupIterations: 100, - time: 10_000, - }) -}) diff --git a/benchmarks/client-nav/react/speed.flame.ts b/benchmarks/client-nav/react/speed.flame.ts deleted file mode 100644 index 285ccc63d7..0000000000 --- a/benchmarks/client-nav/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/react/tsconfig.json b/benchmarks/client-nav/react/tsconfig.json deleted file mode 100644 index 046a85af51..0000000000 --- a/benchmarks/client-nav/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "../jsdom.ts", - "setup.ts", - "vite.config.ts", - "../vitest.setup.ts" - ] -} diff --git a/benchmarks/client-nav/react/vite.config.ts b/benchmarks/client-nav/react/vite.config.ts deleted file mode 100644 index 7df3f80e71..0000000000 --- a/benchmarks/client-nav/react/vite.config.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { cpuSimulationExecArgv } from '../../cpu-simulation' - -// Anchor the project root to the package directory so this config resolves -// identically when run directly and as part of an aggregate `projects` config. -const rootDir = fileURLToPath(new URL('..', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './react/dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './react/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav (react)', - 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/project.json b/benchmarks/client-nav/scenarios/async-pipeline/react/project.json deleted file mode 100644 index 44ab55ccfe..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-async-pipeline-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/async-pipeline/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/setup.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/setup.ts deleted file mode 100644 index 130583b190..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts deleted file mode 100644 index 65dab0781e..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-async-pipeline', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-async-pipeline navigation loop (react)', - 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/async-pipeline/react/speed.flame.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx deleted file mode 100644 index cab86a1272..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/main.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultPendingMs: 0, - defaultPendingMinMs: 0, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routeTree.gen.ts deleted file mode 100644 index 9c79bab826..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routeTree.gen.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const NestedRoute = NestedRouteImport.update({ - id: '/nested', - path: '/nested', - getParentRoute: () => rootRouteImport, -} as any) -const CtxIdRoute = CtxIdRouteImport.update({ - id: '/ctx/$id', - path: '/ctx/$id', - getParentRoute: () => rootRouteImport, -} as any) -const NestedIdRoute = NestedIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => NestedRoute, -} as any) -const SlowIdRoute = SlowIdRouteImport.update({ - id: '/slow/$id', - path: '/slow/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - id: '__root__' | '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - NestedRoute: typeof NestedRouteWithChildren - CtxIdRoute: typeof CtxIdRoute - SlowIdRoute: typeof SlowIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/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': { - id: '/nested/$id' - path: '/$id' - fullPath: '/nested/$id' - preLoaderRoute: typeof NestedIdRouteImport - parentRoute: typeof NestedRoute - } - '/slow/$id': { - id: '/slow/$id' - path: '/slow/$id' - fullPath: '/slow/$id' - preLoaderRoute: typeof SlowIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -interface NestedRouteChildren { - NestedIdRoute: typeof NestedIdRoute -} - -const NestedRouteChildren: NestedRouteChildren = { - NestedIdRoute: NestedIdRoute, -} - -const NestedRouteWithChildren = - NestedRoute._addFileChildren(NestedRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - NestedRoute: NestedRouteWithChildren, - CtxIdRoute: CtxIdRoute, - SlowIdRoute: SlowIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/__root.tsx deleted file mode 100644 index 1cc8566678..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/__root.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -const ids = ['1', '2'] - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/ctx.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/ctx.$id.tsx deleted file mode 100644 index d644376b7b..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/ctx.$id.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { - ctxSeedValue, - ctxStateValue, - deferredHops, - hopDelay, -} from '../../../shared' - -export const Route = createFileRoute('/ctx/$id')({ - staleTime: 0, - gcTime: 0, - beforeLoad: async ({ params }) => { - await hopDelay(deferredHops) - return { ctxSeed: ctxSeedValue(params.id) } - }, - loader: ({ params, context }) => { - if (context.ctxSeed !== ctxSeedValue(params.id)) { - throw new Error('beforeLoad context missing in loader') - } - return { value: ctxStateValue(params.id) } - }, - component: CtxPage, -}) - -function CtxPage() { - const data = Route.useLoaderData() - - return
{data.value}
-} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/index.tsx deleted file mode 100644 index 5b6d70e744..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-
home
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/nested.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/nested.$id.tsx deleted file mode 100644 index bc002c303f..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/nested.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { deferredHops, hopDelay, nestedStateValue } from '../../../shared' - -export const Route = createFileRoute('/nested/$id')({ - staleTime: 0, - gcTime: 0, - loader: async ({ params }) => { - await hopDelay(deferredHops) - return { value: nestedStateValue(params.id) } - }, - component: NestedPage, -}) - -function NestedPage() { - const data = Route.useLoaderData() - - return
{data.value}
-} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/nested.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/nested.tsx deleted file mode 100644 index 443f592373..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/nested.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { deferredHops, hopDelay, nestedLayoutValue } from '../../../shared' - -export const Route = createFileRoute('/nested')({ - staleTime: 0, - gcTime: 0, - loader: async () => { - await hopDelay(deferredHops) - return { value: nestedLayoutValue() } - }, - component: NestedLayout, -}) - -function NestedLayout() { - const data = Route.useLoaderData() - - return ( -
-
{data.value}
- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/slow.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/slow.$id.tsx deleted file mode 100644 index 4839b0ca6d..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/src/routes/slow.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { deferredHops, hopDelay, slowStateValue } from '../../../shared' - -export const Route = createFileRoute('/slow/$id')({ - staleTime: 0, - gcTime: 0, - loader: async ({ params }) => { - await hopDelay(deferredHops) - return { value: slowStateValue(params.id) } - }, - component: SlowPage, -}) - -function SlowPage() { - const data = Route.useLoaderData() - - return
{data.value}
-} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/tsconfig.json b/benchmarks/client-nav/scenarios/async-pipeline/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts b/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts deleted file mode 100644 index e36a5244b1..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav async-pipeline (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/shared.ts b/benchmarks/client-nav/scenarios/async-pipeline/shared.ts deleted file mode 100644 index 02123309b2..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/shared.ts +++ /dev/null @@ -1,113 +0,0 @@ -/** - * Shared definition of the `async-pipeline` scenario: the router's async - * load pipeline — fully async loaders (transition-held navigations), async - * `beforeLoad` context building, and parallel nested async loaders. All async - * work resolves through counted 0ms timer hops so the workload is - * deterministic. The three framework apps consume these builders so the - * workload is identical modulo the rendering layer. - * - * Note: component-level deferred consumption (`Await`/Suspense) is - * intentionally NOT covered. React throttles every Suspense reveal (with or - * without a fallback, including `pendingComponent`) by ~300ms of wall-clock - * time, which cannot be made deterministic; the async work is exercised - * through the router's own pipeline instead. - */ -import type { ScenarioStep } from '../harness' - -/** - * Resolves after exactly `hops` chained macrotask turns. Uses `setImmediate` - * rather than `setTimeout(0)`: both are counted, deterministic event-loop - * turns, but timers cost ~3-4 syscalls per hop (timerfd + epoll) and CodSpeed - * excludes syscall time from the measure — inconsistently past a threshold — - * which destabilized the hop-heavy benches. - */ -export function hopDelay(hops: number): Promise { - let promise = Promise.resolve() - for (let i = 0; i < hops; i++) { - promise = promise.then( - () => new Promise((resolve) => setImmediate(() => resolve())), - ) - } - return promise -} - -/** Number of 0ms hops every async loader/beforeLoad takes before resolving. */ -export const deferredHops = 2 - -function checksum(seed: number) { - let value = seed | 0 - for (let index = 0; index < 20; index++) { - value = (value * 1664525 + 1013904223 + index) >>> 0 - } - return value -} - -export function slowStateValue(id: string) { - return `state-${id}-${checksum(Number(id) * 71 + 3)}` -} - -export function ctxSeedValue(id: string) { - return checksum(Number(id) * 13 + 1) -} - -export function ctxStateValue(id: string) { - return `ctx-${id}-${checksum(ctxSeedValue(id) + 5)}` -} - -export function nestedLayoutValue() { - return `layout-${checksum(97)}` -} - -export function nestedStateValue(id: string) { - return `nested-${id}-${checksum(Number(id) * 41 + 11)}` -} - -function markerText(testId: string) { - return ( - document.querySelector(`[data-testid="${testId}"]`)?.textContent ?? - undefined - ) -} - -function step(testId: string, isSettled: () => boolean): ScenarioStep { - return { type: 'click', testId, isSettled } -} - -export const steps: ReadonlyArray = [ - step('go-slow-1', () => markerText('slow-state') === slowStateValue('1')), - step('go-ctx-1', () => markerText('ctx-state') === ctxStateValue('1')), - step( - 'go-nested-1', - () => - markerText('nested-layout') === nestedLayoutValue() && - markerText('nested-state') === nestedStateValue('1'), - ), - step('go-slow-2', () => markerText('slow-state') === slowStateValue('2')), - step('go-ctx-2', () => markerText('ctx-state') === ctxStateValue('2')), - step( - 'go-nested-2', - () => markerText('nested-state') === nestedStateValue('2'), - ), - step('go-home', () => markerText('home-state') === 'home'), -] - -export function assertStepResult(stepIndex: number) { - const current = steps[stepIndex]! - if (typeof current === 'string' || !('isSettled' in current)) { - return - } - if (!current.isSettled!()) { - throw new Error( - `Unexpected document state after async-pipeline step ${stepIndex}`, - ) - } -} - -// Two laps through the 7-step sequence per benchmark iteration. -export const ticksPerIteration = 14 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/project.json b/benchmarks/client-nav/scenarios/async-pipeline/solid/project.json deleted file mode 100644 index 2fce426b1e..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-async-pipeline-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/async-pipeline/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/setup.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/setup.ts deleted file mode 100644 index 6a46971603..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts deleted file mode 100644 index acef710469..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-async-pipeline', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-async-pipeline navigation loop (solid)', - 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/async-pipeline/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx deleted file mode 100644 index 4c6d49f501..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/main.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultPendingMs: 0, - defaultPendingMinMs: 0, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} 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 deleted file mode 100644 index 27b9498b11..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const NestedRoute = NestedRouteImport.update({ - id: '/nested', - path: '/nested', - getParentRoute: () => rootRouteImport, -} as any) -const CtxIdRoute = CtxIdRouteImport.update({ - id: '/ctx/$id', - path: '/ctx/$id', - getParentRoute: () => rootRouteImport, -} as any) -const NestedIdRoute = NestedIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => NestedRoute, -} as any) -const SlowIdRoute = SlowIdRouteImport.update({ - id: '/slow/$id', - path: '/slow/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - id: '__root__' | '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - NestedRoute: typeof NestedRouteWithChildren - CtxIdRoute: typeof CtxIdRoute - SlowIdRoute: typeof SlowIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/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': { - id: '/nested/$id' - path: '/$id' - fullPath: '/nested/$id' - preLoaderRoute: typeof NestedIdRouteImport - parentRoute: typeof NestedRoute - } - '/slow/$id': { - id: '/slow/$id' - path: '/slow/$id' - fullPath: '/slow/$id' - preLoaderRoute: typeof SlowIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -interface NestedRouteChildren { - NestedIdRoute: typeof NestedIdRoute -} - -const NestedRouteChildren: NestedRouteChildren = { - NestedIdRoute: NestedIdRoute, -} - -const NestedRouteWithChildren = - NestedRoute._addFileChildren(NestedRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - NestedRoute: NestedRouteWithChildren, - CtxIdRoute: CtxIdRoute, - SlowIdRoute: SlowIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/__root.tsx deleted file mode 100644 index 7d3647fee8..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/__root.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { For } from 'solid-js' -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -const ids = ['1', '2'] - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/ctx.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/ctx.$id.tsx deleted file mode 100644 index e757b57b9d..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/ctx.$id.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { - ctxSeedValue, - ctxStateValue, - deferredHops, - hopDelay, -} from '../../../shared' - -export const Route = createFileRoute('/ctx/$id')({ - staleTime: 0, - gcTime: 0, - beforeLoad: async ({ params }) => { - await hopDelay(deferredHops) - return { ctxSeed: ctxSeedValue(params.id) } - }, - loader: ({ params, context }) => { - if (context.ctxSeed !== ctxSeedValue(params.id)) { - throw new Error('beforeLoad context missing in loader') - } - return { value: ctxStateValue(params.id) } - }, - component: CtxPage, -}) - -function CtxPage() { - const data = Route.useLoaderData() - - return
{data().value}
-} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/index.tsx deleted file mode 100644 index 12907d440d..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-
home
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/nested.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/nested.$id.tsx deleted file mode 100644 index 5518ccf498..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/nested.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { deferredHops, hopDelay, nestedStateValue } from '../../../shared' - -export const Route = createFileRoute('/nested/$id')({ - staleTime: 0, - gcTime: 0, - loader: async ({ params }) => { - await hopDelay(deferredHops) - return { value: nestedStateValue(params.id) } - }, - component: NestedPage, -}) - -function NestedPage() { - const data = Route.useLoaderData() - - return
{data().value}
-} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/nested.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/nested.tsx deleted file mode 100644 index fdc939dc95..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/nested.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { deferredHops, hopDelay, nestedLayoutValue } from '../../../shared' - -export const Route = createFileRoute('/nested')({ - staleTime: 0, - gcTime: 0, - loader: async () => { - await hopDelay(deferredHops) - return { value: nestedLayoutValue() } - }, - component: NestedLayout, -}) - -function NestedLayout() { - const data = Route.useLoaderData() - - return ( -
-
{data().value}
- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/slow.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/slow.$id.tsx deleted file mode 100644 index 4c229407e1..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/src/routes/slow.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { deferredHops, hopDelay, slowStateValue } from '../../../shared' - -export const Route = createFileRoute('/slow/$id')({ - staleTime: 0, - gcTime: 0, - loader: async ({ params }) => { - await hopDelay(deferredHops) - return { value: slowStateValue(params.id) } - }, - component: SlowPage, -}) - -function SlowPage() { - const data = Route.useLoaderData() - - return
{data().value}
-} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json b/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts b/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts deleted file mode 100644 index 214da8042e..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav async-pipeline (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/project.json b/benchmarks/client-nav/scenarios/async-pipeline/vue/project.json deleted file mode 100644 index 911bb61e38..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-async-pipeline-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/async-pipeline/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/setup.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/setup.ts deleted file mode 100644 index 97b74b3892..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts deleted file mode 100644 index f0fd3e58df..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-async-pipeline', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-async-pipeline navigation 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/async-pipeline/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx deleted file mode 100644 index e1bfa5965f..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/main.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultPendingMs: 0, - defaultPendingMinMs: 0, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts deleted file mode 100644 index 66b9efd7aa..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const NestedRoute = NestedRouteImport.update({ - id: '/nested', - path: '/nested', - getParentRoute: () => rootRouteImport, -} as any) -const CtxIdRoute = CtxIdRouteImport.update({ - id: '/ctx/$id', - path: '/ctx/$id', - getParentRoute: () => rootRouteImport, -} as any) -const NestedIdRoute = NestedIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => NestedRoute, -} as any) -const SlowIdRoute = SlowIdRouteImport.update({ - id: '/slow/$id', - path: '/slow/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/nested': typeof NestedRouteWithChildren - '/ctx/$id': typeof CtxIdRoute - '/nested/$id': typeof NestedIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - id: '__root__' | '/' | '/nested' | '/ctx/$id' | '/nested/$id' | '/slow/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - NestedRoute: typeof NestedRouteWithChildren - CtxIdRoute: typeof CtxIdRoute - SlowIdRoute: typeof SlowIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/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': { - id: '/nested/$id' - path: '/$id' - fullPath: '/nested/$id' - preLoaderRoute: typeof NestedIdRouteImport - parentRoute: typeof NestedRoute - } - '/slow/$id': { - id: '/slow/$id' - path: '/slow/$id' - fullPath: '/slow/$id' - preLoaderRoute: typeof SlowIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -interface NestedRouteChildren { - NestedIdRoute: typeof NestedIdRoute -} - -const NestedRouteChildren: NestedRouteChildren = { - NestedIdRoute: NestedIdRoute, -} - -const NestedRouteWithChildren = - NestedRoute._addFileChildren(NestedRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - NestedRoute: NestedRouteWithChildren, - CtxIdRoute: CtxIdRoute, - SlowIdRoute: SlowIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/__root.tsx deleted file mode 100644 index c477ab7e68..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/__root.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' - -const ids = ['1', '2'] - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/ctx.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/ctx.$id.tsx deleted file mode 100644 index d995f1ff6c..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/ctx.$id.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { - ctxSeedValue, - ctxStateValue, - deferredHops, - hopDelay, -} from '../../../shared' - -const CtxPage = Vue.defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () =>
{data.value.value}
- }, -}) - -export const Route = createFileRoute('/ctx/$id')({ - staleTime: 0, - gcTime: 0, - beforeLoad: async ({ params }) => { - await hopDelay(deferredHops) - return { ctxSeed: ctxSeedValue(params.id) } - }, - loader: ({ params, context }) => { - if (context.ctxSeed !== ctxSeedValue(params.id)) { - throw new Error('beforeLoad context missing in loader') - } - return { value: ctxStateValue(params.id) } - }, - component: CtxPage, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/index.tsx deleted file mode 100644 index 128e132190..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-
home
-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/nested.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/nested.$id.tsx deleted file mode 100644 index bbeaaa7dd7..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/nested.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { deferredHops, hopDelay, nestedStateValue } from '../../../shared' - -const NestedPage = Vue.defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () =>
{data.value.value}
- }, -}) - -export const Route = createFileRoute('/nested/$id')({ - staleTime: 0, - gcTime: 0, - loader: async ({ params }) => { - await hopDelay(deferredHops) - return { value: nestedStateValue(params.id) } - }, - component: NestedPage, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/nested.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/nested.tsx deleted file mode 100644 index 763657dfc6..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/nested.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { deferredHops, hopDelay, nestedLayoutValue } from '../../../shared' - -const NestedLayout = Vue.defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-
{data.value.value}
- -
- ) - }, -}) - -export const Route = createFileRoute('/nested')({ - staleTime: 0, - gcTime: 0, - loader: async () => { - await hopDelay(deferredHops) - return { value: nestedLayoutValue() } - }, - component: NestedLayout, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/slow.$id.tsx b/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/slow.$id.tsx deleted file mode 100644 index c9afccba97..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/src/routes/slow.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { deferredHops, hopDelay, slowStateValue } from '../../../shared' - -const SlowPage = Vue.defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () =>
{data.value.value}
- }, -}) - -export const Route = createFileRoute('/slow/$id')({ - staleTime: 0, - gcTime: 0, - loader: async ({ params }) => { - await hopDelay(deferredHops) - return { value: slowStateValue(params.id) } - }, - component: SlowPage, -}) diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/tsconfig.json b/benchmarks/client-nav/scenarios/async-pipeline/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts b/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts deleted file mode 100644 index ce4fa7318a..0000000000 --- a/benchmarks/client-nav/scenarios/async-pipeline/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav async-pipeline (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/react/project.json b/benchmarks/client-nav/scenarios/control-flow/react/project.json deleted file mode 100644 index e3e580911f..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-control-flow-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/control-flow/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/setup.ts b/benchmarks/client-nav/scenarios/control-flow/react/setup.ts deleted file mode 100644 index 130583b190..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts deleted file mode 100644 index d6f2190be7..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-control-flow', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-control-flow navigation loop (react)', - 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/control-flow/react/speed.flame.ts b/benchmarks/client-nav/scenarios/control-flow/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx deleted file mode 100644 index da9e63d293..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/main.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - // The scenario intentionally throws loader errors every lap; keep React 19's - // default per-caught-error console reporting out of the measured loop. - const reactRoot = createRoot(container, { onCaughtError: () => {} }) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/control-flow/react/src/routeTree.gen.ts deleted file mode 100644 index 7b6db9b237..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routeTree.gen.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const BrokenRoute = BrokenRouteImport.update({ - id: '/broken', - path: '/broken', - getParentRoute: () => rootRouteImport, -} as any) -const Hop1Route = Hop1RouteImport.update({ - id: '/hop1', - path: '/hop1', - 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({ - id: '/missing/$id', - path: '/missing/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/broken' | '/hop1' | '/hop2' | '/target' | '/missing/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/broken' | '/hop1' | '/hop2' | '/target' | '/missing/$id' - id: - | '__root__' - | '/' - | '/broken' - | '/hop1' - | '/hop2' - | '/target' - | '/missing/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BrokenRoute: typeof BrokenRoute - Hop1Route: typeof Hop1Route - Hop2Route: typeof Hop2Route - TargetRoute: typeof TargetRoute - MissingIdRoute: typeof MissingIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/broken': { - id: '/broken' - path: '/broken' - fullPath: '/broken' - preLoaderRoute: typeof BrokenRouteImport - parentRoute: typeof rootRouteImport - } - '/hop1': { - id: '/hop1' - path: '/hop1' - fullPath: '/hop1' - preLoaderRoute: typeof Hop1RouteImport - 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': { - id: '/missing/$id' - path: '/missing/$id' - fullPath: '/missing/$id' - preLoaderRoute: typeof MissingIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BrokenRoute: BrokenRoute, - Hop1Route: Hop1Route, - Hop2Route: Hop2Route, - TargetRoute: TargetRoute, - MissingIdRoute: MissingIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/__root.tsx deleted file mode 100644 index 63d5feb901..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/__root.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useLocation, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function LocationMarker() { - const pathname = useLocation({ select: (location) => location.pathname }) - return {pathname} -} - -function RootComponent() { - return ( - <> - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx deleted file mode 100644 index b11bb845bc..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/broken.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { errorMessage } from '../../../shared' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/broken')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw new Error(errorMessage) - }, - errorComponent: BrokenError, -}) - -function BrokenError(props: ErrorComponentProps) { - return ( -
- {props.error instanceof Error ? props.error.message : String(props.error)} -
- ) -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/hop1.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/hop1.tsx deleted file mode 100644 index aacba39384..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/hop1.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/hop1')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw redirect({ to: '/hop2' }) - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/hop2.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/hop2.tsx deleted file mode 100644 index db31abe9f3..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/hop2.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/hop2')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw redirect({ to: '/target' }) - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/index.tsx deleted file mode 100644 index 24e856ea15..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return
home
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/missing.$id.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/missing.$id.tsx deleted file mode 100644 index 0c807bb2bc..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/missing.$id.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/react-router' - -export const Route = createFileRoute('/missing/$id')({ - staleTime: 0, - gcTime: 0, - loader: ({ params }) => { - if (params.id === 'gone') { - throw notFound() - } - return { id: params.id } - }, - component: MissingPage, - notFoundComponent: MissingNotFound, -}) - -function MissingPage() { - const data = Route.useLoaderData() - return
{data.id}
-} - -function MissingNotFound() { - return
missing not found
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/target.tsx b/benchmarks/client-nav/scenarios/control-flow/react/src/routes/target.tsx deleted file mode 100644 index 280f65835e..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/src/routes/target.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/target')({ - component: TargetPage, -}) - -function TargetPage() { - return
target
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/tsconfig.json b/benchmarks/client-nav/scenarios/control-flow/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts b/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts deleted file mode 100644 index 1eefca0fc3..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav control-flow (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/shared.ts b/benchmarks/client-nav/scenarios/control-flow/shared.ts deleted file mode 100644 index c4f368bee1..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/shared.ts +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Shared definition of the `control-flow` scenario: loader-thrown redirects - * (including a 2-hop chain), notFound() rendering, loader errors through the - * route error boundary, and recovery navigation resetting the boundary. - */ -import type { ScenarioStep } from '../harness' - -export const errorMessage = 'bench-error' - -export const steps: ReadonlyArray = [ - { - type: 'click', - testId: 'go-hop1', - // The click lands on /hop1 whose loader chains redirects to /target; wait - // until the post-redirect location is committed before finishing the step. - isSettled: () => - document.querySelector('[data-testid="loc"]')?.textContent === '/target', - }, - 'go-missing-ok', - 'go-missing-gone', - 'go-broken', - 'go-target', - 'go-missing-gone', - 'home', -] - -interface StepExpectation { - loc: string - present: ReadonlyArray - absent?: ReadonlyArray - errorText?: string -} - -const expectations: ReadonlyArray = [ - { loc: '/target', present: ['target-state'] }, - { loc: '/missing/exists', present: ['missing-state'] }, - { - loc: '/missing/gone', - present: ['not-found-state'], - absent: ['missing-state'], - }, - { loc: '/broken', present: ['error-state'], errorText: errorMessage }, - { loc: '/target', present: ['target-state'], absent: ['error-state'] }, - { loc: '/missing/gone', present: ['not-found-state'] }, - { loc: '/', present: ['home-state'] }, -] - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const expectation = expectations[stepIndex % expectations.length]! - - const loc = container.querySelector('[data-testid="loc"]') - if (loc?.textContent !== expectation.loc) { - throw new Error( - `Expected location "${expectation.loc}" after step ${stepIndex}, received "${loc?.textContent ?? ''}"`, - ) - } - - for (const testId of expectation.present) { - const element = container.querySelector(`[data-testid="${testId}"]`) - if (!element) { - throw new Error( - `Expected [data-testid="${testId}"] after step ${stepIndex}`, - ) - } - if ( - expectation.errorText && - !element.textContent?.includes(expectation.errorText) - ) { - throw new Error( - `Expected [data-testid="${testId}"] to include "${expectation.errorText}", received "${element.textContent}"`, - ) - } - } - - for (const testId of expectation.absent ?? []) { - if (container.querySelector(`[data-testid="${testId}"]`)) { - throw new Error( - `Expected [data-testid="${testId}"] to be absent after step ${stepIndex}`, - ) - } - } -} - -// Two laps through the 7-step sequence per benchmark iteration. -export const ticksPerIteration = 14 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/project.json b/benchmarks/client-nav/scenarios/control-flow/solid/project.json deleted file mode 100644 index 2b5154d385..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-control-flow-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/control-flow/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/setup.ts b/benchmarks/client-nav/scenarios/control-flow/solid/setup.ts deleted file mode 100644 index 6a46971603..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts deleted file mode 100644 index d803d2a313..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-control-flow', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-control-flow navigation loop (solid)', - 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/control-flow/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/control-flow/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} 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 deleted file mode 100644 index cd84f99d5d..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const BrokenRoute = BrokenRouteImport.update({ - id: '/broken', - path: '/broken', - getParentRoute: () => rootRouteImport, -} as any) -const Hop1Route = Hop1RouteImport.update({ - id: '/hop1', - path: '/hop1', - 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({ - id: '/missing/$id', - path: '/missing/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/broken' | '/hop1' | '/hop2' | '/target' | '/missing/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/broken' | '/hop1' | '/hop2' | '/target' | '/missing/$id' - id: - | '__root__' - | '/' - | '/broken' - | '/hop1' - | '/hop2' - | '/target' - | '/missing/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BrokenRoute: typeof BrokenRoute - Hop1Route: typeof Hop1Route - Hop2Route: typeof Hop2Route - TargetRoute: typeof TargetRoute - MissingIdRoute: typeof MissingIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/broken': { - id: '/broken' - path: '/broken' - fullPath: '/broken' - preLoaderRoute: typeof BrokenRouteImport - parentRoute: typeof rootRouteImport - } - '/hop1': { - id: '/hop1' - path: '/hop1' - fullPath: '/hop1' - preLoaderRoute: typeof Hop1RouteImport - 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': { - id: '/missing/$id' - path: '/missing/$id' - fullPath: '/missing/$id' - preLoaderRoute: typeof MissingIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BrokenRoute: BrokenRoute, - Hop1Route: Hop1Route, - Hop2Route: Hop2Route, - TargetRoute: TargetRoute, - MissingIdRoute: MissingIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/__root.tsx deleted file mode 100644 index 1bce9e8a3e..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/__root.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useLocation, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function LocationMarker() { - const pathname = useLocation({ select: (location) => location.pathname }) - return {pathname()} -} - -function RootComponent() { - return ( - <> - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/broken.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/broken.tsx deleted file mode 100644 index 9931ef9c58..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/broken.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { errorMessage } from '../../../shared' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export const Route = createFileRoute('/broken')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw new Error(errorMessage) - }, - errorComponent: BrokenError, -}) - -function BrokenError(props: ErrorComponentProps) { - return
{props.error.message}
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/hop1.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/hop1.tsx deleted file mode 100644 index 1aedb481ec..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/hop1.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/hop1')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw redirect({ to: '/hop2' }) - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/hop2.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/hop2.tsx deleted file mode 100644 index 91b601c516..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/hop2.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/hop2')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw redirect({ to: '/target' }) - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/index.tsx deleted file mode 100644 index cc46764de5..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return
home
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/missing.$id.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/missing.$id.tsx deleted file mode 100644 index 9c0493fb48..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/missing.$id.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/solid-router' - -export const Route = createFileRoute('/missing/$id')({ - staleTime: 0, - gcTime: 0, - loader: ({ params }) => { - if (params.id === 'gone') { - throw notFound() - } - return { id: params.id } - }, - component: MissingPage, - notFoundComponent: MissingNotFound, -}) - -function MissingPage() { - const data = Route.useLoaderData() - return
{data().id}
-} - -function MissingNotFound() { - return
missing not found
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/target.tsx b/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/target.tsx deleted file mode 100644 index 87de4e59a7..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/src/routes/target.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/target')({ - component: TargetPage, -}) - -function TargetPage() { - return
target
-} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json b/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts b/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts deleted file mode 100644 index f4fa916154..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav control-flow (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/project.json b/benchmarks/client-nav/scenarios/control-flow/vue/project.json deleted file mode 100644 index 7370687988..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-control-flow-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/control-flow/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/setup.ts b/benchmarks/client-nav/scenarios/control-flow/vue/setup.ts deleted file mode 100644 index 97b74b3892..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts deleted file mode 100644 index 8a019945c7..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-control-flow', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-control-flow navigation 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/control-flow/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/control-flow/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts deleted file mode 100644 index 6b53a6a203..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,156 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const BrokenRoute = BrokenRouteImport.update({ - id: '/broken', - path: '/broken', - getParentRoute: () => rootRouteImport, -} as any) -const Hop1Route = Hop1RouteImport.update({ - id: '/hop1', - path: '/hop1', - 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({ - id: '/missing/$id', - path: '/missing/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/broken': typeof BrokenRoute - '/hop1': typeof Hop1Route - '/hop2': typeof Hop2Route - '/target': typeof TargetRoute - '/missing/$id': typeof MissingIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/broken' | '/hop1' | '/hop2' | '/target' | '/missing/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/broken' | '/hop1' | '/hop2' | '/target' | '/missing/$id' - id: - | '__root__' - | '/' - | '/broken' - | '/hop1' - | '/hop2' - | '/target' - | '/missing/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BrokenRoute: typeof BrokenRoute - Hop1Route: typeof Hop1Route - Hop2Route: typeof Hop2Route - TargetRoute: typeof TargetRoute - MissingIdRoute: typeof MissingIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/broken': { - id: '/broken' - path: '/broken' - fullPath: '/broken' - preLoaderRoute: typeof BrokenRouteImport - parentRoute: typeof rootRouteImport - } - '/hop1': { - id: '/hop1' - path: '/hop1' - fullPath: '/hop1' - preLoaderRoute: typeof Hop1RouteImport - 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': { - id: '/missing/$id' - path: '/missing/$id' - fullPath: '/missing/$id' - preLoaderRoute: typeof MissingIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BrokenRoute: BrokenRoute, - Hop1Route: Hop1Route, - Hop2Route: Hop2Route, - TargetRoute: TargetRoute, - MissingIdRoute: MissingIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/__root.tsx deleted file mode 100644 index 9695c4b32d..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/__root.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import * as Vue from 'vue' -import { - Link, - Outlet, - createRootRoute, - useLocation, -} from '@tanstack/vue-router' - -const LocationMarker = Vue.defineComponent({ - setup() { - const pathname = useLocation({ select: (location) => location.pathname }) - return () => {pathname.value} - }, -}) - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/broken.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/broken.tsx deleted file mode 100644 index c67fa2817e..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/broken.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { errorMessage } from '../../../shared' - -const BrokenError = Vue.defineComponent({ - props: { - error: { type: Error, required: true }, - }, - setup(props) { - return () =>
{props.error.message}
- }, -}) - -export const Route = createFileRoute('/broken')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw new Error(errorMessage) - }, - errorComponent: BrokenError, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/hop1.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/hop1.tsx deleted file mode 100644 index ed00cefe3f..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/hop1.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/vue-router' - -export const Route = createFileRoute('/hop1')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw redirect({ to: '/hop2' }) - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/hop2.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/hop2.tsx deleted file mode 100644 index f6d4b1c1e0..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/hop2.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/vue-router' - -export const Route = createFileRoute('/hop2')({ - staleTime: 0, - gcTime: 0, - loader: () => { - throw redirect({ to: '/target' }) - }, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/index.tsx deleted file mode 100644 index f3ffc58610..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () =>
home
- }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/missing.$id.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/missing.$id.tsx deleted file mode 100644 index 022ea656a6..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/missing.$id.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute, notFound } from '@tanstack/vue-router' - -const MissingPage = Vue.defineComponent({ - setup() { - const data = Route.useLoaderData() - return () =>
{data.value.id}
- }, -}) - -const MissingNotFound = Vue.defineComponent({ - setup() { - return () =>
missing not found
- }, -}) - -export const Route = createFileRoute('/missing/$id')({ - staleTime: 0, - gcTime: 0, - loader: ({ params }) => { - if (params.id === 'gone') { - throw notFound() - } - return { id: params.id } - }, - component: MissingPage, - notFoundComponent: MissingNotFound, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/target.tsx b/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/target.tsx deleted file mode 100644 index 4e22d0993a..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/src/routes/target.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const TargetPage = Vue.defineComponent({ - setup() { - return () =>
target
- }, -}) - -export const Route = createFileRoute('/target')({ - component: TargetPage, -}) diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/tsconfig.json b/benchmarks/client-nav/scenarios/control-flow/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts b/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts deleted file mode 100644 index 3c2750d2a6..0000000000 --- a/benchmarks/client-nav/scenarios/control-flow/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav control-flow (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/harness.ts b/benchmarks/client-nav/scenarios/harness.ts deleted file mode 100644 index cf3c39c7e6..0000000000 --- a/benchmarks/client-nav/scenarios/harness.ts +++ /dev/null @@ -1,534 +0,0 @@ -import { - createBrowserHistory, - createMemoryHistory, - type RouterHistory, -} from '@tanstack/history' -import { JSDOM } from 'jsdom' -import { getRequiredLink, waitForRequiredLink } from '../setup-helpers' - -export interface ScenarioRouter { - load: () => Promise - subscribe: (eventType: 'onRendered', callback: () => void) => () => void - navigate: (options: any) => Promise - preloadRoute: (options: any) => Promise - invalidate: () => Promise - history: { - back: () => void - forward: () => void - go: (index: number) => void - } -} - -export interface MountedScenarioApp { - router: ScenarioRouter - unmount: () => void -} - -/** - * A single benchmark step. Plain strings are link-click steps (the common - * case). Steps that change the router location (`click`, `navigate`, `back`, - * `forward`, `go`) are awaited through the router's `onRendered` event; steps - * that do background work (`hover`, `preload`, `invalidate`) are awaited - * through a fixed number of 0ms timer hops so the loop stays deterministic. - */ -export type ScenarioStep = - | string - | { - type: 'click' - testId: string - /** - * Optional post-render settle predicate for steps that trigger work - * finishing after `onRendered` (e.g. deferred data resolving through a - * Suspense boundary). The step keeps taking 0ms timer hops until the - * predicate returns true (bounded, throws when exceeded). - */ - isSettled?: () => boolean - } - | { - /** - * Dispatches a single `mouseover` on the link, which triggers - * `preload: 'intent'` exactly once in every adapter: React synthesizes - * `mouseEnter` from `mouseover`, and Solid/Vue attach a native - * `mouseover` preload handler. (Solid/Vue also listen to `mouseenter` — - * dispatching both events would run the preload pipeline twice for them - * but only once for React.) Then settles via counted 0ms hops. - */ - type: 'hover' - testId: string - settleHops?: number - } - | { type: 'navigate'; getOptions: () => object } - | { type: 'preload'; getOptions: () => object; settleHops?: number } - | { type: 'invalidate'; settleHops?: number } - | { type: 'back' } - | { type: 'forward' } - | { type: 'go'; delta: number } - -/** - * One macrotask turn via `setImmediate` rather than `setTimeout(0)`: both - * yield deterministically to the event loop (timers, MessageChannel, React's - * Node scheduler), but a timer costs ~3-4 syscalls (timerfd + epoll) per hop - * while an immediate costs ~1. CodSpeed excludes syscall time from the - * measure — inconsistently past a threshold, which flagged the hop-heavy - * benches as "skipped" — so the loop must stay syscall-lean. - */ -const timerHop = () => - new Promise((resolve) => setImmediate(() => resolve())) - -async function settle(hops: number) { - for (let i = 0; i < hops; i++) { - await timerHop() - } -} - -const MAX_SETTLE_HOPS = 100 -const BATCH_SETTLE_HOPS = 4 - -/** - * Close the batch at a deterministic macrotask boundary. Four fixed hops give - * framework passive effects and scheduler callbacks time to run without - * changing the amount of navigation work in the batch. - */ -async function finishBatch() { - await settle(BATCH_SETTLE_HOPS) -} - -async function settleUntil(isSettled: () => boolean, label: string) { - for (let i = 0; i < MAX_SETTLE_HOPS; i++) { - if (isSettled()) { - return - } - await timerHop() - } - throw new Error( - `Step "${label}" did not settle within ${MAX_SETTLE_HOPS} timer hops`, - ) -} - -/** - * Reroute zero-delay `window.setTimeout` calls onto `setImmediate` for the - * duration of the benchmark. jsdom delivers history traversals through two - * nested `window.setTimeout(0)` tasks; Node clamps those to 1ms of wall - * time, so with nothing else pending the event loop blocks in `epoll_wait` - * until each timer expires — and that blocked wall-time is recorded as - * highly variable syscall time (5-26ms across runs), enough for CodSpeed to - * skip-warn the history benches. Zero-delay timeouts carry no ordering - * semantics a check-phase immediate doesn't satisfy, and the suite's - * conventions already forbid real-delay timers in measured code; non-zero - * delays are passed through untouched. - */ -interface TimerWindow { - setTimeout: typeof window.setTimeout - clearTimeout: typeof window.clearTimeout -} - -function patchZeroDelayTimeouts(targetWindow: TimerWindow) { - const originalSetTimeout = targetWindow.setTimeout.bind(targetWindow) - const originalClearTimeout = targetWindow.clearTimeout.bind(targetWindow) - const immediates = new Map() - // Negative ids cannot collide with real jsdom timer ids. - let nextImmediateId = -2 - - targetWindow.setTimeout = (( - handler: (...handlerArgs: Array) => void, - delay?: number, - ...args: Array - ) => { - if (!delay) { - const id = nextImmediateId-- - immediates.set( - id, - setImmediate(() => { - immediates.delete(id) - handler(...args) - }), - ) - return id - } - return originalSetTimeout(handler, delay, ...args) - }) as typeof targetWindow.setTimeout - - targetWindow.clearTimeout = ((id: number) => { - const immediate = immediates.get(id) - if (immediate) { - clearImmediate(immediate) - immediates.delete(id) - return - } - originalClearTimeout(id) - }) as typeof targetWindow.clearTimeout - - return () => { - targetWindow.setTimeout = - originalSetTimeout as typeof targetWindow.setTimeout - targetWindow.clearTimeout = - originalClearTimeout as typeof targetWindow.clearTimeout - } -} - -interface ListenerTarget { - addEventListener: ( - type: string, - listener: EventListenerOrEventListenerObject | null, - options?: boolean | AddEventListenerOptions, - ) => void - removeEventListener: ( - type: string, - listener: EventListenerOrEventListenerObject | null, - options?: boolean | EventListenerOptions, - ) => void -} - -/** - * Scroll restoration installs page-lifetime listeners without a public router - * dispose operation. Capture just those listeners while the router is created - * so per-invocation routers do not remain reachable after teardown. - */ -function captureScrollRestorationListeners() { - const captured: Array<{ - target: ListenerTarget - type: string - listener: EventListenerOrEventListenerObject | null - options?: boolean | AddEventListenerOptions - }> = [] - const patches: Array<{ - target: ListenerTarget - addEventListener: ListenerTarget['addEventListener'] - }> = [] - - const patch = (target: ListenerTarget, capturedType: string) => { - const originalAddEventListener = target.addEventListener - patches.push({ target, addEventListener: originalAddEventListener }) - - target.addEventListener = function (type, listener, options) { - if (type === capturedType) { - captured.push({ target, type, listener, options }) - } - originalAddEventListener.call(target, type, listener, options) - } - } - - patch(document as unknown as ListenerTarget, 'scroll') - patch(globalThis as unknown as ListenerTarget, 'pagehide') - - let stopped = false - const stop = () => { - if (stopped) { - return - } - stopped = true - for (const entry of patches) { - entry.target.addEventListener = entry.addEventListener - } - } - - return { - stop, - cleanup() { - stop() - for (const { target, type, listener, options } of captured) { - target.removeEventListener(type, listener, options) - } - }, - } -} - -interface ScenarioHistoryResource { - history: RouterHistory - timeoutWindow?: TimerWindow - dispose: () => void -} - -function createScenarioHistory( - mode: NonNullable, - initialUrl: string, -): ScenarioHistoryResource { - if (mode === 'browser') { - const dom = new JSDOM('', { - url: new URL(initialUrl, 'http://localhost').href, - }) - const history = createBrowserHistory({ window: dom.window }) - - return { - history, - timeoutWindow: dom.window as unknown as TimerWindow, - dispose() { - history.destroy() - dom.window.close() - }, - } - } - - const history = createMemoryHistory({ initialEntries: [initialUrl] }) - return { - history, - dispose: history.destroy, - } -} - -export interface ScenarioSetupOptions { - frameworkLabel: string - mount: (container: HTMLElement, history: RouterHistory) => MountedScenarioApp - /** - * Circular sequence of steps advanced by `tick()`. Link steps must target - * links rendered from the start (e.g. in the root layout), no two - * consecutive location-changing steps may target the same location (a - * same-location click never triggers `onRendered`), and the sequence must - * leave the app back on the initial route so the warm-up lap ends in the - * starting state. - */ - steps: ReadonlyArray - /** Sanity check run once per step during the warm-up lap in `before()`. */ - assertAfterStep?: ( - stepIndex: number, - container: HTMLElement, - history: RouterHistory, - ) => void - /** - * URL used to initialize the fresh history before mounting (default '/'). - * Scenarios whose router uses a `basepath` or an input rewrite must start on - * an external URL that maps to their initial route. - */ - initialUrl?: string - /** - * Browser history is reserved for the scenario that explicitly measures - * browser history traversal. All other scenarios use fresh memory history. - */ - historyMode?: 'memory' | 'browser' -} - -function warnAboutDevMode(frameworkLabel: string) { - if (process.env.NODE_ENV !== 'production') { - console.warn( - `client-nav scenario benchmark is running without NODE_ENV=production; ${frameworkLabel} dev overhead will dominate results.`, - ) - } -} - -/** - * Shared scenario runner: mounts the prebuilt app, then advances a circular - * sequence of steps, synchronizing each step so its work is fully part of the - * measured tick and steps cannot overlap. - */ -export function createScenarioSetup(options: ScenarioSetupOptions) { - warnAboutDevMode(options.frameworkLabel) - - let container: HTMLDivElement | undefined = undefined - let unmount: (() => void) | undefined = undefined - let unsub = () => {} - let restoreTimeouts = () => {} - let cleanupScrollRestorationListeners = () => {} - let historyResource: ScenarioHistoryResource | undefined = undefined - let stepIndex = 0 - let next: () => Promise = () => - Promise.reject(new Error('Benchmark not initialized')) - - async function before() { - stepIndex = 0 - historyResource = createScenarioHistory( - options.historyMode ?? 'memory', - options.initialUrl ?? '/', - ) - - const restoreGlobalTimeouts = patchZeroDelayTimeouts(window) - const restoreHistoryTimeouts = historyResource.timeoutWindow - ? patchZeroDelayTimeouts(historyResource.timeoutWindow) - : () => {} - restoreTimeouts = () => { - restoreHistoryTimeouts() - restoreGlobalTimeouts() - } - - container = document.createElement('div') - document.body.append(container) - - const capturedListeners = captureScrollRestorationListeners() - let mounted: MountedScenarioApp - try { - mounted = options.mount(container, historyResource.history) - } finally { - capturedListeners.stop() - cleanupScrollRestorationListeners = capturedListeners.cleanup - } - - const { router, unmount: dispose } = mounted - unmount = dispose - - let resolveRendered: () => void = () => {} - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - const cachedLinks = new Map() - const rendered = () => - new Promise((resolveNext) => { - resolveRendered = resolveNext - }) - - const runStep = async (step: ScenarioStep) => { - if (typeof step === 'string') { - step = { type: 'click', testId: step } - } - - switch (step.type) { - case 'click': { - const renderedPromise = rendered() - getRequiredLink(container!, step.testId, cachedLinks).dispatchEvent( - new MouseEvent('click', { - bubbles: true, - cancelable: true, - button: 0, - }), - ) - await renderedPromise - if (step.isSettled) { - await settleUntil(step.isSettled, `click ${step.testId}`) - } - return - } - case 'hover': { - const link = getRequiredLink(container!, step.testId, cachedLinks) - link.dispatchEvent( - new MouseEvent('mouseover', { bubbles: true, cancelable: true }), - ) - await settle(step.settleHops ?? 4) - return - } - case 'navigate': { - const renderedPromise = rendered() - router.navigate(step.getOptions()) - await renderedPromise - return - } - case 'preload': { - await router.preloadRoute(step.getOptions()) - await settle(step.settleHops ?? 2) - return - } - case 'invalidate': { - await router.invalidate() - await settle(step.settleHops ?? 2) - return - } - case 'back': { - const renderedPromise = rendered() - router.history.back() - await renderedPromise - return - } - case 'forward': { - const renderedPromise = rendered() - router.history.forward() - await renderedPromise - return - } - case 'go': { - const renderedPromise = rendered() - router.history.go(step.delta) - await renderedPromise - return - } - } - } - - await router.load() - - const linkTestIds = new Set() - for (const step of options.steps) { - if (typeof step === 'string') { - linkTestIds.add(step) - } else if (step.type === 'click' || step.type === 'hover') { - linkTestIds.add(step.testId) - } - } - for (const testId of linkTestIds) { - await waitForRequiredLink(container, testId, cachedLinks) - } - - // One warm-up lap that also sanity-checks each step's observable output, - // ending back on the initial route so measurement starts from a known state. - for (const [index, step] of options.steps.entries()) { - await runStep(step) - options.assertAfterStep?.(index, container, historyResource.history) - } - await finishBatch() - - next = () => { - const step = options.steps[stepIndex % options.steps.length]! - stepIndex += 1 - return runStep(step) - } - } - - function after() { - unmount?.() - container?.remove() - unsub() - cleanupScrollRestorationListeners() - restoreTimeouts() - historyResource?.dispose() - restoreTimeouts = () => {} - cleanupScrollRestorationListeners = () => {} - unmount = undefined - container = undefined - historyResource = undefined - } - - function tick() { - return next() - } - - return { - before, - tick, - finishBatch, - after, - } -} - -export interface MountLoopSetupOptions { - frameworkLabel: string - mount: (container: HTMLElement, history: RouterHistory) => MountedScenarioApp - /** Test id that must appear in the container before a mount counts as done. */ - readyTestId: string - assertReady?: (container: HTMLElement) => void -} - -/** - * Mount-loop runner for cold-start scenarios: every tick creates a fresh - * container, mounts the app (router creation included), waits for the initial - * render to commit, then unmounts and cleans up. - */ -export function createMountLoopSetup(options: MountLoopSetupOptions) { - warnAboutDevMode(options.frameworkLabel) - - async function tick() { - const container = document.createElement('div') - document.body.append(container) - const history = createMemoryHistory({ initialEntries: ['/'] }) - - const { router, unmount } = options.mount(container, history) - - try { - await router.load() - await settleUntil( - () => - container.querySelector(`[data-testid="${options.readyTestId}"]`) !== - null, - `mount ${options.readyTestId}`, - ) - options.assertReady?.(container) - } finally { - unmount() - history.destroy() - container.remove() - } - } - - return { - before: async () => {}, - tick, - finishBatch, - after: () => {}, - } -} diff --git a/benchmarks/client-nav/scenarios/head/react/project.json b/benchmarks/client-nav/scenarios/head/react/project.json deleted file mode 100644 index 1becf30fb9..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-head-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/head/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/head/react/setup.ts b/benchmarks/client-nav/scenarios/head/react/setup.ts deleted file mode 100644 index 1a28b0ca94..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, stepTestIds } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps: stepTestIds, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/head/react/speed.bench.ts b/benchmarks/client-nav/scenarios/head/react/speed.bench.ts deleted file mode 100644 index d0d731a09f..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-head', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-head navigation loop (react)', - 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/head/react/speed.flame.ts b/benchmarks/client-nav/scenarios/head/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/main.tsx b/benchmarks/client-nav/scenarios/head/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/head/react/src/routeTree.gen.ts deleted file mode 100644 index 88867d9190..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routeTree.gen.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DocsRoute = DocsRouteImport.update({ - id: '/docs', - path: '/docs', - getParentRoute: () => rootRouteImport, -} as any) -const SettingsRoute = SettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => rootRouteImport, -} as any) -const ArticlesIdRoute = ArticlesIdRouteImport.update({ - id: '/articles/$id', - path: '/articles/$id', - getParentRoute: () => rootRouteImport, -} as any) -const DocsSectionRoute = DocsSectionRouteImport.update({ - id: '/$section', - path: '/$section', - getParentRoute: () => DocsRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/docs' | '/settings' | '/articles/$id' | '/docs/$section' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/docs' | '/settings' | '/articles/$id' | '/docs/$section' - id: - | '__root__' - | '/' - | '/docs' - | '/settings' - | '/articles/$id' - | '/docs/$section' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DocsRoute: typeof DocsRouteWithChildren - SettingsRoute: typeof SettingsRoute - ArticlesIdRoute: typeof ArticlesIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/docs': { - id: '/docs' - path: '/docs' - fullPath: '/docs' - preLoaderRoute: typeof DocsRouteImport - parentRoute: typeof rootRouteImport - } - '/settings': { - id: '/settings' - path: '/settings' - fullPath: '/settings' - preLoaderRoute: typeof SettingsRouteImport - parentRoute: typeof rootRouteImport - } - '/articles/$id': { - id: '/articles/$id' - path: '/articles/$id' - fullPath: '/articles/$id' - preLoaderRoute: typeof ArticlesIdRouteImport - parentRoute: typeof rootRouteImport - } - '/docs/$section': { - id: '/docs/$section' - path: '/$section' - fullPath: '/docs/$section' - preLoaderRoute: typeof DocsSectionRouteImport - parentRoute: typeof DocsRoute - } - } -} - -interface DocsRouteChildren { - DocsSectionRoute: typeof DocsSectionRoute -} - -const DocsRouteChildren: DocsRouteChildren = { - DocsSectionRoute: DocsSectionRoute, -} - -const DocsRouteWithChildren = DocsRoute._addFileChildren(DocsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DocsRoute: DocsRouteWithChildren, - SettingsRoute: SettingsRoute, - ArticlesIdRoute: ArticlesIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/head/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/head/react/src/routes/__root.tsx deleted file mode 100644 index 3d61dad0e9..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routes/__root.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/react-router' -import { articleIds, docsSections, rootHead } from '../../../shared' - -export const Route = createRootRoute({ - head: rootHead, - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/routes/articles.$id.tsx b/benchmarks/client-nav/scenarios/head/react/src/routes/articles.$id.tsx deleted file mode 100644 index 6f5b78d60e..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routes/articles.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { articleDescription, articleHead, articleTitle } from '../../../shared' - -export const Route = createFileRoute('/articles/$id')({ - head: ({ params }) => articleHead(params.id), - component: ArticlePage, -}) - -function ArticlePage() { - const params = Route.useParams() - - return ( -
-

{articleTitle(params.id)}

-

{articleDescription(params.id)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/routes/docs.$section.tsx b/benchmarks/client-nav/scenarios/head/react/src/routes/docs.$section.tsx deleted file mode 100644 index 6ed1935ada..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routes/docs.$section.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { docsDescription, docsSectionHead, docsTitle } from '../../../shared' - -export const Route = createFileRoute('/docs/$section')({ - head: ({ params }) => docsSectionHead(params.section), - component: DocsSectionPage, -}) - -function DocsSectionPage() { - const params = Route.useParams() - - return ( -
-

{docsTitle(params.section)}

-

{docsDescription(params.section)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/routes/docs.tsx b/benchmarks/client-nav/scenarios/head/react/src/routes/docs.tsx deleted file mode 100644 index a2da216ddb..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routes/docs.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { docsLayoutHead } from '../../../shared' - -export const Route = createFileRoute('/docs')({ - head: docsLayoutHead, - component: DocsLayout, -}) - -function DocsLayout() { - return ( -
-

Docs

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/head/react/src/routes/index.tsx deleted file mode 100644 index 6ac318452f..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routes/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { homeHead, homeTitle } from '../../../shared' - -export const Route = createFileRoute('/')({ - head: homeHead, - component: HomePage, -}) - -function HomePage() { - return ( -
-

{homeTitle}

-

Landing page

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/react/src/routes/settings.tsx b/benchmarks/client-nav/scenarios/head/react/src/routes/settings.tsx deleted file mode 100644 index cd73902bff..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/src/routes/settings.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { settingsHead, settingsTitle } from '../../../shared' - -export const Route = createFileRoute('/settings')({ - head: settingsHead, - component: SettingsPage, -}) - -function SettingsPage() { - return ( -
-

{settingsTitle}

-

Account settings

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/react/tsconfig.json b/benchmarks/client-nav/scenarios/head/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/head/react/vite.config.ts b/benchmarks/client-nav/scenarios/head/react/vite.config.ts deleted file mode 100644 index 7c8d6d4c15..0000000000 --- a/benchmarks/client-nav/scenarios/head/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav head (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/head/shared.ts b/benchmarks/client-nav/scenarios/head/shared.ts deleted file mode 100644 index db185d602b..0000000000 --- a/benchmarks/client-nav/scenarios/head/shared.ts +++ /dev/null @@ -1,152 +0,0 @@ -/** - * Shared definition of the `head` scenario: route head() payloads, the click - * sequence, and per-step sanity assertions. The three framework apps consume - * these builders so the workload is identical modulo the rendering layer. - */ - -const siteName = 'Head Bench' - -export const docsSections = ['api', 'guide', 'cli'] as const -export const articleIds = ['1', '2', '3'] as const - -export const homeTitle = `Home | ${siteName}` -export const settingsTitle = `Settings | ${siteName}` - -export function docsTitle(section: string) { - return `Docs ${section} | ${siteName}` -} - -export function docsDescription(section: string) { - return `Documentation for the ${section} section of the head benchmark app.` -} - -export function articleTitle(id: string) { - return `Article ${id} | ${siteName}` -} - -export function articleDescription(id: string) { - return `Long-form article number ${id}, with a description sized like a realistic summary of the page content.` -} - -export function rootHead() { - return { - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: siteName }, - { name: 'description', content: 'Client head-management benchmark' }, - { name: 'theme-color', content: '#111827' }, - { property: 'og:type', content: 'website' }, - { property: 'og:site_name', content: siteName }, - ], - links: [ - { rel: 'icon', href: '/favicon.ico' }, - { rel: 'preconnect', href: 'https://assets.example.com' }, - ], - } -} - -export function homeHead() { - return { - meta: [ - { title: homeTitle }, - { name: 'description', content: 'Landing page of the head benchmark' }, - { property: 'og:title', content: homeTitle }, - ], - links: [{ rel: 'canonical', href: 'https://example.com/' }], - } -} - -export function docsLayoutHead() { - return { - meta: [ - // Overridden by the child section route on every docs navigation, so the - // dedupe path is exercised for both `name` and `property` entries. - { name: 'description', content: 'Documentation hub' }, - { property: 'og:title', content: `Docs | ${siteName}` }, - { name: 'docsearch:index', content: 'head-bench-docs' }, - ], - links: [{ rel: 'search', href: '/docs/opensearch.xml' }], - } -} - -export function docsSectionHead(section: string) { - return { - meta: [ - { title: docsTitle(section) }, - { name: 'description', content: docsDescription(section) }, - { name: 'keywords', content: `docs,${section},router,benchmark` }, - { property: 'og:title', content: docsTitle(section) }, - { property: 'og:description', content: docsDescription(section) }, - { property: 'og:url', content: `https://example.com/docs/${section}` }, - { name: 'twitter:card', content: 'summary' }, - { name: 'twitter:title', content: docsTitle(section) }, - ], - links: [ - { rel: 'canonical', href: `https://example.com/docs/${section}` }, - { rel: 'prev', href: `https://example.com/docs/${section}/intro` }, - ], - } -} - -export function articleHead(id: string) { - return { - meta: [ - { title: articleTitle(id) }, - { name: 'description', content: articleDescription(id) }, - { name: 'author', content: 'Bench Author' }, - { property: 'og:title', content: articleTitle(id) }, - { property: 'og:description', content: articleDescription(id) }, - { property: 'og:url', content: `https://example.com/articles/${id}` }, - { property: 'og:image', content: `https://example.com/covers/${id}.png` }, - { property: 'article:published_time', content: '2026-01-01T00:00:00Z' }, - { name: 'twitter:card', content: 'summary_large_image' }, - { name: 'twitter:title', content: articleTitle(id) }, - ], - links: [{ rel: 'canonical', href: `https://example.com/articles/${id}` }], - } -} - -export function settingsHead() { - return { - meta: [ - { title: settingsTitle }, - // Same names as root entries, so the child-wins dedupe path runs. - { name: 'description', content: 'Account settings' }, - { name: 'theme-color', content: '#f9fafb' }, - { name: 'robots', content: 'noindex' }, - ], - links: [], - } -} - -export const steps = [ - { testId: 'go-docs-api', title: docsTitle('api') }, - { testId: 'go-article-1', title: articleTitle('1') }, - { testId: 'go-docs-guide', title: docsTitle('guide') }, - { testId: 'go-settings', title: settingsTitle }, - { testId: 'go-article-2', title: articleTitle('2') }, - { testId: 'go-docs-cli', title: docsTitle('cli') }, - { testId: 'go-article-3', title: articleTitle('3') }, - { testId: 'go-home', title: homeTitle }, -] as const - -export const stepTestIds = steps.map((step) => step.testId) - -export function assertStepResult(stepIndex: number) { - const expected = steps[stepIndex]!.title - if (document.title !== expected) { - throw new Error( - `Expected document.title to be "${expected}" after step ${stepIndex}, received "${document.title}"`, - ) - } -} - -// Two laps through the 8-step sequence per benchmark iteration. -export const ticksPerIteration = 16 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/head/solid/project.json b/benchmarks/client-nav/scenarios/head/solid/project.json deleted file mode 100644 index 2575a19b89..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-head-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/head/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/head/solid/setup.ts b/benchmarks/client-nav/scenarios/head/solid/setup.ts deleted file mode 100644 index 4ee924acff..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, stepTestIds } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps: stepTestIds, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts deleted file mode 100644 index ca156c950b..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-head', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-head navigation loop (solid)', - 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/head/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/head/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/main.tsx b/benchmarks/client-nav/scenarios/head/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts deleted file mode 100644 index b6f217e527..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DocsRoute = DocsRouteImport.update({ - id: '/docs', - path: '/docs', - getParentRoute: () => rootRouteImport, -} as any) -const SettingsRoute = SettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => rootRouteImport, -} as any) -const ArticlesIdRoute = ArticlesIdRouteImport.update({ - id: '/articles/$id', - path: '/articles/$id', - getParentRoute: () => rootRouteImport, -} as any) -const DocsSectionRoute = DocsSectionRouteImport.update({ - id: '/$section', - path: '/$section', - getParentRoute: () => DocsRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/docs' | '/settings' | '/articles/$id' | '/docs/$section' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/docs' | '/settings' | '/articles/$id' | '/docs/$section' - id: - | '__root__' - | '/' - | '/docs' - | '/settings' - | '/articles/$id' - | '/docs/$section' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DocsRoute: typeof DocsRouteWithChildren - SettingsRoute: typeof SettingsRoute - ArticlesIdRoute: typeof ArticlesIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/docs': { - id: '/docs' - path: '/docs' - fullPath: '/docs' - preLoaderRoute: typeof DocsRouteImport - parentRoute: typeof rootRouteImport - } - '/settings': { - id: '/settings' - path: '/settings' - fullPath: '/settings' - preLoaderRoute: typeof SettingsRouteImport - parentRoute: typeof rootRouteImport - } - '/articles/$id': { - id: '/articles/$id' - path: '/articles/$id' - fullPath: '/articles/$id' - preLoaderRoute: typeof ArticlesIdRouteImport - parentRoute: typeof rootRouteImport - } - '/docs/$section': { - id: '/docs/$section' - path: '/$section' - fullPath: '/docs/$section' - preLoaderRoute: typeof DocsSectionRouteImport - parentRoute: typeof DocsRoute - } - } -} - -interface DocsRouteChildren { - DocsSectionRoute: typeof DocsSectionRoute -} - -const DocsRouteChildren: DocsRouteChildren = { - DocsSectionRoute: DocsSectionRoute, -} - -const DocsRouteWithChildren = DocsRoute._addFileChildren(DocsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DocsRoute: DocsRouteWithChildren, - SettingsRoute: SettingsRoute, - ArticlesIdRoute: ArticlesIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/head/solid/src/routes/__root.tsx deleted file mode 100644 index 52ca7da373..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routes/__root.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { For } from 'solid-js' -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { articleIds, docsSections, rootHead } from '../../../shared' - -export const Route = createRootRoute({ - head: rootHead, - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routes/articles.$id.tsx b/benchmarks/client-nav/scenarios/head/solid/src/routes/articles.$id.tsx deleted file mode 100644 index dab11ada18..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routes/articles.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { articleDescription, articleHead, articleTitle } from '../../../shared' - -export const Route = createFileRoute('/articles/$id')({ - head: ({ params }) => articleHead(params.id), - component: ArticlePage, -}) - -function ArticlePage() { - const params = Route.useParams() - - return ( -
-

{articleTitle(params().id)}

-

{articleDescription(params().id)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routes/docs.$section.tsx b/benchmarks/client-nav/scenarios/head/solid/src/routes/docs.$section.tsx deleted file mode 100644 index 7ab1123e7a..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routes/docs.$section.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { docsDescription, docsSectionHead, docsTitle } from '../../../shared' - -export const Route = createFileRoute('/docs/$section')({ - head: ({ params }) => docsSectionHead(params.section), - component: DocsSectionPage, -}) - -function DocsSectionPage() { - const params = Route.useParams() - - return ( -
-

{docsTitle(params().section)}

-

{docsDescription(params().section)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routes/docs.tsx b/benchmarks/client-nav/scenarios/head/solid/src/routes/docs.tsx deleted file mode 100644 index 7f84b214d0..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routes/docs.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { docsLayoutHead } from '../../../shared' - -export const Route = createFileRoute('/docs')({ - head: docsLayoutHead, - component: DocsLayout, -}) - -function DocsLayout() { - return ( -
-

Docs

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/head/solid/src/routes/index.tsx deleted file mode 100644 index 229eecc8c1..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routes/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { homeHead, homeTitle } from '../../../shared' - -export const Route = createFileRoute('/')({ - head: homeHead, - component: HomePage, -}) - -function HomePage() { - return ( -
-

{homeTitle}

-

Landing page

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/src/routes/settings.tsx b/benchmarks/client-nav/scenarios/head/solid/src/routes/settings.tsx deleted file mode 100644 index 88424caef3..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/src/routes/settings.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { settingsHead, settingsTitle } from '../../../shared' - -export const Route = createFileRoute('/settings')({ - head: settingsHead, - component: SettingsPage, -}) - -function SettingsPage() { - return ( -
-

{settingsTitle}

-

Account settings

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/head/solid/tsconfig.json b/benchmarks/client-nav/scenarios/head/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/head/solid/vite.config.ts b/benchmarks/client-nav/scenarios/head/solid/vite.config.ts deleted file mode 100644 index 986b2de2b0..0000000000 --- a/benchmarks/client-nav/scenarios/head/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav head (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/project.json b/benchmarks/client-nav/scenarios/head/vue/project.json deleted file mode 100644 index 5ad7909d74..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-head-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/head/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/head/vue/setup.ts b/benchmarks/client-nav/scenarios/head/vue/setup.ts deleted file mode 100644 index 3dd6bc95a5..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, stepTestIds } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps: stepTestIds, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts deleted file mode 100644 index d188a9dd7a..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-head', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-head navigation 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/head/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/head/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/head/vue/src/main.tsx b/benchmarks/client-nav/scenarios/head/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts deleted file mode 100644 index 161f99a65c..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,145 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DocsRoute = DocsRouteImport.update({ - id: '/docs', - path: '/docs', - getParentRoute: () => rootRouteImport, -} as any) -const SettingsRoute = SettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => rootRouteImport, -} as any) -const ArticlesIdRoute = ArticlesIdRouteImport.update({ - id: '/articles/$id', - path: '/articles/$id', - getParentRoute: () => rootRouteImport, -} as any) -const DocsSectionRoute = DocsSectionRouteImport.update({ - id: '/$section', - path: '/$section', - getParentRoute: () => DocsRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/docs': typeof DocsRouteWithChildren - '/settings': typeof SettingsRoute - '/articles/$id': typeof ArticlesIdRoute - '/docs/$section': typeof DocsSectionRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/docs' | '/settings' | '/articles/$id' | '/docs/$section' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/docs' | '/settings' | '/articles/$id' | '/docs/$section' - id: - | '__root__' - | '/' - | '/docs' - | '/settings' - | '/articles/$id' - | '/docs/$section' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DocsRoute: typeof DocsRouteWithChildren - SettingsRoute: typeof SettingsRoute - ArticlesIdRoute: typeof ArticlesIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/docs': { - id: '/docs' - path: '/docs' - fullPath: '/docs' - preLoaderRoute: typeof DocsRouteImport - parentRoute: typeof rootRouteImport - } - '/settings': { - id: '/settings' - path: '/settings' - fullPath: '/settings' - preLoaderRoute: typeof SettingsRouteImport - parentRoute: typeof rootRouteImport - } - '/articles/$id': { - id: '/articles/$id' - path: '/articles/$id' - fullPath: '/articles/$id' - preLoaderRoute: typeof ArticlesIdRouteImport - parentRoute: typeof rootRouteImport - } - '/docs/$section': { - id: '/docs/$section' - path: '/$section' - fullPath: '/docs/$section' - preLoaderRoute: typeof DocsSectionRouteImport - parentRoute: typeof DocsRoute - } - } -} - -interface DocsRouteChildren { - DocsSectionRoute: typeof DocsSectionRoute -} - -const DocsRouteChildren: DocsRouteChildren = { - DocsSectionRoute: DocsSectionRoute, -} - -const DocsRouteWithChildren = DocsRoute._addFileChildren(DocsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DocsRoute: DocsRouteWithChildren, - SettingsRoute: SettingsRoute, - ArticlesIdRoute: ArticlesIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/head/vue/src/routes/__root.tsx deleted file mode 100644 index ad87699fef..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routes/__root.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import * as Vue from 'vue' -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/vue-router' -import { articleIds, docsSections, rootHead } from '../../../shared' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - ) - }, -}) - -export const Route = createRootRoute({ - head: rootHead, - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routes/articles.$id.tsx b/benchmarks/client-nav/scenarios/head/vue/src/routes/articles.$id.tsx deleted file mode 100644 index 43a6fade58..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routes/articles.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { articleDescription, articleHead, articleTitle } from '../../../shared' - -const ArticlePage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{articleTitle(params.value.id)}

-

{articleDescription(params.value.id)}

-
- ) - }, -}) - -export const Route = createFileRoute('/articles/$id')({ - head: ({ params }) => articleHead(params.id), - component: ArticlePage, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routes/docs.$section.tsx b/benchmarks/client-nav/scenarios/head/vue/src/routes/docs.$section.tsx deleted file mode 100644 index ebb59d61a2..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routes/docs.$section.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { docsDescription, docsSectionHead, docsTitle } from '../../../shared' - -const DocsSectionPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{docsTitle(params.value.section)}

-

{docsDescription(params.value.section)}

-
- ) - }, -}) - -export const Route = createFileRoute('/docs/$section')({ - head: ({ params }) => docsSectionHead(params.section), - component: DocsSectionPage, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routes/docs.tsx b/benchmarks/client-nav/scenarios/head/vue/src/routes/docs.tsx deleted file mode 100644 index feabbc4d4a..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routes/docs.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { docsLayoutHead } from '../../../shared' - -const DocsLayout = Vue.defineComponent({ - setup() { - return () => ( -
-

Docs

- -
- ) - }, -}) - -export const Route = createFileRoute('/docs')({ - head: docsLayoutHead, - component: DocsLayout, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/head/vue/src/routes/index.tsx deleted file mode 100644 index 421478833f..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routes/index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { homeHead, homeTitle } from '../../../shared' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

{homeTitle}

-

Landing page

-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - head: homeHead, - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/src/routes/settings.tsx b/benchmarks/client-nav/scenarios/head/vue/src/routes/settings.tsx deleted file mode 100644 index 1a519e16c2..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/src/routes/settings.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { settingsHead, settingsTitle } from '../../../shared' - -const SettingsPage = Vue.defineComponent({ - setup() { - return () => ( -
-

{settingsTitle}

-

Account settings

-
- ) - }, -}) - -export const Route = createFileRoute('/settings')({ - head: settingsHead, - component: SettingsPage, -}) diff --git a/benchmarks/client-nav/scenarios/head/vue/tsconfig.json b/benchmarks/client-nav/scenarios/head/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/head/vue/vite.config.ts b/benchmarks/client-nav/scenarios/head/vue/vite.config.ts deleted file mode 100644 index bb1126d85f..0000000000 --- a/benchmarks/client-nav/scenarios/head/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav head (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/history/react/project.json b/benchmarks/client-nav/scenarios/history/react/project.json deleted file mode 100644 index a2fe0001be..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-history-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/history/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/history/react/setup.ts b/benchmarks/client-nav/scenarios/history/react/setup.ts deleted file mode 100644 index c26b7ffd08..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - historyMode: 'browser', - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/history/react/speed.bench.ts b/benchmarks/client-nav/scenarios/history/react/speed.bench.ts deleted file mode 100644 index 6ec7031857..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-history', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-history navigation loop (react)', - 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/history/react/speed.flame.ts b/benchmarks/client-nav/scenarios/history/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/history/react/src/main.tsx b/benchmarks/client-nav/scenarios/history/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/history/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/history/react/src/routeTree.gen.ts deleted file mode 100644 index 21bb12ba35..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/routeTree.gen.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 GalleryRouteImport } from './routes/gallery' -import { Route as PagesNRouteImport } from './routes/pages.$n' -import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const GalleryRoute = GalleryRouteImport.update({ - id: '/gallery', - path: '/gallery', - getParentRoute: () => rootRouteImport, -} as any) -const PagesNRoute = PagesNRouteImport.update({ - id: '/pages/$n', - path: '/pages/$n', - getParentRoute: () => rootRouteImport, -} as any) -const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({ - id: '/photos/$photoId', - path: '/photos/$photoId', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - id: '__root__' | '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - GalleryRoute: typeof GalleryRoute - PagesNRoute: typeof PagesNRoute - PhotosPhotoIdRoute: typeof PhotosPhotoIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/gallery': { - id: '/gallery' - path: '/gallery' - fullPath: '/gallery' - preLoaderRoute: typeof GalleryRouteImport - parentRoute: typeof rootRouteImport - } - '/pages/$n': { - id: '/pages/$n' - path: '/pages/$n' - fullPath: '/pages/$n' - preLoaderRoute: typeof PagesNRouteImport - parentRoute: typeof rootRouteImport - } - '/photos/$photoId': { - id: '/photos/$photoId' - path: '/photos/$photoId' - fullPath: '/photos/$photoId' - preLoaderRoute: typeof PhotosPhotoIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - GalleryRoute: GalleryRoute, - PagesNRoute: PagesNRoute, - PhotosPhotoIdRoute: PhotosPhotoIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/history/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/history/react/src/routes/__root.tsx deleted file mode 100644 index 240d8719d4..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/routes/__root.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useBlocker, - useCanGoBack, - useLocation, -} from '@tanstack/react-router' -import { maskedPhotoId, shouldBlockFn } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - const pathname = useLocation({ select: (location) => location.pathname }) - const canGoBack = useCanGoBack() - - useBlocker({ shouldBlockFn }) - - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/history/react/src/routes/gallery.tsx b/benchmarks/client-nav/scenarios/history/react/src/routes/gallery.tsx deleted file mode 100644 index 55094556a6..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/routes/gallery.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/gallery')({ - component: GalleryPage, -}) - -function GalleryPage() { - return ( -
-

Gallery

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/history/react/src/routes/index.tsx deleted file mode 100644 index 932a72f2ef..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Home

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/react/src/routes/pages.$n.tsx b/benchmarks/client-nav/scenarios/history/react/src/routes/pages.$n.tsx deleted file mode 100644 index b9c5e2f8d0..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/routes/pages.$n.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { pageLabel } from '../../../shared' - -export const Route = createFileRoute('/pages/$n')({ - component: PageComponent, -}) - -function PageComponent() { - const params = Route.useParams() - - return ( -
-

{pageLabel(params.n)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/react/src/routes/photos.$photoId.tsx b/benchmarks/client-nav/scenarios/history/react/src/routes/photos.$photoId.tsx deleted file mode 100644 index 793b531c89..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/src/routes/photos.$photoId.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { photoLabel } from '../../../shared' - -export const Route = createFileRoute('/photos/$photoId')({ - component: PhotoComponent, -}) - -function PhotoComponent() { - const params = Route.useParams() - - return ( -
-

{photoLabel(params.photoId)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/react/tsconfig.json b/benchmarks/client-nav/scenarios/history/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/history/react/vite.config.ts b/benchmarks/client-nav/scenarios/history/react/vite.config.ts deleted file mode 100644 index bdbde9c668..0000000000 --- a/benchmarks/client-nav/scenarios/history/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav history (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/history/shared.ts b/benchmarks/client-nav/scenarios/history/shared.ts deleted file mode 100644 index be6096cea8..0000000000 --- a/benchmarks/client-nav/scenarios/history/shared.ts +++ /dev/null @@ -1,94 +0,0 @@ -/** - * Shared definition of the `history` scenario: push/replace/back/forward - * traversal, location masking, blocker registration overhead (the blocker - * never blocks), and useLocation/useCanGoBack subscriptions. - * - * The step lap is designed to keep the history depth stationary: it ends back - * on the initial entry, so the first push of the next lap truncates the stale - * forward tail and the session history never grows past 4 entries. - */ -import type { ScenarioStep } from '../harness' -import type { RouterHistory } from '@tanstack/history' - -export const pageIds = ['1', '2', '3'] as const -export const maskedPhotoId = '42' - -export function pageLabel(n: string) { - return `Page ${n}` -} - -export function photoLabel(id: string) { - return `Photo ${id}` -} - -/** Registered on every navigation, never blocks. */ -export const shouldBlockFn = () => false - -interface HistoryStepExpectation { - step: ScenarioStep - /** Expected router location pathname (the REAL location, even when masked). */ - pathname: string - /** Expected browser-history pathname when it differs (location masking). */ - windowPathname?: string - /** Marker test id that must be present in the container after the step. */ - marker?: string -} - -export const stepExpectations: ReadonlyArray = [ - { step: 'p-1', pathname: '/pages/1', marker: 'page-state' }, - { step: 'p-2', pathname: '/pages/2', marker: 'page-state' }, - { - step: 'photo-masked', - pathname: `/photos/${maskedPhotoId}`, - windowPathname: '/gallery', - marker: 'photo-state', - }, - { step: { type: 'back' }, pathname: '/pages/2', marker: 'page-state' }, - { step: { type: 'back' }, pathname: '/pages/1', marker: 'page-state' }, - { step: { type: 'forward' }, pathname: '/pages/2', marker: 'page-state' }, - { step: 'p-3-replace', pathname: '/pages/3', marker: 'page-state' }, - { step: { type: 'back' }, pathname: '/pages/1', marker: 'page-state' }, - { step: { type: 'back' }, pathname: '/', marker: 'home-state' }, -] - -export const steps = stepExpectations.map((expectation) => expectation.step) - -export function assertStepResult( - stepIndex: number, - container: HTMLElement, - history: RouterHistory, -) { - const expected = stepExpectations[stepIndex]! - - const loc = container.querySelector('[data-testid="loc"]')?.textContent - if (loc !== expected.pathname) { - throw new Error( - `Expected location marker to be "${expected.pathname}" after step ${stepIndex}, received "${loc}"`, - ) - } - - const windowPathname = expected.windowPathname ?? expected.pathname - if (history.location.pathname !== windowPathname) { - throw new Error( - `Expected history.location.pathname to be "${windowPathname}" after step ${stepIndex}, received "${history.location.pathname}"`, - ) - } - - if ( - expected.marker && - !container.querySelector(`[data-testid="${expected.marker}"]`) - ) { - throw new Error( - `Expected marker "${expected.marker}" to be rendered after step ${stepIndex}`, - ) - } -} - -// Two laps through the 9-step sequence per benchmark iteration. -export const ticksPerIteration = 18 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/history/solid/project.json b/benchmarks/client-nav/scenarios/history/solid/project.json deleted file mode 100644 index 6f4bba1ca5..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-history-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/history/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/history/solid/setup.ts b/benchmarks/client-nav/scenarios/history/solid/setup.ts deleted file mode 100644 index 4adf55d6df..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - historyMode: 'browser', - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts deleted file mode 100644 index 56af035b2b..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-history', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-history navigation loop (solid)', - 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/history/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/history/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/history/solid/src/main.tsx b/benchmarks/client-nav/scenarios/history/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts deleted file mode 100644 index af253f4a15..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 GalleryRouteImport } from './routes/gallery' -import { Route as PagesNRouteImport } from './routes/pages.$n' -import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const GalleryRoute = GalleryRouteImport.update({ - id: '/gallery', - path: '/gallery', - getParentRoute: () => rootRouteImport, -} as any) -const PagesNRoute = PagesNRouteImport.update({ - id: '/pages/$n', - path: '/pages/$n', - getParentRoute: () => rootRouteImport, -} as any) -const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({ - id: '/photos/$photoId', - path: '/photos/$photoId', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - id: '__root__' | '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - GalleryRoute: typeof GalleryRoute - PagesNRoute: typeof PagesNRoute - PhotosPhotoIdRoute: typeof PhotosPhotoIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/gallery': { - id: '/gallery' - path: '/gallery' - fullPath: '/gallery' - preLoaderRoute: typeof GalleryRouteImport - parentRoute: typeof rootRouteImport - } - '/pages/$n': { - id: '/pages/$n' - path: '/pages/$n' - fullPath: '/pages/$n' - preLoaderRoute: typeof PagesNRouteImport - parentRoute: typeof rootRouteImport - } - '/photos/$photoId': { - id: '/photos/$photoId' - path: '/photos/$photoId' - fullPath: '/photos/$photoId' - preLoaderRoute: typeof PhotosPhotoIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - GalleryRoute: GalleryRoute, - PagesNRoute: PagesNRoute, - PhotosPhotoIdRoute: PhotosPhotoIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/history/solid/src/routes/__root.tsx deleted file mode 100644 index edf7368929..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/routes/__root.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useBlocker, - useCanGoBack, - useLocation, -} from '@tanstack/solid-router' -import { maskedPhotoId, shouldBlockFn } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - const pathname = useLocation({ select: (location) => location.pathname }) - const canGoBack = useCanGoBack() - - useBlocker({ shouldBlockFn }) - - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routes/gallery.tsx b/benchmarks/client-nav/scenarios/history/solid/src/routes/gallery.tsx deleted file mode 100644 index b72d1c6195..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/routes/gallery.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/gallery')({ - component: GalleryPage, -}) - -function GalleryPage() { - return ( -
-

Gallery

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/history/solid/src/routes/index.tsx deleted file mode 100644 index 44a0b8045a..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Home

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routes/pages.$n.tsx b/benchmarks/client-nav/scenarios/history/solid/src/routes/pages.$n.tsx deleted file mode 100644 index 1def6674c6..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/routes/pages.$n.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { pageLabel } from '../../../shared' - -export const Route = createFileRoute('/pages/$n')({ - component: PageComponent, -}) - -function PageComponent() { - const params = Route.useParams() - - return ( -
-

{pageLabel(params().n)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/solid/src/routes/photos.$photoId.tsx b/benchmarks/client-nav/scenarios/history/solid/src/routes/photos.$photoId.tsx deleted file mode 100644 index ab2fe06e3f..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/src/routes/photos.$photoId.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { photoLabel } from '../../../shared' - -export const Route = createFileRoute('/photos/$photoId')({ - component: PhotoComponent, -}) - -function PhotoComponent() { - const params = Route.useParams() - - return ( -
-

{photoLabel(params().photoId)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/history/solid/tsconfig.json b/benchmarks/client-nav/scenarios/history/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/history/solid/vite.config.ts b/benchmarks/client-nav/scenarios/history/solid/vite.config.ts deleted file mode 100644 index 4da589ff0e..0000000000 --- a/benchmarks/client-nav/scenarios/history/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav history (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/history/vue/project.json b/benchmarks/client-nav/scenarios/history/vue/project.json deleted file mode 100644 index 17fca887ca..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-history-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/history/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/history/vue/setup.ts b/benchmarks/client-nav/scenarios/history/vue/setup.ts deleted file mode 100644 index df689964e4..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - historyMode: 'browser', - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts deleted file mode 100644 index 3d36ac4cfa..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-history', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-history navigation 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/history/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/history/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/history/vue/src/main.tsx b/benchmarks/client-nav/scenarios/history/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts deleted file mode 100644 index 519aef7c8f..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 GalleryRouteImport } from './routes/gallery' -import { Route as PagesNRouteImport } from './routes/pages.$n' -import { Route as PhotosPhotoIdRouteImport } from './routes/photos.$photoId' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const GalleryRoute = GalleryRouteImport.update({ - id: '/gallery', - path: '/gallery', - getParentRoute: () => rootRouteImport, -} as any) -const PagesNRoute = PagesNRouteImport.update({ - id: '/pages/$n', - path: '/pages/$n', - getParentRoute: () => rootRouteImport, -} as any) -const PhotosPhotoIdRoute = PhotosPhotoIdRouteImport.update({ - id: '/photos/$photoId', - path: '/photos/$photoId', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/gallery': typeof GalleryRoute - '/pages/$n': typeof PagesNRoute - '/photos/$photoId': typeof PhotosPhotoIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - id: '__root__' | '/' | '/gallery' | '/pages/$n' | '/photos/$photoId' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - GalleryRoute: typeof GalleryRoute - PagesNRoute: typeof PagesNRoute - PhotosPhotoIdRoute: typeof PhotosPhotoIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/gallery': { - id: '/gallery' - path: '/gallery' - fullPath: '/gallery' - preLoaderRoute: typeof GalleryRouteImport - parentRoute: typeof rootRouteImport - } - '/pages/$n': { - id: '/pages/$n' - path: '/pages/$n' - fullPath: '/pages/$n' - preLoaderRoute: typeof PagesNRouteImport - parentRoute: typeof rootRouteImport - } - '/photos/$photoId': { - id: '/photos/$photoId' - path: '/photos/$photoId' - fullPath: '/photos/$photoId' - preLoaderRoute: typeof PhotosPhotoIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - GalleryRoute: GalleryRoute, - PagesNRoute: PagesNRoute, - PhotosPhotoIdRoute: PhotosPhotoIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/history/vue/src/routes/__root.tsx deleted file mode 100644 index 7f7dff159c..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/routes/__root.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import * as Vue from 'vue' -import { - Link, - Outlet, - createRootRoute, - useBlocker, - useCanGoBack, - useLocation, -} from '@tanstack/vue-router' -import { maskedPhotoId, shouldBlockFn } from '../../../shared' - -const RootComponent = Vue.defineComponent({ - setup() { - const pathname = useLocation({ select: (location) => location.pathname }) - const canGoBack = useCanGoBack() - - useBlocker({ shouldBlockFn }) - - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routes/gallery.tsx b/benchmarks/client-nav/scenarios/history/vue/src/routes/gallery.tsx deleted file mode 100644 index 3a397b1843..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/routes/gallery.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const GalleryPage = Vue.defineComponent({ - setup() { - return () => ( -
-

Gallery

-
- ) - }, -}) - -export const Route = createFileRoute('/gallery')({ - component: GalleryPage, -}) diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/history/vue/src/routes/index.tsx deleted file mode 100644 index fbc5b957a7..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/routes/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

Home

-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routes/pages.$n.tsx b/benchmarks/client-nav/scenarios/history/vue/src/routes/pages.$n.tsx deleted file mode 100644 index 560e83ed29..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/routes/pages.$n.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { pageLabel } from '../../../shared' - -const PageComponent = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{pageLabel(params.value.n)}

-
- ) - }, -}) - -export const Route = createFileRoute('/pages/$n')({ - component: PageComponent, -}) diff --git a/benchmarks/client-nav/scenarios/history/vue/src/routes/photos.$photoId.tsx b/benchmarks/client-nav/scenarios/history/vue/src/routes/photos.$photoId.tsx deleted file mode 100644 index 186566fe72..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/src/routes/photos.$photoId.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { photoLabel } from '../../../shared' - -const PhotoComponent = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{photoLabel(params.value.photoId)}

-
- ) - }, -}) - -export const Route = createFileRoute('/photos/$photoId')({ - component: PhotoComponent, -}) diff --git a/benchmarks/client-nav/scenarios/history/vue/tsconfig.json b/benchmarks/client-nav/scenarios/history/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/history/vue/vite.config.ts b/benchmarks/client-nav/scenarios/history/vue/vite.config.ts deleted file mode 100644 index c5f1ca9807..0000000000 --- a/benchmarks/client-nav/scenarios/history/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav history (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/hydration/react/fixture.ts b/benchmarks/client-nav/scenarios/hydration/react/fixture.ts deleted file mode 100644 index 950c870a1c..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/fixture.ts +++ /dev/null @@ -1,31 +0,0 @@ -export const ordinaryLinkCount = 192 -export const hashLinkCount = 8 -export const serverUrl = '/teams/team-7/items/item-42?view=summary' -export const clientUrl = `${serverUrl}#details` - -export interface Diagnostics { - beforeLoads: number - loaders: number - mounted: boolean - clicks: number - ordinaryRenders: number - hashRenders: number - countRenders: boolean -} - -export function createDiagnostics(countRenders = false): Diagnostics { - return { - beforeLoads: 0, - loaders: 0, - mounted: false, - clicks: 0, - ordinaryRenders: 0, - hashRenders: 0, - countRenders, - } -} - -export interface FixtureArtifact { - html: string - scripts: Array -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/generate-fixture.mjs b/benchmarks/client-nav/scenarios/hydration/react/generate-fixture.mjs deleted file mode 100644 index fbc67c5a08..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/generate-fixture.mjs +++ /dev/null @@ -1,23 +0,0 @@ -import assert from 'node:assert/strict' -import { writeFile } from 'node:fs/promises' -import { JSDOM } from 'jsdom' - -if (process.env.NODE_ENV !== 'production') { - throw new Error('Generate the hydration fixture in production mode') -} -const { renderFixture } = await import('./dist/server/server.js') -const html = await renderFixture() -const dom = new JSDOM(html) -try { - const scriptElements = [...dom.window.document.querySelectorAll('script')] - assert.ok(scriptElements.length > 0) - assert.ok(scriptElements.every((script) => !script.src)) - const scripts = scriptElements.map((script) => script.textContent) - assert.ok(scripts.some((script) => script.includes('$_TSR'))) - await writeFile( - new URL('./dist/fixture.json', import.meta.url), - JSON.stringify({ html, scripts }), - ) -} finally { - dom.window.close() -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts b/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts deleted file mode 100644 index 7e466cbaed..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/hydration.test.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { expect, test } from 'vitest' -import { hashLinkCount, ordinaryLinkCount } from './fixture' -import { setup } from './setup' -import { settleHydration } from './settle' - -const turn = () => new Promise((resolve) => setImmediate(resolve)) - -test('restores data and context into fresh DOMs and includes follow-up renders', async () => { - const scenario = setup({ countRenders: true }) - const schedulerTasks = new Set() - for (let iteration = 0; iteration < 3; iteration++) { - await scenario.before() - try { - expect(scenario.snapshot().diagnostics.mounted).toBe(false) - expect(scenario.snapshot().matches).toBeUndefined() - await scenario.run() - schedulerTasks.add(scenario.schedulerTasks()) - const completed = scenario.snapshot() - // Supports both main's extra Link update and the optimized snapshot. - expect([ordinaryLinkCount, ordinaryLinkCount * 2]).toContain( - completed.diagnostics.ordinaryRenders, - ) - expect(completed.diagnostics.hashRenders).toBeGreaterThanOrEqual( - hashLinkCount + hashLinkCount / 2, - ) - for (let index = 0; index < 4; index++) { - await turn() - } - expect(scenario.snapshot()).toEqual(completed) - await expect(scenario.run()).rejects.toThrow('newly prepared sample') - } finally { - await scenario.after() - } - } - // React yields on its pinned clock, never on wall time spent hydrating. - expect(schedulerTasks.size).toBe(1) -}) - -test('rejects an empty measurement and still releases its sample', async () => { - const scenario = setup() - await scenario.before() - await expect(scenario.after()).rejects.toThrow( - 'Hydration sample was not completed', - ) - await scenario.before() - try { - await scenario.run() - } finally { - await scenario.after() - } -}) - -test('waits for a commit and scheduler work lasting more than 100 turns', async () => { - let committed = false - const commit = (async () => { - for (let index = 0; index < 150; index++) { - await turn() - } - committed = true - })() - let remainingCallbacks = 150 - await settleHydration( - commit, - () => { - expect(committed).toBe(true) - return remainingCallbacks-- <= 0 - }, - () => 'delayed commit', - ) - expect(remainingCallbacks).toBeLessThan(0) -}) - -test('retains a watchdog for a commit that never completes', async () => { - await expect( - settleHydration( - new Promise(() => {}), - () => true, - () => 'commit pending', - 10, - ), - ).rejects.toThrow('Hydration did not settle within 10ms: commit pending') -}) - -test('retains a watchdog when scheduler work never becomes idle', async () => { - await expect( - settleHydration( - Promise.resolve(), - () => false, - () => 'callbacks pending', - 10, - ), - ).rejects.toThrow('Hydration did not settle within 10ms: callbacks pending') -}) diff --git a/benchmarks/client-nav/scenarios/hydration/react/project.json b/benchmarks/client-nav/scenarios/hydration/react/project.json deleted file mode 100644 index ca23838c0f..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-hydration-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { "projects": ["@tanstack/react-router"], "target": "build" } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.server.config.ts && NODE_ENV=production node {projectRoot}/generate-fixture.mjs && NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:unit": { - "executor": "nx:run-commands", - "dependsOn": ["build:client"], - "options": { - "command": "vitest run --config ./scenarios/hydration/react/vite.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:perf": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --run --config ./scenarios/hydration/react/vite.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { "projects": ["@tanstack/react-router"], "target": "build" } - ], - "options": { "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" } - } - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/settle.ts b/benchmarks/client-nav/scenarios/hydration/react/settle.ts deleted file mode 100644 index cc4c09a72d..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/settle.ts +++ /dev/null @@ -1,35 +0,0 @@ -const turn = () => new Promise((resolve) => setImmediate(resolve)) - -export async function settleHydration( - committed: Promise, - isIdle: () => boolean, - describeProgress: () => string, - timeoutMs = 60_000, -) { - let timeoutError: Error | undefined - let watchdog: ReturnType | undefined - const timeout = new Promise((_, reject) => { - watchdog = setTimeout(() => { - timeoutError = new Error( - `Hydration did not settle within ${timeoutMs}ms: ${describeProgress()}`, - ) - reject(timeoutError) - }, timeoutMs) - }) - try { - // Concurrent hydration can need many more scheduler turns under CPU - // instrumentation. Await its commit instead of limiting successful work - // to an arbitrary number of event-loop polls. - await Promise.race([committed, timeout]) - let idleTurns = 0 - while (idleTurns < 2) { - await turn() - if (timeoutError) { - throw timeoutError - } - idleTurns = isIdle() ? idleTurns + 1 : 0 - } - } finally { - clearTimeout(watchdog) - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/setup.ts b/benchmarks/client-nav/scenarios/hydration/react/setup.ts deleted file mode 100644 index 7c588af3fd..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/setup.ts +++ /dev/null @@ -1,316 +0,0 @@ -import assert from 'node:assert/strict' -import { readFileSync } from 'node:fs' -import { fileURLToPath } from 'node:url' -import { Script } from 'node:vm' -import { JSDOM, VirtualConsole } from 'jsdom' -import { clientUrl, hashLinkCount, ordinaryLinkCount } from './fixture' -import { settleHydration } from './settle' -import type { FixtureArtifact } from './fixture' -import type * as Client from './src/client' - -type ClientApp = typeof Client -const turn = () => new Promise((resolve) => setImmediate(resolve)) - -// React's scheduler ends a time slice once performance.now() has advanced 5 ms. -// Under CodSpeed's CPU simulation the wall clock advances much further per -// instruction, by a runner-dependent factor, so real time turned identical -// samples into different numbers of yields, scheduler tasks and event-loop -// turns. With a frozen clock React yields only to paint after a commit, as on -// a fast host. 1 s is past React's initial 300 ms fallback throttle. Only the -// window's performance clock is pinned: Date.now(), which the Router uses for -// match timestamps, is unchanged. -const schedulerTime = 1_000 - -export function setup({ countRenders = false } = {}) { - // Compile once, outside measurement. Evaluation below creates fresh objects - // in each window's realm; neither the payload nor module state is reused. - const artifact: FixtureArtifact = JSON.parse( - readFileSync(new URL('./dist/fixture.json', import.meta.url), 'utf8'), - ) - const clientPath = new URL('./dist/client/client.js', import.meta.url) - const clientScript = new Script(readFileSync(clientPath, 'utf8'), { - filename: fileURLToPath(clientPath), - }) - const bootstrapScripts = artifact.scripts.map( - (source, index) => - new Script(source, { - filename: `hydration-bootstrap-${index}.js`, - }), - ) - let current: Awaited> | undefined - - async function prepare() { - const errors: Array = [] - const virtualConsole = new VirtualConsole() - virtualConsole.on('jsdomError', (error) => errors.push(String(error))) - virtualConsole.on('error', (...args) => - errors.push(args.map(String).join(' ')), - ) - const dom = new JSDOM(artifact.html, { - url: `http://localhost${clientUrl}`, - runScripts: 'outside-only', - virtualConsole, - }) - const immediates = new Set() - const scheduler = { tasks: 0 } - try { - Object.assign(dom.window, { - TextEncoder, - TextDecoder, - ReadableStream, - WritableStream, - TransformStream, - // Let React's production scheduler use the same task-turn primitive as - // the existing Node client benchmarks, without a real-delay timer. - setImmediate( - callback: (...args: Array) => void, - ...args: Array - ) { - scheduler.tasks++ - const handle = setImmediate(() => { - immediates.delete(handle) - callback(...args) - }) - immediates.add(handle) - return handle - }, - clearImmediate(handle: NodeJS.Immediate) { - immediates.delete(handle) - clearImmediate(handle) - }, - fetch() { - throw new Error('Hydration attempted a network request') - }, - scrollTo() {}, - }) - dom.window.performance.now = () => schedulerTime - const context = dom.getInternalVMContext() - // jsdom has no layout/scroll implementation; only hydration CPU is measured. - dom.window.HTMLElement.prototype.scrollIntoView = () => {} - clientScript.runInContext(context) - const app = (dom.window as unknown as { HydrationBenchmark: ClientApp }) - .HydrationBenchmark - assert.equal(app.serverEnvironment, false) - const anchors = Array.from(dom.window.document.querySelectorAll('a')) - const scriptElements = Array.from( - dom.window.document.querySelectorAll('script'), - ) - const executingScript = { current: null as HTMLScriptElement | null } - Object.defineProperty(dom.window.document, 'currentScript', { - configurable: true, - get: () => executingScript.current, - }) - assert.equal(anchors.length, ordinaryLinkCount + hashLinkCount) - const content = dom.window.document.getElementById('hydration-content') - assert.ok(content) - // Finish jsdom's initial document lifecycle before opening the measure. - await turn() - assert.equal(dom.window.document.readyState, 'complete') - assert.equal(app.ready(), false) - return { - dom, - context, - app, - anchors, - content, - scriptElements, - executingScript, - immediates, - scheduler, - errors, - started: false, - completed: false, - failed: false, - } - } catch (error) { - for (const handle of immediates) { - clearImmediate(handle) - } - dom.window.close() - throw error - } - } - - async function before() { - if (current) { - throw new Error('Previous hydration sample was not disposed') - } - current = await prepare() - } - - async function run() { - const sample = current - if (!sample || sample.started) { - throw new Error('Hydration requires a newly prepared sample') - } - sample.started = true - try { - // HTML parsing/module evaluation are already done. Payload execution, - // router initialization/restoration and React hydration are measured. - for (let index = 0; index < bootstrapScripts.length; index++) { - // SSR bootstrap scripts remove their own script element after running. - sample.executingScript.current = sample.scriptElements[index]! - try { - bootstrapScripts[index]!.runInContext(sample.context) - } finally { - sample.executingScript.current = null - } - } - await settleHydration( - sample.app.start(countRenders), - () => sample.immediates.size === 0, - () => { - const progress = sample.app.snapshot() - return JSON.stringify({ - diagnostics: progress.diagnostics, - errors: [...sample.errors, ...progress.errors], - restoredMatches: progress.matches?.length, - pendingSchedulerCallbacks: sample.immediates.size, - }) - }, - ) - if (sample.errors.length) { - throw new Error(sample.errors.join('\n')) - } - assert.ok( - sample.app.ready(), - 'Hydration committed without the expected active links', - ) - sample.completed = true - } catch (error) { - sample.failed = true - throw error - } - } - - function snapshot() { - if (!current) { - throw new Error('No hydration sample') - } - // Normalize realm prototypes only for untimed assertions. - return JSON.parse(JSON.stringify(current.app.snapshot())) as ReturnType< - ClientApp['snapshot'] - > - } - - function schedulerTasks() { - if (!current) { - throw new Error('No hydration sample') - } - return current.scheduler.tasks - } - - function validate() { - assert.ok(current?.started) - const { dom, anchors, content, errors } = current - const doc = dom.window.document - const result = snapshot() - assert.deepEqual(errors, []) - assert.deepEqual(result.errors, []) - assert.equal(result.diagnostics.beforeLoads, 0) - assert.equal(result.diagnostics.loaders, 0) - assert.equal(result.diagnostics.mounted, true) - assert.equal(result.location, clientUrl) - assert.equal(result.matches?.length, 3) - for (const match of result.matches) { - assert.equal(match.status, 'success') - assert.deepEqual(match.context.viewer, { - id: 'viewer-3', - name: 'Ada', - role: 'editor', - }) - } - assert.deepEqual(result.matches[1]!.context.team, { - id: 'team-7', - member: 'viewer-3', - }) - assert.deepEqual(result.matches[2]!.context.permissions, { edit: true }) - assert.deepEqual(result.matches[1]!.loaderData, { - title: 'Team team-7', - categories: ['open', 'closed'], - }) - const data = result.matches[2]!.loaderData as { - owner: string - selected: string - rows: Array<{ - id: string - label: string - details: { score: number; open: boolean } - }> - } - assert.equal(data.owner, 'viewer-3') - assert.equal(data.selected, 'item-42') - assert.equal(data.rows.length, ordinaryLinkCount) - assert.equal(doc.getElementById('hydration-content'), content) - assert.equal(doc.querySelectorAll('a').length, anchors.length) - assert.equal(doc.getElementById('viewer')?.textContent, 'Ada') - assert.equal(doc.getElementById('permission')?.textContent, 'Editable') - for (const anchor of anchors) { - assert.equal(doc.getElementById(anchor.id), anchor) - } - for (let index = 0; index < ordinaryLinkCount; index++) { - const anchor = doc.getElementById(`ordinary-item-${index}`)! - assert.equal( - anchor.getAttribute('href'), - `/teams/team-7/items/item-${index}?view=summary`, - ) - assert.equal(anchor.textContent, `Item ${index}`) - assert.equal( - anchor.getAttribute('data-status'), - index === 42 ? 'active' : null, - ) - assert.deepEqual(data.rows[index], { - id: `item-${index}`, - label: `Item ${index}`, - details: { score: index * 3, open: index % 2 === 0 }, - }) - } - for (let index = 0; index < hashLinkCount; index++) { - assert.equal( - doc.getElementById(`hash-${index}`)?.getAttribute('data-status'), - index % 2 === 0 ? 'active' : null, - ) - } - doc - .getElementById('interactive')! - .dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true })) - assert.equal( - current.app.snapshot().diagnostics.clicks, - result.diagnostics.clicks + 1, - ) - } - - async function after() { - const sample = current - if (!sample) { - return - } - try { - if (!sample.failed) { - assert.ok(sample.completed, 'Hydration sample was not completed') - validate() - } - } finally { - current = undefined - try { - sample.app.dispose() - // Unmount work and its scheduled effects stay outside the measure. - await turn() - await turn() - } finally { - for (const handle of sample.immediates) { - clearImmediate(handle) - } - sample.dom.window.close() - } - } - } - - return { - before, - run, - after, - snapshot, - schedulerTasks, - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts b/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts deleted file mode 100644 index 643877760e..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { setup } from './setup' - -test('client-hydration', async ({ bench }) => { - const scenario = setup() - - await bench( - 'hydrate restored route state and mixed Links (react)', - { beforeEach: scenario.before, afterEach: scenario.after }, - async () => { - await scenario.run() - }, - ).run({ - time: 5000, - warmupTime: 1000, - warmupIterations: 20, - throws: true, - }) -}) diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/app.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/app.tsx deleted file mode 100644 index e9797f71fa..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/src/app.tsx +++ /dev/null @@ -1,216 +0,0 @@ -import { useEffect } from 'react' -import { - HeadContent, - Link, - Outlet, - Scripts, - createMemoryHistory, - createRootRoute, - createRoute, - createRouter, - useHydrated, -} from '@tanstack/react-router' -import { - clientUrl, - hashLinkCount, - ordinaryLinkCount, - serverUrl, -} from '../fixture' -import type { ReactNode } from 'react' -import type { Diagnostics } from '../fixture' - -export function createFixtureRouter( - server: boolean, - diagnostics: Diagnostics, - onHydrated: () => void = () => {}, -) { - function beforeLoad() { - diagnostics.beforeLoads++ - if (!server) { - throw new Error('Hydration reran beforeLoad instead of restoring context') - } - } - - function loader() { - diagnostics.loaders++ - if (!server) { - throw new Error('Hydration reran a loader instead of restoring data') - } - } - - const root = createRootRoute({ - beforeLoad: () => { - beforeLoad() - return { viewer: { id: 'viewer-3', name: 'Ada', role: 'editor' } } - }, - head: () => ({ - meta: [{ charSet: 'utf-8' }, { title: 'Hydration benchmark' }], - }), - shellComponent: Document, - }) - const team = createRoute({ - getParentRoute: () => root, - path: '/teams/$teamId', - beforeLoad: ({ context, params }) => { - beforeLoad() - return { team: { id: params.teamId, member: context.viewer.id } } - }, - loader: ({ context }) => { - loader() - return { - title: `Team ${context.team.id}`, - categories: ['open', 'closed'], - } - }, - component: Team, - }) - const items = createRoute({ - getParentRoute: () => team, - path: 'items/$itemId', - validateSearch: (search: Record) => ({ - view: search.view === 'details' ? 'details' : 'summary', - }), - beforeLoad: ({ context }) => { - beforeLoad() - return { permissions: { edit: context.viewer.role === 'editor' } } - }, - loader: ({ context, params }) => { - loader() - return { - selected: params.itemId, - owner: context.team.member, - rows: Array.from({ length: ordinaryLinkCount }, (_, index) => ({ - id: `item-${index}`, - label: `Item ${index}`, - details: { score: index * 3, open: index % 2 === 0 }, - })), - } - }, - component: Items, - }) - - function Document({ children }: { children: ReactNode }) { - return ( - - - - - - {children} - - - - ) - } - - function Team() { - const context = team.useRouteContext() - const data = team.useLoaderData() - return ( -
-

{data.title}

-

{context.viewer.name}

- -
- ) - } - - function Items() { - const data = items.useLoaderData() - const context = items.useRouteContext() - useEffect(() => { - diagnostics.mounted = true - }, []) - return ( - <> -

- {context.permissions.edit ? 'Editable' : 'Read only'} -

- - - - {data.rows.map((row) => ( - - - - - - ))} - -
{row.id}{row.details.score} - - {diagnostics.countRenders - ? () => { - diagnostics.ordinaryRenders++ - return row.label - } - : row.label} - -
- -
Details
- - - ) - } - - function HydrationComplete() { - const hydrated = useHydrated() - useEffect(() => { - if (hydrated) { - onHydrated() - } - }, [hydrated]) - return null - } - - return createRouter({ - routeTree: root.addChildren([team.addChildren([items])]), - history: createMemoryHistory({ - initialEntries: [server ? serverUrl : clientUrl], - }), - isServer: server, - scrollRestoration: false, - defaultHashScrollIntoView: false, - defaultPreload: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx deleted file mode 100644 index 42c5a5104e..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/src/client.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import { startTransition } from 'react' -import { hydrateRoot } from 'react-dom/client' -import { RouterProvider } from '@tanstack/react-router' -import { hydrate } from '@tanstack/react-router/ssr/client' -import { isServer } from '@tanstack/router-core/isServer' -import { createDiagnostics, hashLinkCount } from '../fixture' -import { createFixtureRouter } from './app' - -export const serverEnvironment = isServer -let router: ReturnType | undefined -let root: ReturnType | undefined -let diagnostics = createDiagnostics() -const errors: Array = [] - -export async function start(countRenders = false) { - if (router) { - throw new Error('A hydration sample must use a fresh client realm') - } - if (!window.$_TSR?.router) { - throw new Error('Missing SSR hydration payload') - } - diagnostics = createDiagnostics(countRenders) - let resolveHydrated!: () => void - let rejectHydrated!: (error: unknown) => void - const hydrated = new Promise((resolve, reject) => { - resolveHydrated = resolve - rejectHydrated = reject - }) - router = createFixtureRouter(false, diagnostics, resolveHydrated) - // This is the same restoration path used by Start, without a module-cached - // RouterClient/StartClient promise or a live server in the worker. - await hydrate(router) - window.$_TSR.h() - startTransition(() => { - root = hydrateRoot(document, , { - onRecoverableError: (error) => { - errors.push(String(error)) - rejectHydrated(error) - }, - onUncaughtError: (error) => { - errors.push(String(error)) - rejectHydrated(error) - }, - }) - }) - await hydrated -} - -export function ready() { - if (!diagnostics.mounted) { - return false - } - // Matching hash Links only become active in the follow-up hydration commit. - // Ending at the first mount effect would miss the work this scenario targets. - for (let index = 0; index < hashLinkCount; index += 2) { - if ( - document.getElementById(`hash-${index}`)?.getAttribute('data-status') !== - 'active' - ) { - return false - } - } - return true -} - -export function snapshot() { - const matches = router?.stores.matches.get() - return { - diagnostics: { ...diagnostics }, - errors: [...errors], - location: router?.stores.location.get().href, - matches: matches?.map((match) => ({ - status: match.status, - context: match.context, - loaderData: match.loaderData, - })), - } -} - -export function dispose() { - root?.unmount() - router?.history.destroy() -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/src/server.tsx b/benchmarks/client-nav/scenarios/hydration/react/src/server.tsx deleted file mode 100644 index 713b0a77f2..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/src/server.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - createRequestHandler, - defaultStreamHandler, -} from '@tanstack/react-router/ssr/server' -import { isServer } from '@tanstack/router-core/isServer' -import { createDiagnostics, serverUrl } from '../fixture' -import { createFixtureRouter } from './app' - -export async function renderFixture() { - if ((isServer as boolean | undefined) !== true) { - throw new Error('Fixture generation requires the production server build') - } - const diagnostics = createDiagnostics() - const response = await createRequestHandler({ - createRouter: () => createFixtureRouter(true, diagnostics), - request: new Request(`http://localhost${serverUrl}`), - })(defaultStreamHandler) - const html = await response.text() - if ( - response.status !== 200 || - diagnostics.beforeLoads !== 3 || - diagnostics.loaders !== 2 - ) { - throw new Error( - 'SSR fixture did not execute its beforeLoad and loader functions', - ) - } - return html -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json b/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json deleted file mode 100644 index 23dd08de8b..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": ["./*.ts", "./src/**/*"] -} diff --git a/benchmarks/client-nav/scenarios/hydration/react/vite.config.ts b/benchmarks/client-nav/scenarios/hydration/react/vite.config.ts deleted file mode 100644 index 62ab87115b..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -export default defineConfig({ - root: fileURLToPath(new URL('.', import.meta.url)), - define: { 'process.env.NODE_ENV': JSON.stringify('production') }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - resolve: { conditions: ['browser', 'production'] }, - build: { - outDir: './dist/client', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/client.tsx', - name: 'HydrationBenchmark', - formats: ['iife'], - fileName: () => 'client.js', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav hydration (react)', - watch: false, - environment: 'node', - isolate: true, - include: ['hydration.test.ts'], - benchmark: { include: ['speed.bench.ts'] }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/hydration/react/vite.server.config.ts b/benchmarks/client-nav/scenarios/hydration/react/vite.server.config.ts deleted file mode 100644 index fbf6a149b9..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/react/vite.server.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' - -export default defineConfig({ - root: fileURLToPath(new URL('.', import.meta.url)), - define: { 'process.env.NODE_ENV': JSON.stringify('production') }, - plugins: [react()], - resolve: { conditions: ['node', 'production'] }, - ssr: { noExternal: true }, - build: { - ssr: true, - outDir: './dist/server', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/server.tsx', - formats: ['es'], - fileName: () => 'server.js', - }, - rolldownOptions: { - platform: 'node', - external: [/^node:/, /^react(?:\/|$)/, /^react-dom(?:\/|$)/], - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/hydration/solid/fixture.ts b/benchmarks/client-nav/scenarios/hydration/solid/fixture.ts deleted file mode 100644 index 4c86d0e2f4..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/fixture.ts +++ /dev/null @@ -1,35 +0,0 @@ -export { - clientUrl, - hashLinkCount, - ordinaryLinkCount, - serverUrl, -} from '../react/fixture' -export type { FixtureArtifact } from '../react/fixture' - -export interface Diagnostics { - beforeLoads: number - loaders: number - mounted: boolean - rendered: number - clicks: number - countUpdates: boolean - ordinaryEvaluations: number - hashEvaluations: number - initialHashStates: Array - hashStates: Array -} - -export function createDiagnostics(countUpdates = false): Diagnostics { - return { - beforeLoads: 0, - loaders: 0, - mounted: false, - rendered: 0, - clicks: 0, - countUpdates, - ordinaryEvaluations: 0, - hashEvaluations: 0, - initialHashStates: [], - hashStates: [], - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/generate-fixture.mjs b/benchmarks/client-nav/scenarios/hydration/solid/generate-fixture.mjs deleted file mode 100644 index 63647e1be7..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/generate-fixture.mjs +++ /dev/null @@ -1,30 +0,0 @@ -import assert from 'node:assert/strict' -import { writeFile } from 'node:fs/promises' -import { JSDOM } from 'jsdom' - -if (process.env.NODE_ENV !== 'production') { - throw new Error('Generate the hydration fixture in production mode') -} -const { renderFixture } = await import('./dist/server/server.js') -const html = await renderFixture() -const dom = new JSDOM(html) -try { - const doc = dom.window.document - const scriptElements = [...doc.querySelectorAll('script')] - assert.ok(scriptElements.length > 0) - assert.ok(scriptElements.every((script) => !script.src)) - const scripts = scriptElements.map((script) => script.textContent) - assert.ok(scripts.some((script) => script.includes('$_TSR'))) - assert.ok(scripts.some((script) => script.includes('_$HY'))) - assert.ok(doc.documentElement.hasAttribute('data-hk')) - assert.ok(doc.getElementById('hydration-content')?.hasAttribute('data-hk')) - assert.ok( - [...doc.querySelectorAll('a')].every((a) => a.hasAttribute('data-hk')), - ) - await writeFile( - new URL('./dist/fixture.json', import.meta.url), - JSON.stringify({ html, scripts }), - ) -} finally { - dom.window.close() -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts b/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts deleted file mode 100644 index 4e5f3208ca..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/hydration.test.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { expect, test } from 'vitest' -import { hashLinkCount, ordinaryLinkCount } from './fixture' -import { setup } from './setup' - -const turn = () => new Promise((resolve) => setImmediate(resolve)) - -test('restores fresh DOMs and route state and completes hash-link reactivity', async () => { - const scenario = setup({ countUpdates: true }) - let previous: ReturnType | undefined - for (let iteration = 0; iteration < 3; iteration++) { - await scenario.before() - try { - const initial = scenario.snapshot() - expect(initial.matches).toBeUndefined() - expect(initial.diagnostics.mounted).toBe(false) - expect(initial.diagnostics.rendered).toBe(0) - expect(initial.diagnostics.clicks).toBe(0) - expect(initial.diagnostics.ordinaryEvaluations).toBe(0) - expect(initial.diagnostics.hashEvaluations).toBe(0) - expect(initial.diagnostics.initialHashStates).toEqual([]) - await scenario.run() - const completed = scenario.snapshot() - expect(completed.diagnostics.ordinaryEvaluations).toBeGreaterThanOrEqual( - ordinaryLinkCount, - ) - expect(completed.diagnostics.initialHashStates).toEqual( - Array.from({ length: hashLinkCount }, () => false), - ) - expect(completed.diagnostics.hashStates).toEqual( - Array.from({ length: hashLinkCount }, (_, index) => index % 2 === 0), - ) - expect(completed.diagnostics.hashEvaluations).toBeGreaterThanOrEqual( - hashLinkCount + hashLinkCount / 2, - ) - expect(completed.hydrating).toBe(false) - for (let index = 0; index < 4; index++) { - await turn() - } - expect(scenario.snapshot()).toEqual(completed) - if (previous) { - expect(completed).toEqual(previous) - } - previous = completed - await expect(scenario.run()).rejects.toThrow('newly prepared sample') - } finally { - // Untimed assertions include DOM identity, all restored data/context, - // native event handling, and the absence of hydration diagnostics. - await scenario.after() - } - } -}) - -test('prepares every sample without counting diagnostics', async () => { - const scenario = setup() - for (let iteration = 0; iteration < 2; iteration++) { - 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 scenario.after() - } - } -}) - -test('rejects an empty measurement and still releases its sample', async () => { - const scenario = setup() - await scenario.before() - await expect(scenario.after()).rejects.toThrow( - 'Hydration sample was not completed', - ) - await scenario.before() - try { - await expect(scenario.before()).rejects.toThrow('was not disposed') - await scenario.run() - } finally { - await scenario.after() - } -}) diff --git a/benchmarks/client-nav/scenarios/hydration/solid/project.json b/benchmarks/client-nav/scenarios/hydration/solid/project.json deleted file mode 100644 index 1fa162771b..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-hydration-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { "projects": ["@tanstack/solid-router"], "target": "build" } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.server.config.ts && NODE_ENV=production node {projectRoot}/generate-fixture.mjs && NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:unit": { - "executor": "nx:run-commands", - "dependsOn": ["build:client"], - "options": { - "command": "vitest run --config ./scenarios/hydration/solid/vite.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:perf": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --run --config ./scenarios/hydration/solid/vite.config.ts", - "cwd": "benchmarks/client-nav" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { "projects": ["@tanstack/solid-router"], "target": "build" } - ], - "options": { "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" } - } - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/setup.ts b/benchmarks/client-nav/scenarios/hydration/solid/setup.ts deleted file mode 100644 index ebdbc8e9b2..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/setup.ts +++ /dev/null @@ -1,326 +0,0 @@ -import assert from 'node:assert/strict' -import { readFileSync } from 'node:fs' -import { fileURLToPath } from 'node:url' -import { Script } from 'node:vm' -import { JSDOM, VirtualConsole } from 'jsdom' -import { clientUrl, hashLinkCount, ordinaryLinkCount } from './fixture' -import type { FixtureArtifact } from './fixture' -import type * as Client from './src/client' - -type ClientApp = typeof Client -const turn = () => new Promise((resolve) => setImmediate(resolve)) -const maxSettleTurns = 100 - -export function setup({ countUpdates = false } = {}) { - // Compile once, outside measurement; evaluate the entire production bundle - // anew in every window, including Solid's module-level hydration state. - const artifact: FixtureArtifact = JSON.parse( - readFileSync(new URL('./dist/fixture.json', import.meta.url), 'utf8'), - ) - const clientPath = new URL('./dist/client/client.js', import.meta.url) - const clientScript = new Script(readFileSync(clientPath, 'utf8'), { - filename: fileURLToPath(clientPath), - }) - const bootstrapScripts = artifact.scripts.map( - (source, index) => - new Script(source, { - filename: `solid-hydration-bootstrap-${index}.js`, - }), - ) - let current: Awaited> | undefined - - async function prepare() { - const errors: Array = [] - const virtualConsole = new VirtualConsole() - virtualConsole.on('jsdomError', (error) => errors.push(String(error))) - for (const event of ['error', 'warn'] as const) { - virtualConsole.on(event, (...args) => - errors.push(args.map(String).join(' ')), - ) - } - const dom = new JSDOM(artifact.html, { - url: `http://localhost${clientUrl}`, - runScripts: 'outside-only', - virtualConsole, - }) - const immediates = new Set() - try { - Object.assign(dom.window, { - TextEncoder, - TextDecoder, - ReadableStream, - WritableStream, - TransformStream, - setImmediate( - callback: (...args: Array) => void, - ...args: Array - ) { - const handle = setImmediate(() => { - immediates.delete(handle) - callback(...args) - }) - immediates.add(handle) - return handle - }, - clearImmediate(handle: NodeJS.Immediate) { - immediates.delete(handle) - clearImmediate(handle) - }, - fetch() { - throw new Error('Hydration attempted a network request') - }, - scrollTo() {}, - }) - dom.window.addEventListener('unhandledrejection', (event) => { - errors.push(String(event.reason)) - }) - dom.window.HTMLElement.prototype.scrollIntoView = () => {} - const context = dom.getInternalVMContext() - clientScript.runInContext(context) - const app = (dom.window as unknown as { HydrationBenchmark: ClientApp }) - .HydrationBenchmark - assert.equal(app.serverEnvironment, false) - assert.equal(app.solidServerEnvironment, false) - const doc = dom.window.document - const anchors = Array.from(doc.querySelectorAll('a')) - const scriptElements = Array.from(doc.querySelectorAll('script')) - assert.equal(scriptElements.length, bootstrapScripts.length) - const executingScript = { current: null as HTMLScriptElement | null } - Object.defineProperty(doc, 'currentScript', { - configurable: true, - get: () => executingScript.current, - }) - assert.equal(anchors.length, ordinaryLinkCount + hashLinkCount) - const content = doc.getElementById('hydration-content') - assert.ok(content) - assert.ok(content.hasAttribute('data-hk')) - assert.ok(anchors.every((anchor) => anchor.hasAttribute('data-hk'))) - for (let index = 0; index < hashLinkCount; index++) { - assert.equal( - doc.getElementById(`hash-${index}`)?.getAttribute('data-status'), - null, - ) - } - // Production Solid can fall back to templates for missing hydration keys. - // Retain every workload element, not only the parent and the anchors. - const elements = Array.from(content.querySelectorAll('*')) - const documentElement = doc.documentElement - await turn() - assert.equal(doc.readyState, 'complete') - assert.equal(app.ready(), false) - assert.deepEqual(errors, []) - return { - dom, - context, - app, - anchors, - content, - elements, - documentElement, - scriptElements, - executingScript, - immediates, - errors, - started: false, - completed: false, - failed: false, - } - } catch (error) { - for (const handle of immediates) { - clearImmediate(handle) - } - dom.window.close() - throw error - } - } - - async function before() { - if (current) { - throw new Error('Previous hydration sample was not disposed') - } - current = await prepare() - } - - async function run() { - const sample = current - if (!sample || sample.started) { - throw new Error('Hydration requires a newly prepared sample') - } - sample.started = true - try { - // Parsing/evaluation are done. Execute both native Solid bootstrap and - // Router payload, then create/restore the router and hydrate the DOM. - for (let index = 0; index < bootstrapScripts.length; index++) { - // Router scripts remove document.currentScript. Keep the original - // script nodes and order, including Solid's bootstrap and markers. - sample.executingScript.current = sample.scriptElements[index]! - try { - bootstrapScripts[index]!.runInContext(sample.context) - } finally { - sample.executingScript.current = null - } - } - await sample.app.start(countUpdates) - let idleTurns = 0 - for (let index = 0; index < maxSettleTurns; index++) { - await turn() - if (sample.errors.length) { - throw new Error(sample.errors.join('\n')) - } - if (sample.app.ready() && sample.immediates.size === 0) { - if (++idleTurns === 2) { - sample.completed = true - return - } - } else { - idleTurns = 0 - } - } - throw new Error( - `Hydration did not settle: ${JSON.stringify(sample.app.snapshot())}`, - ) - } catch (error) { - sample.failed = true - throw error - } - } - - function snapshot() { - if (!current) { - throw new Error('No hydration sample') - } - // Normalize realm prototypes only for untimed assertions. - return JSON.parse(JSON.stringify(current.app.snapshot())) as ReturnType< - ClientApp['snapshot'] - > - } - - function validate() { - assert.ok(current?.started) - const { dom, anchors, content, elements, documentElement, errors } = current - const doc = dom.window.document - const result = snapshot() - assert.deepEqual(errors, []) - assert.equal(result.diagnostics.beforeLoads, 0) - assert.equal(result.diagnostics.loaders, 0) - assert.equal(result.diagnostics.mounted, true) - assert.ok(result.diagnostics.rendered > 0) - assert.equal(result.hydrating, false) - assert.equal(result.location, clientUrl) - assert.equal(result.resolvedLocation, clientUrl) - assert.equal(result.matches?.length, 3) - for (const match of result.matches) { - assert.equal(match.status, 'success') - assert.deepEqual(match.context.viewer, { - id: 'viewer-3', - name: 'Ada', - role: 'editor', - }) - } - const teamContext = { id: 'team-7', member: 'viewer-3' } - assert.deepEqual(result.matches[1]!.context.team, teamContext) - assert.deepEqual(result.matches[2]!.context.team, teamContext) - assert.deepEqual(result.matches[2]!.context.permissions, { edit: true }) - assert.deepEqual(result.matches[1]!.loaderData, { - title: 'Team team-7', - categories: ['open', 'closed'], - }) - const data = result.matches[2]!.loaderData as { - owner: string - selected: string - rows: Array<{ - id: string - label: string - details: { score: number; open: boolean } - }> - } - assert.equal(data.owner, 'viewer-3') - assert.equal(data.selected, 'item-42') - assert.equal(data.rows.length, ordinaryLinkCount) - assert.equal(doc.documentElement, documentElement) - assert.equal(doc.getElementById('hydration-content'), content) - const hydratedElements = Array.from(content.querySelectorAll('*')) - assert.equal(hydratedElements.length, elements.length) - elements.forEach((element, index) => { - assert.equal(hydratedElements[index], element) - }) - assert.equal(doc.querySelectorAll('a').length, anchors.length) - assert.equal(doc.title, 'Hydration benchmark') - assert.equal(content.querySelector('h1')?.textContent, 'Team team-7') - assert.equal(doc.getElementById('viewer')?.textContent, 'Ada') - assert.equal(doc.getElementById('permission')?.textContent, 'Editable') - for (const anchor of anchors) { - assert.equal(doc.getElementById(anchor.id), anchor) - } - for (let index = 0; index < ordinaryLinkCount; index++) { - const anchor = doc.getElementById(`ordinary-item-${index}`)! - assert.equal( - anchor.getAttribute('href'), - `/teams/team-7/items/item-${index}?view=summary`, - ) - assert.equal(anchor.textContent, `Item ${index}`) - assert.equal( - anchor.getAttribute('data-status'), - index === 42 ? 'active' : null, - ) - assert.deepEqual(data.rows[index], { - id: `item-${index}`, - label: `Item ${index}`, - details: { score: index * 3, open: index % 2 === 0 }, - }) - } - for (let index = 0; index < hashLinkCount; index++) { - const anchor = doc.getElementById(`hash-${index}`)! - assert.equal( - anchor.getAttribute('data-status'), - index % 2 === 0 ? 'active' : null, - ) - assert.equal( - anchor.getAttribute('href'), - `/teams/team-7/items/item-42?view=summary#${index % 2 === 0 ? 'details' : 'other'}`, - ) - assert.equal(anchor.textContent, `Section ${index}`) - } - assert.equal(result.diagnostics.clicks, 0) - doc - .getElementById('interactive')! - .dispatchEvent(new dom.window.MouseEvent('click', { bubbles: true })) - assert.equal(current.app.snapshot().diagnostics.clicks, 1) - assert.deepEqual(errors, []) - } - - async function after() { - const sample = current - if (!sample) { - return - } - try { - if (!sample.failed) { - assert.ok(sample.completed, 'Hydration sample was not completed') - validate() - } - } finally { - current = undefined - try { - sample.app.dispose() - await turn() - await turn() - if (!sample.failed) { - assert.deepEqual(sample.errors, []) - } - } finally { - for (const handle of sample.immediates) { - clearImmediate(handle) - } - sample.dom.window.close() - } - } - } - - return { - before, - run, - after, - snapshot, - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts deleted file mode 100644 index b386cb8215..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { setup } from './setup' - -test('client-hydration', async ({ bench }) => { - const scenario = setup() - - await bench( - 'hydrate restored route state and mixed Links (solid)', - { beforeEach: scenario.before, afterEach: scenario.after }, - async () => { - await scenario.run() - }, - ).run({ - time: 5000, - warmupTime: 1000, - warmupIterations: 20, - throws: true, - }) -}) diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/app.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/app.tsx deleted file mode 100644 index cb772d6b5b..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/src/app.tsx +++ /dev/null @@ -1,213 +0,0 @@ -import { For, onMount } from 'solid-js' -import { HydrationScript } from 'solid-js/web' -import { - HeadContent, - Link, - Outlet, - Scripts, - createMemoryHistory, - createRootRoute, - createRoute, - createRouter, -} from '@tanstack/solid-router' -import { - clientUrl, - hashLinkCount, - ordinaryLinkCount, - serverUrl, -} from '../fixture' -import type { JSX } from 'solid-js' -import type { Diagnostics } from '../fixture' - -export function createFixtureRouter(server: boolean, diagnostics: Diagnostics) { - function beforeLoad() { - diagnostics.beforeLoads++ - if (!server) { - throw new Error('Hydration reran beforeLoad instead of restoring context') - } - } - - function loader() { - diagnostics.loaders++ - if (!server) { - throw new Error('Hydration reran a loader instead of restoring data') - } - } - - const root = createRootRoute({ - beforeLoad: () => { - beforeLoad() - return { viewer: { id: 'viewer-3', name: 'Ada', role: 'editor' } } - }, - head: () => ({ - meta: [{ charset: 'utf-8' }, { title: 'Hydration benchmark' }], - }), - shellComponent: Document, - }) - const team = createRoute({ - getParentRoute: () => root, - path: '/teams/$teamId', - beforeLoad: ({ context, params }) => { - beforeLoad() - return { team: { id: params.teamId, member: context.viewer.id } } - }, - loader: ({ context }) => { - loader() - return { - title: `Team ${context.team.id}`, - categories: ['open', 'closed'], - } - }, - component: Team, - }) - const items = createRoute({ - getParentRoute: () => team, - path: 'items/$itemId', - validateSearch: (search: Record) => ({ - view: search.view === 'details' ? 'details' : 'summary', - }), - beforeLoad: ({ context }) => { - beforeLoad() - return { permissions: { edit: context.viewer.role === 'editor' } } - }, - loader: ({ context, params }) => { - loader() - return { - selected: params.itemId, - owner: context.team.member, - rows: Array.from({ length: ordinaryLinkCount }, (_, index) => ({ - id: `item-${index}`, - label: `Item ${index}`, - details: { score: index * 3, open: index % 2 === 0 }, - })), - } - }, - component: Items, - }) - - function Document(props: { children: JSX.Element }) { - return ( - - - - - - - {props.children} - - - - ) - } - - function Team() { - const context = team.useRouteContext() - const data = team.useLoaderData() - return ( -
-

{data().title}

-

{context().viewer.name}

- -
- ) - } - - function Items() { - const data = items.useLoaderData() - const context = items.useRouteContext() - onMount(() => { - diagnostics.mounted = true - }) - return ( - <> -

- {context().permissions.edit ? 'Editable' : 'Read only'} -

- - - - - {(row) => ( - - - - - - )} - - -
{row.id}{row.details.score} - - {diagnostics.countUpdates - ? (state) => { - // Read the getter so this unit-only probe observes - // Link reactivity, rather than component execution. - void state.isActive - diagnostics.ordinaryEvaluations++ - return row.label - } - : row.label} - -
- -
Details
- - ) - } - - return createRouter({ - routeTree: root.addChildren([team.addChildren([items])]), - history: createMemoryHistory({ - initialEntries: [server ? serverUrl : clientUrl], - }), - isServer: server, - scrollRestoration: false, - defaultHashScrollIntoView: false, - defaultPreload: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx deleted file mode 100644 index ef0f5268d6..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/src/client.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { sharedConfig } from 'solid-js' -import { hydrate as hydrateDOM, isServer as solidIsServer } from 'solid-js/web' -import { RouterProvider } from '@tanstack/solid-router' -import { hydrate } from '@tanstack/router-core/ssr/client' -import { isServer } from '@tanstack/router-core/isServer' -import { createDiagnostics, hashLinkCount } from '../fixture' -import { createFixtureRouter } from './app' - -export const serverEnvironment = isServer -export const solidServerEnvironment = solidIsServer -let router: ReturnType | undefined -let disposeRoot: (() => void) | undefined -let unsubscribe: (() => void) | undefined -let diagnostics = createDiagnostics() - -type HydrationWindow = Window & { - _$HY?: { done?: boolean; events?: Array; r: object } -} - -export async function start(countUpdates = false) { - if (router) { - throw new Error('A hydration sample must use a fresh client realm') - } - if (!window.$_TSR?.router) { - throw new Error('Missing SSR hydration payload') - } - const bootstrap = (window as HydrationWindow)._$HY - if (!bootstrap || bootstrap.done || sharedConfig.context) { - throw new Error('Missing or already consumed Solid hydration bootstrap') - } - diagnostics = createDiagnostics(countUpdates) - router = createFixtureRouter(false, diagnostics) - unsubscribe = router.subscribe('onRendered', () => { - diagnostics.rendered++ - }) - // Solid's RouterClient uses this core restoration API. Await it directly so - // the shell has the same component/key hierarchy as the server provider. - await hydrate(router) - window.$_TSR.h() - disposeRoot = hydrateDOM(() => , document) -} - -export function ready() { - if ( - !diagnostics.mounted || - !diagnostics.rendered || - sharedConfig.context || - router?.stores.status.get() === 'pending' - ) { - return false - } - // Each Link's onMount updates its hydration signal. Solid updates attributes - // through fine-grained effects, without rerendering the route components. - for (let index = 0; index < hashLinkCount; index++) { - const anchor = document.getElementById(`hash-${index}`) - if ( - !anchor || - anchor.getAttribute('data-status') !== (index % 2 === 0 ? 'active' : null) - ) { - return false - } - } - return true -} - -export function snapshot() { - return { - diagnostics: { - ...diagnostics, - initialHashStates: [...diagnostics.initialHashStates], - hashStates: [...diagnostics.hashStates], - }, - hydrating: !!sharedConfig.context, - location: router?.stores.location.get().href, - resolvedLocation: router?.stores.resolvedLocation.get()?.href, - matches: router?.stores.matches.get().map((match) => ({ - status: match.status, - context: match.context, - loaderData: match.loaderData, - })), - } -} - -export function dispose() { - try { - disposeRoot?.() - } finally { - unsubscribe?.() - router?.history.destroy() - } -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/src/server.tsx b/benchmarks/client-nav/scenarios/hydration/solid/src/server.tsx deleted file mode 100644 index 6052c48eac..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/src/server.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { - createRequestHandler, - renderRouterToStream, -} from '@tanstack/solid-router/ssr/server' -import { isServer } from '@tanstack/router-core/isServer' -import { isServer as solidIsServer } from 'solid-js/web' -import { createDiagnostics, serverUrl } from '../fixture' -import { createFixtureRouter } from './app' - -export async function renderFixture() { - if ((isServer as boolean | undefined) !== true || !solidIsServer) { - throw new Error('Fixture generation requires the production server build') - } - const diagnostics = createDiagnostics() - const response = await createRequestHandler({ - createRouter: () => createFixtureRouter(true, diagnostics), - request: new Request(`http://localhost${serverUrl}`), - })(({ request, router, responseHeaders }) => - renderRouterToStream({ - request, - router, - responseHeaders, - // The route shell owns the document, as in Solid Start. Using the same - // provider tree on both sides preserves Solid's hydration key sequence. - children: () => , - }), - ) - const html = await response.text() - if ( - response.status !== 200 || - diagnostics.beforeLoads !== 3 || - diagnostics.loaders !== 2 - ) { - throw new Error( - 'SSR fixture did not execute its beforeLoad and loader functions', - ) - } - return html -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json b/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json deleted file mode 100644 index daf27ddf12..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/tsconfig.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": ["./*.ts", "./src/**/*"] -} diff --git a/benchmarks/client-nav/scenarios/hydration/solid/vite.config.ts b/benchmarks/client-nav/scenarios/hydration/solid/vite.config.ts deleted file mode 100644 index 16e5ff95aa..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/vite.config.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -export default defineConfig({ - root: fileURLToPath(new URL('.', import.meta.url)), - define: { 'process.env.NODE_ENV': JSON.stringify('production') }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - // The Node worker evaluates the prebuilt bundle and needs no JSX transform - // or browser test setup injected by vite-plugin-solid. - !process.env.VITEST && solid({ ssr: true, hot: false, dev: false }), - ], - resolve: { conditions: ['solid', 'browser', 'production'] }, - build: { - outDir: './dist/client', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/client.tsx', - name: 'HydrationBenchmark', - formats: ['iife'], - fileName: () => 'client.js', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav hydration (solid)', - watch: false, - environment: 'node', - isolate: true, - include: ['hydration.test.ts'], - benchmark: { include: ['speed.bench.ts'] }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/hydration/solid/vite.server.config.ts b/benchmarks/client-nav/scenarios/hydration/solid/vite.server.config.ts deleted file mode 100644 index 9787cbb4e2..0000000000 --- a/benchmarks/client-nav/scenarios/hydration/solid/vite.server.config.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' - -export default defineConfig({ - root: fileURLToPath(new URL('.', import.meta.url)), - define: { 'process.env.NODE_ENV': JSON.stringify('production') }, - plugins: [solid({ ssr: true, hot: false, dev: false })], - resolve: { conditions: ['solid', 'node', 'production'] }, - ssr: { - noExternal: true, - resolve: { conditions: ['solid', 'node', 'production'] }, - }, - build: { - ssr: true, - outDir: './dist/server', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/server.tsx', - formats: ['es'], - fileName: () => 'server.js', - }, - rolldownOptions: { - platform: 'node', - external: [/^node:/], - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/react/project.json b/benchmarks/client-nav/scenarios/link-churn/react/project.json deleted file mode 100644 index 1606b2c456..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-link-churn-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/link-churn/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/setup.ts b/benchmarks/client-nav/scenarios/link-churn/react/setup.ts deleted file mode 100644 index 59221603da..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, initialUrl, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - initialUrl, - }) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts deleted file mode 100644 index ca0b370528..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-link-churn', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-link-churn navigation loop (react)', - 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/link-churn/react/speed.flame.ts b/benchmarks/client-nav/scenarios/link-churn/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/main.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/link-churn/react/src/routeTree.gen.ts deleted file mode 100644 index 4535430b61..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/routeTree.gen.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* 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 HubRouteImport } from './routes/hub' -import { Route as OtherRouteImport } from './routes/other' -import { Route as HubListRouteImport } from './routes/hub.list' -import { Route as HubDetailIdRouteImport } from './routes/hub.detail.$id' - -const HubRoute = HubRouteImport.update({ - id: '/hub', - path: '/hub', - getParentRoute: () => rootRouteImport, -} as any) -const OtherRoute = OtherRouteImport.update({ - id: '/other', - path: '/other', - getParentRoute: () => rootRouteImport, -} as any) -const HubListRoute = HubListRouteImport.update({ - id: '/list', - path: '/list', - getParentRoute: () => HubRoute, -} as any) -const HubDetailIdRoute = HubDetailIdRouteImport.update({ - id: '/detail/$id', - path: '/detail/$id', - getParentRoute: () => HubRoute, -} as any) - -export interface FileRoutesByFullPath { - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRoutesByTo { - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - fileRoutesByTo: FileRoutesByTo - to: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - id: '__root__' | '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - HubRoute: typeof HubRouteWithChildren - OtherRoute: typeof OtherRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/hub': { - id: '/hub' - path: '/hub' - fullPath: '/hub' - preLoaderRoute: typeof HubRouteImport - parentRoute: typeof rootRouteImport - } - '/other': { - id: '/other' - path: '/other' - fullPath: '/other' - preLoaderRoute: typeof OtherRouteImport - parentRoute: typeof rootRouteImport - } - '/hub/list': { - id: '/hub/list' - path: '/list' - fullPath: '/hub/list' - preLoaderRoute: typeof HubListRouteImport - parentRoute: typeof HubRoute - } - '/hub/detail/$id': { - id: '/hub/detail/$id' - path: '/detail/$id' - fullPath: '/hub/detail/$id' - preLoaderRoute: typeof HubDetailIdRouteImport - parentRoute: typeof HubRoute - } - } -} - -interface HubRouteChildren { - HubListRoute: typeof HubListRoute - HubDetailIdRoute: typeof HubDetailIdRoute -} - -const HubRouteChildren: HubRouteChildren = { - HubListRoute: HubListRoute, - HubDetailIdRoute: HubDetailIdRoute, -} - -const HubRouteWithChildren = HubRoute._addFileChildren(HubRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - HubRoute: HubRouteWithChildren, - OtherRoute: OtherRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/__root.tsx deleted file mode 100644 index 199cf1ff73..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/__root.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { sortedSearch } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.detail.$id.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.detail.$id.tsx deleted file mode 100644 index 143cb39a7a..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.detail.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' -import { detailMarker } from '../../../shared' - -export const Route = createFileRoute('/hub/detail/$id')({ - component: DetailPage, -}) - -function DetailPage() { - const params = Route.useParams() - - return ( -
-

{detailMarker(params.id)}

- Back to list - - Next - - Elsewhere -
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.list.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.list.tsx deleted file mode 100644 index 5aa37b20a7..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.list.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' -import { - listItemIds, - listMarker, - listRelativeTestId, - listSortedMarker, -} from '../../../shared' - -export const Route = createFileRoute('/hub/list')({ - component: ListPage, -}) - -const ascSearch = { sort: 'asc' } as const - -// List Links depart whenever the list leaf is left. -function ListLinks() { - return ( -
    - {listItemIds.map((id) => { - const page = Number(id) - return ( -
  • - - {`Item ${id}`} - - - {`Item ${id} asc`} - - - {`Item ${id} exact`} - - ({ ...prev, page })}> - {`Page ${id}`} - - ({ ...prev, page, sort: 'asc' as const })} - data-testid={id === '1' ? listRelativeTestId : undefined} - > - {`Page ${id} asc`} - -
  • - ) - })} -
- ) -} - -function ListPage() { - const sort = Route.useSearch({ select: (search) => search.sort }) - - return ( -
-

- {sort === 'desc' ? listSortedMarker : listMarker} -

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.tsx deleted file mode 100644 index ac12eae2da..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/hub.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -import { - hubItemIds, - hubRelativeTestId, - validateHubSearch, -} from '../../../shared' - -export const Route = createFileRoute('/hub')({ - validateSearch: validateHubSearch, - component: HubLayout, -}) - -// Layout Links stay mounted while the hub leaves change. -function HubLinks() { - return ( -
- {hubItemIds.map((id) => { - const page = Number(id) - return ( -
- - {`Detail ${id}`} - - - {`Detail ${id} exact`} - - - {`List page ${id}`} - - ({ ...prev, page })}> - {`List keep ${id}`} - - ({ ...prev, page })} - data-testid={id === '1' ? hubRelativeTestId : undefined} - > - {`Here page ${id}`} - -
- ) - })} -
- ) -} - -function HubLayout() { - return ( -
- - -
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/other.tsx b/benchmarks/client-nav/scenarios/link-churn/react/src/routes/other.tsx deleted file mode 100644 index 1f146b789f..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/src/routes/other.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { otherMarker } from '../../../shared' - -export const Route = createFileRoute('/other')({ - component: OtherPage, -}) - -function OtherPage() { - return ( -
-

{otherMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/tsconfig.json b/benchmarks/client-nav/scenarios/link-churn/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/link-churn/react/vite.config.ts b/benchmarks/client-nav/scenarios/link-churn/react/vite.config.ts deleted file mode 100644 index 344974ebf9..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav link-churn (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/shared.ts b/benchmarks/client-nav/scenarios/link-churn/shared.ts deleted file mode 100644 index d936af35cc..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/shared.ts +++ /dev/null @@ -1,178 +0,0 @@ -/** - * Shared definition of the `link-churn` scenario: Links that leave, stay and - * arrive across navigations. A `/hub` layout renders Links that stay mounted - * while its leaves change; the `/hub/list` leaf renders Links that depart when - * leaving it and mount again when returning; `/other` sits outside the layout - * so leaving the list there unmounts layout and leaf Links together. The - * existing `links` scenario keeps all its Links in the root layout, so none of - * them ever departs or remounts. The three framework apps consume these - * constants so the workload is identical modulo the rendering layer. - */ -import type { ScenarioStep } from '../harness' - -// Layout (staying) Links: HUB_ITEM_COUNT ids x 5 variants. -export const HUB_ITEM_COUNT = 6 -// List leaf (departing) Links: LIST_ITEM_COUNT ids x 5 variants. -export const LIST_ITEM_COUNT = 20 - -const ids = (count: number) => - Array.from({ length: count }, (_, index) => String(index + 1)) - -export const hubItemIds = ids(HUB_ITEM_COUNT) -export const listItemIds = ids(LIST_ITEM_COUNT) - -export interface HubSearch { - page?: number - sort?: 'asc' | 'desc' -} - -/** Search validation of the `/hub` layout, inherited by its leaves. */ -export function validateHubSearch(search: Record): HubSearch { - const result: HubSearch = {} - if (typeof search.page === 'number') { - result.page = search.page - } - if (search.sort === 'asc' || search.sort === 'desc') { - result.sort = search.sort - } - return result -} - -export const sortedSearch = { sort: 'desc' } as const - -export function detailMarker(id: string) { - return `detail-${id}` -} - -export const listMarker = 'list' -export const listSortedMarker = 'list-desc' -export const otherMarker = 'other' - -// Sampled Links whose href depends on the current location: the first layout -// `to="."` updater Link and the first list `to="."` updater Link. -export const hubRelativeTestId = 'hub-relative-1' -export const listRelativeTestId = 'list-relative-1' - -interface StepDef { - testId: string - marker: string - /** Expected number of `.active-link` elements after the step. */ - activeCount: number - /** Expected href of the sampled layout updater Link (null: not mounted). */ - hubRelativeHref: string | null - /** Expected href of the sampled list updater Link (null: not mounted). */ - listRelativeHref: string | null -} - -// On the list, every layout `includeSearch: false` Link to the list is active. -const listActiveCount = HUB_ITEM_COUNT - -export const stepDefs: ReadonlyArray = [ - // 1. list -> detail/1: list Links depart, layout Links stay and update. - { - testId: 'go-detail-1', - marker: detailMarker('1'), - activeCount: 1, - hubRelativeHref: '/hub/detail/1?page=1', - listRelativeHref: null, - }, - // 2. detail/1 -> detail/2: same route, new param; every Link stays. - { - testId: 'go-detail-2', - marker: detailMarker('2'), - activeCount: 1, - hubRelativeHref: '/hub/detail/2?page=1', - listRelativeHref: null, - }, - // 3. detail/2 -> list: list Links mount. - { - testId: 'go-list', - marker: listMarker, - activeCount: listActiveCount, - hubRelativeHref: '/hub/list?page=1', - listRelativeHref: '/hub/list?page=1&sort=asc', - }, - // 4. list -> other: layout and list Links depart together. - { - testId: 'go-other', - marker: otherMarker, - activeCount: 0, - hubRelativeHref: null, - listRelativeHref: null, - }, - // 5. other -> list: layout and list Links all mount. - { - testId: 'go-list', - marker: listMarker, - activeCount: listActiveCount, - hubRelativeHref: '/hub/list?page=1', - listRelativeHref: '/hub/list?page=1&sort=asc', - }, - // 6a. list -> list?sort=desc: nothing departs, updater Links rebuild. - { - testId: 'go-list-sorted', - marker: listSortedMarker, - activeCount: listActiveCount, - hubRelativeHref: '/hub/list?sort=desc&page=1', - listRelativeHref: '/hub/list?sort=asc&page=1', - }, - // 6b. back to the plain list so the lap ends on the initial location. - { - testId: 'go-list', - marker: listMarker, - activeCount: listActiveCount, - hubRelativeHref: '/hub/list?page=1', - listRelativeHref: '/hub/list?page=1&sort=asc', - }, -] - -export const initialUrl = '/hub/list' - -export const scenarioSteps: ReadonlyArray = stepDefs.map( - (step) => step.testId, -) - -function assertHref( - container: HTMLElement, - testId: string, - expected: string | null, - stepIndex: number, -) { - const link = container.querySelector(`[data-testid="${testId}"]`) - const href = link ? link.getAttribute('href') : null - if (href !== expected) { - throw new Error( - `Expected "${testId}" href ${JSON.stringify(expected)} after step ${stepIndex}, received ${JSON.stringify(href)}`, - ) - } -} - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const step = stepDefs[stepIndex]! - - const marker = container.querySelector('[data-testid="page-state"]') - if (marker?.textContent !== step.marker) { - throw new Error( - `Expected page marker "${step.marker}" after step ${stepIndex}, received "${marker?.textContent}"`, - ) - } - - const activeLinks = container.querySelectorAll('a.active-link') - if (activeLinks.length !== step.activeCount) { - throw new Error( - `Expected ${step.activeCount} active link(s) after step ${stepIndex}, received ${activeLinks.length}`, - ) - } - - assertHref(container, hubRelativeTestId, step.hubRelativeHref, stepIndex) - assertHref(container, listRelativeTestId, step.listRelativeHref, stepIndex) -} - -// One lap through the 7-step sequence per benchmark iteration. -export const ticksPerIteration = stepDefs.length - -export const benchOptions = { - warmupIterations: 50, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/project.json b/benchmarks/client-nav/scenarios/link-churn/solid/project.json deleted file mode 100644 index 4e46143b32..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-link-churn-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/link-churn/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/setup.ts b/benchmarks/client-nav/scenarios/link-churn/solid/setup.ts deleted file mode 100644 index a2a024341d..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, initialUrl, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - initialUrl, - }) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts deleted file mode 100644 index 80c4aaa6fd..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-link-churn', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-link-churn navigation loop (solid)', - 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/link-churn/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/link-churn/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/main.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/link-churn/solid/src/routeTree.gen.ts deleted file mode 100644 index e3cb546963..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* 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 HubRouteImport } from './routes/hub' -import { Route as OtherRouteImport } from './routes/other' -import { Route as HubListRouteImport } from './routes/hub.list' -import { Route as HubDetailIdRouteImport } from './routes/hub.detail.$id' - -const HubRoute = HubRouteImport.update({ - id: '/hub', - path: '/hub', - getParentRoute: () => rootRouteImport, -} as any) -const OtherRoute = OtherRouteImport.update({ - id: '/other', - path: '/other', - getParentRoute: () => rootRouteImport, -} as any) -const HubListRoute = HubListRouteImport.update({ - id: '/list', - path: '/list', - getParentRoute: () => HubRoute, -} as any) -const HubDetailIdRoute = HubDetailIdRouteImport.update({ - id: '/detail/$id', - path: '/detail/$id', - getParentRoute: () => HubRoute, -} as any) - -export interface FileRoutesByFullPath { - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRoutesByTo { - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - fileRoutesByTo: FileRoutesByTo - to: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - id: '__root__' | '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - HubRoute: typeof HubRouteWithChildren - OtherRoute: typeof OtherRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/hub': { - id: '/hub' - path: '/hub' - fullPath: '/hub' - preLoaderRoute: typeof HubRouteImport - parentRoute: typeof rootRouteImport - } - '/other': { - id: '/other' - path: '/other' - fullPath: '/other' - preLoaderRoute: typeof OtherRouteImport - parentRoute: typeof rootRouteImport - } - '/hub/list': { - id: '/hub/list' - path: '/list' - fullPath: '/hub/list' - preLoaderRoute: typeof HubListRouteImport - parentRoute: typeof HubRoute - } - '/hub/detail/$id': { - id: '/hub/detail/$id' - path: '/detail/$id' - fullPath: '/hub/detail/$id' - preLoaderRoute: typeof HubDetailIdRouteImport - parentRoute: typeof HubRoute - } - } -} - -interface HubRouteChildren { - HubListRoute: typeof HubListRoute - HubDetailIdRoute: typeof HubDetailIdRoute -} - -const HubRouteChildren: HubRouteChildren = { - HubListRoute: HubListRoute, - HubDetailIdRoute: HubDetailIdRoute, -} - -const HubRouteWithChildren = HubRoute._addFileChildren(HubRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - HubRoute: HubRouteWithChildren, - OtherRoute: OtherRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/__root.tsx deleted file mode 100644 index a9de4ea356..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/__root.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' -import { sortedSearch } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.detail.$id.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.detail.$id.tsx deleted file mode 100644 index 7aca4a9935..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.detail.$id.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { detailMarker } from '../../../shared' - -export const Route = createFileRoute('/hub/detail/$id')({ - component: DetailPage, -}) - -function DetailPage() { - const params = Route.useParams() - - return ( -
-

{detailMarker(params().id)}

- Back to list - - Next - - Elsewhere -
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.list.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.list.tsx deleted file mode 100644 index 5796a50b02..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.list.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { For } from 'solid-js' -import { Link, createFileRoute } from '@tanstack/solid-router' -import { - listItemIds, - listMarker, - listRelativeTestId, - listSortedMarker, -} from '../../../shared' - -export const Route = createFileRoute('/hub/list')({ - component: ListPage, -}) - -const ascSearch = { sort: 'asc' } as const - -// List Links depart whenever the list leaf is left. -function ListLinks() { - return ( -
    - - {(id) => { - const page = Number(id) - return ( -
  • - - {`Item ${id}`} - - - {`Item ${id} asc`} - - - {`Item ${id} exact`} - - ({ ...prev, page })}> - {`Page ${id}`} - - ({ ...prev, page, sort: 'asc' as const })} - data-testid={id === '1' ? listRelativeTestId : undefined} - > - {`Page ${id} asc`} - -
  • - ) - }} -
    -
- ) -} - -function ListPage() { - const sort = Route.useSearch({ select: (search) => search.sort }) - - return ( -
-

- {sort() === 'desc' ? listSortedMarker : listMarker} -

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.tsx deleted file mode 100644 index 4682f85aae..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/hub.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { For } from 'solid-js' -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { - hubItemIds, - hubRelativeTestId, - validateHubSearch, -} from '../../../shared' - -export const Route = createFileRoute('/hub')({ - validateSearch: validateHubSearch, - component: HubLayout, -}) - -// Layout Links stay mounted while the hub leaves change. -function HubLinks() { - return ( -
- - {(id) => { - const page = Number(id) - return ( -
- - {`Detail ${id}`} - - - {`Detail ${id} exact`} - - - {`List page ${id}`} - - ({ ...prev, page })}> - {`List keep ${id}`} - - ({ ...prev, page })} - data-testid={id === '1' ? hubRelativeTestId : undefined} - > - {`Here page ${id}`} - -
- ) - }} -
-
- ) -} - -function HubLayout() { - return ( -
- - -
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/other.tsx b/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/other.tsx deleted file mode 100644 index 2606089113..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/src/routes/other.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { otherMarker } from '../../../shared' - -export const Route = createFileRoute('/other')({ - component: OtherPage, -}) - -function OtherPage() { - return ( -
-

{otherMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/tsconfig.json b/benchmarks/client-nav/scenarios/link-churn/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/link-churn/solid/vite.config.ts b/benchmarks/client-nav/scenarios/link-churn/solid/vite.config.ts deleted file mode 100644 index 37718a2d6a..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav link-churn (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/project.json b/benchmarks/client-nav/scenarios/link-churn/vue/project.json deleted file mode 100644 index fb890ddfb8..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-link-churn-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/link-churn/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/setup.ts b/benchmarks/client-nav/scenarios/link-churn/vue/setup.ts deleted file mode 100644 index 95cacb9ea8..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, initialUrl, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - initialUrl, - }) -} diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts deleted file mode 100644 index dea511c24c..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-link-churn', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-link-churn navigation 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/link-churn/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/link-churn/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/main.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/link-churn/vue/src/routeTree.gen.ts deleted file mode 100644 index 9327bbc01d..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,121 +0,0 @@ -/* 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 HubRouteImport } from './routes/hub' -import { Route as OtherRouteImport } from './routes/other' -import { Route as HubListRouteImport } from './routes/hub.list' -import { Route as HubDetailIdRouteImport } from './routes/hub.detail.$id' - -const HubRoute = HubRouteImport.update({ - id: '/hub', - path: '/hub', - getParentRoute: () => rootRouteImport, -} as any) -const OtherRoute = OtherRouteImport.update({ - id: '/other', - path: '/other', - getParentRoute: () => rootRouteImport, -} as any) -const HubListRoute = HubListRouteImport.update({ - id: '/list', - path: '/list', - getParentRoute: () => HubRoute, -} as any) -const HubDetailIdRoute = HubDetailIdRouteImport.update({ - id: '/detail/$id', - path: '/detail/$id', - getParentRoute: () => HubRoute, -} as any) - -export interface FileRoutesByFullPath { - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRoutesByTo { - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/hub': typeof HubRouteWithChildren - '/other': typeof OtherRoute - '/hub/list': typeof HubListRoute - '/hub/detail/$id': typeof HubDetailIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - fileRoutesByTo: FileRoutesByTo - to: '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - id: '__root__' | '/hub' | '/other' | '/hub/list' | '/hub/detail/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - HubRoute: typeof HubRouteWithChildren - OtherRoute: typeof OtherRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/hub': { - id: '/hub' - path: '/hub' - fullPath: '/hub' - preLoaderRoute: typeof HubRouteImport - parentRoute: typeof rootRouteImport - } - '/other': { - id: '/other' - path: '/other' - fullPath: '/other' - preLoaderRoute: typeof OtherRouteImport - parentRoute: typeof rootRouteImport - } - '/hub/list': { - id: '/hub/list' - path: '/list' - fullPath: '/hub/list' - preLoaderRoute: typeof HubListRouteImport - parentRoute: typeof HubRoute - } - '/hub/detail/$id': { - id: '/hub/detail/$id' - path: '/detail/$id' - fullPath: '/hub/detail/$id' - preLoaderRoute: typeof HubDetailIdRouteImport - parentRoute: typeof HubRoute - } - } -} - -interface HubRouteChildren { - HubListRoute: typeof HubListRoute - HubDetailIdRoute: typeof HubDetailIdRoute -} - -const HubRouteChildren: HubRouteChildren = { - HubListRoute: HubListRoute, - HubDetailIdRoute: HubDetailIdRoute, -} - -const HubRouteWithChildren = HubRoute._addFileChildren(HubRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - HubRoute: HubRouteWithChildren, - OtherRoute: OtherRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/__root.tsx deleted file mode 100644 index a4f7985c5a..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/__root.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' -import { sortedSearch } from '../../../shared' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.detail.$id.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.detail.$id.tsx deleted file mode 100644 index 4701ab44eb..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.detail.$id.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import * as Vue from 'vue' -import { Link, createFileRoute } from '@tanstack/vue-router' -import { detailMarker } from '../../../shared' - -const DetailPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{detailMarker(params.value.id)}

- Back to list - - Next - - Elsewhere -
- ) - }, -}) - -export const Route = createFileRoute('/hub/detail/$id')({ - component: DetailPage, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.list.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.list.tsx deleted file mode 100644 index 02abd6db1b..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.list.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Link, createFileRoute } from '@tanstack/vue-router' -import { - listItemIds, - listMarker, - listRelativeTestId, - listSortedMarker, -} from '../../../shared' - -const ascSearch = { sort: 'asc' } as const - -// List Links depart whenever the list leaf is left. -const ListLinks = Vue.defineComponent({ - setup() { - return () => ( -
    - {listItemIds.map((id) => { - const page = Number(id) - return ( -
  • - - {`Item ${id}`} - - - {`Item ${id} asc`} - - - {`Item ${id} exact`} - - ({ ...prev, page })}> - {`Page ${id}`} - - ({ - ...prev, - page, - sort: 'asc' as const, - })} - data-testid={id === '1' ? listRelativeTestId : undefined} - > - {`Page ${id} asc`} - -
  • - ) - })} -
- ) - }, -}) - -const ListPage = Vue.defineComponent({ - setup() { - const sort = Route.useSearch({ select: (search) => search.sort }) - - return () => ( -
-

- {sort.value === 'desc' ? listSortedMarker : listMarker} -

- -
- ) - }, -}) - -export const Route = createFileRoute('/hub/list')({ - component: ListPage, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.tsx deleted file mode 100644 index 5be17f3350..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/hub.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createFileRoute } from '@tanstack/vue-router' -import { - hubItemIds, - hubRelativeTestId, - validateHubSearch, -} from '../../../shared' - -// Layout Links stay mounted while the hub leaves change. -const HubLinks = Vue.defineComponent({ - setup() { - return () => ( -
- {hubItemIds.map((id) => { - const page = Number(id) - return ( -
- - {`Detail ${id}`} - - - {`Detail ${id} exact`} - - - {`List page ${id}`} - - ({ ...prev, page })}> - {`List keep ${id}`} - - ({ ...prev, page })} - data-testid={id === '1' ? hubRelativeTestId : undefined} - > - {`Here page ${id}`} - -
- ) - })} -
- ) - }, -}) - -const HubLayout = Vue.defineComponent({ - setup() { - return () => ( -
- - -
- ) - }, -}) - -export const Route = createFileRoute('/hub')({ - validateSearch: validateHubSearch, - component: HubLayout, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/other.tsx b/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/other.tsx deleted file mode 100644 index 08dec586fa..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/src/routes/other.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { otherMarker } from '../../../shared' - -const OtherPage = Vue.defineComponent({ - setup() { - return () => ( -
-

{otherMarker}

-
- ) - }, -}) - -export const Route = createFileRoute('/other')({ - component: OtherPage, -}) diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/tsconfig.json b/benchmarks/client-nav/scenarios/link-churn/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/link-churn/vue/vite.config.ts b/benchmarks/client-nav/scenarios/link-churn/vue/vite.config.ts deleted file mode 100644 index 8f56734e04..0000000000 --- a/benchmarks/client-nav/scenarios/link-churn/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav link-churn (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/links/react/project.json b/benchmarks/client-nav/scenarios/links/react/project.json deleted file mode 100644 index 52c9df8a68..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-links-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/links/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/links/react/setup.ts b/benchmarks/client-nav/scenarios/links/react/setup.ts deleted file mode 100644 index 5409df903c..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/links/react/speed.bench.ts b/benchmarks/client-nav/scenarios/links/react/speed.bench.ts deleted file mode 100644 index 75f5f725d4..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-links', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-links navigation loop (react)', - 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/links/react/speed.flame.ts b/benchmarks/client-nav/scenarios/links/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/links/react/src/main.tsx b/benchmarks/client-nav/scenarios/links/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/links/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/links/react/src/routeTree.gen.ts deleted file mode 100644 index 6e0c29ca88..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/about' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/about' | '/items/$id' - id: '__root__' | '/' | '/about' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/links/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/links/react/src/routes/__root.tsx deleted file mode 100644 index 7a48510e8a..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/src/routes/__root.tsx +++ /dev/null @@ -1,104 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useMatchRoute, -} from '@tanstack/react-router' -import { - itemIds, - matchProbeIds, - stepItemIds, - variantSearch, -} from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function StatusPanel() { - const matchRoute = useMatchRoute() - - return ( - - ) -} - -function LinkGrid() { - return ( -
- {itemIds.map((id) => ( -
- - {`Item ${id}`} - - - {`Item ${id} exact`} - - - {`Item ${id} search`} - - - {`Item ${id} hash`} - - - {({ isActive }) => (isActive ? `Item ${id} on` : `Item ${id} off`)} - -
- ))} -
- ) -} - -function RootComponent() { - return ( - <> - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/links/react/src/routes/about.tsx b/benchmarks/client-nav/scenarios/links/react/src/routes/about.tsx deleted file mode 100644 index 0e4afc9297..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/src/routes/about.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { aboutMarker } from '../../../shared' - -export const Route = createFileRoute('/about')({ - component: AboutPage, -}) - -function AboutPage() { - return ( -
-

{aboutMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/links/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/links/react/src/routes/index.tsx deleted file mode 100644 index 2b8c83ebab..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { homeMarker } from '../../../shared' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

{homeMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/links/react/src/routes/items.$id.tsx b/benchmarks/client-nav/scenarios/links/react/src/routes/items.$id.tsx deleted file mode 100644 index 23121edb5c..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/src/routes/items.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { itemMarker } from '../../../shared' - -export const Route = createFileRoute('/items/$id')({ - component: ItemPage, -}) - -function ItemPage() { - const params = Route.useParams() - - return ( -
-

{itemMarker(params.id)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/links/react/tsconfig.json b/benchmarks/client-nav/scenarios/links/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/links/react/vite.config.ts b/benchmarks/client-nav/scenarios/links/react/vite.config.ts deleted file mode 100644 index 69de10b5b7..0000000000 --- a/benchmarks/client-nav/scenarios/links/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav links (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/links/shared.ts b/benchmarks/client-nav/scenarios/links/shared.ts deleted file mode 100644 index 6e75ea045c..0000000000 --- a/benchmarks/client-nav/scenarios/links/shared.ts +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Shared definition of the `links` scenario: a large persistent grid of - * ``s in the root layout so every navigation recomputes link props and - * active state across many activeOptions variants, plus `useMatchRoute` / - * `MatchRoute` consumers. The three framework apps consume these constants so - * the workload is identical modulo the rendering layer. - */ -import type { ScenarioStep } from '../harness' - -// 40 item ids x 5 link variants = 200 links mounted in the root layout. -export const LINK_ITEM_COUNT = 40 -export const LINK_VARIANT_COUNT = 5 - -export const itemIds = Array.from({ length: LINK_ITEM_COUNT }, (_, index) => - String(index + 1), -) - -// Static search object attached to the includeSearch:false variant. -export const variantSearch = { tab: 'specs', page: 2 } - -// Item ids that get a `go-item-` test id on their plain variant link. -export const stepItemIds = ['1', '7', '13', '25', '40'] - -// Ids probed by the useMatchRoute checks in the root StatusPanel. -export const matchProbeIds = [ - '1', - '5', - '7', - '13', - '20', - '25', - '30', - '35', - '40', - '2', -] - -export function itemMarker(id: string) { - return `item-${id}` -} - -export const homeMarker = 'home' -export const aboutMarker = 'about' - -interface StepDef { - testId: string - marker: string - /** Expected number of `.active-link` elements after the step. */ - activeCount: number - /** When one link is active, its href must include this substring. */ - activeHrefPart?: string -} - -export const stepDefs: ReadonlyArray = [ - { - testId: 'go-item-1', - marker: itemMarker('1'), - activeCount: 1, - activeHrefPart: '/items/1', - }, - { - testId: 'go-item-7', - marker: itemMarker('7'), - activeCount: 1, - activeHrefPart: '/items/7', - }, - { testId: 'go-about', marker: aboutMarker, activeCount: 0 }, - { - testId: 'go-item-13', - marker: itemMarker('13'), - activeCount: 1, - activeHrefPart: '/items/13', - }, - { - testId: 'go-item-25', - marker: itemMarker('25'), - activeCount: 1, - activeHrefPart: '/items/25', - }, - { - testId: 'go-item-40', - marker: itemMarker('40'), - activeCount: 1, - activeHrefPart: '/items/40', - }, - { - testId: 'go-item-7', - marker: itemMarker('7'), - activeCount: 1, - activeHrefPart: '/items/7', - }, - { testId: 'go-home', marker: homeMarker, activeCount: 0 }, -] - -export const scenarioSteps: ReadonlyArray = stepDefs.map( - (step) => step.testId, -) - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const step = stepDefs[stepIndex]! - - const marker = container.querySelector('[data-testid="page-state"]') - if (marker?.textContent !== step.marker) { - throw new Error( - `Expected page marker "${step.marker}" after step ${stepIndex}, received "${marker?.textContent}"`, - ) - } - - const activeLinks = container.querySelectorAll('a.active-link') - if (activeLinks.length !== step.activeCount) { - throw new Error( - `Expected ${step.activeCount} active link(s) after step ${stepIndex}, received ${activeLinks.length}`, - ) - } - if (step.activeHrefPart) { - const href = activeLinks[0]!.getAttribute('href') ?? '' - if (!href.includes(step.activeHrefPart)) { - throw new Error( - `Expected the active link href to include "${step.activeHrefPart}" after step ${stepIndex}, received "${href}"`, - ) - } - } -} - -// One lap through the 8-step sequence per benchmark iteration; each step -// recomputes all 200 links plus the match probes. -export const ticksPerIteration = 8 - -export const benchOptions = { - warmupIterations: 50, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/links/solid/project.json b/benchmarks/client-nav/scenarios/links/solid/project.json deleted file mode 100644 index ef1dab4c50..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-links-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/links/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/links/solid/setup.ts b/benchmarks/client-nav/scenarios/links/solid/setup.ts deleted file mode 100644 index 34270fe8a4..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts deleted file mode 100644 index fc7f3e71e7..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-links', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-links navigation loop (solid)', - 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/links/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/links/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/links/solid/src/main.tsx b/benchmarks/client-nav/scenarios/links/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts deleted file mode 100644 index 0da70513e8..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/about' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/about' | '/items/$id' - id: '__root__' | '/' | '/about' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/links/solid/src/routes/__root.tsx deleted file mode 100644 index a889a26854..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/src/routes/__root.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import { For } from 'solid-js' -import { - Link, - Outlet, - createRootRoute, - useMatchRoute, -} from '@tanstack/solid-router' -import { - itemIds, - matchProbeIds, - stepItemIds, - variantSearch, -} from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function StatusPanel() { - const matchRoute = useMatchRoute() - - return ( - - ) -} - -function LinkGrid() { - return ( -
- - {(id) => ( -
- - {`Item ${id}`} - - - {`Item ${id} exact`} - - - {`Item ${id} search`} - - - {`Item ${id} hash`} - - - {({ isActive }) => - isActive ? `Item ${id} on` : `Item ${id} off` - } - -
- )} -
-
- ) -} - -function RootComponent() { - return ( - <> - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routes/about.tsx b/benchmarks/client-nav/scenarios/links/solid/src/routes/about.tsx deleted file mode 100644 index a2a71678b7..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/src/routes/about.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { aboutMarker } from '../../../shared' - -export const Route = createFileRoute('/about')({ - component: AboutPage, -}) - -function AboutPage() { - return ( -
-

{aboutMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/links/solid/src/routes/index.tsx deleted file mode 100644 index 72fbfe387a..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { homeMarker } from '../../../shared' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

{homeMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/links/solid/src/routes/items.$id.tsx b/benchmarks/client-nav/scenarios/links/solid/src/routes/items.$id.tsx deleted file mode 100644 index 64d84f81f4..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/src/routes/items.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { itemMarker } from '../../../shared' - -export const Route = createFileRoute('/items/$id')({ - component: ItemPage, -}) - -function ItemPage() { - const params = Route.useParams() - - return ( -
-

{itemMarker(params().id)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/links/solid/tsconfig.json b/benchmarks/client-nav/scenarios/links/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/links/solid/vite.config.ts b/benchmarks/client-nav/scenarios/links/solid/vite.config.ts deleted file mode 100644 index e37342ffc3..0000000000 --- a/benchmarks/client-nav/scenarios/links/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav links (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/links/vue/project.json b/benchmarks/client-nav/scenarios/links/vue/project.json deleted file mode 100644 index fe1e68fad3..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-links-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/links/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/links/vue/setup.ts b/benchmarks/client-nav/scenarios/links/vue/setup.ts deleted file mode 100644 index f70a154909..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts deleted file mode 100644 index 2ace7a8409..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-links', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-links navigation 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/links/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/links/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/links/vue/src/main.tsx b/benchmarks/client-nav/scenarios/links/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts deleted file mode 100644 index 7d2b1e9bbb..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/about' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/about' | '/items/$id' - id: '__root__' | '/' | '/about' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/links/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/links/vue/src/routes/__root.tsx deleted file mode 100644 index 04f99677fd..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/src/routes/__root.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import * as Vue from 'vue' -import { - Link, - Outlet, - createRootRoute, - useMatchRoute, -} from '@tanstack/vue-router' -import { - itemIds, - matchProbeIds, - stepItemIds, - variantSearch, -} from '../../../shared' - -const StatusPanel = Vue.defineComponent({ - setup() { - const matchRoute = useMatchRoute() - const probes = matchProbeIds.map((id) => ({ - id, - match: matchRoute({ to: '/items/$id', params: { id } }), - })) - // Static probes use the setup-scoped matchRoute instead of : - // vue-router's MatchRoute creates an undisposed watcher per render (one - // leaked subscription per navigation), so all three apps use - // useMatchRoute for cross-framework parity. - const atHome = matchRoute({ to: '/' }) - const atAbout = matchRoute({ to: '/about' }) - const underRoot = matchRoute({ to: '/', fuzzy: true }) - const underAbout = matchRoute({ to: '/about', fuzzy: true }) - const aboutSearch = matchRoute({ to: '/about', includeSearch: true }) - - return () => ( - - ) - }, -}) - -const LinkGrid = Vue.defineComponent({ - setup() { - return () => ( -
- {itemIds.map((id) => ( -
- - {`Item ${id}`} - - - {`Item ${id} exact`} - - - {`Item ${id} search`} - - - {`Item ${id} hash`} - - - {({ isActive }: { isActive: boolean }) => - isActive ? `Item ${id} on` : `Item ${id} off` - } - -
- ))} -
- ) - }, -}) - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/links/vue/src/routes/about.tsx b/benchmarks/client-nav/scenarios/links/vue/src/routes/about.tsx deleted file mode 100644 index 5cc1473bff..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/src/routes/about.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { aboutMarker } from '../../../shared' - -const AboutPage = Vue.defineComponent({ - setup() { - return () => ( -
-

{aboutMarker}

-
- ) - }, -}) - -export const Route = createFileRoute('/about')({ - component: AboutPage, -}) diff --git a/benchmarks/client-nav/scenarios/links/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/links/vue/src/routes/index.tsx deleted file mode 100644 index f04a9f5796..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/src/routes/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { homeMarker } from '../../../shared' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

{homeMarker}

-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/links/vue/src/routes/items.$id.tsx b/benchmarks/client-nav/scenarios/links/vue/src/routes/items.$id.tsx deleted file mode 100644 index 0dc5efa3d3..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/src/routes/items.$id.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { itemMarker } from '../../../shared' - -const ItemPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{itemMarker(params.value.id)}

-
- ) - }, -}) - -export const Route = createFileRoute('/items/$id')({ - component: ItemPage, -}) diff --git a/benchmarks/client-nav/scenarios/links/vue/tsconfig.json b/benchmarks/client-nav/scenarios/links/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/links/vue/vite.config.ts b/benchmarks/client-nav/scenarios/links/vue/vite.config.ts deleted file mode 100644 index ad89a49d70..0000000000 --- a/benchmarks/client-nav/scenarios/links/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav links (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/react/project.json b/benchmarks/client-nav/scenarios/loaders/react/project.json deleted file mode 100644 index d3dbe585d4..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-loaders-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/loaders/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/setup.ts b/benchmarks/client-nav/scenarios/loaders/react/setup.ts deleted file mode 100644 index 130583b190..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts deleted file mode 100644 index 8bcc53b88e..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-loaders', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-loaders navigation loop (react)', - 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/loaders/react/speed.flame.ts b/benchmarks/client-nav/scenarios/loaders/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/main.tsx b/benchmarks/client-nav/scenarios/loaders/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/loaders/react/src/routeTree.gen.ts deleted file mode 100644 index 35908a225f..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/routeTree.gen.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 DepsRouteImport } from './routes/deps' -import { Route as CachedIdRouteImport } from './routes/cached.$id' -import { Route as FreshIdRouteImport } from './routes/fresh.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DepsRoute = DepsRouteImport.update({ - id: '/deps', - path: '/deps', - getParentRoute: () => rootRouteImport, -} as any) -const CachedIdRoute = CachedIdRouteImport.update({ - id: '/cached/$id', - path: '/cached/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FreshIdRoute = FreshIdRouteImport.update({ - id: '/fresh/$id', - path: '/fresh/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/deps' | '/cached/$id' | '/fresh/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/deps' | '/cached/$id' | '/fresh/$id' - id: '__root__' | '/' | '/deps' | '/cached/$id' | '/fresh/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DepsRoute: typeof DepsRoute - CachedIdRoute: typeof CachedIdRoute - FreshIdRoute: typeof FreshIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/deps': { - id: '/deps' - path: '/deps' - fullPath: '/deps' - preLoaderRoute: typeof DepsRouteImport - parentRoute: typeof rootRouteImport - } - '/cached/$id': { - id: '/cached/$id' - path: '/cached/$id' - fullPath: '/cached/$id' - preLoaderRoute: typeof CachedIdRouteImport - parentRoute: typeof rootRouteImport - } - '/fresh/$id': { - id: '/fresh/$id' - path: '/fresh/$id' - fullPath: '/fresh/$id' - preLoaderRoute: typeof FreshIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DepsRoute: DepsRoute, - CachedIdRoute: CachedIdRoute, - FreshIdRoute: FreshIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/loaders/react/src/routes/__root.tsx deleted file mode 100644 index 6309763cf3..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/routes/__root.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/routes/cached.$id.tsx b/benchmarks/client-nav/scenarios/loaders/react/src/routes/cached.$id.tsx deleted file mode 100644 index 9b954185cc..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/routes/cached.$id.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { computeChecksum, itemsChecksum, makeItems } from '../../../shared' - -export const Route = createFileRoute('/cached/$id')({ - loader: ({ params }) => { - const items = makeItems(`cached-${params.id}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 1e9, - gcTime: 1e9, - component: CachedPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function SumSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - void computeChecksum(value) - return null -} - -function FirstItemSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.items[0]?.value ?? 0), - }) - - void computeChecksum(value) - return null -} - -function CachedPage() { - const params = Route.useParams() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Cached

-
{`c-${params.id}-${loaderData.checksum}`}
-
    - {loaderData.items.slice(0, 5).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/routes/deps.tsx b/benchmarks/client-nav/scenarios/loaders/react/src/routes/deps.tsx deleted file mode 100644 index 92afe04a21..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/routes/deps.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import type { SearchSchemaInput } from '@tanstack/react-router' -import { - computeChecksum, - itemsChecksum, - makeItems, - normalizePage, -} from '../../../shared' - -export const Route = createFileRoute('/deps')({ - validateSearch: (search: Record & SearchSchemaInput) => ({ - page: normalizePage(search.page), - }), - loaderDeps: ({ search }) => ({ page: search.page }), - loader: ({ deps }) => { - const items = makeItems(`deps-${deps.page}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 1e9, - gcTime: 1e9, - component: DepsPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function SumSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - void computeChecksum(value) - return null -} - -function DepsSubscriber() { - const value = Route.useLoaderDeps({ - select: (deps) => computeChecksum(deps.page * 17), - }) - - void computeChecksum(value) - return null -} - -function DepsPage() { - const search = Route.useSearch() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Deps

-
{`d-${search.page}-${loaderData.checksum}`}
-
    - {loaderData.items.slice(0, 5).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/routes/fresh.$id.tsx b/benchmarks/client-nav/scenarios/loaders/react/src/routes/fresh.$id.tsx deleted file mode 100644 index fb7cbf2f00..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/routes/fresh.$id.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { computeChecksum, itemsChecksum, makeItems } from '../../../shared' - -export const Route = createFileRoute('/fresh/$id')({ - loader: ({ params }) => { - const items = makeItems(`fresh-${params.id}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 0, - gcTime: 0, - component: FreshPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function SumSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - void computeChecksum(value) - return null -} - -function FirstItemSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.items[0]?.value ?? 0), - }) - - void computeChecksum(value) - return null -} - -function FreshPage() { - const params = Route.useParams() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Fresh

-
{`f-${params.id}-${loaderData.checksum}`}
-
    - {loaderData.items.slice(0, 5).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/loaders/react/src/routes/index.tsx deleted file mode 100644 index 9203c00841..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Loaders Bench

-
home
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/tsconfig.json b/benchmarks/client-nav/scenarios/loaders/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts b/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts deleted file mode 100644 index 818b224130..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav loaders (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/shared.ts b/benchmarks/client-nav/scenarios/loaders/shared.ts deleted file mode 100644 index f744246160..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/shared.ts +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Shared definition of the `loaders` scenario: deterministic loader data - * derivation, the click sequence, and per-step sanity assertions. The three - * framework apps consume these builders so the workload is identical modulo - * the rendering layer. - * - * Isolates: client loader dispatch — always-stale re-runs (staleTime 0), - * pure cache hits (staleTime 1e9), loaderDeps-keyed caching, - * router.invalidate(), and useLoaderData selector subscriptions. - */ - -import type { ScenarioStep } from '../harness' - -export function computeChecksum(seed: number) { - let value = Math.trunc(seed) | 0 - - for (let index = 0; index < 40; index++) { - value = (value * 1664525 + 1013904223 + index) >>> 0 - } - - return value -} - -export interface LoaderItem { - id: string - name: string - value: number - flag: boolean -} - -export function makeItems(seedText: string): Array { - let seed = 0 - for (let index = 0; index < seedText.length; index++) { - seed = (seed * 31 + seedText.charCodeAt(index)) >>> 0 - } - - const items: Array = [] - let value = seed - - for (let index = 0; index < 50; index++) { - value = (value * 1664525 + 1013904223) >>> 0 - items.push({ - id: `${seedText}-${index}`, - name: `Item ${index} of ${seedText}`, - value: value % 100000, - flag: value % 3 === 0, - }) - } - - return items -} - -export function itemsChecksum(items: Array) { - let sum = 0 - for (const item of items) { - sum = (sum + item.value + (item.flag ? 1 : 0)) >>> 0 - } - return sum -} - -export function normalizePage(value: unknown) { - const page = Number(value) - return Number.isFinite(page) && page > 0 ? Math.trunc(page) : 1 -} - -export function freshMarkerText(id: string) { - return `f-${id}-${itemsChecksum(makeItems(`fresh-${id}`))}` -} - -export function cachedMarkerText(id: string) { - return `c-${id}-${itemsChecksum(makeItems(`cached-${id}`))}` -} - -export function depsMarkerText(page: number) { - return `d-${page}-${itemsChecksum(makeItems(`deps-${page}`))}` -} - -export const steps: ReadonlyArray = [ - 'go-fresh-1', - 'go-fresh-2', - 'go-cached-1', - 'go-cached-2', - 'go-deps-1', - 'go-deps-2', - // Invalidates the currently matched routes (the deps route), re-running its - // loader with unchanged deps. Note: this also marks the cached fresh/cached - // matches invalid, so each of those loaders re-runs once per lap on its next - // visit — deterministic, identical work every lap. - { type: 'invalidate' }, - 'go-home', -] - -interface ExpectedState { - testId: string - text?: string -} - -const expectedStates: ReadonlyArray = [ - { testId: 'fresh-state', text: freshMarkerText('1') }, - { testId: 'fresh-state', text: freshMarkerText('2') }, - { testId: 'cached-state', text: cachedMarkerText('1') }, - { testId: 'cached-state', text: cachedMarkerText('2') }, - { testId: 'deps-state', text: depsMarkerText(1) }, - { testId: 'deps-state', text: depsMarkerText(2) }, - // After invalidate the deps loader re-ran with the same deps. - { testId: 'deps-state', text: depsMarkerText(2) }, - { testId: 'home-state' }, -] - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const expected = expectedStates[stepIndex]! - const element = container.querySelector(`[data-testid="${expected.testId}"]`) - - if (!element) { - throw new Error( - `Expected marker "${expected.testId}" to exist after step ${stepIndex}`, - ) - } - - if (expected.text !== undefined && element.textContent !== expected.text) { - throw new Error( - `Expected marker "${expected.testId}" to read "${expected.text}" after step ${stepIndex}, received "${element.textContent}"`, - ) - } -} - -// Two laps through the 8-step sequence per benchmark iteration. -export const ticksPerIteration = 16 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/project.json b/benchmarks/client-nav/scenarios/loaders/solid/project.json deleted file mode 100644 index 071e6bc385..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-loaders-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/loaders/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/setup.ts b/benchmarks/client-nav/scenarios/loaders/solid/setup.ts deleted file mode 100644 index 6a46971603..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts deleted file mode 100644 index 953a17b31a..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-loaders', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-loaders navigation loop (solid)', - 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/loaders/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/loaders/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts deleted file mode 100644 index fa5d032141..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 DepsRouteImport } from './routes/deps' -import { Route as CachedIdRouteImport } from './routes/cached.$id' -import { Route as FreshIdRouteImport } from './routes/fresh.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DepsRoute = DepsRouteImport.update({ - id: '/deps', - path: '/deps', - getParentRoute: () => rootRouteImport, -} as any) -const CachedIdRoute = CachedIdRouteImport.update({ - id: '/cached/$id', - path: '/cached/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FreshIdRoute = FreshIdRouteImport.update({ - id: '/fresh/$id', - path: '/fresh/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/deps' | '/cached/$id' | '/fresh/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/deps' | '/cached/$id' | '/fresh/$id' - id: '__root__' | '/' | '/deps' | '/cached/$id' | '/fresh/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DepsRoute: typeof DepsRoute - CachedIdRoute: typeof CachedIdRoute - FreshIdRoute: typeof FreshIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/deps': { - id: '/deps' - path: '/deps' - fullPath: '/deps' - preLoaderRoute: typeof DepsRouteImport - parentRoute: typeof rootRouteImport - } - '/cached/$id': { - id: '/cached/$id' - path: '/cached/$id' - fullPath: '/cached/$id' - preLoaderRoute: typeof CachedIdRouteImport - parentRoute: typeof rootRouteImport - } - '/fresh/$id': { - id: '/fresh/$id' - path: '/fresh/$id' - fullPath: '/fresh/$id' - preLoaderRoute: typeof FreshIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DepsRoute: DepsRoute, - CachedIdRoute: CachedIdRoute, - FreshIdRoute: FreshIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/__root.tsx deleted file mode 100644 index 30350f7907..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/__root.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx deleted file mode 100644 index aab6be74dc..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/cached.$id.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import { For, createRenderEffect } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import { computeChecksum, itemsChecksum, makeItems } from '../../../shared' - -export const Route = createFileRoute('/cached/$id')({ - loader: ({ params }) => { - const items = makeItems(`cached-${params.id}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 1e9, - gcTime: 1e9, - component: CachedPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function SumSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - return computeChecksum(value())} /> -} - -function FirstItemSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.items[0]?.value ?? 0), - }) - - return computeChecksum(value())} /> -} - -function CachedPage() { - const params = Route.useParams() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map(() => ( - - ))} - {subscriberIndexes.map(() => ( - - ))} -

Cached

-
{`c-${params().id}-${loaderData().checksum}`}
-
    - - {(item) =>
  • {item.name}
  • } -
    -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx deleted file mode 100644 index 2f23f2d3da..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/deps.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { For, createRenderEffect } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import type { SearchSchemaInput } from '@tanstack/solid-router' -import { - computeChecksum, - itemsChecksum, - makeItems, - normalizePage, -} from '../../../shared' - -export const Route = createFileRoute('/deps')({ - validateSearch: (search: Record & SearchSchemaInput) => ({ - page: normalizePage(search.page), - }), - loaderDeps: ({ search }) => ({ page: search.page }), - loader: ({ deps }) => { - const items = makeItems(`deps-${deps.page}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 1e9, - gcTime: 1e9, - component: DepsPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function SumSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - return computeChecksum(value())} /> -} - -function DepsSubscriber() { - const value = Route.useLoaderDeps({ - select: (deps) => computeChecksum(deps.page * 17), - }) - - return computeChecksum(value())} /> -} - -function DepsPage() { - const search = Route.useSearch() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map(() => ( - - ))} - {subscriberIndexes.map(() => ( - - ))} -

Deps

-
{`d-${search().page}-${loaderData().checksum}`}
-
    - - {(item) =>
  • {item.name}
  • } -
    -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx deleted file mode 100644 index acd6a9aa27..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/fresh.$id.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import { For, createRenderEffect } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import { computeChecksum, itemsChecksum, makeItems } from '../../../shared' - -export const Route = createFileRoute('/fresh/$id')({ - loader: ({ params }) => { - const items = makeItems(`fresh-${params.id}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 0, - gcTime: 0, - component: FreshPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function SumSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - return computeChecksum(value())} /> -} - -function FirstItemSubscriber() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.items[0]?.value ?? 0), - }) - - return computeChecksum(value())} /> -} - -function FreshPage() { - const params = Route.useParams() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map(() => ( - - ))} - {subscriberIndexes.map(() => ( - - ))} -

Fresh

-
{`f-${params().id}-${loaderData().checksum}`}
-
    - - {(item) =>
  • {item.name}
  • } -
    -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/loaders/solid/src/routes/index.tsx deleted file mode 100644 index 7287d47d0a..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Loaders Bench

-
home
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json b/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts b/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts deleted file mode 100644 index 90584d3b7e..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav loaders (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/vue/project.json b/benchmarks/client-nav/scenarios/loaders/vue/project.json deleted file mode 100644 index 69bd95837d..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-loaders-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/loaders/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/loaders/vue/setup.ts b/benchmarks/client-nav/scenarios/loaders/vue/setup.ts deleted file mode 100644 index 97b74b3892..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts deleted file mode 100644 index 1ae2f89a56..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-loaders', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-loaders navigation 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/loaders/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/loaders/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx b/benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts deleted file mode 100644 index 10cb8f2aca..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,113 +0,0 @@ -/* 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 DepsRouteImport } from './routes/deps' -import { Route as CachedIdRouteImport } from './routes/cached.$id' -import { Route as FreshIdRouteImport } from './routes/fresh.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DepsRoute = DepsRouteImport.update({ - id: '/deps', - path: '/deps', - getParentRoute: () => rootRouteImport, -} as any) -const CachedIdRoute = CachedIdRouteImport.update({ - id: '/cached/$id', - path: '/cached/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FreshIdRoute = FreshIdRouteImport.update({ - id: '/fresh/$id', - path: '/fresh/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/deps': typeof DepsRoute - '/cached/$id': typeof CachedIdRoute - '/fresh/$id': typeof FreshIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/deps' | '/cached/$id' | '/fresh/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/deps' | '/cached/$id' | '/fresh/$id' - id: '__root__' | '/' | '/deps' | '/cached/$id' | '/fresh/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DepsRoute: typeof DepsRoute - CachedIdRoute: typeof CachedIdRoute - FreshIdRoute: typeof FreshIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/deps': { - id: '/deps' - path: '/deps' - fullPath: '/deps' - preLoaderRoute: typeof DepsRouteImport - parentRoute: typeof rootRouteImport - } - '/cached/$id': { - id: '/cached/$id' - path: '/cached/$id' - fullPath: '/cached/$id' - preLoaderRoute: typeof CachedIdRouteImport - parentRoute: typeof rootRouteImport - } - '/fresh/$id': { - id: '/fresh/$id' - path: '/fresh/$id' - fullPath: '/fresh/$id' - preLoaderRoute: typeof FreshIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DepsRoute: DepsRoute, - CachedIdRoute: CachedIdRoute, - FreshIdRoute: FreshIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/loaders/vue/src/routes/__root.tsx deleted file mode 100644 index b9102a92c4..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/__root.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/cached.$id.tsx b/benchmarks/client-nav/scenarios/loaders/vue/src/routes/cached.$id.tsx deleted file mode 100644 index a426e35765..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/cached.$id.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { computeChecksum, itemsChecksum, makeItems } from '../../../shared' - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -const SumSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const FirstItemSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.items[0]?.value ?? 0), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const CachedPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - const loaderData = Route.useLoaderData() - - return () => ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Cached

-
- {`c-${params.value.id}-${loaderData.value.checksum}`} -
-
    - {loaderData.value.items.slice(0, 5).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/cached/$id')({ - loader: ({ params }) => { - const items = makeItems(`cached-${params.id}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 1e9, - gcTime: 1e9, - component: CachedPage, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/deps.tsx b/benchmarks/client-nav/scenarios/loaders/vue/src/routes/deps.tsx deleted file mode 100644 index f987d15d34..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/deps.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import type { SearchSchemaInput } from '@tanstack/vue-router' -import { - computeChecksum, - itemsChecksum, - makeItems, - normalizePage, -} from '../../../shared' - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -const SumSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const DepsSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useLoaderDeps({ - select: (deps) => computeChecksum(deps.page * 17), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const DepsPage = Vue.defineComponent({ - setup() { - const search = Route.useSearch() - const loaderData = Route.useLoaderData() - - return () => ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Deps

-
- {`d-${search.value.page}-${loaderData.value.checksum}`} -
-
    - {loaderData.value.items.slice(0, 5).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/deps')({ - validateSearch: (search: Record & SearchSchemaInput) => ({ - page: normalizePage(search.page), - }), - loaderDeps: ({ search }) => ({ page: search.page }), - loader: ({ deps }) => { - const items = makeItems(`deps-${deps.page}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 1e9, - gcTime: 1e9, - component: DepsPage, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/fresh.$id.tsx b/benchmarks/client-nav/scenarios/loaders/vue/src/routes/fresh.$id.tsx deleted file mode 100644 index 64eec85cfa..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/fresh.$id.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { computeChecksum, itemsChecksum, makeItems } from '../../../shared' - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -const SumSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.checksum), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const FirstItemSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useLoaderData({ - select: (data) => computeChecksum(data.items[0]?.value ?? 0), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const FreshPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - const loaderData = Route.useLoaderData() - - return () => ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Fresh

-
- {`f-${params.value.id}-${loaderData.value.checksum}`} -
-
    - {loaderData.value.items.slice(0, 5).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/fresh/$id')({ - loader: ({ params }) => { - const items = makeItems(`fresh-${params.id}`) - return { items, checksum: itemsChecksum(items) } - }, - staleTime: 0, - gcTime: 0, - component: FreshPage, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/loaders/vue/src/routes/index.tsx deleted file mode 100644 index c9724c90a4..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/src/routes/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

Loaders Bench

-
home
-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/loaders/vue/tsconfig.json b/benchmarks/client-nav/scenarios/loaders/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts b/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts deleted file mode 100644 index ecf4cce139..0000000000 --- a/benchmarks/client-nav/scenarios/loaders/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav loaders (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/mount/react/project.json b/benchmarks/client-nav/scenarios/mount/react/project.json deleted file mode 100644 index 61839943b3..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-mount-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/mount/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/mount/react/setup.ts b/benchmarks/client-nav/scenarios/mount/react/setup.ts deleted file mode 100644 index ed0426c696..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createMountLoopSetup } from '../../harness' -import { assertReady, readyTestId } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createMountLoopSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - readyTestId, - assertReady, - }) -} diff --git a/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts deleted file mode 100644 index 6c3a64b026..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-mount', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-mount loop (react)', - 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/mount/react/speed.flame.ts b/benchmarks/client-nav/scenarios/mount/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/main.tsx b/benchmarks/client-nav/scenarios/mount/react/src/main.tsx deleted file mode 100644 index 4e45ed7ef3..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/main.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' -import type { RouterHistory } from '@tanstack/history' - -/** - * Unlike the other scenarios, this app is mounted and unmounted in a loop, so - * it must not register page-lifetime globals that have no dispose path: - * - the harness injects and destroys a fresh memory history per mount; - * - `scrollRestoration` stays off — enabling it registers per-router - * document/window listeners that retain every router ever created. - */ -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/mount/react/src/routeTree.gen.ts deleted file mode 100644 index f9b7e5c268..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routeTree.gen.ts +++ /dev/null @@ -1,264 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as BlogRouteImport } from './routes/blog' -import { Route as SearchRouteImport } from './routes/search' -import { Route as SettingsRouteImport } from './routes/settings' -import { Route as ShopRouteImport } from './routes/shop' -import { Route as BlogIndexRouteImport } from './routes/blog.index' -import { Route as BlogSlugRouteImport } from './routes/blog.$slug' -import { Route as ShopIndexRouteImport } from './routes/shop.index' -import { Route as ShopProductIdRouteImport } from './routes/shop.$productId' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRoute = BlogRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const SearchRoute = SearchRouteImport.update({ - id: '/search', - path: '/search', - 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 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 - '/about': typeof AboutRoute - '/blog': typeof BlogRouteWithChildren - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/shop': typeof ShopRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog/': typeof BlogIndexRoute - '/shop/': typeof ShopIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog': typeof BlogIndexRoute - '/shop': typeof ShopIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/blog': typeof BlogRouteWithChildren - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/shop': typeof ShopRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog/': typeof BlogIndexRoute - '/shop/': typeof ShopIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/about' - | '/blog' - | '/search' - | '/settings' - | '/shop' - | '/blog/$slug' - | '/shop/$productId' - | '/blog/' - | '/shop/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/about' - | '/search' - | '/settings' - | '/blog/$slug' - | '/shop/$productId' - | '/blog' - | '/shop' - id: - | '__root__' - | '/' - | '/about' - | '/blog' - | '/search' - | '/settings' - | '/shop' - | '/blog/$slug' - | '/shop/$productId' - | '/blog/' - | '/shop/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - BlogRoute: typeof BlogRouteWithChildren - SearchRoute: typeof SearchRoute - SettingsRoute: typeof SettingsRoute - ShopRoute: typeof ShopRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteImport - parentRoute: typeof rootRouteImport - } - '/search': { - id: '/search' - path: '/search' - fullPath: '/search' - preLoaderRoute: typeof SearchRouteImport - 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/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof BlogIndexRouteImport - parentRoute: typeof BlogRoute - } - '/blog/$slug': { - id: '/blog/$slug' - path: '/$slug' - fullPath: '/blog/$slug' - 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 - } - } -} - -interface BlogRouteChildren { - BlogSlugRoute: typeof BlogSlugRoute - BlogIndexRoute: typeof BlogIndexRoute -} - -const BlogRouteChildren: BlogRouteChildren = { - BlogSlugRoute: BlogSlugRoute, - BlogIndexRoute: BlogIndexRoute, -} - -const BlogRouteWithChildren = BlogRoute._addFileChildren(BlogRouteChildren) - -interface ShopRouteChildren { - ShopProductIdRoute: typeof ShopProductIdRoute - ShopIndexRoute: typeof ShopIndexRoute -} - -const ShopRouteChildren: ShopRouteChildren = { - ShopProductIdRoute: ShopProductIdRoute, - ShopIndexRoute: ShopIndexRoute, -} - -const ShopRouteWithChildren = ShopRoute._addFileChildren(ShopRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - BlogRoute: BlogRouteWithChildren, - SearchRoute: SearchRoute, - SettingsRoute: SettingsRoute, - ShopRoute: ShopRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/__root.tsx deleted file mode 100644 index 0deab171d8..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/__root.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/about.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/about.tsx deleted file mode 100644 index 3fedde283b..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/about')({ - component: AboutPage, -}) - -function AboutPage() { - return

About

-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.$slug.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.$slug.tsx deleted file mode 100644 index f995d95d94..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.$slug.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { articleData } from '../../../shared' - -export const Route = createFileRoute('/blog/$slug')({ - loader: ({ params }) => articleData(params.slug), - component: ArticlePage, -}) - -function ArticlePage() { - const article = Route.useLoaderData() - - return
{`${article.title} (${article.words} words)`}
-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.index.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.index.tsx deleted file mode 100644 index 437187eb4f..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/blog/')({ - component: BlogIndexPage, -}) - -function BlogIndexPage() { - return

All articles

-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.tsx deleted file mode 100644 index ab4fbeb482..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/blog.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { blogContext } from '../../../shared' - -export const Route = createFileRoute('/blog')({ - beforeLoad: () => blogContext(), - component: BlogLayout, -}) - -function BlogLayout() { - return ( -
-

Blog

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/index.tsx deleted file mode 100644 index dbc99d8f66..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { homeItems, readyTestId } from '../../../shared' - -export const Route = createFileRoute('/')({ - loader: () => homeItems(), - component: HomePage, -}) - -function HomePage() { - const items = Route.useLoaderData() - - return ( -
-

{`Home (${items.length} items)`}

-
    - {items.map((item) => ( -
  • {`${item.label}: ${item.score}`}
  • - ))} -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/search.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/search.tsx deleted file mode 100644 index faba50fc72..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/search.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { normalizePage, normalizeQuery } from '../../../shared' - -export const Route = createFileRoute('/search')({ - validateSearch: (search: Record) => ({ - q: normalizeQuery(search.q), - page: normalizePage(search.page), - }), - component: SearchPage, -}) - -function SearchPage() { - const search = Route.useSearch() - - return

{`Results for "${search.q}" page ${search.page}`}

-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/settings.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/settings.tsx deleted file mode 100644 index 1f46d9d885..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/settings')({ - component: SettingsPage, -}) - -function SettingsPage() { - return

Settings

-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.$productId.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.$productId.tsx deleted file mode 100644 index 7b729a3dca..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.$productId.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { productData } from '../../../shared' - -export const Route = createFileRoute('/shop/$productId')({ - loader: ({ params }) => productData(params.productId), - component: ProductPage, -}) - -function ProductPage() { - const product = Route.useLoaderData() - - return
{`${product.name}: ${product.price}`}
-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.index.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.index.tsx deleted file mode 100644 index dbca94357a..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/shop/')({ - component: ShopIndexPage, -}) - -function ShopIndexPage() { - return

All products

-} diff --git a/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.tsx b/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.tsx deleted file mode 100644 index 5243d7bb0e..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/src/routes/shop.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { shopContext } from '../../../shared' - -export const Route = createFileRoute('/shop')({ - beforeLoad: () => shopContext(), - component: ShopLayout, -}) - -function ShopLayout() { - return ( -
-

Shop

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/mount/react/tsconfig.json b/benchmarks/client-nav/scenarios/mount/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/mount/react/vite.config.ts b/benchmarks/client-nav/scenarios/mount/react/vite.config.ts deleted file mode 100644 index e197d33a9e..0000000000 --- a/benchmarks/client-nav/scenarios/mount/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav mount (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/mount/shared.ts b/benchmarks/client-nav/scenarios/mount/shared.ts deleted file mode 100644 index a8f3d2c7bd..0000000000 --- a/benchmarks/client-nav/scenarios/mount/shared.ts +++ /dev/null @@ -1,75 +0,0 @@ -/** - * Shared definition of the `mount` scenario: cold start of a moderate, - * realistic app — router creation (processRouteTree), first render, initial - * `router.load()`, and unmount. This is the only scenario where router - * construction is inside the measured loop; the wider tree exists as - * realistic route-processing weight even though only the index route loads. - */ - -export const readyTestId = 'mount-ready' - -export const homeItemCount = 5 - -export function homeItems() { - return Array.from({ length: homeItemCount }, (_, index) => ({ - id: `item-${index}`, - label: `Featured item ${index}`, - score: index * 17 + 3, - })) -} - -export const homeReadyText = `Home (${homeItemCount} items)` - -export function shopContext() { - return { shopSeed: 7 } -} - -export function blogContext() { - return { blogSeed: 13 } -} - -export function productData(productId: string) { - return { - id: productId, - name: `Product ${productId}`, - price: productId.length * 100 + 42, - } -} - -export function articleData(slug: string) { - return { - slug, - title: `Article ${slug}`, - words: slug.length * 250, - } -} - -export function normalizePage(value: unknown) { - const page = Number(value) - return Number.isFinite(page) && page > 0 ? Math.trunc(page) : 1 -} - -export function normalizeQuery(value: unknown) { - return typeof value === 'string' ? value : '' -} - -export function assertReady(container: HTMLElement) { - const marker = container.querySelector(`[data-testid="${readyTestId}"]`) - if (marker?.textContent !== homeReadyText) { - throw new Error( - `Expected mount marker to be "${homeReadyText}", received "${marker?.textContent}"`, - ) - } -} - -// Mounts per benchmark iteration. -// 6 mounts per iteration: a single mount simulates to only ~8ms of CPU, and -// very short measures amplify the relative impact of allocator/GC -// quantization; 6 keeps the measure comfortably above ~50ms simulated. -export const ticksPerIteration = 6 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/project.json b/benchmarks/client-nav/scenarios/mount/solid/project.json deleted file mode 100644 index 4349570654..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-mount-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/mount/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/setup.ts b/benchmarks/client-nav/scenarios/mount/solid/setup.ts deleted file mode 100644 index 810ea38c91..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createMountLoopSetup } from '../../harness' -import { assertReady, readyTestId } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createMountLoopSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - readyTestId, - assertReady, - }) -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts deleted file mode 100644 index 236f875f57..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-mount', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-mount loop (solid)', - 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/mount/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/mount/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx deleted file mode 100644 index 2586872f5c..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import type { RouterHistory } from '@tanstack/history' - -/** - * Unlike the other scenarios, this app is mounted and unmounted in a loop, so - * it must not register page-lifetime globals that have no dispose path: - * - the harness injects and destroys a fresh memory history per mount; - * - `scrollRestoration` stays off — enabling it registers per-router - * document/window listeners that retain every router ever created. - */ -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const dispose = render(() => , container) - - return { - router, - unmount() { - dispose() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts deleted file mode 100644 index 30247636dd..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,264 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as BlogRouteImport } from './routes/blog' -import { Route as SearchRouteImport } from './routes/search' -import { Route as SettingsRouteImport } from './routes/settings' -import { Route as ShopRouteImport } from './routes/shop' -import { Route as BlogIndexRouteImport } from './routes/blog.index' -import { Route as BlogSlugRouteImport } from './routes/blog.$slug' -import { Route as ShopIndexRouteImport } from './routes/shop.index' -import { Route as ShopProductIdRouteImport } from './routes/shop.$productId' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRoute = BlogRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const SearchRoute = SearchRouteImport.update({ - id: '/search', - path: '/search', - 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 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 - '/about': typeof AboutRoute - '/blog': typeof BlogRouteWithChildren - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/shop': typeof ShopRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog/': typeof BlogIndexRoute - '/shop/': typeof ShopIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog': typeof BlogIndexRoute - '/shop': typeof ShopIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/blog': typeof BlogRouteWithChildren - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/shop': typeof ShopRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog/': typeof BlogIndexRoute - '/shop/': typeof ShopIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/about' - | '/blog' - | '/search' - | '/settings' - | '/shop' - | '/blog/$slug' - | '/shop/$productId' - | '/blog/' - | '/shop/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/about' - | '/search' - | '/settings' - | '/blog/$slug' - | '/shop/$productId' - | '/blog' - | '/shop' - id: - | '__root__' - | '/' - | '/about' - | '/blog' - | '/search' - | '/settings' - | '/shop' - | '/blog/$slug' - | '/shop/$productId' - | '/blog/' - | '/shop/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - BlogRoute: typeof BlogRouteWithChildren - SearchRoute: typeof SearchRoute - SettingsRoute: typeof SettingsRoute - ShopRoute: typeof ShopRouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteImport - parentRoute: typeof rootRouteImport - } - '/search': { - id: '/search' - path: '/search' - fullPath: '/search' - preLoaderRoute: typeof SearchRouteImport - 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/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof BlogIndexRouteImport - parentRoute: typeof BlogRoute - } - '/blog/$slug': { - id: '/blog/$slug' - path: '/$slug' - fullPath: '/blog/$slug' - 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 - } - } -} - -interface BlogRouteChildren { - BlogSlugRoute: typeof BlogSlugRoute - BlogIndexRoute: typeof BlogIndexRoute -} - -const BlogRouteChildren: BlogRouteChildren = { - BlogSlugRoute: BlogSlugRoute, - BlogIndexRoute: BlogIndexRoute, -} - -const BlogRouteWithChildren = BlogRoute._addFileChildren(BlogRouteChildren) - -interface ShopRouteChildren { - ShopProductIdRoute: typeof ShopProductIdRoute - ShopIndexRoute: typeof ShopIndexRoute -} - -const ShopRouteChildren: ShopRouteChildren = { - ShopProductIdRoute: ShopProductIdRoute, - ShopIndexRoute: ShopIndexRoute, -} - -const ShopRouteWithChildren = ShopRoute._addFileChildren(ShopRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - BlogRoute: BlogRouteWithChildren, - SearchRoute: SearchRoute, - SettingsRoute: SettingsRoute, - ShopRoute: ShopRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/__root.tsx deleted file mode 100644 index f5c3be2641..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/__root.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/about.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/about.tsx deleted file mode 100644 index f74d85aa06..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/about')({ - component: AboutPage, -}) - -function AboutPage() { - return

About

-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.$slug.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.$slug.tsx deleted file mode 100644 index 82caee757a..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.$slug.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { articleData } from '../../../shared' - -export const Route = createFileRoute('/blog/$slug')({ - loader: ({ params }) => articleData(params.slug), - component: ArticlePage, -}) - -function ArticlePage() { - const article = Route.useLoaderData() - - return
{`${article().title} (${article().words} words)`}
-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.index.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.index.tsx deleted file mode 100644 index 8e75108aca..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/blog/')({ - component: BlogIndexPage, -}) - -function BlogIndexPage() { - return

All articles

-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.tsx deleted file mode 100644 index 1e2cfbd019..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/blog.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { blogContext } from '../../../shared' - -export const Route = createFileRoute('/blog')({ - beforeLoad: () => blogContext(), - component: BlogLayout, -}) - -function BlogLayout() { - return ( -
-

Blog

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/index.tsx deleted file mode 100644 index 30665ba224..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { For } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import { homeItems, readyTestId } from '../../../shared' - -export const Route = createFileRoute('/')({ - loader: () => homeItems(), - component: HomePage, -}) - -function HomePage() { - const items = Route.useLoaderData() - - return ( -
-

{`Home (${items().length} items)`}

-
    - - {(item) =>
  • {`${item.label}: ${item.score}`}
  • } -
    -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/search.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/search.tsx deleted file mode 100644 index 3f8b2d9dd7..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/search.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { normalizePage, normalizeQuery } from '../../../shared' - -export const Route = createFileRoute('/search')({ - validateSearch: (search: Record) => ({ - q: normalizeQuery(search.q), - page: normalizePage(search.page), - }), - component: SearchPage, -}) - -function SearchPage() { - const search = Route.useSearch() - - return

{`Results for "${search().q}" page ${search().page}`}

-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/settings.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/settings.tsx deleted file mode 100644 index c6b95424d9..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/settings')({ - component: SettingsPage, -}) - -function SettingsPage() { - return

Settings

-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.$productId.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.$productId.tsx deleted file mode 100644 index 71b0411d6b..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.$productId.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { productData } from '../../../shared' - -export const Route = createFileRoute('/shop/$productId')({ - loader: ({ params }) => productData(params.productId), - component: ProductPage, -}) - -function ProductPage() { - const product = Route.useLoaderData() - - return
{`${product().name}: ${product().price}`}
-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.index.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.index.tsx deleted file mode 100644 index e33c8779f9..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/shop/')({ - component: ShopIndexPage, -}) - -function ShopIndexPage() { - return

All products

-} diff --git a/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.tsx b/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.tsx deleted file mode 100644 index ff2ca78653..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/src/routes/shop.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { shopContext } from '../../../shared' - -export const Route = createFileRoute('/shop')({ - beforeLoad: () => shopContext(), - component: ShopLayout, -}) - -function ShopLayout() { - return ( -
-

Shop

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json b/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts b/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts deleted file mode 100644 index 5b586dd128..0000000000 --- a/benchmarks/client-nav/scenarios/mount/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav mount (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/project.json b/benchmarks/client-nav/scenarios/mount/vue/project.json deleted file mode 100644 index f2dbd10440..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-mount-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/mount/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/mount/vue/setup.ts b/benchmarks/client-nav/scenarios/mount/vue/setup.ts deleted file mode 100644 index 3976e71c51..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createMountLoopSetup } from '../../harness' -import { assertReady, readyTestId } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createMountLoopSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - readyTestId, - assertReady, - }) -} diff --git a/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts deleted file mode 100644 index d9268ba91b..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/speed.bench.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-mount', async ({ bench }) => { - const scenario = setup() - - 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/mount/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/mount/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/main.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/main.tsx deleted file mode 100644 index fc493c10a5..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/main.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' -import type { RouterHistory } from '@tanstack/history' - -/** - * Unlike the other scenarios, this app is mounted and unmounted in a loop, so - * it must not register page-lifetime globals that have no dispose path: - * - the harness injects and destroys a fresh memory history per mount; - * - `scrollRestoration` stays off — enabling it registers per-router - * document/window listeners that retain every router ever created. - */ -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts deleted file mode 100644 index cd27c917e1..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,264 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as BlogRouteImport } from './routes/blog' -import { Route as SearchRouteImport } from './routes/search' -import { Route as SettingsRouteImport } from './routes/settings' -import { Route as ShopRouteImport } from './routes/shop' -import { Route as BlogIndexRouteImport } from './routes/blog.index' -import { Route as BlogSlugRouteImport } from './routes/blog.$slug' -import { Route as ShopIndexRouteImport } from './routes/shop.index' -import { Route as ShopProductIdRouteImport } from './routes/shop.$productId' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRoute = BlogRouteImport.update({ - id: '/blog', - path: '/blog', - getParentRoute: () => rootRouteImport, -} as any) -const SearchRoute = SearchRouteImport.update({ - id: '/search', - path: '/search', - 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 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 - '/about': typeof AboutRoute - '/blog': typeof BlogRouteWithChildren - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/shop': typeof ShopRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog/': typeof BlogIndexRoute - '/shop/': typeof ShopIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog': typeof BlogIndexRoute - '/shop': typeof ShopIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/blog': typeof BlogRouteWithChildren - '/search': typeof SearchRoute - '/settings': typeof SettingsRoute - '/shop': typeof ShopRouteWithChildren - '/blog/$slug': typeof BlogSlugRoute - '/shop/$productId': typeof ShopProductIdRoute - '/blog/': typeof BlogIndexRoute - '/shop/': typeof ShopIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/about' - | '/blog' - | '/search' - | '/settings' - | '/shop' - | '/blog/$slug' - | '/shop/$productId' - | '/blog/' - | '/shop/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/about' - | '/search' - | '/settings' - | '/blog/$slug' - | '/shop/$productId' - | '/blog' - | '/shop' - id: - | '__root__' - | '/' - | '/about' - | '/blog' - | '/search' - | '/settings' - | '/shop' - | '/blog/$slug' - | '/shop/$productId' - | '/blog/' - | '/shop/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - BlogRoute: typeof BlogRouteWithChildren - SearchRoute: typeof SearchRoute - SettingsRoute: typeof SettingsRoute - ShopRoute: typeof ShopRouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/blog': { - id: '/blog' - path: '/blog' - fullPath: '/blog' - preLoaderRoute: typeof BlogRouteImport - parentRoute: typeof rootRouteImport - } - '/search': { - id: '/search' - path: '/search' - fullPath: '/search' - preLoaderRoute: typeof SearchRouteImport - 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/' - path: '/' - fullPath: '/blog/' - preLoaderRoute: typeof BlogIndexRouteImport - parentRoute: typeof BlogRoute - } - '/blog/$slug': { - id: '/blog/$slug' - path: '/$slug' - fullPath: '/blog/$slug' - 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 - } - } -} - -interface BlogRouteChildren { - BlogSlugRoute: typeof BlogSlugRoute - BlogIndexRoute: typeof BlogIndexRoute -} - -const BlogRouteChildren: BlogRouteChildren = { - BlogSlugRoute: BlogSlugRoute, - BlogIndexRoute: BlogIndexRoute, -} - -const BlogRouteWithChildren = BlogRoute._addFileChildren(BlogRouteChildren) - -interface ShopRouteChildren { - ShopProductIdRoute: typeof ShopProductIdRoute - ShopIndexRoute: typeof ShopIndexRoute -} - -const ShopRouteChildren: ShopRouteChildren = { - ShopProductIdRoute: ShopProductIdRoute, - ShopIndexRoute: ShopIndexRoute, -} - -const ShopRouteWithChildren = ShopRoute._addFileChildren(ShopRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - BlogRoute: BlogRouteWithChildren, - SearchRoute: SearchRoute, - SettingsRoute: SettingsRoute, - ShopRoute: ShopRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/__root.tsx deleted file mode 100644 index 5c2b7b52d0..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/__root.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/about.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/about.tsx deleted file mode 100644 index 254ecca29c..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const AboutPage = Vue.defineComponent({ - setup() { - return () =>

About

- }, -}) - -export const Route = createFileRoute('/about')({ - component: AboutPage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.$slug.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.$slug.tsx deleted file mode 100644 index 3b2e855a6e..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.$slug.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { articleData } from '../../../shared' - -const ArticlePage = Vue.defineComponent({ - setup() { - const article = Route.useLoaderData() - - return () => ( -
{`${article.value.title} (${article.value.words} words)`}
- ) - }, -}) - -export const Route = createFileRoute('/blog/$slug')({ - loader: ({ params }) => articleData(params.slug), - component: ArticlePage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.index.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.index.tsx deleted file mode 100644 index d3c2bd0305..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const BlogIndexPage = Vue.defineComponent({ - setup() { - return () =>

All articles

- }, -}) - -export const Route = createFileRoute('/blog/')({ - component: BlogIndexPage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.tsx deleted file mode 100644 index fe9532cc6f..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/blog.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { blogContext } from '../../../shared' - -const BlogLayout = Vue.defineComponent({ - setup() { - return () => ( -
-

Blog

- -
- ) - }, -}) - -export const Route = createFileRoute('/blog')({ - beforeLoad: () => blogContext(), - component: BlogLayout, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/index.tsx deleted file mode 100644 index b0be4d78bb..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/index.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { homeItems, readyTestId } from '../../../shared' - -const HomePage = Vue.defineComponent({ - setup() { - const items = Route.useLoaderData() - - return () => ( -
-

{`Home (${items.value.length} items)`}

-
    - {items.value.map((item) => ( -
  • {`${item.label}: ${item.score}`}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - loader: () => homeItems(), - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/search.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/search.tsx deleted file mode 100644 index 09fdb29c1e..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/search.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { normalizePage, normalizeQuery } from '../../../shared' - -const SearchPage = Vue.defineComponent({ - setup() { - const search = Route.useSearch() - - return () => ( -

{`Results for "${search.value.q}" page ${search.value.page}`}

- ) - }, -}) - -export const Route = createFileRoute('/search')({ - validateSearch: (search: Record) => ({ - q: normalizeQuery(search.q), - page: normalizePage(search.page), - }), - component: SearchPage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/settings.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/settings.tsx deleted file mode 100644 index 3fc0485606..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const SettingsPage = Vue.defineComponent({ - setup() { - return () =>

Settings

- }, -}) - -export const Route = createFileRoute('/settings')({ - component: SettingsPage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.$productId.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.$productId.tsx deleted file mode 100644 index 897559599a..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.$productId.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { productData } from '../../../shared' - -const ProductPage = Vue.defineComponent({ - setup() { - const product = Route.useLoaderData() - - return () => ( -
{`${product.value.name}: ${product.value.price}`}
- ) - }, -}) - -export const Route = createFileRoute('/shop/$productId')({ - loader: ({ params }) => productData(params.productId), - component: ProductPage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.index.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.index.tsx deleted file mode 100644 index 1040520f03..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const ShopIndexPage = Vue.defineComponent({ - setup() { - return () =>

All products

- }, -}) - -export const Route = createFileRoute('/shop/')({ - component: ShopIndexPage, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.tsx b/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.tsx deleted file mode 100644 index 184807cfa0..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/src/routes/shop.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { shopContext } from '../../../shared' - -const ShopLayout = Vue.defineComponent({ - setup() { - return () => ( -
-

Shop

- -
- ) - }, -}) - -export const Route = createFileRoute('/shop')({ - beforeLoad: () => shopContext(), - component: ShopLayout, -}) diff --git a/benchmarks/client-nav/scenarios/mount/vue/tsconfig.json b/benchmarks/client-nav/scenarios/mount/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts b/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts deleted file mode 100644 index 8d4005f339..0000000000 --- a/benchmarks/client-nav/scenarios/mount/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav mount (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/react/project.json b/benchmarks/client-nav/scenarios/nested-params/react/project.json deleted file mode 100644 index 800f8af9a8..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-nested-params-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/nested-params/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/setup.ts b/benchmarks/client-nav/scenarios/nested-params/react/setup.ts deleted file mode 100644 index 130583b190..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts deleted file mode 100644 index fa5809c1fd..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-nested-params', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-nested-params navigation loop (react)', - 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.flame.ts b/benchmarks/client-nav/scenarios/nested-params/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/nested-params/react/src/routeTree.gen.ts deleted file mode 100644 index 95d4b46623..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routeTree.gen.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* 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 LARouteImport } from './routes/l.$a' -import { Route as LABRouteImport } from './routes/l.$a.$b' -import { Route as LABCRouteImport } from './routes/l.$a.$b.$c' -import { Route as LABCDRouteImport } from './routes/l.$a.$b.$c.$d' -import { Route as LABCDERouteImport } from './routes/l.$a.$b.$c.$d.$e' -import { Route as LABCDEFRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f' -import { Route as LABCDEFGRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f.$g' -import { Route as LABCDEFGHRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f.$g.$h' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LARoute = LARouteImport.update({ - id: '/l/$a', - path: '/l/$a', - getParentRoute: () => rootRouteImport, -} as any) -const LABRoute = LABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => LARoute, -} as any) -const LABCRoute = LABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => LABRoute, -} as any) -const LABCDRoute = LABCDRouteImport.update({ - id: '/$d', - path: '/$d', - getParentRoute: () => LABCRoute, -} as any) -const LABCDERoute = LABCDERouteImport.update({ - id: '/$e', - path: '/$e', - getParentRoute: () => LABCDRoute, -} as any) -const LABCDEFRoute = LABCDEFRouteImport.update({ - id: '/$f', - path: '/$f', - getParentRoute: () => LABCDERoute, -} as any) -const LABCDEFGRoute = LABCDEFGRouteImport.update({ - id: '/$g', - path: '/$g', - getParentRoute: () => LABCDEFRoute, -} as any) -const LABCDEFGHRoute = LABCDEFGHRouteImport.update({ - id: '/$h', - path: '/$h', - getParentRoute: () => LABCDEFGRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - id: - | '__root__' - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LARoute: typeof LARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/l/$a': { - id: '/l/$a' - path: '/l/$a' - fullPath: '/l/$a' - preLoaderRoute: typeof LARouteImport - parentRoute: typeof rootRouteImport - } - '/l/$a/$b': { - id: '/l/$a/$b' - path: '/$b' - fullPath: '/l/$a/$b' - preLoaderRoute: typeof LABRouteImport - parentRoute: typeof LARoute - } - '/l/$a/$b/$c': { - id: '/l/$a/$b/$c' - path: '/$c' - fullPath: '/l/$a/$b/$c' - preLoaderRoute: typeof LABCRouteImport - parentRoute: typeof LABRoute - } - '/l/$a/$b/$c/$d': { - id: '/l/$a/$b/$c/$d' - path: '/$d' - fullPath: '/l/$a/$b/$c/$d' - preLoaderRoute: typeof LABCDRouteImport - parentRoute: typeof LABCRoute - } - '/l/$a/$b/$c/$d/$e': { - id: '/l/$a/$b/$c/$d/$e' - path: '/$e' - fullPath: '/l/$a/$b/$c/$d/$e' - preLoaderRoute: typeof LABCDERouteImport - parentRoute: typeof LABCDRoute - } - '/l/$a/$b/$c/$d/$e/$f': { - id: '/l/$a/$b/$c/$d/$e/$f' - path: '/$f' - fullPath: '/l/$a/$b/$c/$d/$e/$f' - preLoaderRoute: typeof LABCDEFRouteImport - parentRoute: typeof LABCDERoute - } - '/l/$a/$b/$c/$d/$e/$f/$g': { - id: '/l/$a/$b/$c/$d/$e/$f/$g' - path: '/$g' - fullPath: '/l/$a/$b/$c/$d/$e/$f/$g' - preLoaderRoute: typeof LABCDEFGRouteImport - parentRoute: typeof LABCDEFRoute - } - '/l/$a/$b/$c/$d/$e/$f/$g/$h': { - id: '/l/$a/$b/$c/$d/$e/$f/$g/$h' - path: '/$h' - fullPath: '/l/$a/$b/$c/$d/$e/$f/$g/$h' - preLoaderRoute: typeof LABCDEFGHRouteImport - parentRoute: typeof LABCDEFGRoute - } - } -} - -interface LABCDEFGRouteChildren { - LABCDEFGHRoute: typeof LABCDEFGHRoute -} - -const LABCDEFGRouteChildren: LABCDEFGRouteChildren = { - LABCDEFGHRoute: LABCDEFGHRoute, -} - -const LABCDEFGRouteWithChildren = LABCDEFGRoute._addFileChildren( - LABCDEFGRouteChildren, -) - -interface LABCDEFRouteChildren { - LABCDEFGRoute: typeof LABCDEFGRouteWithChildren -} - -const LABCDEFRouteChildren: LABCDEFRouteChildren = { - LABCDEFGRoute: LABCDEFGRouteWithChildren, -} - -const LABCDEFRouteWithChildren = - LABCDEFRoute._addFileChildren(LABCDEFRouteChildren) - -interface LABCDERouteChildren { - LABCDEFRoute: typeof LABCDEFRouteWithChildren -} - -const LABCDERouteChildren: LABCDERouteChildren = { - LABCDEFRoute: LABCDEFRouteWithChildren, -} - -const LABCDERouteWithChildren = - LABCDERoute._addFileChildren(LABCDERouteChildren) - -interface LABCDRouteChildren { - LABCDERoute: typeof LABCDERouteWithChildren -} - -const LABCDRouteChildren: LABCDRouteChildren = { - LABCDERoute: LABCDERouteWithChildren, -} - -const LABCDRouteWithChildren = LABCDRoute._addFileChildren(LABCDRouteChildren) - -interface LABCRouteChildren { - LABCDRoute: typeof LABCDRouteWithChildren -} - -const LABCRouteChildren: LABCRouteChildren = { - LABCDRoute: LABCDRouteWithChildren, -} - -const LABCRouteWithChildren = LABCRoute._addFileChildren(LABCRouteChildren) - -interface LABRouteChildren { - LABCRoute: typeof LABCRouteWithChildren -} - -const LABRouteChildren: LABRouteChildren = { - LABCRoute: LABCRouteWithChildren, -} - -const LABRouteWithChildren = LABRoute._addFileChildren(LABRouteChildren) - -interface LARouteChildren { - LABRoute: typeof LABRouteWithChildren -} - -const LARouteChildren: LARouteChildren = { - LABRoute: LABRouteWithChildren, -} - -const LARouteWithChildren = LARoute._addFileChildren(LARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LARoute: LARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/__root.tsx deleted file mode 100644 index ef2c7b1b18..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/__root.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { leafParamSets, midParams } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/index.tsx deleted file mode 100644 index 24e856ea15..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return
home
-} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx deleted file mode 100644 index 9789e28040..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g/$h')({ - params: { - parse: (params) => ({ ...params, h: normalizeParam(params.h) }), - stringify: (params) => ({ ...params, h: String(params.h) }), - }, - beforeLoad: ({ params }) => ({ ctxH: smallHash(params.h) }), - component: LevelH, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.h) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.h}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxH }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxH * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelH() { - const params = Route.useParams() - return ( - <> - - - - -
- {[ - params.a, - params.b, - params.c, - params.d, - params.e, - params.f, - params.g, - params.h, - ].join('.')} -
- - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx deleted file mode 100644 index 650b32ce96..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g')({ - params: { - parse: (params) => ({ ...params, g: normalizeParam(params.g) }), - stringify: (params) => ({ ...params, g: String(params.g) }), - }, - beforeLoad: ({ params }) => ({ ctxG: smallHash(params.g) }), - component: LevelG, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.g) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.g}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxG }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxG * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelG() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.tsx deleted file mode 100644 index ca18e3ccd2..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.$f.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f')({ - params: { - parse: (params) => ({ ...params, f: normalizeParam(params.f) }), - stringify: (params) => ({ ...params, f: String(params.f) }), - }, - beforeLoad: ({ params }) => ({ ctxF: smallHash(params.f) }), - component: LevelF, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.f) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.f}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxF }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxF * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelF() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.tsx deleted file mode 100644 index 782c1808c7..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.$e.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e')({ - params: { - parse: (params) => ({ ...params, e: normalizeParam(params.e) }), - stringify: (params) => ({ ...params, e: String(params.e) }), - }, - beforeLoad: ({ params }) => ({ ctxE: smallHash(params.e) }), - component: LevelE, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.e) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.e}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxE }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxE * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelE() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.tsx deleted file mode 100644 index a874bbcb63..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.$d.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d')({ - params: { - parse: (params) => ({ ...params, d: normalizeParam(params.d) }), - stringify: (params) => ({ ...params, d: String(params.d) }), - }, - beforeLoad: ({ params }) => ({ ctxD: smallHash(params.d) }), - component: LevelD, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.d) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.d}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxD }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxD * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelD() { - const params = Route.useParams() - return ( - <> - - - - -
- {[params.a, params.b, params.c, params.d].join('.')} -
- - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.tsx deleted file mode 100644 index 94aba79453..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.$c.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c')({ - params: { - parse: (params) => ({ ...params, c: normalizeParam(params.c) }), - stringify: (params) => ({ ...params, c: String(params.c) }), - }, - beforeLoad: ({ params }) => ({ ctxC: smallHash(params.c) }), - component: LevelC, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.c) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.c}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxC }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxC * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelC() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.tsx deleted file mode 100644 index 1960b68276..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.$b.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b')({ - params: { - parse: (params) => ({ ...params, b: normalizeParam(params.b) }), - stringify: (params) => ({ ...params, b: String(params.b) }), - }, - beforeLoad: ({ params }) => ({ ctxB: smallHash(params.b) }), - component: LevelB, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.b) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.b}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxB }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxB * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelB() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.tsx b/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.tsx deleted file mode 100644 index 85d1de6f68..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/src/routes/l.$a.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a')({ - params: { - parse: (params) => ({ ...params, a: normalizeParam(params.a) }), - stringify: (params) => ({ ...params, a: String(params.a) }), - }, - beforeLoad: ({ params }) => ({ ctxA: smallHash(params.a) }), - component: LevelA, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.a) }) - void value - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.a}:2`), - }) - void value - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxA }) - void value - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxA * 31 + 7) >>> 0, - }) - void value - return null -} - -function LevelA() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/tsconfig.json b/benchmarks/client-nav/scenarios/nested-params/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts b/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts deleted file mode 100644 index a99060bf1c..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav nested-params (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/shared.ts b/benchmarks/client-nav/scenarios/nested-params/shared.ts deleted file mode 100644 index 06c968bb18..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/shared.ts +++ /dev/null @@ -1,143 +0,0 @@ -/** - * Shared definition of the `nested-params` scenario: deep dynamic nesting with - * per-level params.parse/stringify, beforeLoad context accumulation, and - * useParams/useRouteContext subscribers at every level. The three framework - * apps consume these builders so the workload is identical modulo the - * rendering layer. - */ - -export interface LeafParams { - a: string - b: string - c: string - d: string - e: string - f: string - g: string - h: string -} - -// Several values need percent-encoding in the URL (spaces, `&`, `%`, `+`, -// unicode) so every navigation exercises the param encode/decode paths, not -// just plain-ASCII interpolation. -const baseParams: LeafParams = { - a: 'alpha', - b: 'bravo & co', - c: 'charlie 100%', - d: 'delta', - e: 'écho-café', - f: 'foxtrot+one', - g: 'golf', - h: 'hôtel', -} - -/** - * set 0: base; set 1: only the deepest param differs (only the leaf re-runs); - * set 2: a mid param differs (levels d..h re-run); set 3: the top param - * differs (every level re-runs). - */ -export const leafParamSets: ReadonlyArray = [ - baseParams, - { ...baseParams, h: 'hilton' }, - { ...baseParams, d: 'dover' }, - { ...baseParams, a: 'axel' }, -] - -export const midParams = { - a: baseParams.a, - b: baseParams.b, - c: baseParams.c, - d: baseParams.d, -} - -export function normalizeParam(value: unknown) { - const raw = String(value) - return raw.length > 24 ? raw.slice(0, 24) : raw -} - -export function smallHash(value: string | number) { - const input = `${value}` - let hash = 5381 - for (let index = 0; index < input.length; index++) { - hash = ((hash * 33) ^ input.charCodeAt(index)) >>> 0 - } - return hash -} - -export function leafMarker(params: LeafParams) { - return [ - params.a, - params.b, - params.c, - params.d, - params.e, - params.f, - params.g, - params.h, - ] - .map(normalizeParam) - .join('.') -} - -export function midMarker(params: typeof midParams) { - return [params.a, params.b, params.c, params.d].map(normalizeParam).join('.') -} - -export const steps = [ - 'leaf-1', - 'leaf-2', - 'leaf-3', - 'leaf-4', - 'mid-4', - 'home', -] as const - -function requireText(container: HTMLElement, testId: string, expected: string) { - const element = container.querySelector(`[data-testid="${testId}"]`) - if (!element || element.textContent !== expected) { - throw new Error( - `Expected [data-testid="${testId}"] to render "${expected}", received "${element?.textContent ?? ''}"`, - ) - } -} - -function requireAbsent(container: HTMLElement, testId: string) { - if (container.querySelector(`[data-testid="${testId}"]`)) { - throw new Error(`Expected [data-testid="${testId}"] to be absent`) - } -} - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const step = steps[stepIndex % steps.length]! - switch (step) { - case 'leaf-1': - requireText(container, 'leaf-state', leafMarker(leafParamSets[0]!)) - break - case 'leaf-2': - requireText(container, 'leaf-state', leafMarker(leafParamSets[1]!)) - break - case 'leaf-3': - requireText(container, 'leaf-state', leafMarker(leafParamSets[2]!)) - break - case 'leaf-4': - requireText(container, 'leaf-state', leafMarker(leafParamSets[3]!)) - break - case 'mid-4': - requireAbsent(container, 'leaf-state') - requireText(container, 'mid-state', midMarker(midParams)) - break - case 'home': - requireAbsent(container, 'leaf-state') - requireAbsent(container, 'mid-state') - break - } -} - -// Three laps through the 6-step sequence per benchmark iteration. -export const ticksPerIteration = 18 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/project.json b/benchmarks/client-nav/scenarios/nested-params/solid/project.json deleted file mode 100644 index eb0b91bd6c..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-nested-params-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/nested-params/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/setup.ts b/benchmarks/client-nav/scenarios/nested-params/solid/setup.ts deleted file mode 100644 index 6a46971603..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts deleted file mode 100644 index 2c64d9a221..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-nested-params', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-nested-params navigation loop (solid)', - 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/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/nested-params/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/nested-params/solid/src/routeTree.gen.ts deleted file mode 100644 index 9065c9294f..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* 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 LARouteImport } from './routes/l.$a' -import { Route as LABRouteImport } from './routes/l.$a.$b' -import { Route as LABCRouteImport } from './routes/l.$a.$b.$c' -import { Route as LABCDRouteImport } from './routes/l.$a.$b.$c.$d' -import { Route as LABCDERouteImport } from './routes/l.$a.$b.$c.$d.$e' -import { Route as LABCDEFRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f' -import { Route as LABCDEFGRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f.$g' -import { Route as LABCDEFGHRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f.$g.$h' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LARoute = LARouteImport.update({ - id: '/l/$a', - path: '/l/$a', - getParentRoute: () => rootRouteImport, -} as any) -const LABRoute = LABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => LARoute, -} as any) -const LABCRoute = LABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => LABRoute, -} as any) -const LABCDRoute = LABCDRouteImport.update({ - id: '/$d', - path: '/$d', - getParentRoute: () => LABCRoute, -} as any) -const LABCDERoute = LABCDERouteImport.update({ - id: '/$e', - path: '/$e', - getParentRoute: () => LABCDRoute, -} as any) -const LABCDEFRoute = LABCDEFRouteImport.update({ - id: '/$f', - path: '/$f', - getParentRoute: () => LABCDERoute, -} as any) -const LABCDEFGRoute = LABCDEFGRouteImport.update({ - id: '/$g', - path: '/$g', - getParentRoute: () => LABCDEFRoute, -} as any) -const LABCDEFGHRoute = LABCDEFGHRouteImport.update({ - id: '/$h', - path: '/$h', - getParentRoute: () => LABCDEFGRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - id: - | '__root__' - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LARoute: typeof LARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/l/$a': { - id: '/l/$a' - path: '/l/$a' - fullPath: '/l/$a' - preLoaderRoute: typeof LARouteImport - parentRoute: typeof rootRouteImport - } - '/l/$a/$b': { - id: '/l/$a/$b' - path: '/$b' - fullPath: '/l/$a/$b' - preLoaderRoute: typeof LABRouteImport - parentRoute: typeof LARoute - } - '/l/$a/$b/$c': { - id: '/l/$a/$b/$c' - path: '/$c' - fullPath: '/l/$a/$b/$c' - preLoaderRoute: typeof LABCRouteImport - parentRoute: typeof LABRoute - } - '/l/$a/$b/$c/$d': { - id: '/l/$a/$b/$c/$d' - path: '/$d' - fullPath: '/l/$a/$b/$c/$d' - preLoaderRoute: typeof LABCDRouteImport - parentRoute: typeof LABCRoute - } - '/l/$a/$b/$c/$d/$e': { - id: '/l/$a/$b/$c/$d/$e' - path: '/$e' - fullPath: '/l/$a/$b/$c/$d/$e' - preLoaderRoute: typeof LABCDERouteImport - parentRoute: typeof LABCDRoute - } - '/l/$a/$b/$c/$d/$e/$f': { - id: '/l/$a/$b/$c/$d/$e/$f' - path: '/$f' - fullPath: '/l/$a/$b/$c/$d/$e/$f' - preLoaderRoute: typeof LABCDEFRouteImport - parentRoute: typeof LABCDERoute - } - '/l/$a/$b/$c/$d/$e/$f/$g': { - id: '/l/$a/$b/$c/$d/$e/$f/$g' - path: '/$g' - fullPath: '/l/$a/$b/$c/$d/$e/$f/$g' - preLoaderRoute: typeof LABCDEFGRouteImport - parentRoute: typeof LABCDEFRoute - } - '/l/$a/$b/$c/$d/$e/$f/$g/$h': { - id: '/l/$a/$b/$c/$d/$e/$f/$g/$h' - path: '/$h' - fullPath: '/l/$a/$b/$c/$d/$e/$f/$g/$h' - preLoaderRoute: typeof LABCDEFGHRouteImport - parentRoute: typeof LABCDEFGRoute - } - } -} - -interface LABCDEFGRouteChildren { - LABCDEFGHRoute: typeof LABCDEFGHRoute -} - -const LABCDEFGRouteChildren: LABCDEFGRouteChildren = { - LABCDEFGHRoute: LABCDEFGHRoute, -} - -const LABCDEFGRouteWithChildren = LABCDEFGRoute._addFileChildren( - LABCDEFGRouteChildren, -) - -interface LABCDEFRouteChildren { - LABCDEFGRoute: typeof LABCDEFGRouteWithChildren -} - -const LABCDEFRouteChildren: LABCDEFRouteChildren = { - LABCDEFGRoute: LABCDEFGRouteWithChildren, -} - -const LABCDEFRouteWithChildren = - LABCDEFRoute._addFileChildren(LABCDEFRouteChildren) - -interface LABCDERouteChildren { - LABCDEFRoute: typeof LABCDEFRouteWithChildren -} - -const LABCDERouteChildren: LABCDERouteChildren = { - LABCDEFRoute: LABCDEFRouteWithChildren, -} - -const LABCDERouteWithChildren = - LABCDERoute._addFileChildren(LABCDERouteChildren) - -interface LABCDRouteChildren { - LABCDERoute: typeof LABCDERouteWithChildren -} - -const LABCDRouteChildren: LABCDRouteChildren = { - LABCDERoute: LABCDERouteWithChildren, -} - -const LABCDRouteWithChildren = LABCDRoute._addFileChildren(LABCDRouteChildren) - -interface LABCRouteChildren { - LABCDRoute: typeof LABCDRouteWithChildren -} - -const LABCRouteChildren: LABCRouteChildren = { - LABCDRoute: LABCDRouteWithChildren, -} - -const LABCRouteWithChildren = LABCRoute._addFileChildren(LABCRouteChildren) - -interface LABRouteChildren { - LABCRoute: typeof LABCRouteWithChildren -} - -const LABRouteChildren: LABRouteChildren = { - LABCRoute: LABCRouteWithChildren, -} - -const LABRouteWithChildren = LABRoute._addFileChildren(LABRouteChildren) - -interface LARouteChildren { - LABRoute: typeof LABRouteWithChildren -} - -const LARouteChildren: LARouteChildren = { - LABRoute: LABRouteWithChildren, -} - -const LARouteWithChildren = LARoute._addFileChildren(LARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LARoute: LARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/__root.tsx deleted file mode 100644 index 6fe7ab3e3d..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/__root.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' -import { leafParamSets, midParams } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/index.tsx deleted file mode 100644 index cc46764de5..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return
home
-} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx deleted file mode 100644 index 7dc55db0e4..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx +++ /dev/null @@ -1,72 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g/$h')({ - params: { - parse: (params) => ({ ...params, h: normalizeParam(params.h) }), - stringify: (params) => ({ ...params, h: String(params.h) }), - }, - beforeLoad: ({ params }) => ({ ctxH: smallHash(params.h) }), - component: LevelH, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.h) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.h}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxH }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxH * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelH() { - const params = Route.useParams() - return ( - <> - - - - -
- {[ - params().a, - params().b, - params().c, - params().d, - params().e, - params().f, - params().g, - params().h, - ].join('.')} -
- - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx deleted file mode 100644 index d9c6c9429b..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g')({ - params: { - parse: (params) => ({ ...params, g: normalizeParam(params.g) }), - stringify: (params) => ({ ...params, g: String(params.g) }), - }, - beforeLoad: ({ params }) => ({ ctxG: smallHash(params.g) }), - component: LevelG, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.g) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.g}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxG }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxG * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelG() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx deleted file mode 100644 index 010f89bc4d..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.$f.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f')({ - params: { - parse: (params) => ({ ...params, f: normalizeParam(params.f) }), - stringify: (params) => ({ ...params, f: String(params.f) }), - }, - beforeLoad: ({ params }) => ({ ctxF: smallHash(params.f) }), - component: LevelF, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.f) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.f}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxF }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxF * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelF() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx deleted file mode 100644 index 08c107f0c6..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.$e.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e')({ - params: { - parse: (params) => ({ ...params, e: normalizeParam(params.e) }), - stringify: (params) => ({ ...params, e: String(params.e) }), - }, - beforeLoad: ({ params }) => ({ ctxE: smallHash(params.e) }), - component: LevelE, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.e) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.e}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxE }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxE * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelE() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx deleted file mode 100644 index 1b64edd58b..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.$d.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c/$d')({ - params: { - parse: (params) => ({ ...params, d: normalizeParam(params.d) }), - stringify: (params) => ({ ...params, d: String(params.d) }), - }, - beforeLoad: ({ params }) => ({ ctxD: smallHash(params.d) }), - component: LevelD, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.d) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.d}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxD }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxD * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelD() { - const params = Route.useParams() - return ( - <> - - - - -
- {[params().a, params().b, params().c, params().d].join('.')} -
- - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx deleted file mode 100644 index e509ea82c6..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.$c.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b/$c')({ - params: { - parse: (params) => ({ ...params, c: normalizeParam(params.c) }), - stringify: (params) => ({ ...params, c: String(params.c) }), - }, - beforeLoad: ({ params }) => ({ ctxC: smallHash(params.c) }), - component: LevelC, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.c) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.c}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxC }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxC * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelC() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx deleted file mode 100644 index ada853b845..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.$b.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a/$b')({ - params: { - parse: (params) => ({ ...params, b: normalizeParam(params.b) }), - stringify: (params) => ({ ...params, b: String(params.b) }), - }, - beforeLoad: ({ params }) => ({ ctxB: smallHash(params.b) }), - component: LevelB, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.b) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.b}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxB }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxB * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelB() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx b/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx deleted file mode 100644 index 5ecf004fae..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/src/routes/l.$a.tsx +++ /dev/null @@ -1,60 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { normalizeParam, smallHash } from '../../../shared' - -export const Route = createFileRoute('/l/$a')({ - params: { - parse: (params) => ({ ...params, a: normalizeParam(params.a) }), - stringify: (params) => ({ ...params, a: String(params.a) }), - }, - beforeLoad: ({ params }) => ({ ctxA: smallHash(params.a) }), - component: LevelA, -}) - -function ParamsSubscriberOne() { - const value = Route.useParams({ select: (params) => smallHash(params.a) }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ParamsSubscriberTwo() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.a}:2`), - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberOne() { - const value = Route.useRouteContext({ select: (context) => context.ctxA }) - createRenderEffect(() => { - void value() - }) - return null -} - -function ContextSubscriberTwo() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxA * 31 + 7) >>> 0, - }) - createRenderEffect(() => { - void value() - }) - return null -} - -function LevelA() { - return ( - <> - - - - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json b/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts b/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts deleted file mode 100644 index 9897e2c199..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav nested-params (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/project.json b/benchmarks/client-nav/scenarios/nested-params/vue/project.json deleted file mode 100644 index 83c234382c..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-nested-params-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/nested-params/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/setup.ts b/benchmarks/client-nav/scenarios/nested-params/vue/setup.ts deleted file mode 100644 index 97b74b3892..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts deleted file mode 100644 index bd3e82e070..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-nested-params', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-nested-params navigation 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/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/nested-params/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/nested-params/vue/src/routeTree.gen.ts deleted file mode 100644 index a7d1049b49..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,291 +0,0 @@ -/* 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 LARouteImport } from './routes/l.$a' -import { Route as LABRouteImport } from './routes/l.$a.$b' -import { Route as LABCRouteImport } from './routes/l.$a.$b.$c' -import { Route as LABCDRouteImport } from './routes/l.$a.$b.$c.$d' -import { Route as LABCDERouteImport } from './routes/l.$a.$b.$c.$d.$e' -import { Route as LABCDEFRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f' -import { Route as LABCDEFGRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f.$g' -import { Route as LABCDEFGHRouteImport } from './routes/l.$a.$b.$c.$d.$e.$f.$g.$h' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LARoute = LARouteImport.update({ - id: '/l/$a', - path: '/l/$a', - getParentRoute: () => rootRouteImport, -} as any) -const LABRoute = LABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => LARoute, -} as any) -const LABCRoute = LABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => LABRoute, -} as any) -const LABCDRoute = LABCDRouteImport.update({ - id: '/$d', - path: '/$d', - getParentRoute: () => LABCRoute, -} as any) -const LABCDERoute = LABCDERouteImport.update({ - id: '/$e', - path: '/$e', - getParentRoute: () => LABCDRoute, -} as any) -const LABCDEFRoute = LABCDEFRouteImport.update({ - id: '/$f', - path: '/$f', - getParentRoute: () => LABCDERoute, -} as any) -const LABCDEFGRoute = LABCDEFGRouteImport.update({ - id: '/$g', - path: '/$g', - getParentRoute: () => LABCDEFRoute, -} as any) -const LABCDEFGHRoute = LABCDEFGHRouteImport.update({ - id: '/$h', - path: '/$h', - getParentRoute: () => LABCDEFGRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/l/$a': typeof LARouteWithChildren - '/l/$a/$b': typeof LABRouteWithChildren - '/l/$a/$b/$c': typeof LABCRouteWithChildren - '/l/$a/$b/$c/$d': typeof LABCDRouteWithChildren - '/l/$a/$b/$c/$d/$e': typeof LABCDERouteWithChildren - '/l/$a/$b/$c/$d/$e/$f': typeof LABCDEFRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g': typeof LABCDEFGRouteWithChildren - '/l/$a/$b/$c/$d/$e/$f/$g/$h': typeof LABCDEFGHRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - id: - | '__root__' - | '/' - | '/l/$a' - | '/l/$a/$b' - | '/l/$a/$b/$c' - | '/l/$a/$b/$c/$d' - | '/l/$a/$b/$c/$d/$e' - | '/l/$a/$b/$c/$d/$e/$f' - | '/l/$a/$b/$c/$d/$e/$f/$g' - | '/l/$a/$b/$c/$d/$e/$f/$g/$h' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LARoute: typeof LARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/l/$a': { - id: '/l/$a' - path: '/l/$a' - fullPath: '/l/$a' - preLoaderRoute: typeof LARouteImport - parentRoute: typeof rootRouteImport - } - '/l/$a/$b': { - id: '/l/$a/$b' - path: '/$b' - fullPath: '/l/$a/$b' - preLoaderRoute: typeof LABRouteImport - parentRoute: typeof LARoute - } - '/l/$a/$b/$c': { - id: '/l/$a/$b/$c' - path: '/$c' - fullPath: '/l/$a/$b/$c' - preLoaderRoute: typeof LABCRouteImport - parentRoute: typeof LABRoute - } - '/l/$a/$b/$c/$d': { - id: '/l/$a/$b/$c/$d' - path: '/$d' - fullPath: '/l/$a/$b/$c/$d' - preLoaderRoute: typeof LABCDRouteImport - parentRoute: typeof LABCRoute - } - '/l/$a/$b/$c/$d/$e': { - id: '/l/$a/$b/$c/$d/$e' - path: '/$e' - fullPath: '/l/$a/$b/$c/$d/$e' - preLoaderRoute: typeof LABCDERouteImport - parentRoute: typeof LABCDRoute - } - '/l/$a/$b/$c/$d/$e/$f': { - id: '/l/$a/$b/$c/$d/$e/$f' - path: '/$f' - fullPath: '/l/$a/$b/$c/$d/$e/$f' - preLoaderRoute: typeof LABCDEFRouteImport - parentRoute: typeof LABCDERoute - } - '/l/$a/$b/$c/$d/$e/$f/$g': { - id: '/l/$a/$b/$c/$d/$e/$f/$g' - path: '/$g' - fullPath: '/l/$a/$b/$c/$d/$e/$f/$g' - preLoaderRoute: typeof LABCDEFGRouteImport - parentRoute: typeof LABCDEFRoute - } - '/l/$a/$b/$c/$d/$e/$f/$g/$h': { - id: '/l/$a/$b/$c/$d/$e/$f/$g/$h' - path: '/$h' - fullPath: '/l/$a/$b/$c/$d/$e/$f/$g/$h' - preLoaderRoute: typeof LABCDEFGHRouteImport - parentRoute: typeof LABCDEFGRoute - } - } -} - -interface LABCDEFGRouteChildren { - LABCDEFGHRoute: typeof LABCDEFGHRoute -} - -const LABCDEFGRouteChildren: LABCDEFGRouteChildren = { - LABCDEFGHRoute: LABCDEFGHRoute, -} - -const LABCDEFGRouteWithChildren = LABCDEFGRoute._addFileChildren( - LABCDEFGRouteChildren, -) - -interface LABCDEFRouteChildren { - LABCDEFGRoute: typeof LABCDEFGRouteWithChildren -} - -const LABCDEFRouteChildren: LABCDEFRouteChildren = { - LABCDEFGRoute: LABCDEFGRouteWithChildren, -} - -const LABCDEFRouteWithChildren = - LABCDEFRoute._addFileChildren(LABCDEFRouteChildren) - -interface LABCDERouteChildren { - LABCDEFRoute: typeof LABCDEFRouteWithChildren -} - -const LABCDERouteChildren: LABCDERouteChildren = { - LABCDEFRoute: LABCDEFRouteWithChildren, -} - -const LABCDERouteWithChildren = - LABCDERoute._addFileChildren(LABCDERouteChildren) - -interface LABCDRouteChildren { - LABCDERoute: typeof LABCDERouteWithChildren -} - -const LABCDRouteChildren: LABCDRouteChildren = { - LABCDERoute: LABCDERouteWithChildren, -} - -const LABCDRouteWithChildren = LABCDRoute._addFileChildren(LABCDRouteChildren) - -interface LABCRouteChildren { - LABCDRoute: typeof LABCDRouteWithChildren -} - -const LABCRouteChildren: LABCRouteChildren = { - LABCDRoute: LABCDRouteWithChildren, -} - -const LABCRouteWithChildren = LABCRoute._addFileChildren(LABCRouteChildren) - -interface LABRouteChildren { - LABCRoute: typeof LABCRouteWithChildren -} - -const LABRouteChildren: LABRouteChildren = { - LABCRoute: LABCRouteWithChildren, -} - -const LABRouteWithChildren = LABRoute._addFileChildren(LABRouteChildren) - -interface LARouteChildren { - LABRoute: typeof LABRouteWithChildren -} - -const LARouteChildren: LARouteChildren = { - LABRoute: LABRouteWithChildren, -} - -const LARouteWithChildren = LARoute._addFileChildren(LARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LARoute: LARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/__root.tsx deleted file mode 100644 index 28dd4e847a..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/__root.tsx +++ /dev/null @@ -1,53 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' -import { leafParamSets, midParams } from '../../../shared' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/index.tsx deleted file mode 100644 index f3ffc58610..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () =>
home
- }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx deleted file mode 100644 index 756c31e1a9..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.$g.$h.tsx +++ /dev/null @@ -1,86 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.h), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.h}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxH, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxH * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelH = Vue.defineComponent({ - setup() { - const params = Route.useParams() - return () => ( - <> - - - - -
- {[ - params.value.a, - params.value.b, - params.value.c, - params.value.d, - params.value.e, - params.value.f, - params.value.g, - params.value.h, - ].join('.')} -
- - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g/$h')({ - params: { - parse: (params) => ({ ...params, h: normalizeParam(params.h) }), - stringify: (params) => ({ ...params, h: String(params.h) }), - }, - beforeLoad: ({ params }) => ({ ctxH: smallHash(params.h) }), - component: LevelH, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx deleted file mode 100644 index d6b9ccde83..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.$g.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.g), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.g}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxG, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxG * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelG = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f/$g')({ - params: { - parse: (params) => ({ ...params, g: normalizeParam(params.g) }), - stringify: (params) => ({ ...params, g: String(params.g) }), - }, - beforeLoad: ({ params }) => ({ ctxG: smallHash(params.g) }), - component: LevelG, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.tsx deleted file mode 100644 index 76ed24904c..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.$f.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.f), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.f}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxF, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxF * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelF = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e/$f')({ - params: { - parse: (params) => ({ ...params, f: normalizeParam(params.f) }), - stringify: (params) => ({ ...params, f: String(params.f) }), - }, - beforeLoad: ({ params }) => ({ ctxF: smallHash(params.f) }), - component: LevelF, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.tsx deleted file mode 100644 index e24d3dc373..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.$e.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.e), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.e}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxE, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxE * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelE = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b/$c/$d/$e')({ - params: { - parse: (params) => ({ ...params, e: normalizeParam(params.e) }), - stringify: (params) => ({ ...params, e: String(params.e) }), - }, - beforeLoad: ({ params }) => ({ ctxE: smallHash(params.e) }), - component: LevelE, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.tsx deleted file mode 100644 index 7785638ee7..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.$d.tsx +++ /dev/null @@ -1,83 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.d), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.d}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxD, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxD * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelD = Vue.defineComponent({ - setup() { - const params = Route.useParams() - return () => ( - <> - - - - -
- {[ - params.value.a, - params.value.b, - params.value.c, - params.value.d, - ].join('.')} -
- - - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b/$c/$d')({ - params: { - parse: (params) => ({ ...params, d: normalizeParam(params.d) }), - stringify: (params) => ({ ...params, d: String(params.d) }), - }, - beforeLoad: ({ params }) => ({ ctxD: smallHash(params.d) }), - component: LevelD, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.tsx deleted file mode 100644 index 0d0adc65ff..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.$c.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.c), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.c}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxC, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxC * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelC = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b/$c')({ - params: { - parse: (params) => ({ ...params, c: normalizeParam(params.c) }), - stringify: (params) => ({ ...params, c: String(params.c) }), - }, - beforeLoad: ({ params }) => ({ ctxC: smallHash(params.c) }), - component: LevelC, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.tsx deleted file mode 100644 index f013d865af..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.$b.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.b), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.b}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxB, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxB * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelB = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - - ) - }, -}) - -export const Route = createFileRoute('/l/$a/$b')({ - params: { - parse: (params) => ({ ...params, b: normalizeParam(params.b) }), - stringify: (params) => ({ ...params, b: String(params.b) }), - }, - beforeLoad: ({ params }) => ({ ctxB: smallHash(params.b) }), - component: LevelB, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.tsx b/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.tsx deleted file mode 100644 index d5764c0985..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/src/routes/l.$a.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { normalizeParam, smallHash } from '../../../shared' - -const ParamsSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(params.a), - }) - return () => { - void value.value - return null - } - }, -}) - -const ParamsSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useParams({ - select: (params) => smallHash(`${params.a}:2`), - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberOne = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => context.ctxA, - }) - return () => { - void value.value - return null - } - }, -}) - -const ContextSubscriberTwo = Vue.defineComponent({ - setup() { - const value = Route.useRouteContext({ - select: (context) => (context.ctxA * 31 + 7) >>> 0, - }) - return () => { - void value.value - return null - } - }, -}) - -const LevelA = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - - - - ) - }, -}) - -export const Route = createFileRoute('/l/$a')({ - params: { - parse: (params) => ({ ...params, a: normalizeParam(params.a) }), - stringify: (params) => ({ ...params, a: String(params.a) }), - }, - beforeLoad: ({ params }) => ({ ctxA: smallHash(params.a) }), - component: LevelA, -}) diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/tsconfig.json b/benchmarks/client-nav/scenarios/nested-params/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts b/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts deleted file mode 100644 index 0d74eb7a7c..0000000000 --- a/benchmarks/client-nav/scenarios/nested-params/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav nested-params (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/preload/react/project.json b/benchmarks/client-nav/scenarios/preload/react/project.json deleted file mode 100644 index f095228746..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-preload-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/preload/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/preload/react/setup.ts b/benchmarks/client-nav/scenarios/preload/react/setup.ts deleted file mode 100644 index 5409df903c..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts deleted file mode 100644 index 5c210b2fd7..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-preload', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-preload interaction loop (react)', - 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/preload/react/speed.flame.ts b/benchmarks/client-nav/scenarios/preload/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/preload/react/src/main.tsx b/benchmarks/client-nav/scenarios/preload/react/src/main.tsx deleted file mode 100644 index 395867f674..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/src/main.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultPreload: 'intent', - defaultPreloadDelay: 0, - defaultPreloadStaleTime: 0, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/preload/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/preload/react/src/routeTree.gen.ts deleted file mode 100644 index 20619341c0..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 DocsRouteImport } from './routes/docs' -import { Route as SectionsSectionRouteImport } from './routes/sections.$section' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DocsRoute = DocsRouteImport.update({ - id: '/docs', - path: '/docs', - getParentRoute: () => rootRouteImport, -} as any) -const SectionsSectionRoute = SectionsSectionRouteImport.update({ - id: '/sections/$section', - path: '/sections/$section', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/docs' | '/sections/$section' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/docs' | '/sections/$section' - id: '__root__' | '/' | '/docs' | '/sections/$section' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DocsRoute: typeof DocsRoute - SectionsSectionRoute: typeof SectionsSectionRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - 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' - fullPath: '/sections/$section' - preLoaderRoute: typeof SectionsSectionRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DocsRoute: DocsRoute, - SectionsSectionRoute: SectionsSectionRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/preload/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/preload/react/src/routes/__root.tsx deleted file mode 100644 index b659fe4d26..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/src/routes/__root.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { sections } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/preload/react/src/routes/docs.tsx b/benchmarks/client-nav/scenarios/preload/react/src/routes/docs.tsx deleted file mode 100644 index 1f87530bac..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/src/routes/docs.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { docsMarker } from '../../../shared' - -export const Route = createFileRoute('/docs')({ - component: DocsPage, -}) - -function DocsPage() { - return ( -
-

{docsMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/preload/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/preload/react/src/routes/index.tsx deleted file mode 100644 index 2b8c83ebab..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { homeMarker } from '../../../shared' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

{homeMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/preload/react/src/routes/sections.$section.tsx b/benchmarks/client-nav/scenarios/preload/react/src/routes/sections.$section.tsx deleted file mode 100644 index 42962b8be7..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/src/routes/sections.$section.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { sectionItems } from '../../../shared' - -export const Route = createFileRoute('/sections/$section')({ - loader: ({ params }) => { - const items = sectionItems(params.section) - const checksum = items.reduce( - (sum, item) => (sum + item.value) % 1_000_000_007, - 0, - ) - return { items, checksum } - }, - staleTime: 0, - gcTime: 0, - component: SectionPage, -}) - -function SectionPage() { - const params = Route.useParams() - const data = Route.useLoaderData() - - return ( -
-

{`${params.section}:${data.checksum}`}

-
    - {data.items.map((item) => ( -
  • {`${item.name}=${item.value}`}
  • - ))} -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/preload/react/tsconfig.json b/benchmarks/client-nav/scenarios/preload/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/preload/react/vite.config.ts b/benchmarks/client-nav/scenarios/preload/react/vite.config.ts deleted file mode 100644 index 8a41fc8707..0000000000 --- a/benchmarks/client-nav/scenarios/preload/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav preload (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/preload/shared.ts b/benchmarks/client-nav/scenarios/preload/shared.ts deleted file mode 100644 index d061f99451..0000000000 --- a/benchmarks/client-nav/scenarios/preload/shared.ts +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Shared definition of the `preload` scenario: intent preloading via link - * hover, programmatic `router.preloadRoute`, and commit-time preload-cache - * maintenance. The router is configured with `defaultPreload: 'intent'`, - * `defaultPreloadDelay: 0` (no wall-clock debounce timer) and - * `defaultPreloadStaleTime: 0` — the default 30s wall-clock threshold would - * flip cache-hit behavior mid-run; with 0 every hover re-runs the preload - * work, keeping the loop stationary. - * - * Hover-intent preloading was verified manually per adapter (standalone jsdom - * run inspecting the router's cached matches after dispatching `mouseover` on - * a link). The harness hover step dispatches a single `mouseover`, which - * triggers the preload pipeline exactly once in every adapter: React - * synthesizes mouseEnter from it, Solid/Vue attach a native `mouseover` - * handler. (Solid/Vue also listen to `mouseenter`; dispatching both events - * would preload twice for them but once for React.) - */ -import type { ScenarioStep } from '../harness' - -export const sections = ['a', 'b', 'c', 'd', 'e'] as const - -export const SECTION_ITEM_COUNT = 30 - -/** Deterministic LCG stream seeded from a string — no Math.random. */ -function seededValues(seedText: string, count: number) { - let value = 0 - for (let i = 0; i < seedText.length; i++) { - value = (value * 31 + seedText.charCodeAt(i)) >>> 0 - } - - const values: Array = [] - for (let i = 0; i < count; i++) { - value = (value * 1664525 + 1013904223) >>> 0 - values.push(value % 100_000) - } - return values -} - -export interface SectionItem { - name: string - value: number -} - -export function sectionItems(section: string): Array { - return seededValues(`section-${section}`, SECTION_ITEM_COUNT).map( - (value, index) => ({ - name: `item-${section}-${index}`, - value, - }), - ) -} - -export function sectionChecksum(section: string) { - return sectionItems(section).reduce( - (sum, item) => (sum + item.value) % 1_000_000_007, - 0, - ) -} - -export function sectionMarker(section: string) { - return `${section}:${sectionChecksum(section)}` -} - -export const docsMarker = 'docs' -export const homeMarker = 'home' - -interface StepDef { - step: ScenarioStep - /** Expected page marker after the step; undefined for non-navigation steps. */ - marker?: string -} - -export const stepDefs: ReadonlyArray = [ - { step: { type: 'hover', testId: 's-a' } }, - { step: { type: 'hover', testId: 's-b' } }, - { step: 's-a', marker: sectionMarker('a') }, - { step: { type: 'hover', testId: 's-c' } }, - { step: 's-c', marker: sectionMarker('c') }, - { - step: { - type: 'preload', - getOptions: () => ({ - to: '/sections/$section', - params: { section: 'd' }, - }), - }, - }, - { step: 's-d', marker: sectionMarker('d') }, - { step: { type: 'hover', testId: 's-e' } }, - { step: 'go-docs', marker: docsMarker }, - { step: 'go-home', marker: homeMarker }, -] - -export const scenarioSteps: ReadonlyArray = stepDefs.map( - (def) => def.step, -) - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const def = stepDefs[stepIndex]! - if (!def.marker) { - return - } - - const marker = container.querySelector('[data-testid="page-state"]') - if (marker?.textContent !== def.marker) { - throw new Error( - `Expected page marker "${def.marker}" after step ${stepIndex}, received "${marker?.textContent}"`, - ) - } -} - -// Two laps through the 10-step sequence per benchmark iteration. -export const ticksPerIteration = 20 - -export const benchOptions = { - warmupIterations: 50, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/project.json b/benchmarks/client-nav/scenarios/preload/solid/project.json deleted file mode 100644 index a186879335..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-preload-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/preload/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/setup.ts b/benchmarks/client-nav/scenarios/preload/solid/setup.ts deleted file mode 100644 index 34270fe8a4..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts deleted file mode 100644 index f835b4a7b9..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-preload', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-preload interaction loop (solid)', - 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/preload/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/preload/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx b/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx deleted file mode 100644 index 3791156c64..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultPreload: 'intent', - defaultPreloadDelay: 0, - defaultPreloadStaleTime: 0, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts deleted file mode 100644 index 97e215b6da..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 DocsRouteImport } from './routes/docs' -import { Route as SectionsSectionRouteImport } from './routes/sections.$section' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DocsRoute = DocsRouteImport.update({ - id: '/docs', - path: '/docs', - getParentRoute: () => rootRouteImport, -} as any) -const SectionsSectionRoute = SectionsSectionRouteImport.update({ - id: '/sections/$section', - path: '/sections/$section', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/docs' | '/sections/$section' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/docs' | '/sections/$section' - id: '__root__' | '/' | '/docs' | '/sections/$section' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DocsRoute: typeof DocsRoute - SectionsSectionRoute: typeof SectionsSectionRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - 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' - fullPath: '/sections/$section' - preLoaderRoute: typeof SectionsSectionRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DocsRoute: DocsRoute, - SectionsSectionRoute: SectionsSectionRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/preload/solid/src/routes/__root.tsx deleted file mode 100644 index a805ed0feb..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/src/routes/__root.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { For } from 'solid-js' -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' -import { sections } from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routes/docs.tsx b/benchmarks/client-nav/scenarios/preload/solid/src/routes/docs.tsx deleted file mode 100644 index b077cfd18f..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/src/routes/docs.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { docsMarker } from '../../../shared' - -export const Route = createFileRoute('/docs')({ - component: DocsPage, -}) - -function DocsPage() { - return ( -
-

{docsMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/preload/solid/src/routes/index.tsx deleted file mode 100644 index 72fbfe387a..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { homeMarker } from '../../../shared' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

{homeMarker}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/src/routes/sections.$section.tsx b/benchmarks/client-nav/scenarios/preload/solid/src/routes/sections.$section.tsx deleted file mode 100644 index 2a7fb2ad1b..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/src/routes/sections.$section.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { For } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import { sectionItems } from '../../../shared' - -export const Route = createFileRoute('/sections/$section')({ - loader: ({ params }) => { - const items = sectionItems(params.section) - const checksum = items.reduce( - (sum, item) => (sum + item.value) % 1_000_000_007, - 0, - ) - return { items, checksum } - }, - staleTime: 0, - gcTime: 0, - component: SectionPage, -}) - -function SectionPage() { - const params = Route.useParams() - const data = Route.useLoaderData() - - return ( -
-

{`${params().section}:${data().checksum}`}

-
    - - {(item) =>
  • {`${item.name}=${item.value}`}
  • } -
    -
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json b/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts b/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts deleted file mode 100644 index 07014e6124..0000000000 --- a/benchmarks/client-nav/scenarios/preload/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav preload (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/preload/vue/project.json b/benchmarks/client-nav/scenarios/preload/vue/project.json deleted file mode 100644 index 404476723d..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-preload-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/preload/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/preload/vue/setup.ts b/benchmarks/client-nav/scenarios/preload/vue/setup.ts deleted file mode 100644 index f70a154909..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, scenarioSteps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps: scenarioSteps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts deleted file mode 100644 index e0ec83619b..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-preload', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-preload interaction 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/preload/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/preload/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/main.tsx b/benchmarks/client-nav/scenarios/preload/vue/src/main.tsx deleted file mode 100644 index 3da20b2cbf..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/src/main.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultPreload: 'intent', - defaultPreloadDelay: 0, - defaultPreloadStaleTime: 0, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts deleted file mode 100644 index 5f95d09da0..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 DocsRouteImport } from './routes/docs' -import { Route as SectionsSectionRouteImport } from './routes/sections.$section' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DocsRoute = DocsRouteImport.update({ - id: '/docs', - path: '/docs', - getParentRoute: () => rootRouteImport, -} as any) -const SectionsSectionRoute = SectionsSectionRouteImport.update({ - id: '/sections/$section', - path: '/sections/$section', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/docs': typeof DocsRoute - '/sections/$section': typeof SectionsSectionRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/docs' | '/sections/$section' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/docs' | '/sections/$section' - id: '__root__' | '/' | '/docs' | '/sections/$section' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DocsRoute: typeof DocsRoute - SectionsSectionRoute: typeof SectionsSectionRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - 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' - fullPath: '/sections/$section' - preLoaderRoute: typeof SectionsSectionRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DocsRoute: DocsRoute, - SectionsSectionRoute: SectionsSectionRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/preload/vue/src/routes/__root.tsx deleted file mode 100644 index bf91ba3770..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/src/routes/__root.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' -import { sections } from '../../../shared' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/routes/docs.tsx b/benchmarks/client-nav/scenarios/preload/vue/src/routes/docs.tsx deleted file mode 100644 index 07d0a989ad..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/src/routes/docs.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { docsMarker } from '../../../shared' - -const DocsPage = Vue.defineComponent({ - setup() { - return () => ( -
-

{docsMarker}

-
- ) - }, -}) - -export const Route = createFileRoute('/docs')({ - component: DocsPage, -}) diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/preload/vue/src/routes/index.tsx deleted file mode 100644 index f04a9f5796..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/src/routes/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { homeMarker } from '../../../shared' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

{homeMarker}

-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/preload/vue/src/routes/sections.$section.tsx b/benchmarks/client-nav/scenarios/preload/vue/src/routes/sections.$section.tsx deleted file mode 100644 index aeb617a86f..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/src/routes/sections.$section.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { sectionItems } from '../../../shared' - -const SectionPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - const data = Route.useLoaderData() - - return () => ( -
-

- {`${params.value.section}:${data.value.checksum}`} -

-
    - {data.value.items.map((item) => ( -
  • {`${item.name}=${item.value}`}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/sections/$section')({ - loader: ({ params }) => { - const items = sectionItems(params.section) - const checksum = items.reduce( - (sum, item) => (sum + item.value) % 1_000_000_007, - 0, - ) - return { items, checksum } - }, - staleTime: 0, - gcTime: 0, - component: SectionPage, -}) diff --git a/benchmarks/client-nav/scenarios/preload/vue/tsconfig.json b/benchmarks/client-nav/scenarios/preload/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts b/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts deleted file mode 100644 index 8d00e66378..0000000000 --- a/benchmarks/client-nav/scenarios/preload/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav preload (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/react/project.json b/benchmarks/client-nav/scenarios/rewrites/react/project.json deleted file mode 100644 index d98c6e1412..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-rewrites-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/rewrites/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/setup.ts b/benchmarks/client-nav/scenarios/rewrites/react/setup.ts deleted file mode 100644 index 0c5df273ed..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, initialUrl, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - initialUrl, - }) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts deleted file mode 100644 index dd1b6f3686..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-rewrites', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-rewrites navigation loop (react)', - 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/rewrites/react/speed.flame.ts b/benchmarks/client-nav/scenarios/rewrites/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx b/benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx deleted file mode 100644 index 28020ce373..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/src/main.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' -import { basepath, localeRewrite } from '../../shared' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - basepath, - rewrite: localeRewrite, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/rewrites/react/src/routeTree.gen.ts deleted file mode 100644 index b6ab8c8be4..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/src/routeTree.gen.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 PARouteImport } from './routes/p.$a' -import { Route as PABRouteImport } from './routes/p.$a.$b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PARoute = PARouteImport.update({ - id: '/p/$a', - path: '/p/$a', - getParentRoute: () => rootRouteImport, -} as any) -const PABRoute = PABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => PARoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/p/$a' | '/p/$a/$b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/p/$a' | '/p/$a/$b' - id: '__root__' | '/' | '/p/$a' | '/p/$a/$b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PARoute: typeof PARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a': { - id: '/p/$a' - path: '/p/$a' - fullPath: '/p/$a' - preLoaderRoute: typeof PARouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a/$b': { - id: '/p/$a/$b' - path: '/$b' - fullPath: '/p/$a/$b' - preLoaderRoute: typeof PABRouteImport - parentRoute: typeof PARoute - } - } -} - -interface PARouteChildren { - PABRoute: typeof PABRoute -} - -const PARouteChildren: PARouteChildren = { - PABRoute: PABRoute, -} - -const PARouteWithChildren = PARoute._addFileChildren(PARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PARoute: PARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/rewrites/react/src/routes/__root.tsx deleted file mode 100644 index ad14ff51f1..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/__root.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useLocation, -} from '@tanstack/react-router' -import type { SearchSchemaInput } from '@tanstack/react-router' - -export const Route = createRootRoute({ - validateSearch: (search: Record & SearchSchemaInput) => - ({ - _locale: typeof search._locale === 'string' ? search._locale : undefined, - }) as { _locale?: string }, - component: RootComponent, -}) - -function RootComponent() { - const pathname = useLocation({ select: (location) => location.pathname }) - - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/rewrites/react/src/routes/index.tsx deleted file mode 100644 index 821cfe4a7c..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Home

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/p.$a.$b.tsx b/benchmarks/client-nav/scenarios/rewrites/react/src/routes/p.$a.$b.tsx deleted file mode 100644 index ec1163e5c2..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/p.$a.$b.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { itemLabel } from '../../../shared' - -export const Route = createFileRoute('/p/$a/$b')({ - component: ItemPage, -}) - -function ItemPage() { - const params = Route.useParams() - - return ( -
-

{itemLabel(params.a, params.b)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/p.$a.tsx b/benchmarks/client-nav/scenarios/rewrites/react/src/routes/p.$a.tsx deleted file mode 100644 index f4937494f0..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/src/routes/p.$a.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { sectionLabel } from '../../../shared' - -export const Route = createFileRoute('/p/$a')({ - component: SectionPage, -}) - -function SectionPage() { - const params = Route.useParams() - - return ( -
-

{sectionLabel(params.a)}

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts b/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts deleted file mode 100644 index e79e8522e9..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav rewrites (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/shared.ts b/benchmarks/client-nav/scenarios/rewrites/shared.ts deleted file mode 100644 index 0ca0a7ceb9..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/shared.ts +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Shared definition of the `rewrites` scenario: composed client-side location - * rewrites — router `basepath` plus a locale input/output rewrite (the client - * analog of the SSR `rewrites` scenario). Externally URLs look like - * `/app/{locale}/p/...`; internally the router sees `/p/...` with the locale - * carried in the `_locale` search param. Every navigation runs the composed - * output rewrite when building hrefs/committing and the input rewrite when - * parsing the committed location. - */ -import type { ScenarioStep } from '../harness' -import type { RouterHistory } from '@tanstack/history' - -export const basepath = '/app' -export const defaultLocale = 'en' - -const localePrefixRe = /^\/(fr|de|es)(\/.*)$/ - -// Framework-agnostic rewrite pair consumed by all three apps' createRouter. -export const localeRewrite = { - input: ({ url }: { url: URL }) => { - const match = url.pathname.match(localePrefixRe) - - if (match) { - url.pathname = match[2]! - url.searchParams.set('_locale', match[1]!) - return url - } - - return undefined - }, - output: ({ url }: { url: URL }) => { - const locale = url.searchParams.get('_locale') - - if (locale) { - url.searchParams.delete('_locale') - url.pathname = `/${locale}${url.pathname}` - } - - return url - }, -} - -export function sectionLabel(a: string) { - return `Section ${a}` -} - -export function itemLabel(a: string, b: string) { - return `Item ${a}/${b}` -} - -interface StepDef { - testId: string - /** Internal router pathname expected after the step. */ - routerPath: string - /** External history pathname expected after the step. */ - windowPath: string -} - -// Circular lap: alternates sections, depths, and locales so every step runs -// the composed rewrites in both directions, then returns to the start. -export const stepDefs: ReadonlyArray = [ - { testId: 'go-x', routerPath: '/p/x', windowPath: '/app/p/x' }, - { testId: 'go-x-1-fr', routerPath: '/p/x/1', windowPath: '/app/fr/p/x/1' }, - { testId: 'go-y-de', routerPath: '/p/y', windowPath: '/app/de/p/y' }, - { testId: 'go-y-2', routerPath: '/p/y/2', windowPath: '/app/p/y/2' }, - { testId: 'go-x-es', routerPath: '/p/x', windowPath: '/app/es/p/x' }, - { testId: 'go-home', routerPath: '/', windowPath: '/app/' }, -] as const - -export const steps: ReadonlyArray = stepDefs.map( - (step) => step.testId, -) - -export function assertStepResult( - stepIndex: number, - container: HTMLElement, - history: RouterHistory, -) { - const expected = stepDefs[stepIndex]! - const marker = container.querySelector('[data-testid="loc"]') - const routerPath = marker?.textContent - - if (routerPath !== expected.routerPath) { - throw new Error( - `Expected router pathname "${expected.routerPath}" after step ${stepIndex}, received "${routerPath}"`, - ) - } - - if (history.location.pathname !== expected.windowPath) { - throw new Error( - `Expected history pathname "${expected.windowPath}" after step ${stepIndex}, received "${history.location.pathname}"`, - ) - } -} - -// The app starts on the external root inside the basepath. -export const initialUrl = '/app' - -// Three laps through the 6-step sequence per benchmark iteration. -export const ticksPerIteration = 18 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/project.json b/benchmarks/client-nav/scenarios/rewrites/solid/project.json deleted file mode 100644 index 4b2f763032..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-rewrites-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/rewrites/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/setup.ts b/benchmarks/client-nav/scenarios/rewrites/solid/setup.ts deleted file mode 100644 index 5796df712d..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, initialUrl, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - initialUrl, - }) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts deleted file mode 100644 index 9c4313e2ff..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-rewrites', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-rewrites navigation loop (solid)', - 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/rewrites/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/rewrites/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx b/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx deleted file mode 100644 index 31f1d07650..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import { basepath, localeRewrite } from '../../shared' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - basepath, - rewrite: localeRewrite, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/rewrites/solid/src/routeTree.gen.ts deleted file mode 100644 index 2d35f899c9..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 PARouteImport } from './routes/p.$a' -import { Route as PABRouteImport } from './routes/p.$a.$b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PARoute = PARouteImport.update({ - id: '/p/$a', - path: '/p/$a', - getParentRoute: () => rootRouteImport, -} as any) -const PABRoute = PABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => PARoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/p/$a' | '/p/$a/$b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/p/$a' | '/p/$a/$b' - id: '__root__' | '/' | '/p/$a' | '/p/$a/$b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PARoute: typeof PARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a': { - id: '/p/$a' - path: '/p/$a' - fullPath: '/p/$a' - preLoaderRoute: typeof PARouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a/$b': { - id: '/p/$a/$b' - path: '/$b' - fullPath: '/p/$a/$b' - preLoaderRoute: typeof PABRouteImport - parentRoute: typeof PARoute - } - } -} - -interface PARouteChildren { - PABRoute: typeof PABRoute -} - -const PARouteChildren: PARouteChildren = { - PABRoute: PABRoute, -} - -const PARouteWithChildren = PARoute._addFileChildren(PARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PARoute: PARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/__root.tsx deleted file mode 100644 index 3a78f2c3cf..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/__root.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useLocation, -} from '@tanstack/solid-router' -import type { SearchSchemaInput } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - validateSearch: (search: Record & SearchSchemaInput) => - ({ - _locale: typeof search._locale === 'string' ? search._locale : undefined, - }) as { _locale?: string }, - component: RootComponent, -}) - -function RootComponent() { - const pathname = useLocation({ select: (location) => location.pathname }) - - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/index.tsx deleted file mode 100644 index 5ee381ff05..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Home

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx b/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx deleted file mode 100644 index febcad35e3..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { itemLabel } from '../../../shared' - -export const Route = createFileRoute('/p/$a/$b')({ - component: ItemPage, -}) - -function ItemPage() { - const params = Route.useParams() - - return ( -
-

{itemLabel(params().a, params().b)}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/p.$a.tsx b/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/p.$a.tsx deleted file mode 100644 index adfb7bc3b6..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/src/routes/p.$a.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { sectionLabel } from '../../../shared' - -export const Route = createFileRoute('/p/$a')({ - component: SectionPage, -}) - -function SectionPage() { - const params = Route.useParams() - - return ( -
-

{sectionLabel(params().a)}

- -
- ) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts b/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts deleted file mode 100644 index c9e99b7d60..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav rewrites (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/project.json b/benchmarks/client-nav/scenarios/rewrites/vue/project.json deleted file mode 100644 index 9b7cb5d198..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-rewrites-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/rewrites/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/setup.ts b/benchmarks/client-nav/scenarios/rewrites/vue/setup.ts deleted file mode 100644 index e26b4d05ca..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/setup.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, initialUrl, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - initialUrl, - }) -} diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts deleted file mode 100644 index e96aff39eb..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-rewrites', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-rewrites navigation 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/rewrites/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/rewrites/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx b/benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx deleted file mode 100644 index 6695e82dbb..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/src/main.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' -import { basepath, localeRewrite } from '../../shared' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - basepath, - rewrite: localeRewrite, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/rewrites/vue/src/routeTree.gen.ts deleted file mode 100644 index 6eca4e8ce5..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,103 +0,0 @@ -/* 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 PARouteImport } from './routes/p.$a' -import { Route as PABRouteImport } from './routes/p.$a.$b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PARoute = PARouteImport.update({ - id: '/p/$a', - path: '/p/$a', - getParentRoute: () => rootRouteImport, -} as any) -const PABRoute = PABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => PARoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/p/$a' | '/p/$a/$b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/p/$a' | '/p/$a/$b' - id: '__root__' | '/' | '/p/$a' | '/p/$a/$b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PARoute: typeof PARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a': { - id: '/p/$a' - path: '/p/$a' - fullPath: '/p/$a' - preLoaderRoute: typeof PARouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a/$b': { - id: '/p/$a/$b' - path: '/$b' - fullPath: '/p/$a/$b' - preLoaderRoute: typeof PABRouteImport - parentRoute: typeof PARoute - } - } -} - -interface PARouteChildren { - PABRoute: typeof PABRoute -} - -const PARouteChildren: PARouteChildren = { - PABRoute: PABRoute, -} - -const PARouteWithChildren = PARoute._addFileChildren(PARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PARoute: PARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/__root.tsx deleted file mode 100644 index ae89645005..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/__root.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import * as Vue from 'vue' -import { - Link, - Outlet, - createRootRoute, - useLocation, -} from '@tanstack/vue-router' -import type { SearchSchemaInput } from '@tanstack/vue-router' - -const RootComponent = Vue.defineComponent({ - setup() { - const pathname = useLocation({ select: (location) => location.pathname }) - - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - validateSearch: (search: Record & SearchSchemaInput) => - ({ - _locale: typeof search._locale === 'string' ? search._locale : undefined, - }) as { _locale?: string }, - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/index.tsx deleted file mode 100644 index d5405b52d2..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/index.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

Home

-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx b/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx deleted file mode 100644 index 062c0903b9..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { itemLabel } from '../../../shared' - -const ItemPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{itemLabel(params.value.a, params.value.b)}

-
- ) - }, -}) - -export const Route = createFileRoute('/p/$a/$b')({ - component: ItemPage, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/p.$a.tsx b/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/p.$a.tsx deleted file mode 100644 index 552700d402..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/src/routes/p.$a.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { sectionLabel } from '../../../shared' - -const SectionPage = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

{sectionLabel(params.value.a)}

- -
- ) - }, -}) - -export const Route = createFileRoute('/p/$a')({ - component: SectionPage, -}) diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json b/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts b/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts deleted file mode 100644 index 1a795a4e1d..0000000000 --- a/benchmarks/client-nav/scenarios/rewrites/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav rewrites (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/project.json b/benchmarks/client-nav/scenarios/route-tree-scale/react/project.json deleted file mode 100644 index 3291738f79..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-route-tree-scale-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/route-tree-scale/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/setup.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/setup.ts deleted file mode 100644 index 130583b190..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} 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 deleted file mode 100644 index 6f4b448775..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-route-tree-scale', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-route-tree-scale navigation loop (react)', - 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/route-tree-scale/react/speed.flame.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx deleted file mode 100644 index 5febd6f795..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routeTree.gen.ts deleted file mode 100644 index f8eeb73dda..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routeTree.gen.ts +++ /dev/null @@ -1,881 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const SecARoute = SecARouteImport.update({ - id: '/sec-a', - path: '/sec-a', - getParentRoute: () => rootRouteImport, -} as any) -const SecBRoute = SecBRouteImport.update({ - id: '/sec-b', - path: '/sec-b', - getParentRoute: () => rootRouteImport, -} as any) -const SecCRoute = SecCRouteImport.update({ - id: '/sec-c', - path: '/sec-c', - getParentRoute: () => rootRouteImport, -} as any) -const SecDRoute = SecDRouteImport.update({ - id: '/sec-d', - path: '/sec-d', - getParentRoute: () => rootRouteImport, -} as any) -const SecERoute = SecERouteImport.update({ - id: '/sec-e', - path: '/sec-e', - getParentRoute: () => rootRouteImport, -} as any) -const SecFRoute = SecFRouteImport.update({ - id: '/sec-f', - path: '/sec-f', - getParentRoute: () => rootRouteImport, -} as any) -const marketingPricingRoute = marketingPricingRouteImport.update({ - id: '/(marketing)/pricing', - path: '/pricing', - getParentRoute: () => rootRouteImport, -} as any) -const marketingPromoRoute = marketingPromoRouteImport.update({ - id: '/(marketing)/promo', - path: '/promo', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutAlphaRoute = LayoutAlphaRouteImport.update({ - id: '/alpha', - path: '/alpha', - getParentRoute: () => LayoutRoute, -} as any) -const LayoutBetaRoute = LayoutBetaRouteImport.update({ - id: '/beta', - path: '/beta', - getParentRoute: () => LayoutRoute, -} as any) -const FilesSplatRoute = FilesSplatRouteImport.update({ - id: '/files/$', - path: '/files/$', - getParentRoute: () => rootRouteImport, -} as any) -const ReleaseVChar123versionChar125Route = - ReleaseVChar123versionChar125RouteImport.update({ - id: '/release/v{$version}', - path: '/release/v{$version}', - getParentRoute: () => rootRouteImport, - } as any) -const SecAIndexRoute = SecAIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecARoute, -} as any) -const SecAIdRoute = SecAIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecARoute, -} as any) -const SecAAboutRoute = SecAAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecARoute, -} as any) -const SecASettingsRoute = SecASettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecARoute, -} as any) -const SecBIndexRoute = SecBIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecBRoute, -} as any) -const SecBIdRoute = SecBIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecBRoute, -} as any) -const SecBAboutRoute = SecBAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecBRoute, -} as any) -const SecBSettingsRoute = SecBSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecBRoute, -} as any) -const SecCIndexRoute = SecCIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecCRoute, -} as any) -const SecCIdRoute = SecCIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecCRoute, -} as any) -const SecCAboutRoute = SecCAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecCRoute, -} as any) -const SecCSettingsRoute = SecCSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecCRoute, -} as any) -const SecDIndexRoute = SecDIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecDRoute, -} as any) -const SecDIdRoute = SecDIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecDRoute, -} as any) -const SecDAboutRoute = SecDAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecDRoute, -} as any) -const SecDSettingsRoute = SecDSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecDRoute, -} as any) -const SecEIndexRoute = SecEIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecERoute, -} as any) -const SecEIdRoute = SecEIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecERoute, -} as any) -const SecEAboutRoute = SecEAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecERoute, -} as any) -const SecESettingsRoute = SecESettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecERoute, -} 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 { - '/': typeof IndexRoute - '/sec-a': typeof SecARouteWithChildren - '/sec-b': typeof SecBRouteWithChildren - '/sec-c': typeof SecCRouteWithChildren - '/sec-d': typeof SecDRouteWithChildren - '/sec-e': typeof SecERouteWithChildren - '/sec-f': typeof SecFRouteWithChildren - '/pricing': typeof marketingPricingRoute - '/promo': typeof marketingPromoRoute - '/alpha': typeof LayoutAlphaRoute - '/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a/': typeof SecAIndexRoute - '/sec-b/': typeof SecBIndexRoute - '/sec-c/': typeof SecCIndexRoute - '/sec-d/': typeof SecDIndexRoute - '/sec-e/': typeof SecEIndexRoute - '/sec-f/': typeof SecFIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/pricing': typeof marketingPricingRoute - '/promo': typeof marketingPromoRoute - '/alpha': typeof LayoutAlphaRoute - '/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a': typeof SecAIndexRoute - '/sec-b': typeof SecBIndexRoute - '/sec-c': typeof SecCIndexRoute - '/sec-d': typeof SecDIndexRoute - '/sec-e': typeof SecEIndexRoute - '/sec-f': typeof SecFIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/sec-a': typeof SecARouteWithChildren - '/sec-b': typeof SecBRouteWithChildren - '/sec-c': typeof SecCRouteWithChildren - '/sec-d': typeof SecDRouteWithChildren - '/sec-e': typeof SecERouteWithChildren - '/sec-f': typeof SecFRouteWithChildren - '/(marketing)/pricing': typeof marketingPricingRoute - '/(marketing)/promo': typeof marketingPromoRoute - '/_layout/alpha': typeof LayoutAlphaRoute - '/_layout/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a/': typeof SecAIndexRoute - '/sec-b/': typeof SecBIndexRoute - '/sec-c/': typeof SecCIndexRoute - '/sec-d/': typeof SecDIndexRoute - '/sec-e/': typeof SecEIndexRoute - '/sec-f/': typeof SecFIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - | '/pricing' - | '/promo' - | '/alpha' - | '/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a/' - | '/sec-b/' - | '/sec-c/' - | '/sec-d/' - | '/sec-e/' - | '/sec-f/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/pricing' - | '/promo' - | '/alpha' - | '/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - id: - | '__root__' - | '/' - | '/_layout' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - | '/(marketing)/pricing' - | '/(marketing)/promo' - | '/_layout/alpha' - | '/_layout/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a/' - | '/sec-b/' - | '/sec-c/' - | '/sec-d/' - | '/sec-e/' - | '/sec-f/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - SecARoute: typeof SecARouteWithChildren - SecBRoute: typeof SecBRouteWithChildren - SecCRoute: typeof SecCRouteWithChildren - SecDRoute: typeof SecDRouteWithChildren - SecERoute: typeof SecERouteWithChildren - SecFRoute: typeof SecFRouteWithChildren - marketingPricingRoute: typeof marketingPricingRoute - marketingPromoRoute: typeof marketingPromoRoute - FilesSplatRoute: typeof FilesSplatRoute - ReleaseVChar123versionChar125Route: typeof ReleaseVChar123versionChar125Route -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-a': { - id: '/sec-a' - path: '/sec-a' - fullPath: '/sec-a' - preLoaderRoute: typeof SecARouteImport - parentRoute: typeof rootRouteImport - } - '/sec-b': { - id: '/sec-b' - path: '/sec-b' - fullPath: '/sec-b' - preLoaderRoute: typeof SecBRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-c': { - id: '/sec-c' - path: '/sec-c' - fullPath: '/sec-c' - preLoaderRoute: typeof SecCRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-d': { - id: '/sec-d' - path: '/sec-d' - fullPath: '/sec-d' - preLoaderRoute: typeof SecDRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-e': { - id: '/sec-e' - path: '/sec-e' - fullPath: '/sec-e' - preLoaderRoute: typeof SecERouteImport - parentRoute: typeof rootRouteImport - } - '/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/' - path: '/' - fullPath: '/sec-a/' - preLoaderRoute: typeof SecAIndexRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/$id': { - id: '/sec-a/$id' - path: '/$id' - fullPath: '/sec-a/$id' - preLoaderRoute: typeof SecAIdRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/about': { - id: '/sec-a/about' - path: '/about' - fullPath: '/sec-a/about' - preLoaderRoute: typeof SecAAboutRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/settings': { - id: '/sec-a/settings' - path: '/settings' - fullPath: '/sec-a/settings' - preLoaderRoute: typeof SecASettingsRouteImport - parentRoute: typeof SecARoute - } - '/sec-b/': { - id: '/sec-b/' - path: '/' - fullPath: '/sec-b/' - preLoaderRoute: typeof SecBIndexRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/$id': { - id: '/sec-b/$id' - path: '/$id' - fullPath: '/sec-b/$id' - preLoaderRoute: typeof SecBIdRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/about': { - id: '/sec-b/about' - path: '/about' - fullPath: '/sec-b/about' - preLoaderRoute: typeof SecBAboutRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/settings': { - id: '/sec-b/settings' - path: '/settings' - fullPath: '/sec-b/settings' - preLoaderRoute: typeof SecBSettingsRouteImport - parentRoute: typeof SecBRoute - } - '/sec-c/': { - id: '/sec-c/' - path: '/' - fullPath: '/sec-c/' - preLoaderRoute: typeof SecCIndexRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/$id': { - id: '/sec-c/$id' - path: '/$id' - fullPath: '/sec-c/$id' - preLoaderRoute: typeof SecCIdRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/about': { - id: '/sec-c/about' - path: '/about' - fullPath: '/sec-c/about' - preLoaderRoute: typeof SecCAboutRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/settings': { - id: '/sec-c/settings' - path: '/settings' - fullPath: '/sec-c/settings' - preLoaderRoute: typeof SecCSettingsRouteImport - parentRoute: typeof SecCRoute - } - '/sec-d/': { - id: '/sec-d/' - path: '/' - fullPath: '/sec-d/' - preLoaderRoute: typeof SecDIndexRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/$id': { - id: '/sec-d/$id' - path: '/$id' - fullPath: '/sec-d/$id' - preLoaderRoute: typeof SecDIdRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/about': { - id: '/sec-d/about' - path: '/about' - fullPath: '/sec-d/about' - preLoaderRoute: typeof SecDAboutRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/settings': { - id: '/sec-d/settings' - path: '/settings' - fullPath: '/sec-d/settings' - preLoaderRoute: typeof SecDSettingsRouteImport - parentRoute: typeof SecDRoute - } - '/sec-e/': { - id: '/sec-e/' - path: '/' - fullPath: '/sec-e/' - preLoaderRoute: typeof SecEIndexRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/$id': { - id: '/sec-e/$id' - path: '/$id' - fullPath: '/sec-e/$id' - preLoaderRoute: typeof SecEIdRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/about': { - id: '/sec-e/about' - path: '/about' - fullPath: '/sec-e/about' - preLoaderRoute: typeof SecEAboutRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/settings': { - id: '/sec-e/settings' - path: '/settings' - fullPath: '/sec-e/settings' - preLoaderRoute: typeof SecESettingsRouteImport - parentRoute: typeof SecERoute - } - '/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 - } - } -} - -interface LayoutRouteChildren { - LayoutAlphaRoute: typeof LayoutAlphaRoute - LayoutBetaRoute: typeof LayoutBetaRoute -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutAlphaRoute: LayoutAlphaRoute, - LayoutBetaRoute: LayoutBetaRoute, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface SecARouteChildren { - SecAIdRoute: typeof SecAIdRoute - SecAAboutRoute: typeof SecAAboutRoute - SecASettingsRoute: typeof SecASettingsRoute - SecAIndexRoute: typeof SecAIndexRoute -} - -const SecARouteChildren: SecARouteChildren = { - SecAIdRoute: SecAIdRoute, - SecAAboutRoute: SecAAboutRoute, - SecASettingsRoute: SecASettingsRoute, - SecAIndexRoute: SecAIndexRoute, -} - -const SecARouteWithChildren = SecARoute._addFileChildren(SecARouteChildren) - -interface SecBRouteChildren { - SecBIdRoute: typeof SecBIdRoute - SecBAboutRoute: typeof SecBAboutRoute - SecBSettingsRoute: typeof SecBSettingsRoute - SecBIndexRoute: typeof SecBIndexRoute -} - -const SecBRouteChildren: SecBRouteChildren = { - SecBIdRoute: SecBIdRoute, - SecBAboutRoute: SecBAboutRoute, - SecBSettingsRoute: SecBSettingsRoute, - SecBIndexRoute: SecBIndexRoute, -} - -const SecBRouteWithChildren = SecBRoute._addFileChildren(SecBRouteChildren) - -interface SecCRouteChildren { - SecCIdRoute: typeof SecCIdRoute - SecCAboutRoute: typeof SecCAboutRoute - SecCSettingsRoute: typeof SecCSettingsRoute - SecCIndexRoute: typeof SecCIndexRoute -} - -const SecCRouteChildren: SecCRouteChildren = { - SecCIdRoute: SecCIdRoute, - SecCAboutRoute: SecCAboutRoute, - SecCSettingsRoute: SecCSettingsRoute, - SecCIndexRoute: SecCIndexRoute, -} - -const SecCRouteWithChildren = SecCRoute._addFileChildren(SecCRouteChildren) - -interface SecDRouteChildren { - SecDIdRoute: typeof SecDIdRoute - SecDAboutRoute: typeof SecDAboutRoute - SecDSettingsRoute: typeof SecDSettingsRoute - SecDIndexRoute: typeof SecDIndexRoute -} - -const SecDRouteChildren: SecDRouteChildren = { - SecDIdRoute: SecDIdRoute, - SecDAboutRoute: SecDAboutRoute, - SecDSettingsRoute: SecDSettingsRoute, - SecDIndexRoute: SecDIndexRoute, -} - -const SecDRouteWithChildren = SecDRoute._addFileChildren(SecDRouteChildren) - -interface SecERouteChildren { - SecEIdRoute: typeof SecEIdRoute - SecEAboutRoute: typeof SecEAboutRoute - SecESettingsRoute: typeof SecESettingsRoute - SecEIndexRoute: typeof SecEIndexRoute -} - -const SecERouteChildren: SecERouteChildren = { - SecEIdRoute: SecEIdRoute, - SecEAboutRoute: SecEAboutRoute, - SecESettingsRoute: SecESettingsRoute, - SecEIndexRoute: SecEIndexRoute, -} - -const SecERouteWithChildren = SecERoute._addFileChildren(SecERouteChildren) - -interface SecFRouteChildren { - SecFIdRoute: typeof SecFIdRoute - SecFAboutRoute: typeof SecFAboutRoute - SecFSettingsRoute: typeof SecFSettingsRoute - SecFIndexRoute: typeof SecFIndexRoute -} - -const SecFRouteChildren: SecFRouteChildren = { - SecFIdRoute: SecFIdRoute, - SecFAboutRoute: SecFAboutRoute, - SecFSettingsRoute: SecFSettingsRoute, - SecFIndexRoute: SecFIndexRoute, -} - -const SecFRouteWithChildren = SecFRoute._addFileChildren(SecFRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - SecARoute: SecARouteWithChildren, - SecBRoute: SecBRouteWithChildren, - SecCRoute: SecCRouteWithChildren, - SecDRoute: SecDRouteWithChildren, - SecERoute: SecERouteWithChildren, - SecFRoute: SecFRouteWithChildren, - marketingPricingRoute: marketingPricingRoute, - marketingPromoRoute: marketingPromoRoute, - FilesSplatRoute: FilesSplatRoute, - ReleaseVChar123versionChar125Route: ReleaseVChar123versionChar125Route, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/(marketing)/pricing.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/(marketing)/pricing.tsx deleted file mode 100644 index ac2a376549..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/(marketing)/pricing.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/(marketing)/pricing')({ - component: Page, -}) - -function Page() { - return
pricing
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/(marketing)/promo.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/(marketing)/promo.tsx deleted file mode 100644 index b71962254e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/(marketing)/promo.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/(marketing)/promo')({ - component: Page, -}) - -function Page() { - return
promo
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/__root.tsx deleted file mode 100644 index 7ed47da924..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/__root.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.alpha.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.alpha.tsx deleted file mode 100644 index 893419cef5..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.alpha.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout/alpha')({ - component: Page, -}) - -function Page() { - return
alpha
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.beta.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.beta.tsx deleted file mode 100644 index d20c6007ee..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.beta.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout/beta')({ - component: Page, -}) - -function Page() { - return
beta
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.tsx deleted file mode 100644 index 961feb50f1..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/_layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/files.$.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/files.$.tsx deleted file mode 100644 index 028aa43d5a..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/files.$.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/files/$')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`files:${params._splat}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/index.tsx deleted file mode 100644 index 8a7ffca9e7..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: Page, -}) - -function Page() { - return
home
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/release.v{$version}.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/release.v{$version}.tsx deleted file mode 100644 index dfe8e31905..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/release.v{$version}.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/release/v{$version}')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`release:${params.version}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.$id.tsx deleted file mode 100644 index 8be053a040..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-a/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-a:${params.id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.about.tsx deleted file mode 100644 index 54c1b28618..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-a/about')({ - component: Page, -}) - -function Page() { - return
sec-a:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.index.tsx deleted file mode 100644 index 3c793a94f5..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-a/')({ - component: Page, -}) - -function Page() { - return
sec-a:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.settings.tsx deleted file mode 100644 index 0037f6463d..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-a/settings')({ - component: Page, -}) - -function Page() { - return
sec-a:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.tsx deleted file mode 100644 index 846f96b67b..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-a.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-a')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.$id.tsx deleted file mode 100644 index 0dd7f94feb..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-b/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-b:${params.id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.about.tsx deleted file mode 100644 index fde4647472..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-b/about')({ - component: Page, -}) - -function Page() { - return
sec-b:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.index.tsx deleted file mode 100644 index 51b69cf664..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-b/')({ - component: Page, -}) - -function Page() { - return
sec-b:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.settings.tsx deleted file mode 100644 index 977b7438b1..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-b/settings')({ - component: Page, -}) - -function Page() { - return
sec-b:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.tsx deleted file mode 100644 index 77d7e6475d..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-b.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-b')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.$id.tsx deleted file mode 100644 index eb3be796c0..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-c/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-c:${params.id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.about.tsx deleted file mode 100644 index 7910acf332..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-c/about')({ - component: Page, -}) - -function Page() { - return
sec-c:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.index.tsx deleted file mode 100644 index f6ae102f2d..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-c/')({ - component: Page, -}) - -function Page() { - return
sec-c:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.settings.tsx deleted file mode 100644 index bf2be30788..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-c/settings')({ - component: Page, -}) - -function Page() { - return
sec-c:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.tsx deleted file mode 100644 index 77ac5644c6..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-c.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-c')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.$id.tsx deleted file mode 100644 index d34aee8972..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-d/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-d:${params.id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.about.tsx deleted file mode 100644 index 1f095cb2ff..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-d/about')({ - component: Page, -}) - -function Page() { - return
sec-d:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.index.tsx deleted file mode 100644 index 8fc698a4d4..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-d/')({ - component: Page, -}) - -function Page() { - return
sec-d:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.settings.tsx deleted file mode 100644 index 76c7a178ea..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-d/settings')({ - component: Page, -}) - -function Page() { - return
sec-d:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.tsx deleted file mode 100644 index 5f3d281b5e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-d.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-d')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.$id.tsx deleted file mode 100644 index 6e31d0c5d1..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-e/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-e:${params.id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.about.tsx deleted file mode 100644 index 5a2835917b..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-e/about')({ - component: Page, -}) - -function Page() { - return
sec-e:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.index.tsx deleted file mode 100644 index 0f23b8d484..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-e/')({ - component: Page, -}) - -function Page() { - return
sec-e:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.settings.tsx deleted file mode 100644 index b566a1ffaa..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-e/settings')({ - component: Page, -}) - -function Page() { - return
sec-e:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.tsx deleted file mode 100644 index e573a71d98..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-e.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-e')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.$id.tsx deleted file mode 100644 index a71c17f96e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-f/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-f:${params.id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.about.tsx deleted file mode 100644 index 06831063ad..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-f/about')({ - component: Page, -}) - -function Page() { - return
sec-f:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.index.tsx deleted file mode 100644 index 4cd54b6a7f..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-f/')({ - component: Page, -}) - -function Page() { - return
sec-f:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.settings.tsx deleted file mode 100644 index 92bdca5e44..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-f/settings')({ - component: Page, -}) - -function Page() { - return
sec-f:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.tsx deleted file mode 100644 index 2fa27873e8..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/src/routes/sec-f.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/sec-f')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/tsconfig.json b/benchmarks/client-nav/scenarios/route-tree-scale/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts b/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts deleted file mode 100644 index 0f588fda53..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/react/vite.config.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - // Real file-based apps code-split by default; this scenario keeps it on - // so navigations also exercise lazy route-chunk resolution. - autoCodeSplitting: true, - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav route-tree-scale (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/shared.ts b/benchmarks/client-nav/scenarios/route-tree-scale/shared.ts deleted file mode 100644 index 8af5996804..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/shared.ts +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Shared definition of the `route-tree-scale` scenario: route matching, - * location building, and link-target resolution over a wide route tree - * (~40 routes) mixing static segments, dynamic params, prefixed params, - * splats, pathless layouts, and route groups. Navigations jump between - * distant branches so matching cannot reuse the previous branch. - */ - -export const sections = [ - 'sec-a', - 'sec-b', - 'sec-c', - 'sec-d', - 'sec-e', - 'sec-f', -] as const - -export const steps = [ - 'go-sec-a-id', - 'go-sec-f-settings', - 'go-files', - 'go-release', - 'go-alpha', - 'go-promo', - 'go-sec-c-id', - 'go-sec-d-about', - 'go-home', -] as const - -// The dynamic ids and the splat carry characters that need percent-encoding -// (spaces, `&`, `%`, `+`, unicode) so matching also exercises the segment -// encode/decode paths. -const expectedMarkers = [ - 'sec-a:item 11%', - 'sec-f:settings', - 'files:x/ü y/z', - 'release:9', - 'alpha', - 'promo', - 'sec-c:q&a+42', - 'sec-d:about', - 'home', -] as const - -export function assertStepResult(stepIndex: number) { - const expected = expectedMarkers[stepIndex]! - const actual = document.querySelector( - '[data-testid="scale-state"]', - )?.textContent - if (actual !== expected) { - throw new Error( - `Expected scale-state marker "${expected}" after step ${stepIndex}, received "${actual}"`, - ) - } -} - -// Three laps through the 9-step sequence per benchmark iteration. -export const ticksPerIteration = 27 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/project.json b/benchmarks/client-nav/scenarios/route-tree-scale/solid/project.json deleted file mode 100644 index c568e41196..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-route-tree-scale-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/route-tree-scale/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/setup.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/setup.ts deleted file mode 100644 index 6a46971603..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} 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 deleted file mode 100644 index 9244ef1350..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-route-tree-scale', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-route-tree-scale navigation loop (solid)', - 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/route-tree-scale/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx deleted file mode 100644 index fa9d239418..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/main.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} 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 deleted file mode 100644 index e6f3596562..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,881 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const SecARoute = SecARouteImport.update({ - id: '/sec-a', - path: '/sec-a', - getParentRoute: () => rootRouteImport, -} as any) -const SecBRoute = SecBRouteImport.update({ - id: '/sec-b', - path: '/sec-b', - getParentRoute: () => rootRouteImport, -} as any) -const SecCRoute = SecCRouteImport.update({ - id: '/sec-c', - path: '/sec-c', - getParentRoute: () => rootRouteImport, -} as any) -const SecDRoute = SecDRouteImport.update({ - id: '/sec-d', - path: '/sec-d', - getParentRoute: () => rootRouteImport, -} as any) -const SecERoute = SecERouteImport.update({ - id: '/sec-e', - path: '/sec-e', - getParentRoute: () => rootRouteImport, -} as any) -const SecFRoute = SecFRouteImport.update({ - id: '/sec-f', - path: '/sec-f', - getParentRoute: () => rootRouteImport, -} as any) -const marketingPricingRoute = marketingPricingRouteImport.update({ - id: '/(marketing)/pricing', - path: '/pricing', - getParentRoute: () => rootRouteImport, -} as any) -const marketingPromoRoute = marketingPromoRouteImport.update({ - id: '/(marketing)/promo', - path: '/promo', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutAlphaRoute = LayoutAlphaRouteImport.update({ - id: '/alpha', - path: '/alpha', - getParentRoute: () => LayoutRoute, -} as any) -const LayoutBetaRoute = LayoutBetaRouteImport.update({ - id: '/beta', - path: '/beta', - getParentRoute: () => LayoutRoute, -} as any) -const FilesSplatRoute = FilesSplatRouteImport.update({ - id: '/files/$', - path: '/files/$', - getParentRoute: () => rootRouteImport, -} as any) -const ReleaseVChar123versionChar125Route = - ReleaseVChar123versionChar125RouteImport.update({ - id: '/release/v{$version}', - path: '/release/v{$version}', - getParentRoute: () => rootRouteImport, - } as any) -const SecAIndexRoute = SecAIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecARoute, -} as any) -const SecAIdRoute = SecAIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecARoute, -} as any) -const SecAAboutRoute = SecAAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecARoute, -} as any) -const SecASettingsRoute = SecASettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecARoute, -} as any) -const SecBIndexRoute = SecBIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecBRoute, -} as any) -const SecBIdRoute = SecBIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecBRoute, -} as any) -const SecBAboutRoute = SecBAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecBRoute, -} as any) -const SecBSettingsRoute = SecBSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecBRoute, -} as any) -const SecCIndexRoute = SecCIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecCRoute, -} as any) -const SecCIdRoute = SecCIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecCRoute, -} as any) -const SecCAboutRoute = SecCAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecCRoute, -} as any) -const SecCSettingsRoute = SecCSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecCRoute, -} as any) -const SecDIndexRoute = SecDIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecDRoute, -} as any) -const SecDIdRoute = SecDIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecDRoute, -} as any) -const SecDAboutRoute = SecDAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecDRoute, -} as any) -const SecDSettingsRoute = SecDSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecDRoute, -} as any) -const SecEIndexRoute = SecEIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecERoute, -} as any) -const SecEIdRoute = SecEIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecERoute, -} as any) -const SecEAboutRoute = SecEAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecERoute, -} as any) -const SecESettingsRoute = SecESettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecERoute, -} 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 { - '/': typeof IndexRoute - '/sec-a': typeof SecARouteWithChildren - '/sec-b': typeof SecBRouteWithChildren - '/sec-c': typeof SecCRouteWithChildren - '/sec-d': typeof SecDRouteWithChildren - '/sec-e': typeof SecERouteWithChildren - '/sec-f': typeof SecFRouteWithChildren - '/pricing': typeof marketingPricingRoute - '/promo': typeof marketingPromoRoute - '/alpha': typeof LayoutAlphaRoute - '/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a/': typeof SecAIndexRoute - '/sec-b/': typeof SecBIndexRoute - '/sec-c/': typeof SecCIndexRoute - '/sec-d/': typeof SecDIndexRoute - '/sec-e/': typeof SecEIndexRoute - '/sec-f/': typeof SecFIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/pricing': typeof marketingPricingRoute - '/promo': typeof marketingPromoRoute - '/alpha': typeof LayoutAlphaRoute - '/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a': typeof SecAIndexRoute - '/sec-b': typeof SecBIndexRoute - '/sec-c': typeof SecCIndexRoute - '/sec-d': typeof SecDIndexRoute - '/sec-e': typeof SecEIndexRoute - '/sec-f': typeof SecFIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/sec-a': typeof SecARouteWithChildren - '/sec-b': typeof SecBRouteWithChildren - '/sec-c': typeof SecCRouteWithChildren - '/sec-d': typeof SecDRouteWithChildren - '/sec-e': typeof SecERouteWithChildren - '/sec-f': typeof SecFRouteWithChildren - '/(marketing)/pricing': typeof marketingPricingRoute - '/(marketing)/promo': typeof marketingPromoRoute - '/_layout/alpha': typeof LayoutAlphaRoute - '/_layout/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a/': typeof SecAIndexRoute - '/sec-b/': typeof SecBIndexRoute - '/sec-c/': typeof SecCIndexRoute - '/sec-d/': typeof SecDIndexRoute - '/sec-e/': typeof SecEIndexRoute - '/sec-f/': typeof SecFIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - | '/pricing' - | '/promo' - | '/alpha' - | '/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a/' - | '/sec-b/' - | '/sec-c/' - | '/sec-d/' - | '/sec-e/' - | '/sec-f/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/pricing' - | '/promo' - | '/alpha' - | '/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - id: - | '__root__' - | '/' - | '/_layout' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - | '/(marketing)/pricing' - | '/(marketing)/promo' - | '/_layout/alpha' - | '/_layout/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a/' - | '/sec-b/' - | '/sec-c/' - | '/sec-d/' - | '/sec-e/' - | '/sec-f/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - SecARoute: typeof SecARouteWithChildren - SecBRoute: typeof SecBRouteWithChildren - SecCRoute: typeof SecCRouteWithChildren - SecDRoute: typeof SecDRouteWithChildren - SecERoute: typeof SecERouteWithChildren - SecFRoute: typeof SecFRouteWithChildren - marketingPricingRoute: typeof marketingPricingRoute - marketingPromoRoute: typeof marketingPromoRoute - FilesSplatRoute: typeof FilesSplatRoute - ReleaseVChar123versionChar125Route: typeof ReleaseVChar123versionChar125Route -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-a': { - id: '/sec-a' - path: '/sec-a' - fullPath: '/sec-a' - preLoaderRoute: typeof SecARouteImport - parentRoute: typeof rootRouteImport - } - '/sec-b': { - id: '/sec-b' - path: '/sec-b' - fullPath: '/sec-b' - preLoaderRoute: typeof SecBRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-c': { - id: '/sec-c' - path: '/sec-c' - fullPath: '/sec-c' - preLoaderRoute: typeof SecCRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-d': { - id: '/sec-d' - path: '/sec-d' - fullPath: '/sec-d' - preLoaderRoute: typeof SecDRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-e': { - id: '/sec-e' - path: '/sec-e' - fullPath: '/sec-e' - preLoaderRoute: typeof SecERouteImport - parentRoute: typeof rootRouteImport - } - '/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/' - path: '/' - fullPath: '/sec-a/' - preLoaderRoute: typeof SecAIndexRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/$id': { - id: '/sec-a/$id' - path: '/$id' - fullPath: '/sec-a/$id' - preLoaderRoute: typeof SecAIdRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/about': { - id: '/sec-a/about' - path: '/about' - fullPath: '/sec-a/about' - preLoaderRoute: typeof SecAAboutRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/settings': { - id: '/sec-a/settings' - path: '/settings' - fullPath: '/sec-a/settings' - preLoaderRoute: typeof SecASettingsRouteImport - parentRoute: typeof SecARoute - } - '/sec-b/': { - id: '/sec-b/' - path: '/' - fullPath: '/sec-b/' - preLoaderRoute: typeof SecBIndexRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/$id': { - id: '/sec-b/$id' - path: '/$id' - fullPath: '/sec-b/$id' - preLoaderRoute: typeof SecBIdRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/about': { - id: '/sec-b/about' - path: '/about' - fullPath: '/sec-b/about' - preLoaderRoute: typeof SecBAboutRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/settings': { - id: '/sec-b/settings' - path: '/settings' - fullPath: '/sec-b/settings' - preLoaderRoute: typeof SecBSettingsRouteImport - parentRoute: typeof SecBRoute - } - '/sec-c/': { - id: '/sec-c/' - path: '/' - fullPath: '/sec-c/' - preLoaderRoute: typeof SecCIndexRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/$id': { - id: '/sec-c/$id' - path: '/$id' - fullPath: '/sec-c/$id' - preLoaderRoute: typeof SecCIdRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/about': { - id: '/sec-c/about' - path: '/about' - fullPath: '/sec-c/about' - preLoaderRoute: typeof SecCAboutRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/settings': { - id: '/sec-c/settings' - path: '/settings' - fullPath: '/sec-c/settings' - preLoaderRoute: typeof SecCSettingsRouteImport - parentRoute: typeof SecCRoute - } - '/sec-d/': { - id: '/sec-d/' - path: '/' - fullPath: '/sec-d/' - preLoaderRoute: typeof SecDIndexRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/$id': { - id: '/sec-d/$id' - path: '/$id' - fullPath: '/sec-d/$id' - preLoaderRoute: typeof SecDIdRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/about': { - id: '/sec-d/about' - path: '/about' - fullPath: '/sec-d/about' - preLoaderRoute: typeof SecDAboutRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/settings': { - id: '/sec-d/settings' - path: '/settings' - fullPath: '/sec-d/settings' - preLoaderRoute: typeof SecDSettingsRouteImport - parentRoute: typeof SecDRoute - } - '/sec-e/': { - id: '/sec-e/' - path: '/' - fullPath: '/sec-e/' - preLoaderRoute: typeof SecEIndexRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/$id': { - id: '/sec-e/$id' - path: '/$id' - fullPath: '/sec-e/$id' - preLoaderRoute: typeof SecEIdRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/about': { - id: '/sec-e/about' - path: '/about' - fullPath: '/sec-e/about' - preLoaderRoute: typeof SecEAboutRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/settings': { - id: '/sec-e/settings' - path: '/settings' - fullPath: '/sec-e/settings' - preLoaderRoute: typeof SecESettingsRouteImport - parentRoute: typeof SecERoute - } - '/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 - } - } -} - -interface LayoutRouteChildren { - LayoutAlphaRoute: typeof LayoutAlphaRoute - LayoutBetaRoute: typeof LayoutBetaRoute -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutAlphaRoute: LayoutAlphaRoute, - LayoutBetaRoute: LayoutBetaRoute, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface SecARouteChildren { - SecAIdRoute: typeof SecAIdRoute - SecAAboutRoute: typeof SecAAboutRoute - SecASettingsRoute: typeof SecASettingsRoute - SecAIndexRoute: typeof SecAIndexRoute -} - -const SecARouteChildren: SecARouteChildren = { - SecAIdRoute: SecAIdRoute, - SecAAboutRoute: SecAAboutRoute, - SecASettingsRoute: SecASettingsRoute, - SecAIndexRoute: SecAIndexRoute, -} - -const SecARouteWithChildren = SecARoute._addFileChildren(SecARouteChildren) - -interface SecBRouteChildren { - SecBIdRoute: typeof SecBIdRoute - SecBAboutRoute: typeof SecBAboutRoute - SecBSettingsRoute: typeof SecBSettingsRoute - SecBIndexRoute: typeof SecBIndexRoute -} - -const SecBRouteChildren: SecBRouteChildren = { - SecBIdRoute: SecBIdRoute, - SecBAboutRoute: SecBAboutRoute, - SecBSettingsRoute: SecBSettingsRoute, - SecBIndexRoute: SecBIndexRoute, -} - -const SecBRouteWithChildren = SecBRoute._addFileChildren(SecBRouteChildren) - -interface SecCRouteChildren { - SecCIdRoute: typeof SecCIdRoute - SecCAboutRoute: typeof SecCAboutRoute - SecCSettingsRoute: typeof SecCSettingsRoute - SecCIndexRoute: typeof SecCIndexRoute -} - -const SecCRouteChildren: SecCRouteChildren = { - SecCIdRoute: SecCIdRoute, - SecCAboutRoute: SecCAboutRoute, - SecCSettingsRoute: SecCSettingsRoute, - SecCIndexRoute: SecCIndexRoute, -} - -const SecCRouteWithChildren = SecCRoute._addFileChildren(SecCRouteChildren) - -interface SecDRouteChildren { - SecDIdRoute: typeof SecDIdRoute - SecDAboutRoute: typeof SecDAboutRoute - SecDSettingsRoute: typeof SecDSettingsRoute - SecDIndexRoute: typeof SecDIndexRoute -} - -const SecDRouteChildren: SecDRouteChildren = { - SecDIdRoute: SecDIdRoute, - SecDAboutRoute: SecDAboutRoute, - SecDSettingsRoute: SecDSettingsRoute, - SecDIndexRoute: SecDIndexRoute, -} - -const SecDRouteWithChildren = SecDRoute._addFileChildren(SecDRouteChildren) - -interface SecERouteChildren { - SecEIdRoute: typeof SecEIdRoute - SecEAboutRoute: typeof SecEAboutRoute - SecESettingsRoute: typeof SecESettingsRoute - SecEIndexRoute: typeof SecEIndexRoute -} - -const SecERouteChildren: SecERouteChildren = { - SecEIdRoute: SecEIdRoute, - SecEAboutRoute: SecEAboutRoute, - SecESettingsRoute: SecESettingsRoute, - SecEIndexRoute: SecEIndexRoute, -} - -const SecERouteWithChildren = SecERoute._addFileChildren(SecERouteChildren) - -interface SecFRouteChildren { - SecFIdRoute: typeof SecFIdRoute - SecFAboutRoute: typeof SecFAboutRoute - SecFSettingsRoute: typeof SecFSettingsRoute - SecFIndexRoute: typeof SecFIndexRoute -} - -const SecFRouteChildren: SecFRouteChildren = { - SecFIdRoute: SecFIdRoute, - SecFAboutRoute: SecFAboutRoute, - SecFSettingsRoute: SecFSettingsRoute, - SecFIndexRoute: SecFIndexRoute, -} - -const SecFRouteWithChildren = SecFRoute._addFileChildren(SecFRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - SecARoute: SecARouteWithChildren, - SecBRoute: SecBRouteWithChildren, - SecCRoute: SecCRouteWithChildren, - SecDRoute: SecDRouteWithChildren, - SecERoute: SecERouteWithChildren, - SecFRoute: SecFRouteWithChildren, - marketingPricingRoute: marketingPricingRoute, - marketingPromoRoute: marketingPromoRoute, - FilesSplatRoute: FilesSplatRoute, - ReleaseVChar123versionChar125Route: ReleaseVChar123versionChar125Route, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/(marketing)/pricing.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/(marketing)/pricing.tsx deleted file mode 100644 index 0965507de6..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/(marketing)/pricing.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/(marketing)/pricing')({ - component: Page, -}) - -function Page() { - return
pricing
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/(marketing)/promo.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/(marketing)/promo.tsx deleted file mode 100644 index 220bd06a68..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/(marketing)/promo.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/(marketing)/promo')({ - component: Page, -}) - -function Page() { - return
promo
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/__root.tsx deleted file mode 100644 index a4e4113d9a..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/__root.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.alpha.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.alpha.tsx deleted file mode 100644 index 234b8488a9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.alpha.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/alpha')({ - component: Page, -}) - -function Page() { - return
alpha
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.beta.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.beta.tsx deleted file mode 100644 index 39bc716efa..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.beta.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/beta')({ - component: Page, -}) - -function Page() { - return
beta
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.tsx deleted file mode 100644 index f1e499d3b3..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/_layout.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/files.$.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/files.$.tsx deleted file mode 100644 index 47b1a5eea9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/files.$.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/files/$')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`files:${params()._splat}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/index.tsx deleted file mode 100644 index 25b1c03c1a..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Page, -}) - -function Page() { - return
home
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/release.v{$version}.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/release.v{$version}.tsx deleted file mode 100644 index 0dbcee35ca..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/release.v{$version}.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/release/v{$version}')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`release:${params().version}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.$id.tsx deleted file mode 100644 index 18731a2844..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-a/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-a:${params().id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.about.tsx deleted file mode 100644 index 1699360a1c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-a/about')({ - component: Page, -}) - -function Page() { - return
sec-a:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.index.tsx deleted file mode 100644 index e71e525d07..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-a/')({ - component: Page, -}) - -function Page() { - return
sec-a:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.settings.tsx deleted file mode 100644 index 49d470190e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-a/settings')({ - component: Page, -}) - -function Page() { - return
sec-a:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.tsx deleted file mode 100644 index 2861169fb9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-a.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-a')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.$id.tsx deleted file mode 100644 index 86fe71d7c0..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-b/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-b:${params().id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.about.tsx deleted file mode 100644 index 586b829cd0..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-b/about')({ - component: Page, -}) - -function Page() { - return
sec-b:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.index.tsx deleted file mode 100644 index 7098416658..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-b/')({ - component: Page, -}) - -function Page() { - return
sec-b:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.settings.tsx deleted file mode 100644 index c2e0f47650..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-b/settings')({ - component: Page, -}) - -function Page() { - return
sec-b:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.tsx deleted file mode 100644 index f2905da9ca..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-b.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-b')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.$id.tsx deleted file mode 100644 index 3e07e8033a..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-c/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-c:${params().id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.about.tsx deleted file mode 100644 index 86ed5043a3..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-c/about')({ - component: Page, -}) - -function Page() { - return
sec-c:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.index.tsx deleted file mode 100644 index aa9ed2dc6c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-c/')({ - component: Page, -}) - -function Page() { - return
sec-c:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.settings.tsx deleted file mode 100644 index d0dd3e952c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-c/settings')({ - component: Page, -}) - -function Page() { - return
sec-c:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.tsx deleted file mode 100644 index fa53825238..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-c.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-c')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.$id.tsx deleted file mode 100644 index 3722012d7c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-d/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-d:${params().id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.about.tsx deleted file mode 100644 index 860d2b9e5b..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-d/about')({ - component: Page, -}) - -function Page() { - return
sec-d:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.index.tsx deleted file mode 100644 index ec7b8eaf2c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-d/')({ - component: Page, -}) - -function Page() { - return
sec-d:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.settings.tsx deleted file mode 100644 index d83e3885fd..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-d/settings')({ - component: Page, -}) - -function Page() { - return
sec-d:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.tsx deleted file mode 100644 index e71391e2a3..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-d.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-d')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.$id.tsx deleted file mode 100644 index e58d9d77ac..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-e/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-e:${params().id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.about.tsx deleted file mode 100644 index 3ef4d2c763..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-e/about')({ - component: Page, -}) - -function Page() { - return
sec-e:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.index.tsx deleted file mode 100644 index 88bf7ca271..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-e/')({ - component: Page, -}) - -function Page() { - return
sec-e:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.settings.tsx deleted file mode 100644 index 8a9945926d..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-e/settings')({ - component: Page, -}) - -function Page() { - return
sec-e:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.tsx deleted file mode 100644 index 8b5ef24519..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-e.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-e')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.$id.tsx deleted file mode 100644 index 2b81ef96ff..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-f/$id')({ - component: Page, -}) - -function Page() { - const params = Route.useParams() - - return
{`sec-f:${params().id}`}
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.about.tsx deleted file mode 100644 index 1c4e3a5474..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.about.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-f/about')({ - component: Page, -}) - -function Page() { - return
sec-f:about
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.index.tsx deleted file mode 100644 index 65803ee848..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-f/')({ - component: Page, -}) - -function Page() { - return
sec-f:index
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.settings.tsx deleted file mode 100644 index 5761138262..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.settings.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-f/settings')({ - component: Page, -}) - -function Page() { - return
sec-f:settings
-} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.tsx deleted file mode 100644 index c7f25eecdd..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/src/routes/sec-f.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/sec-f')({ - component: Layout, -}) - -function Layout() { - return -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json b/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts b/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts deleted file mode 100644 index 542ede131b..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/solid/vite.config.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - // Real file-based apps code-split by default; this scenario keeps it on - // so navigations also exercise lazy route-chunk resolution. - autoCodeSplitting: true, - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav route-tree-scale (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/project.json b/benchmarks/client-nav/scenarios/route-tree-scale/vue/project.json deleted file mode 100644 index f613070038..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-route-tree-scale-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/route-tree-scale/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/setup.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/setup.ts deleted file mode 100644 index 97b74b3892..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} 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 deleted file mode 100644 index 331e8e008f..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-route-tree-scale', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-route-tree-scale navigation 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/route-tree-scale/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx deleted file mode 100644 index cae9b54f1d..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/main.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts deleted file mode 100644 index a12f981bb4..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,881 +0,0 @@ -/* 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 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 IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const SecARoute = SecARouteImport.update({ - id: '/sec-a', - path: '/sec-a', - getParentRoute: () => rootRouteImport, -} as any) -const SecBRoute = SecBRouteImport.update({ - id: '/sec-b', - path: '/sec-b', - getParentRoute: () => rootRouteImport, -} as any) -const SecCRoute = SecCRouteImport.update({ - id: '/sec-c', - path: '/sec-c', - getParentRoute: () => rootRouteImport, -} as any) -const SecDRoute = SecDRouteImport.update({ - id: '/sec-d', - path: '/sec-d', - getParentRoute: () => rootRouteImport, -} as any) -const SecERoute = SecERouteImport.update({ - id: '/sec-e', - path: '/sec-e', - getParentRoute: () => rootRouteImport, -} as any) -const SecFRoute = SecFRouteImport.update({ - id: '/sec-f', - path: '/sec-f', - getParentRoute: () => rootRouteImport, -} as any) -const marketingPricingRoute = marketingPricingRouteImport.update({ - id: '/(marketing)/pricing', - path: '/pricing', - getParentRoute: () => rootRouteImport, -} as any) -const marketingPromoRoute = marketingPromoRouteImport.update({ - id: '/(marketing)/promo', - path: '/promo', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutAlphaRoute = LayoutAlphaRouteImport.update({ - id: '/alpha', - path: '/alpha', - getParentRoute: () => LayoutRoute, -} as any) -const LayoutBetaRoute = LayoutBetaRouteImport.update({ - id: '/beta', - path: '/beta', - getParentRoute: () => LayoutRoute, -} as any) -const FilesSplatRoute = FilesSplatRouteImport.update({ - id: '/files/$', - path: '/files/$', - getParentRoute: () => rootRouteImport, -} as any) -const ReleaseVChar123versionChar125Route = - ReleaseVChar123versionChar125RouteImport.update({ - id: '/release/v{$version}', - path: '/release/v{$version}', - getParentRoute: () => rootRouteImport, - } as any) -const SecAIndexRoute = SecAIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecARoute, -} as any) -const SecAIdRoute = SecAIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecARoute, -} as any) -const SecAAboutRoute = SecAAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecARoute, -} as any) -const SecASettingsRoute = SecASettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecARoute, -} as any) -const SecBIndexRoute = SecBIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecBRoute, -} as any) -const SecBIdRoute = SecBIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecBRoute, -} as any) -const SecBAboutRoute = SecBAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecBRoute, -} as any) -const SecBSettingsRoute = SecBSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecBRoute, -} as any) -const SecCIndexRoute = SecCIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecCRoute, -} as any) -const SecCIdRoute = SecCIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecCRoute, -} as any) -const SecCAboutRoute = SecCAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecCRoute, -} as any) -const SecCSettingsRoute = SecCSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecCRoute, -} as any) -const SecDIndexRoute = SecDIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecDRoute, -} as any) -const SecDIdRoute = SecDIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecDRoute, -} as any) -const SecDAboutRoute = SecDAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecDRoute, -} as any) -const SecDSettingsRoute = SecDSettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecDRoute, -} as any) -const SecEIndexRoute = SecEIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SecERoute, -} as any) -const SecEIdRoute = SecEIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => SecERoute, -} as any) -const SecEAboutRoute = SecEAboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => SecERoute, -} as any) -const SecESettingsRoute = SecESettingsRouteImport.update({ - id: '/settings', - path: '/settings', - getParentRoute: () => SecERoute, -} 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 { - '/': typeof IndexRoute - '/sec-a': typeof SecARouteWithChildren - '/sec-b': typeof SecBRouteWithChildren - '/sec-c': typeof SecCRouteWithChildren - '/sec-d': typeof SecDRouteWithChildren - '/sec-e': typeof SecERouteWithChildren - '/sec-f': typeof SecFRouteWithChildren - '/pricing': typeof marketingPricingRoute - '/promo': typeof marketingPromoRoute - '/alpha': typeof LayoutAlphaRoute - '/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a/': typeof SecAIndexRoute - '/sec-b/': typeof SecBIndexRoute - '/sec-c/': typeof SecCIndexRoute - '/sec-d/': typeof SecDIndexRoute - '/sec-e/': typeof SecEIndexRoute - '/sec-f/': typeof SecFIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/pricing': typeof marketingPricingRoute - '/promo': typeof marketingPromoRoute - '/alpha': typeof LayoutAlphaRoute - '/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a': typeof SecAIndexRoute - '/sec-b': typeof SecBIndexRoute - '/sec-c': typeof SecCIndexRoute - '/sec-d': typeof SecDIndexRoute - '/sec-e': typeof SecEIndexRoute - '/sec-f': typeof SecFIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/sec-a': typeof SecARouteWithChildren - '/sec-b': typeof SecBRouteWithChildren - '/sec-c': typeof SecCRouteWithChildren - '/sec-d': typeof SecDRouteWithChildren - '/sec-e': typeof SecERouteWithChildren - '/sec-f': typeof SecFRouteWithChildren - '/(marketing)/pricing': typeof marketingPricingRoute - '/(marketing)/promo': typeof marketingPromoRoute - '/_layout/alpha': typeof LayoutAlphaRoute - '/_layout/beta': typeof LayoutBetaRoute - '/files/$': typeof FilesSplatRoute - '/release/v{$version}': typeof ReleaseVChar123versionChar125Route - '/sec-a/$id': typeof SecAIdRoute - '/sec-a/about': typeof SecAAboutRoute - '/sec-a/settings': typeof SecASettingsRoute - '/sec-b/$id': typeof SecBIdRoute - '/sec-b/about': typeof SecBAboutRoute - '/sec-b/settings': typeof SecBSettingsRoute - '/sec-c/$id': typeof SecCIdRoute - '/sec-c/about': typeof SecCAboutRoute - '/sec-c/settings': typeof SecCSettingsRoute - '/sec-d/$id': typeof SecDIdRoute - '/sec-d/about': typeof SecDAboutRoute - '/sec-d/settings': typeof SecDSettingsRoute - '/sec-e/$id': typeof SecEIdRoute - '/sec-e/about': typeof SecEAboutRoute - '/sec-e/settings': typeof SecESettingsRoute - '/sec-f/$id': typeof SecFIdRoute - '/sec-f/about': typeof SecFAboutRoute - '/sec-f/settings': typeof SecFSettingsRoute - '/sec-a/': typeof SecAIndexRoute - '/sec-b/': typeof SecBIndexRoute - '/sec-c/': typeof SecCIndexRoute - '/sec-d/': typeof SecDIndexRoute - '/sec-e/': typeof SecEIndexRoute - '/sec-f/': typeof SecFIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - | '/pricing' - | '/promo' - | '/alpha' - | '/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a/' - | '/sec-b/' - | '/sec-c/' - | '/sec-d/' - | '/sec-e/' - | '/sec-f/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/pricing' - | '/promo' - | '/alpha' - | '/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - id: - | '__root__' - | '/' - | '/_layout' - | '/sec-a' - | '/sec-b' - | '/sec-c' - | '/sec-d' - | '/sec-e' - | '/sec-f' - | '/(marketing)/pricing' - | '/(marketing)/promo' - | '/_layout/alpha' - | '/_layout/beta' - | '/files/$' - | '/release/v{$version}' - | '/sec-a/$id' - | '/sec-a/about' - | '/sec-a/settings' - | '/sec-b/$id' - | '/sec-b/about' - | '/sec-b/settings' - | '/sec-c/$id' - | '/sec-c/about' - | '/sec-c/settings' - | '/sec-d/$id' - | '/sec-d/about' - | '/sec-d/settings' - | '/sec-e/$id' - | '/sec-e/about' - | '/sec-e/settings' - | '/sec-f/$id' - | '/sec-f/about' - | '/sec-f/settings' - | '/sec-a/' - | '/sec-b/' - | '/sec-c/' - | '/sec-d/' - | '/sec-e/' - | '/sec-f/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - SecARoute: typeof SecARouteWithChildren - SecBRoute: typeof SecBRouteWithChildren - SecCRoute: typeof SecCRouteWithChildren - SecDRoute: typeof SecDRouteWithChildren - SecERoute: typeof SecERouteWithChildren - SecFRoute: typeof SecFRouteWithChildren - marketingPricingRoute: typeof marketingPricingRoute - marketingPromoRoute: typeof marketingPromoRoute - FilesSplatRoute: typeof FilesSplatRoute - ReleaseVChar123versionChar125Route: typeof ReleaseVChar123versionChar125Route -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-a': { - id: '/sec-a' - path: '/sec-a' - fullPath: '/sec-a' - preLoaderRoute: typeof SecARouteImport - parentRoute: typeof rootRouteImport - } - '/sec-b': { - id: '/sec-b' - path: '/sec-b' - fullPath: '/sec-b' - preLoaderRoute: typeof SecBRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-c': { - id: '/sec-c' - path: '/sec-c' - fullPath: '/sec-c' - preLoaderRoute: typeof SecCRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-d': { - id: '/sec-d' - path: '/sec-d' - fullPath: '/sec-d' - preLoaderRoute: typeof SecDRouteImport - parentRoute: typeof rootRouteImport - } - '/sec-e': { - id: '/sec-e' - path: '/sec-e' - fullPath: '/sec-e' - preLoaderRoute: typeof SecERouteImport - parentRoute: typeof rootRouteImport - } - '/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/' - path: '/' - fullPath: '/sec-a/' - preLoaderRoute: typeof SecAIndexRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/$id': { - id: '/sec-a/$id' - path: '/$id' - fullPath: '/sec-a/$id' - preLoaderRoute: typeof SecAIdRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/about': { - id: '/sec-a/about' - path: '/about' - fullPath: '/sec-a/about' - preLoaderRoute: typeof SecAAboutRouteImport - parentRoute: typeof SecARoute - } - '/sec-a/settings': { - id: '/sec-a/settings' - path: '/settings' - fullPath: '/sec-a/settings' - preLoaderRoute: typeof SecASettingsRouteImport - parentRoute: typeof SecARoute - } - '/sec-b/': { - id: '/sec-b/' - path: '/' - fullPath: '/sec-b/' - preLoaderRoute: typeof SecBIndexRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/$id': { - id: '/sec-b/$id' - path: '/$id' - fullPath: '/sec-b/$id' - preLoaderRoute: typeof SecBIdRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/about': { - id: '/sec-b/about' - path: '/about' - fullPath: '/sec-b/about' - preLoaderRoute: typeof SecBAboutRouteImport - parentRoute: typeof SecBRoute - } - '/sec-b/settings': { - id: '/sec-b/settings' - path: '/settings' - fullPath: '/sec-b/settings' - preLoaderRoute: typeof SecBSettingsRouteImport - parentRoute: typeof SecBRoute - } - '/sec-c/': { - id: '/sec-c/' - path: '/' - fullPath: '/sec-c/' - preLoaderRoute: typeof SecCIndexRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/$id': { - id: '/sec-c/$id' - path: '/$id' - fullPath: '/sec-c/$id' - preLoaderRoute: typeof SecCIdRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/about': { - id: '/sec-c/about' - path: '/about' - fullPath: '/sec-c/about' - preLoaderRoute: typeof SecCAboutRouteImport - parentRoute: typeof SecCRoute - } - '/sec-c/settings': { - id: '/sec-c/settings' - path: '/settings' - fullPath: '/sec-c/settings' - preLoaderRoute: typeof SecCSettingsRouteImport - parentRoute: typeof SecCRoute - } - '/sec-d/': { - id: '/sec-d/' - path: '/' - fullPath: '/sec-d/' - preLoaderRoute: typeof SecDIndexRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/$id': { - id: '/sec-d/$id' - path: '/$id' - fullPath: '/sec-d/$id' - preLoaderRoute: typeof SecDIdRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/about': { - id: '/sec-d/about' - path: '/about' - fullPath: '/sec-d/about' - preLoaderRoute: typeof SecDAboutRouteImport - parentRoute: typeof SecDRoute - } - '/sec-d/settings': { - id: '/sec-d/settings' - path: '/settings' - fullPath: '/sec-d/settings' - preLoaderRoute: typeof SecDSettingsRouteImport - parentRoute: typeof SecDRoute - } - '/sec-e/': { - id: '/sec-e/' - path: '/' - fullPath: '/sec-e/' - preLoaderRoute: typeof SecEIndexRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/$id': { - id: '/sec-e/$id' - path: '/$id' - fullPath: '/sec-e/$id' - preLoaderRoute: typeof SecEIdRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/about': { - id: '/sec-e/about' - path: '/about' - fullPath: '/sec-e/about' - preLoaderRoute: typeof SecEAboutRouteImport - parentRoute: typeof SecERoute - } - '/sec-e/settings': { - id: '/sec-e/settings' - path: '/settings' - fullPath: '/sec-e/settings' - preLoaderRoute: typeof SecESettingsRouteImport - parentRoute: typeof SecERoute - } - '/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 - } - } -} - -interface LayoutRouteChildren { - LayoutAlphaRoute: typeof LayoutAlphaRoute - LayoutBetaRoute: typeof LayoutBetaRoute -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutAlphaRoute: LayoutAlphaRoute, - LayoutBetaRoute: LayoutBetaRoute, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface SecARouteChildren { - SecAIdRoute: typeof SecAIdRoute - SecAAboutRoute: typeof SecAAboutRoute - SecASettingsRoute: typeof SecASettingsRoute - SecAIndexRoute: typeof SecAIndexRoute -} - -const SecARouteChildren: SecARouteChildren = { - SecAIdRoute: SecAIdRoute, - SecAAboutRoute: SecAAboutRoute, - SecASettingsRoute: SecASettingsRoute, - SecAIndexRoute: SecAIndexRoute, -} - -const SecARouteWithChildren = SecARoute._addFileChildren(SecARouteChildren) - -interface SecBRouteChildren { - SecBIdRoute: typeof SecBIdRoute - SecBAboutRoute: typeof SecBAboutRoute - SecBSettingsRoute: typeof SecBSettingsRoute - SecBIndexRoute: typeof SecBIndexRoute -} - -const SecBRouteChildren: SecBRouteChildren = { - SecBIdRoute: SecBIdRoute, - SecBAboutRoute: SecBAboutRoute, - SecBSettingsRoute: SecBSettingsRoute, - SecBIndexRoute: SecBIndexRoute, -} - -const SecBRouteWithChildren = SecBRoute._addFileChildren(SecBRouteChildren) - -interface SecCRouteChildren { - SecCIdRoute: typeof SecCIdRoute - SecCAboutRoute: typeof SecCAboutRoute - SecCSettingsRoute: typeof SecCSettingsRoute - SecCIndexRoute: typeof SecCIndexRoute -} - -const SecCRouteChildren: SecCRouteChildren = { - SecCIdRoute: SecCIdRoute, - SecCAboutRoute: SecCAboutRoute, - SecCSettingsRoute: SecCSettingsRoute, - SecCIndexRoute: SecCIndexRoute, -} - -const SecCRouteWithChildren = SecCRoute._addFileChildren(SecCRouteChildren) - -interface SecDRouteChildren { - SecDIdRoute: typeof SecDIdRoute - SecDAboutRoute: typeof SecDAboutRoute - SecDSettingsRoute: typeof SecDSettingsRoute - SecDIndexRoute: typeof SecDIndexRoute -} - -const SecDRouteChildren: SecDRouteChildren = { - SecDIdRoute: SecDIdRoute, - SecDAboutRoute: SecDAboutRoute, - SecDSettingsRoute: SecDSettingsRoute, - SecDIndexRoute: SecDIndexRoute, -} - -const SecDRouteWithChildren = SecDRoute._addFileChildren(SecDRouteChildren) - -interface SecERouteChildren { - SecEIdRoute: typeof SecEIdRoute - SecEAboutRoute: typeof SecEAboutRoute - SecESettingsRoute: typeof SecESettingsRoute - SecEIndexRoute: typeof SecEIndexRoute -} - -const SecERouteChildren: SecERouteChildren = { - SecEIdRoute: SecEIdRoute, - SecEAboutRoute: SecEAboutRoute, - SecESettingsRoute: SecESettingsRoute, - SecEIndexRoute: SecEIndexRoute, -} - -const SecERouteWithChildren = SecERoute._addFileChildren(SecERouteChildren) - -interface SecFRouteChildren { - SecFIdRoute: typeof SecFIdRoute - SecFAboutRoute: typeof SecFAboutRoute - SecFSettingsRoute: typeof SecFSettingsRoute - SecFIndexRoute: typeof SecFIndexRoute -} - -const SecFRouteChildren: SecFRouteChildren = { - SecFIdRoute: SecFIdRoute, - SecFAboutRoute: SecFAboutRoute, - SecFSettingsRoute: SecFSettingsRoute, - SecFIndexRoute: SecFIndexRoute, -} - -const SecFRouteWithChildren = SecFRoute._addFileChildren(SecFRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - SecARoute: SecARouteWithChildren, - SecBRoute: SecBRouteWithChildren, - SecCRoute: SecCRouteWithChildren, - SecDRoute: SecDRouteWithChildren, - SecERoute: SecERouteWithChildren, - SecFRoute: SecFRouteWithChildren, - marketingPricingRoute: marketingPricingRoute, - marketingPromoRoute: marketingPromoRoute, - FilesSplatRoute: FilesSplatRoute, - ReleaseVChar123versionChar125Route: ReleaseVChar123versionChar125Route, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/(marketing)/pricing.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/(marketing)/pricing.tsx deleted file mode 100644 index f606c10b4b..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/(marketing)/pricing.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
pricing
- }, -}) - -export const Route = createFileRoute('/(marketing)/pricing')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/(marketing)/promo.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/(marketing)/promo.tsx deleted file mode 100644 index 61c3eb3ec9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/(marketing)/promo.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
promo
- }, -}) - -export const Route = createFileRoute('/(marketing)/promo')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/__root.tsx deleted file mode 100644 index d2e1483106..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/__root.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute } from '@tanstack/vue-router' - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.alpha.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.alpha.tsx deleted file mode 100644 index ff6ad5350e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.alpha.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
alpha
- }, -}) - -export const Route = createFileRoute('/_layout/alpha')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.beta.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.beta.tsx deleted file mode 100644 index 2f7cab6c0a..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.beta.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
beta
- }, -}) - -export const Route = createFileRoute('/_layout/beta')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.tsx deleted file mode 100644 index e8221f0f65..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/_layout.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/_layout')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/files.$.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/files.$.tsx deleted file mode 100644 index 221fae01be..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/files.$.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`files:${params.value._splat}`}
- ) - }, -}) - -export const Route = createFileRoute('/files/$')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/index.tsx deleted file mode 100644 index b3e94f37c4..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
home
- }, -}) - -export const Route = createFileRoute('/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/release.v{$version}.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/release.v{$version}.tsx deleted file mode 100644 index 86b1a2c8f0..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/release.v{$version}.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`release:${params.value.version}`}
- ) - }, -}) - -export const Route = createFileRoute('/release/v{$version}')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.$id.tsx deleted file mode 100644 index 864074940d..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`sec-a:${params.value.id}`}
- ) - }, -}) - -export const Route = createFileRoute('/sec-a/$id')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.about.tsx deleted file mode 100644 index 715ab9548c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-a:about
- }, -}) - -export const Route = createFileRoute('/sec-a/about')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.index.tsx deleted file mode 100644 index baef08547c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-a:index
- }, -}) - -export const Route = createFileRoute('/sec-a/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.settings.tsx deleted file mode 100644 index 9e6a56b913..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-a:settings
- }, -}) - -export const Route = createFileRoute('/sec-a/settings')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.tsx deleted file mode 100644 index a9fb557aea..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-a.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/sec-a')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.$id.tsx deleted file mode 100644 index 9a03a8fe01..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`sec-b:${params.value.id}`}
- ) - }, -}) - -export const Route = createFileRoute('/sec-b/$id')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.about.tsx deleted file mode 100644 index 2ef1100995..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-b:about
- }, -}) - -export const Route = createFileRoute('/sec-b/about')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.index.tsx deleted file mode 100644 index 652e5f895c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-b:index
- }, -}) - -export const Route = createFileRoute('/sec-b/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.settings.tsx deleted file mode 100644 index e8fa36377e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-b:settings
- }, -}) - -export const Route = createFileRoute('/sec-b/settings')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.tsx deleted file mode 100644 index ba31612633..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-b.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/sec-b')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.$id.tsx deleted file mode 100644 index 7f0407d84e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`sec-c:${params.value.id}`}
- ) - }, -}) - -export const Route = createFileRoute('/sec-c/$id')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.about.tsx deleted file mode 100644 index d26776d439..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-c:about
- }, -}) - -export const Route = createFileRoute('/sec-c/about')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.index.tsx deleted file mode 100644 index 1835eff9b7..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-c:index
- }, -}) - -export const Route = createFileRoute('/sec-c/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.settings.tsx deleted file mode 100644 index 1bf85fd6d9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-c:settings
- }, -}) - -export const Route = createFileRoute('/sec-c/settings')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.tsx deleted file mode 100644 index 009f814b93..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-c.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/sec-c')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.$id.tsx deleted file mode 100644 index ff5aab05e3..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`sec-d:${params.value.id}`}
- ) - }, -}) - -export const Route = createFileRoute('/sec-d/$id')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.about.tsx deleted file mode 100644 index 25a8078626..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-d:about
- }, -}) - -export const Route = createFileRoute('/sec-d/about')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.index.tsx deleted file mode 100644 index cd9b89664a..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-d:index
- }, -}) - -export const Route = createFileRoute('/sec-d/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.settings.tsx deleted file mode 100644 index 8e4309de32..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-d:settings
- }, -}) - -export const Route = createFileRoute('/sec-d/settings')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.tsx deleted file mode 100644 index 6b12b514da..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-d.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/sec-d')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.$id.tsx deleted file mode 100644 index 4525051967..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`sec-e:${params.value.id}`}
- ) - }, -}) - -export const Route = createFileRoute('/sec-e/$id')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.about.tsx deleted file mode 100644 index 71a32bd36b..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-e:about
- }, -}) - -export const Route = createFileRoute('/sec-e/about')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.index.tsx deleted file mode 100644 index 9b467ca53e..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-e:index
- }, -}) - -export const Route = createFileRoute('/sec-e/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.settings.tsx deleted file mode 100644 index a01066488c..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-e:settings
- }, -}) - -export const Route = createFileRoute('/sec-e/settings')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.tsx deleted file mode 100644 index 38f4da91fb..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-e.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/sec-e')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.$id.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.$id.tsx deleted file mode 100644 index c740f9d223..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.$id.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
{`sec-f:${params.value.id}`}
- ) - }, -}) - -export const Route = createFileRoute('/sec-f/$id')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.about.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.about.tsx deleted file mode 100644 index 229dab22a2..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.about.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-f:about
- }, -}) - -export const Route = createFileRoute('/sec-f/about')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.index.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.index.tsx deleted file mode 100644 index 14e3f46a13..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-f:index
- }, -}) - -export const Route = createFileRoute('/sec-f/')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.settings.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.settings.tsx deleted file mode 100644 index da2c7483b9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.settings.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const Page = Vue.defineComponent({ - setup() { - return () =>
sec-f:settings
- }, -}) - -export const Route = createFileRoute('/sec-f/settings')({ - component: Page, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.tsx b/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.tsx deleted file mode 100644 index 3b389c8144..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/src/routes/sec-f.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import * as Vue from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const Layout = Vue.defineComponent({ - setup() { - return () => - }, -}) - -export const Route = createFileRoute('/sec-f')({ - component: Layout, -}) diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/tsconfig.json b/benchmarks/client-nav/scenarios/route-tree-scale/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts b/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts deleted file mode 100644 index 189ba1de99..0000000000 --- a/benchmarks/client-nav/scenarios/route-tree-scale/vue/vite.config.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - // Real file-based apps code-split by default; this scenario keeps it on - // so navigations also exercise lazy route-chunk resolution. - autoCodeSplitting: true, - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav route-tree-scale (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/react/project.json b/benchmarks/client-nav/scenarios/search-params/react/project.json deleted file mode 100644 index f2d743f5f9..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-search-params-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/search-params/react/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/setup.ts b/benchmarks/client-nav/scenarios/search-params/react/setup.ts deleted file mode 100644 index 130583b190..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'React', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts deleted file mode 100644 index 0b38f7bddb..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-search-params', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-search-params navigation loop (react)', - 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/search-params/react/speed.flame.ts b/benchmarks/client-nav/scenarios/search-params/react/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/src/main.tsx b/benchmarks/client-nav/scenarios/search-params/react/src/main.tsx deleted file mode 100644 index b10d53554b..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/src/main.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultStructuralSharing: true, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const reactRoot = createRoot(container) - reactRoot.render() - - return { - router, - unmount() { - reactRoot.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/search-params/react/src/routeTree.gen.ts deleted file mode 100644 index cff9dca167..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 CatalogRouteImport } from './routes/catalog' -import { Route as ProductsRouteImport } from './routes/products' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const CatalogRoute = CatalogRouteImport.update({ - id: '/catalog', - path: '/catalog', - getParentRoute: () => rootRouteImport, -} as any) -const ProductsRoute = ProductsRouteImport.update({ - id: '/products', - path: '/products', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/catalog' | '/products' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/catalog' | '/products' - id: '__root__' | '/' | '/catalog' | '/products' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - CatalogRoute: typeof CatalogRoute - ProductsRoute: typeof ProductsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/catalog': { - id: '/catalog' - path: '/catalog' - fullPath: '/catalog' - preLoaderRoute: typeof CatalogRouteImport - parentRoute: typeof rootRouteImport - } - '/products': { - id: '/products' - path: '/products' - fullPath: '/products' - preLoaderRoute: typeof ProductsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - CatalogRoute: CatalogRoute, - ProductsRoute: ProductsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/search-params/react/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/search-params/react/src/routes/__root.tsx deleted file mode 100644 index 86399d0175..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/src/routes/__root.tsx +++ /dev/null @@ -1,116 +0,0 @@ -import { - Link, - Outlet, - createRootRoute, - useSearch, -} from '@tanstack/react-router' -import { - changedCategories, - computeChecksum, - initialProductsSearch, -} from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -const rootSubscribers = Array.from({ length: 4 }, (_, index) => index) - -function RootSearchSubscriber() { - const value = useSearch({ - strict: false, - select: (search) => computeChecksum(Number(search.page ?? 0)), - }) - - void computeChecksum(value) - return null -} - -function RootComponent() { - return ( - <> - {rootSubscribers.map((index) => ( - - ))} - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/src/routes/catalog.tsx b/benchmarks/client-nav/scenarios/search-params/react/src/routes/catalog.tsx deleted file mode 100644 index 73f59c13b0..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/src/routes/catalog.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { createFileRoute, retainSearchParams } from '@tanstack/react-router' -import type { SearchSchemaInput } from '@tanstack/react-router' -import { - catalogMarkerText, - computeChecksum, - normalizeCatalogSearch, -} from '../../../shared' - -export const Route = createFileRoute('/catalog')({ - validateSearch: (search: Record & SearchSchemaInput) => - normalizeCatalogSearch(search), - search: { - middlewares: [retainSearchParams(['perPage', 'sort'])], - }, - component: CatalogPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function ViewSubscriber() { - const value = Route.useSearch({ - select: (search) => - computeChecksum(search.view.length * 5 + search.page * 11), - }) - - void computeChecksum(value) - return null -} - -function CatalogPage() { - const search = Route.useSearch() - - return ( -
- {subscriberIndexes.map((index) => ( - - ))} -

Catalog

-
{catalogMarkerText(search)}
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/src/routes/index.tsx b/benchmarks/client-nav/scenarios/search-params/react/src/routes/index.tsx deleted file mode 100644 index 5879ad518d..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Search Params Bench

-
home
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/src/routes/products.tsx b/benchmarks/client-nav/scenarios/search-params/react/src/routes/products.tsx deleted file mode 100644 index d22e99c4bf..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/src/routes/products.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { - createFileRoute, - retainSearchParams, - stripSearchParams, -} from '@tanstack/react-router' -import type { SearchSchemaInput } from '@tanstack/react-router' -import { - computeChecksum, - normalizeProductsSearch, - productsLoaderChecksum, - productsMarkerText, -} from '../../../shared' - -export const Route = createFileRoute('/products')({ - validateSearch: (search: Record & SearchSchemaInput) => - normalizeProductsSearch(search), - search: { - middlewares: [ - retainSearchParams(['perPage', 'sort']), - stripSearchParams({ page: 1 }), - ], - }, - loaderDeps: ({ search }) => ({ - page: search.page, - sort: search.sort, - filters: search.filters, - }), - loader: ({ deps }) => ({ - checksum: productsLoaderChecksum(deps), - }), - staleTime: 1e9, - gcTime: 1e9, - component: ProductsPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function PageSubscriber() { - const value = Route.useSearch({ - select: (search) => computeChecksum(search.page * 31 + search.perPage), - }) - - void computeChecksum(value) - return null -} - -function FiltersSubscriber() { - const value = Route.useSearch({ - select: (search) => - computeChecksum( - search.filters.categories.length * 7 + - (search.filters.price.max - search.filters.price.min) + - search.filters.tags.length * 3, - ), - }) - - void computeChecksum(value) - return null -} - -function QuerySubscriber() { - const value = Route.useSearch({ - select: (search) => - computeChecksum(search.q.length * 13 + search.sort.length), - }) - - void computeChecksum(value) - return null -} - -function ProductsPage() { - const search = Route.useSearch() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Products

-
{productsMarkerText(search)}
-

{`checksum ${loaderData.checksum}`}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/tsconfig.json b/benchmarks/client-nav/scenarios/search-params/react/tsconfig.json deleted file mode 100644 index 1d59cbb450..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts b/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts deleted file mode 100644 index 0318a10815..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/react/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import react from '@vitejs/plugin-react' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'react', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav search-params (react)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/shared.ts b/benchmarks/client-nav/scenarios/search-params/shared.ts deleted file mode 100644 index 343e319ded..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/shared.ts +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Shared definition of the `search-params` scenario: search schema - * normalizers, the click sequence, and per-step sanity assertions. The three - * framework apps consume these builders so the workload is identical modulo - * the rendering layer. - * - * Isolates: validateSearch execution, search middlewares - * (retainSearchParams/stripSearchParams), parse/stringify of medium-complex - * search objects, functional search updaters, structural sharing, and - * useSearch selector subscriptions. - */ - -import type { ScenarioStep } from '../harness' - -export function computeChecksum(seed: number) { - let value = Math.trunc(seed) | 0 - - for (let index = 0; index < 40; index++) { - value = (value * 1664525 + 1013904223 + index) >>> 0 - } - - return value -} - -export interface ProductsSearch { - page: number - perPage: number - sort: 'asc' | 'desc' - q: string - filters: { - categories: Array - price: { min: number; max: number } - tags: Array - } -} - -export interface CatalogSearch { - view: 'grid' | 'list' - page: number - perPage: number - sort: 'asc' | 'desc' -} - -function normalizeNumber(value: unknown, fallback: number) { - const num = Number(value) - return Number.isFinite(num) && num >= 0 ? Math.trunc(num) : fallback -} - -function normalizeString(value: unknown, fallback: string) { - return typeof value === 'string' ? value : fallback -} - -function normalizeSort(value: unknown): 'asc' | 'desc' { - return value === 'desc' ? 'desc' : 'asc' -} - -function normalizeStringArray(value: unknown): Array { - if (!Array.isArray(value)) { - return [] - } - return value.filter((entry): entry is string => typeof entry === 'string') -} - -export function normalizeProductsSearch( - search: Record, -): ProductsSearch { - const filters = - typeof search.filters === 'object' && search.filters !== null - ? (search.filters as Record) - : {} - const price = - typeof filters.price === 'object' && filters.price !== null - ? (filters.price as Record) - : {} - - return { - page: Math.max(1, normalizeNumber(search.page, 1)), - perPage: Math.max(1, normalizeNumber(search.perPage, 20)), - sort: normalizeSort(search.sort), - q: normalizeString(search.q, ''), - filters: { - categories: normalizeStringArray(filters.categories), - price: { - min: normalizeNumber(price.min, 0), - max: normalizeNumber(price.max, 1000), - }, - tags: normalizeStringArray(filters.tags), - }, - } -} - -export function normalizeCatalogSearch( - search: Record, -): CatalogSearch { - return { - view: search.view === 'list' ? 'list' : 'grid', - page: Math.max(1, normalizeNumber(search.page, 1)), - perPage: Math.max(1, normalizeNumber(search.perPage, 20)), - sort: normalizeSort(search.sort), - } -} - -export const initialProductsSearch = { - page: 2, - perPage: 50, - sort: 'desc', - q: 'gadget', - filters: { - categories: ['audio', 'video'], - price: { min: 10, max: 200 }, - tags: ['new', 'sale'], - }, -} satisfies ProductsSearch - -export const changedCategories = ['x-ray', 'yield', 'zeta'] - -export function productsMarkerText(search: ProductsSearch) { - return `${search.page}|${search.sort}|${search.filters.categories.join(',')}` -} - -export function catalogMarkerText(search: CatalogSearch) { - return `${search.view}|${search.page}|${search.perPage}|${search.sort}` -} - -export function productsLoaderChecksum(deps: { - page: number - sort: string - filters: ProductsSearch['filters'] -}) { - return computeChecksum( - deps.page * 31 + - deps.sort.length * 7 + - deps.filters.categories.join('').length * 13 + - deps.filters.tags.length * 3 + - (deps.filters.price.max - deps.filters.price.min), - ) -} - -export const steps: ReadonlyArray = [ - 'go-products', - 'products-next-page', - 'products-categories', - 'products-sort', - 'products-reset', - 'go-catalog', - 'catalog-next-page', - 'products-partial', - 'go-home', -] - -interface ExpectedState { - testId: string - text?: string -} - -const expectedStates: ReadonlyArray = [ - // Full search literal from home. - { testId: 'products-state', text: '2|desc|audio,video' }, - // Functional updater bumping the page. - { testId: 'products-state', text: '3|desc|audio,video' }, - // Functional updater replacing filters.categories. - { testId: 'products-state', text: '3|desc|x-ray,yield,zeta' }, - // Functional updater flipping sort desc -> asc. - { testId: 'products-state', text: '3|asc|x-ray,yield,zeta' }, - // Functional updater resetting page to 1 (stripSearchParams removes it). - { testId: 'products-state', text: '1|asc|x-ray,yield,zeta' }, - // search: true carries the current products search into catalog. - { testId: 'catalog-state', text: 'grid|1|50|asc' }, - // Functional updater bumping the catalog page. - { testId: 'catalog-state', text: 'grid|2|50|asc' }, - // Partial search literal; retainSearchParams fills perPage/sort from catalog. - { testId: 'products-state', text: '1|asc|' }, - { testId: 'home-state' }, -] - -export function assertStepResult(stepIndex: number, container: HTMLElement) { - const expected = expectedStates[stepIndex]! - const element = container.querySelector(`[data-testid="${expected.testId}"]`) - - if (!element) { - throw new Error( - `Expected marker "${expected.testId}" to exist after step ${stepIndex}`, - ) - } - - if (expected.text !== undefined && element.textContent !== expected.text) { - throw new Error( - `Expected marker "${expected.testId}" to read "${expected.text}" after step ${stepIndex}, received "${element.textContent}"`, - ) - } -} - -// Two laps through the 9-step sequence per benchmark iteration. -export const ticksPerIteration = 18 - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/project.json b/benchmarks/client-nav/scenarios/search-params/solid/project.json deleted file mode 100644 index af48217e03..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-search-params-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/search-params/solid/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/setup.ts b/benchmarks/client-nav/scenarios/search-params/solid/setup.ts deleted file mode 100644 index 6a46971603..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Solid', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts deleted file mode 100644 index caa626c596..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-search-params', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-search-params navigation loop (solid)', - 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/search-params/solid/speed.flame.ts b/benchmarks/client-nav/scenarios/search-params/solid/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx deleted file mode 100644 index 25071f7979..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/src/main.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultStructuralSharing: true, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} 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 deleted file mode 100644 index b15beed09b..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 CatalogRouteImport } from './routes/catalog' -import { Route as ProductsRouteImport } from './routes/products' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const CatalogRoute = CatalogRouteImport.update({ - id: '/catalog', - path: '/catalog', - getParentRoute: () => rootRouteImport, -} as any) -const ProductsRoute = ProductsRouteImport.update({ - id: '/products', - path: '/products', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/catalog' | '/products' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/catalog' | '/products' - id: '__root__' | '/' | '/catalog' | '/products' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - CatalogRoute: typeof CatalogRoute - ProductsRoute: typeof ProductsRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/catalog': { - id: '/catalog' - path: '/catalog' - fullPath: '/catalog' - preLoaderRoute: typeof CatalogRouteImport - parentRoute: typeof rootRouteImport - } - '/products': { - id: '/products' - path: '/products' - fullPath: '/products' - preLoaderRoute: typeof ProductsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - CatalogRoute: CatalogRoute, - ProductsRoute: ProductsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx deleted file mode 100644 index 30c042f9c5..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/__root.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { - Link, - Outlet, - createRootRoute, - useSearch, -} from '@tanstack/solid-router' -import { - changedCategories, - computeChecksum, - initialProductsSearch, -} from '../../../shared' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -const rootSubscribers = Array.from({ length: 4 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function RootSearchSubscriber() { - const value = useSearch({ - strict: false, - select: (search) => computeChecksum(Number(search.page ?? 0)), - }) - - return computeChecksum(value())} /> -} - -function RootComponent() { - return ( - <> - {rootSubscribers.map(() => ( - - ))} - - - - ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx deleted file mode 100644 index 60cf8e7896..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/catalog.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { createFileRoute, retainSearchParams } from '@tanstack/solid-router' -import type { SearchSchemaInput } from '@tanstack/solid-router' -import { - catalogMarkerText, - computeChecksum, - normalizeCatalogSearch, -} from '../../../shared' - -export const Route = createFileRoute('/catalog')({ - validateSearch: (search: Record & SearchSchemaInput) => - normalizeCatalogSearch(search), - search: { - middlewares: [retainSearchParams(['perPage', 'sort'])], - }, - component: CatalogPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function ViewSubscriber() { - const value = Route.useSearch({ - select: (search) => - computeChecksum(search.view.length * 5 + search.page * 11), - }) - - return computeChecksum(value())} /> -} - -function CatalogPage() { - const search = Route.useSearch() - - return ( -
- {subscriberIndexes.map(() => ( - - ))} -

Catalog

-
{catalogMarkerText(search())}
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/index.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/index.tsx deleted file mode 100644 index 0bbb913d83..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: HomePage, -}) - -function HomePage() { - return ( -
-

Search Params Bench

-
home
-
- ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx b/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx deleted file mode 100644 index 8b2a252155..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/src/routes/products.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { createRenderEffect } from 'solid-js' -import { - createFileRoute, - retainSearchParams, - stripSearchParams, -} from '@tanstack/solid-router' -import type { SearchSchemaInput } from '@tanstack/solid-router' -import { - computeChecksum, - normalizeProductsSearch, - productsLoaderChecksum, - productsMarkerText, -} from '../../../shared' - -export const Route = createFileRoute('/products')({ - validateSearch: (search: Record & SearchSchemaInput) => - normalizeProductsSearch(search), - search: { - middlewares: [ - retainSearchParams(['perPage', 'sort']), - stripSearchParams({ page: 1 }), - ], - }, - loaderDeps: ({ search }) => ({ - page: search.page, - sort: search.sort, - filters: search.filters, - }), - loader: ({ deps }) => ({ - checksum: productsLoaderChecksum(deps), - }), - staleTime: 1e9, - gcTime: 1e9, - component: ProductsPage, -}) - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function PageSubscriber() { - const value = Route.useSearch({ - select: (search) => computeChecksum(search.page * 31 + search.perPage), - }) - - return computeChecksum(value())} /> -} - -function FiltersSubscriber() { - const value = Route.useSearch({ - select: (search) => - computeChecksum( - search.filters.categories.length * 7 + - (search.filters.price.max - search.filters.price.min) + - search.filters.tags.length * 3, - ), - }) - - return computeChecksum(value())} /> -} - -function QuerySubscriber() { - const value = Route.useSearch({ - select: (search) => - computeChecksum(search.q.length * 13 + search.sort.length), - }) - - return computeChecksum(value())} /> -} - -function ProductsPage() { - const search = Route.useSearch() - const loaderData = Route.useLoaderData() - - return ( -
- {subscriberIndexes.map(() => ( - - ))} - {subscriberIndexes.map(() => ( - - ))} - {subscriberIndexes.map(() => ( - - ))} -

Products

-
{productsMarkerText(search())}
-

{`checksum ${loaderData().checksum}`}

-
- ) -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json b/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json deleted file mode 100644 index 98d76ad6b8..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts b/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts deleted file mode 100644 index 511fd49466..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/solid/vite.config.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'solid', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav search-params (solid)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/vue/project.json b/benchmarks/client-nav/scenarios/search-params/vue/project.json deleted file mode 100644 index 47b9712a2c..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/project.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "@benchmarks/client-nav-search-params-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router", "@tanstack/router-plugin"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": ["build:client"], - "options": { - "command": "NODE_ENV=production flame run --md-format=detailed --delay=none --node-options=\"--stack-size=65500\" ./scenarios/search-params/vue/speed.flame.ts", - "cwd": "benchmarks/client-nav" - } - } - } -} diff --git a/benchmarks/client-nav/scenarios/search-params/vue/setup.ts b/benchmarks/client-nav/scenarios/search-params/vue/setup.ts deleted file mode 100644 index 97b74b3892..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/setup.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createScenarioSetup } from '../../harness' -import { assertStepResult, steps } from '../shared' -import type * as App from './src/main' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - return createScenarioSetup({ - frameworkLabel: 'Vue', - mount: mountTestApp, - steps, - assertAfterStep: assertStepResult, - }) -} diff --git a/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts b/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts deleted file mode 100644 index 728d2779e8..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { benchLifecycle } from '../../../../cpu-simulation' -import { benchOptions, ticksPerIteration } from '../shared' -import { setup } from './setup' - -test('client-search-params', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-search-params navigation 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/search-params/vue/speed.flame.ts b/benchmarks/client-nav/scenarios/search-params/vue/speed.flame.ts deleted file mode 100644 index f4a0b4e6ff..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../../../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx b/benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx deleted file mode 100644 index 65bade775c..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/src/main.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import type { RouterHistory } from '@tanstack/history' -import * as Vue from 'vue' -import { RouterProvider, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function createTestRouter(history: RouterHistory) { - return createRouter({ - routeTree, - history, - scrollRestoration: true, - // Key the scroll-restoration cache by pathname instead of the default - // random per-entry location key: with push navigations the default mints - // a fresh key per navigation and the module-level cache grows one entry - // per push for the whole run, which is non-stationary. - getScrollRestorationKey: (location) => location.pathname, - defaultStructuralSharing: true, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} - -export function mountTestApp(container: HTMLElement, history: RouterHistory) { - const router = createTestRouter(history) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts b/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts deleted file mode 100644 index f73b84ebe7..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 CatalogRouteImport } from './routes/catalog' -import { Route as ProductsRouteImport } from './routes/products' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const CatalogRoute = CatalogRouteImport.update({ - id: '/catalog', - path: '/catalog', - getParentRoute: () => rootRouteImport, -} as any) -const ProductsRoute = ProductsRouteImport.update({ - id: '/products', - path: '/products', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/catalog': typeof CatalogRoute - '/products': typeof ProductsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/catalog' | '/products' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/catalog' | '/products' - id: '__root__' | '/' | '/catalog' | '/products' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - CatalogRoute: typeof CatalogRoute - ProductsRoute: typeof ProductsRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/catalog': { - id: '/catalog' - path: '/catalog' - fullPath: '/catalog' - preLoaderRoute: typeof CatalogRouteImport - parentRoute: typeof rootRouteImport - } - '/products': { - id: '/products' - path: '/products' - fullPath: '/products' - preLoaderRoute: typeof ProductsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - CatalogRoute: CatalogRoute, - ProductsRoute: ProductsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/__root.tsx b/benchmarks/client-nav/scenarios/search-params/vue/src/routes/__root.tsx deleted file mode 100644 index b4cb07f2ae..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/__root.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import * as Vue from 'vue' -import { Link, Outlet, createRootRoute, useSearch } from '@tanstack/vue-router' -import { - changedCategories, - computeChecksum, - initialProductsSearch, -} from '../../../shared' - -const rootSubscribers = Array.from({ length: 4 }, (_, index) => index) - -const RootSearchSubscriber = Vue.defineComponent({ - setup() { - const value = useSearch({ - strict: false, - select: (search) => computeChecksum(Number(search.page ?? 0)), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const RootComponent = Vue.defineComponent({ - setup() { - return () => ( - <> - {rootSubscribers.map((index) => ( - - ))} - - - - ) - }, -}) - -export const Route = createRootRoute({ - component: RootComponent, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/catalog.tsx b/benchmarks/client-nav/scenarios/search-params/vue/src/routes/catalog.tsx deleted file mode 100644 index 6a09efdd4a..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/catalog.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute, retainSearchParams } from '@tanstack/vue-router' -import type { SearchSchemaInput } from '@tanstack/vue-router' -import { - catalogMarkerText, - computeChecksum, - normalizeCatalogSearch, -} from '../../../shared' - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -const ViewSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useSearch({ - select: (search) => - computeChecksum(search.view.length * 5 + search.page * 11), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const CatalogPage = Vue.defineComponent({ - setup() { - const search = Route.useSearch() - - return () => ( -
- {subscriberIndexes.map((index) => ( - - ))} -

Catalog

-
{catalogMarkerText(search.value)}
-
- ) - }, -}) - -export const Route = createFileRoute('/catalog')({ - validateSearch: (search: Record & SearchSchemaInput) => - normalizeCatalogSearch(search), - search: { - middlewares: [retainSearchParams(['perPage', 'sort'])], - }, - component: CatalogPage, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/index.tsx b/benchmarks/client-nav/scenarios/search-params/vue/src/routes/index.tsx deleted file mode 100644 index 081aa7b4fd..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/index.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import * as Vue from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HomePage = Vue.defineComponent({ - setup() { - return () => ( -
-

Search Params Bench

-
home
-
- ) - }, -}) - -export const Route = createFileRoute('/')({ - component: HomePage, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/products.tsx b/benchmarks/client-nav/scenarios/search-params/vue/src/routes/products.tsx deleted file mode 100644 index 8be1683e14..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/src/routes/products.tsx +++ /dev/null @@ -1,108 +0,0 @@ -import * as Vue from 'vue' -import { - createFileRoute, - retainSearchParams, - stripSearchParams, -} from '@tanstack/vue-router' -import type { SearchSchemaInput } from '@tanstack/vue-router' -import { - computeChecksum, - normalizeProductsSearch, - productsLoaderChecksum, - productsMarkerText, -} from '../../../shared' - -const subscriberIndexes = Array.from({ length: 2 }, (_, index) => index) - -const PageSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useSearch({ - select: (search) => computeChecksum(search.page * 31 + search.perPage), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const FiltersSubscriber = Vue.defineComponent({ - setup() { - const value = Route.useSearch({ - select: (search) => - computeChecksum( - search.filters.categories.length * 7 + - (search.filters.price.max - search.filters.price.min) + - search.filters.tags.length * 3, - ), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const QuerySubscriber = Vue.defineComponent({ - setup() { - const value = Route.useSearch({ - select: (search) => - computeChecksum(search.q.length * 13 + search.sort.length), - }) - - return () => { - void computeChecksum(value.value) - return null - } - }, -}) - -const ProductsPage = Vue.defineComponent({ - setup() { - const search = Route.useSearch() - const loaderData = Route.useLoaderData() - - return () => ( -
- {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} - {subscriberIndexes.map((index) => ( - - ))} -

Products

-
- {productsMarkerText(search.value)} -
-

{`checksum ${loaderData.value.checksum}`}

-
- ) - }, -}) - -export const Route = createFileRoute('/products')({ - validateSearch: (search: Record & SearchSchemaInput) => - normalizeProductsSearch(search), - search: { - middlewares: [ - retainSearchParams(['perPage', 'sort']), - stripSearchParams({ page: 1 }), - ], - }, - loaderDeps: ({ search }) => ({ - page: search.page, - sort: search.sort, - filters: search.filters, - }), - loader: ({ deps }) => ({ - checksum: productsLoaderChecksum(deps), - }), - staleTime: 1e9, - gcTime: 1e9, - component: ProductsPage, -}) diff --git a/benchmarks/client-nav/scenarios/search-params/vue/tsconfig.json b/benchmarks/client-nav/scenarios/search-params/vue/tsconfig.json deleted file mode 100644 index 7786fc3da9..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "allowImportingTsExtensions": true, - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "setup.ts", - "vite.config.ts", - "../shared.ts", - "../../harness.ts", - "../../../setup-helpers.ts", - "../../../jsdom.ts", - "../../../vitest.setup.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts b/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts deleted file mode 100644 index 27490b276a..0000000000 --- a/benchmarks/client-nav/scenarios/search-params/vue/vite.config.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackRouter({ - target: 'vue', - routesDirectory: `${rootDir}src/routes`, - generatedRouteTree: `${rootDir}src/routeTree.gen.ts`, - }), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/main.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav search-params (vue)', - watch: false, - environment: 'jsdom', - setupFiles: ['../../../vitest.setup.ts'], - }, -}) diff --git a/benchmarks/client-nav/setup-helpers.ts b/benchmarks/client-nav/setup-helpers.ts deleted file mode 100644 index c070018743..0000000000 --- a/benchmarks/client-nav/setup-helpers.ts +++ /dev/null @@ -1,43 +0,0 @@ -export function getRequiredLink( - container: ParentNode, - testId: string, - cache?: Map, -) { - const cachedLink = cache?.get(testId) - if (cachedLink) { - return cachedLink - } - - const link = container.querySelector( - `[data-testid="${testId}"]`, - ) - if (!link) { - throw new Error(`Unable to find benchmark link: ${testId}`) - } - - cache?.set(testId, link) - return link -} - -export async function waitForRequiredLink( - container: ParentNode, - testId: string, - cache?: Map, -) { - for (let attempt = 0; attempt < 10; attempt++) { - const link = container.querySelector( - `[data-testid="${testId}"]`, - ) - - if (link) { - cache?.set(testId, link) - return link - } - - await new Promise((resolve) => { - requestAnimationFrame(() => resolve()) - }) - } - - return getRequiredLink(container, testId, cache) -} diff --git a/benchmarks/client-nav/solid/app.tsx b/benchmarks/client-nav/solid/app.tsx deleted file mode 100644 index ef90130f5e..0000000000 --- a/benchmarks/client-nav/solid/app.tsx +++ /dev/null @@ -1,367 +0,0 @@ -import { For, createRenderEffect } from 'solid-js' -import { render } from 'solid-js/web' -import { - Link, - Outlet, - RouterProvider, - createMemoryHistory, - createRootRoute, - createRoute, - createRouter, - useParams, - useSearch, -} from '@tanstack/solid-router' - -function runPerfSelectorComputation(seed: number) { - let value = Math.trunc(seed) | 0 - - for (let index = 0; index < 40; index++) { - value = (value * 1664525 + 1013904223 + index) >>> 0 - } - - return value -} - -function normalizePage(value: unknown) { - const page = Number(value) - return Number.isFinite(page) && page > 0 ? Math.trunc(page) : 1 -} - -function normalizeFilter(value: unknown) { - return typeof value === 'string' && value.length > 0 ? value : 'all' -} - -const noop = () => {} -const rootSelectors = Array.from({ length: 10 }, (_, index) => index) -const routeSelectors = Array.from({ length: 6 }, (_, index) => index) -const linkGroups = Array.from({ length: 4 }, (_, index) => index) - -function PerfValue(props: { value: () => number }) { - createRenderEffect(() => { - void props.value() - }) - - return null -} - -function RootParamsSubscriber() { - const params = useParams({ - strict: false, - select: (params) => runPerfSelectorComputation(Number(params.id ?? 0)), - }) - - return runPerfSelectorComputation(params())} /> -} - -function RootSearchSubscriber() { - const search = useSearch({ - strict: false, - select: (search) => runPerfSelectorComputation(Number(search.page ?? 0)), - }) - - return runPerfSelectorComputation(search())} /> -} - -function LinkPanel() { - return ( - <> - - {(groupIndex) => { - const itemsId = groupIndex === 0 ? 1 : groupIndex + 2 - const ctxId = groupIndex + 1 - - return ( -
- - {`Items ${itemsId}`} - - - {`Items 2 alt ${groupIndex}`} - - - {`Search ${groupIndex}`} - - - {`Context ${ctxId}`} - - ({ - page: prev.page + groupIndex + 1, - filter: prev.filter, - junk: `updater-${groupIndex}`, - })} - activeOptions={{ includeSearch: true }} - > - {({ isActive }) => - isActive - ? `Search updater active ${groupIndex}` - : `Search updater inactive ${groupIndex}` - } - -
- ) - }} -
- - ) -} - -function Root() { - return ( - <> - {() => } - {() => } - - - - ) -} - -const rootRoute = createRootRoute({ - component: Root, -}) - -const itemsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/items/$id', - params: { - parse: (params) => ({ - ...params, - id: normalizePage(params.id), - }), - stringify: (params) => ({ - ...params, - id: `${params.id}`, - }), - }, - onEnter: noop, - onStay: noop, - onLeave: noop, - component: ItemsPage, -}) - -const itemDetailsRoute = createRoute({ - getParentRoute: () => itemsRoute, - path: 'details', - component: ItemDetailsPage, -}) - -const searchRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/search', - validateSearch: (search: Record) => ({ - page: normalizePage(search.page), - filter: normalizeFilter(search.filter), - }), - search: { - middlewares: [ - ({ search, next }) => { - const result = next(search) - return { - page: result.page, - filter: result.filter, - } - }, - ], - }, - loaderDeps: ({ search }) => ({ - page: search.page, - filter: search.filter, - }), - loader: ({ deps }) => ({ - seed: deps.page * 31 + deps.filter.length, - checksum: deps.page * 17 + deps.filter.length, - }), - staleTime: 60_000, - gcTime: 60_000, - component: SearchPage, -}) - -const contextRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/ctx/$id', - beforeLoad: ({ params }) => ({ - sectionSeed: Number(params.id) * 13 + 1, - }), - component: ContextPage, -}) - -function ItemParamsSubscriber() { - const params = itemsRoute.useParams({ - select: (params) => runPerfSelectorComputation(params.id), - }) - - return runPerfSelectorComputation(params())} /> -} - -function SearchStateSubscriber() { - const search = searchRoute.useSearch({ - select: (search) => - runPerfSelectorComputation(search.page + search.filter.length), - }) - - return runPerfSelectorComputation(search())} /> -} - -function SearchLoaderDepsSubscriber() { - const loaderDeps = searchRoute.useLoaderDeps({ - select: (loaderDeps) => - runPerfSelectorComputation(loaderDeps.page + loaderDeps.filter.length), - }) - - return runPerfSelectorComputation(loaderDeps())} /> -} - -function SearchLoaderDataSubscriber() { - const loaderData = searchRoute.useLoaderData({ - select: (loaderData) => - runPerfSelectorComputation(loaderData.seed + loaderData.checksum), - }) - - return runPerfSelectorComputation(loaderData())} /> -} - -function ContextParamsSubscriber() { - const params = contextRoute.useParams({ - select: (params) => runPerfSelectorComputation(Number(params.id)), - }) - - return runPerfSelectorComputation(params())} /> -} - -function ContextRouteSubscriber() { - const context = contextRoute.useRouteContext({ - select: (context) => runPerfSelectorComputation(context.sectionSeed), - }) - - return runPerfSelectorComputation(context())} /> -} - -function ItemsPage() { - return ( - <> - {() => } - - Details - - - Preserve search on item - - - - ) -} - -function ItemDetailsPage() { - return ( - <> - {() => } - - Back to item - - - ) -} - -function SearchPage() { - return ( - <> - {() => } - {() => } - {() => } - ({ - page: prev.page + 1, - filter: prev.filter, - junk: 'local-updater', - })} - activeOptions={{ includeSearch: true }} - activeProps={{ class: 'active-link' }} - inactiveProps={{ class: 'inactive-link' }} - > - Next page - - - ) -} - -function ContextPage() { - return ( - <> - {() => } - {() => } - - ) -} - -export function mountTestApp(container: Element) { - const router = createRouter({ - history: createMemoryHistory({ - initialEntries: ['/items/0'], - }), - scrollRestoration: true, - routeTree: rootRoute.addChildren([ - itemsRoute.addChildren([itemDetailsRoute]), - searchRoute, - contextRoute, - ]), - }) - - const unmount = render(() => , container) - - return { - router, - unmount, - } -} diff --git a/benchmarks/client-nav/solid/setup.ts b/benchmarks/client-nav/solid/setup.ts deleted file mode 100644 index 9b532a466a..0000000000 --- a/benchmarks/client-nav/solid/setup.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { NavigateOptions } from '@tanstack/router-core' -import type * as App from './app' -import { getRequiredLink, waitForRequiredLink } from '../setup-helpers' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - if (process.env.NODE_ENV !== 'production') { - console.warn( - 'client-nav benchmark is running without NODE_ENV=production; Solid dev overhead will dominate results.', - ) - } - - let container: HTMLDivElement | undefined = undefined - let unmount: (() => void) | undefined = undefined - let unsub = () => {} - let stepIndex = 0 - let next: () => Promise = () => Promise.reject('Test not initialized') - - async function before() { - stepIndex = 0 - container = document.createElement('div') - document.body.append(container) - - const { router, unmount: dispose } = mountTestApp(container) - unmount = dispose - - let resolveRendered: () => void = () => {} - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - const navigate = (opts: NavigateOptions) => - new Promise((resolveNext) => { - resolveRendered = resolveNext - router.navigate(opts) - }) - - const click = (testId: string, cache?: Map) => - new Promise((resolveNext) => { - resolveRendered = resolveNext - - getRequiredLink(container!, testId, cache).dispatchEvent( - new MouseEvent('click', { - bubbles: true, - cancelable: true, - button: 0, - }), - ) - }) - - await router.load() - - const cachedLinks = new Map() - for (const testId of ['go-items-1', 'go-items-2', 'go-search', 'go-ctx']) { - await waitForRequiredLink(container, testId, cachedLinks) - } - - const steps = [ - () => click('go-items-1', cachedLinks), - () => click('items-details'), - () => - navigate({ - to: '/items/$id/details', - params: { id: 2 }, - replace: true, - }), - () => click('items-parent'), - () => click('go-search', cachedLinks), - () => click('search-next-page'), - () => - navigate({ - to: '/search', - search: { page: 1, filter: 'all' }, - replace: true, - }), - () => click('go-ctx', cachedLinks), - () => - navigate({ - to: '/ctx/$id', - params: { id: 2 }, - replace: true, - }), - () => click('go-items-2', cachedLinks), - ] as const - - next = () => { - const step = steps[stepIndex % steps.length]! - stepIndex += 1 - return step() - } - } - - function after() { - unmount?.() - container?.remove() - unsub() - } - - function tick() { - return next() - } - - return { - before, - tick, - after, - } -} diff --git a/benchmarks/client-nav/solid/speed.bench.ts b/benchmarks/client-nav/solid/speed.bench.ts deleted file mode 100644 index d629da17a8..0000000000 --- a/benchmarks/client-nav/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { setup } from './setup' - -test('client-nav', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-side navigation loop (solid)', - { beforeAll: scenario.before, afterAll: scenario.after }, - async () => { - for (let i = 0; i < 10; i++) { - await scenario.tick() - } - }, - ).run({ - warmupIterations: 100, - time: 10_000, - }) -}) diff --git a/benchmarks/client-nav/solid/speed.flame.ts b/benchmarks/client-nav/solid/speed.flame.ts deleted file mode 100644 index 285ccc63d7..0000000000 --- a/benchmarks/client-nav/solid/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/solid/tsconfig.json b/benchmarks/client-nav/solid/tsconfig.json deleted file mode 100644 index 4c500d0793..0000000000 --- a/benchmarks/client-nav/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "../jsdom.ts", - "setup.ts", - "vite.config.ts", - "../vitest.setup.ts" - ] -} diff --git a/benchmarks/client-nav/solid/vite.config.ts b/benchmarks/client-nav/solid/vite.config.ts deleted file mode 100644 index 0c26b32f5f..0000000000 --- a/benchmarks/client-nav/solid/vite.config.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import solid from 'vite-plugin-solid' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { cpuSimulationExecArgv } from '../../cpu-simulation' - -// Anchor the project root to the package directory so this config resolves -// identically when run directly and as part of an aggregate `projects` config. -const rootDir = fileURLToPath(new URL('..', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './solid/dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './solid/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - resolve: { - conditions: ['solid', 'browser'], - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav (solid)', - 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/tsconfig.json b/benchmarks/client-nav/tsconfig.json deleted file mode 100644 index f657f504d4..0000000000 --- a/benchmarks/client-nav/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": ["vitest.setup.ts"] -} diff --git a/benchmarks/client-nav/vitest.config.ts b/benchmarks/client-nav/vitest.config.ts deleted file mode 100644 index 808e7fc724..0000000000 --- a/benchmarks/client-nav/vitest.config.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: [ - './react/vite.config.ts', - './solid/vite.config.ts', - './vue/vite.config.ts', - './scenarios/*/react/vite.config.ts', - './scenarios/*/solid/vite.config.ts', - './scenarios/*/vue/vite.config.ts', - ], - }, -}) diff --git a/benchmarks/client-nav/vitest.react.config.ts b/benchmarks/client-nav/vitest.react.config.ts deleted file mode 100644 index a397ad929e..0000000000 --- a/benchmarks/client-nav/vitest.react.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: ['./react/vite.config.ts', './scenarios/*/react/vite.config.ts'], - }, -}) diff --git a/benchmarks/client-nav/vitest.setup.ts b/benchmarks/client-nav/vitest.setup.ts deleted file mode 100644 index 9bac58bd41..0000000000 --- a/benchmarks/client-nav/vitest.setup.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { vi } from 'vitest' - -// @ts-expect-error -global.IS_REACT_ACT_ENVIRONMENT = true - -window.scrollTo = vi.fn() diff --git a/benchmarks/client-nav/vitest.solid.config.ts b/benchmarks/client-nav/vitest.solid.config.ts deleted file mode 100644 index b8827b86aa..0000000000 --- a/benchmarks/client-nav/vitest.solid.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: ['./solid/vite.config.ts', './scenarios/*/solid/vite.config.ts'], - }, -}) diff --git a/benchmarks/client-nav/vitest.vue.config.ts b/benchmarks/client-nav/vitest.vue.config.ts deleted file mode 100644 index 17960d7569..0000000000 --- a/benchmarks/client-nav/vitest.vue.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: ['./vue/vite.config.ts', './scenarios/*/vue/vite.config.ts'], - }, -}) diff --git a/benchmarks/client-nav/vue/app.tsx b/benchmarks/client-nav/vue/app.tsx deleted file mode 100644 index f88eee8129..0000000000 --- a/benchmarks/client-nav/vue/app.tsx +++ /dev/null @@ -1,433 +0,0 @@ -import * as Vue from 'vue' -import { - Link, - Outlet, - RouterProvider, - createMemoryHistory, - createRootRoute, - createRoute, - createRouter, - useParams, - useSearch, -} from '@tanstack/vue-router' - -function runPerfSelectorComputation(seed: number) { - let value = Math.trunc(seed) | 0 - - for (let index = 0; index < 40; index++) { - value = (value * 1664525 + 1013904223 + index) >>> 0 - } - - return value -} - -function normalizePage(value: unknown) { - const page = Number(value) - return Number.isFinite(page) && page > 0 ? Math.trunc(page) : 1 -} - -function normalizeFilter(value: unknown) { - return typeof value === 'string' && value.length > 0 ? value : 'all' -} - -const noop = () => {} -const rootSelectors = Array.from({ length: 10 }, (_, index) => index) -const routeSelectors = Array.from({ length: 6 }, (_, index) => index) -const linkGroups = Array.from({ length: 4 }, (_, index) => index) - -const RootParamsSubscriber = Vue.defineComponent({ - setup() { - const params = useParams({ - strict: false, - select: (params) => runPerfSelectorComputation(Number(params.id ?? 0)), - }) - - return () => { - void runPerfSelectorComputation(params.value) - return null - } - }, -}) - -const RootSearchSubscriber = Vue.defineComponent({ - setup() { - const search = useSearch({ - strict: false, - select: (search) => runPerfSelectorComputation(Number(search.page ?? 0)), - }) - - return () => { - void runPerfSelectorComputation(search.value) - return null - } - }, -}) - -const LinkPanel = Vue.defineComponent({ - setup() { - return () => ( - <> - {linkGroups.map((groupIndex) => { - const itemsId = groupIndex === 0 ? 1 : groupIndex + 2 - const ctxId = groupIndex + 1 - - return ( -
- - {`Items ${itemsId}`} - - - {`Items 2 alt ${groupIndex}`} - - - {`Search ${groupIndex}`} - - - {`Context ${ctxId}`} - - ({ - page: prev.page + groupIndex + 1, - filter: prev.filter, - junk: `updater-${groupIndex}`, - })} - activeOptions={{ includeSearch: true }} - > - {({ isActive }: { isActive: boolean }) => - isActive - ? `Search updater active ${groupIndex}` - : `Search updater inactive ${groupIndex}` - } - -
- ) - })} - - ) - }, -}) - -const Root = Vue.defineComponent({ - setup() { - return () => ( - <> - {rootSelectors.map((selector) => ( - - ))} - {rootSelectors.map((selector) => ( - - ))} - - - - ) - }, -}) - -const rootRoute = createRootRoute({ - component: Root, -}) - -const ItemParamsSubscriber = Vue.defineComponent({ - setup() { - const params = itemsRoute.useParams({ - select: (params) => runPerfSelectorComputation(params.id), - }) - - return () => { - void runPerfSelectorComputation(params.value) - return null - } - }, -}) - -const SearchStateSubscriber = Vue.defineComponent({ - setup() { - const search = searchRoute.useSearch({ - select: (search) => - runPerfSelectorComputation(search.page + search.filter.length), - }) - - return () => { - void runPerfSelectorComputation(search.value) - return null - } - }, -}) - -const SearchLoaderDepsSubscriber = Vue.defineComponent({ - setup() { - const loaderDeps = searchRoute.useLoaderDeps({ - select: (loaderDeps) => - runPerfSelectorComputation(loaderDeps.page + loaderDeps.filter.length), - }) - - return () => { - void runPerfSelectorComputation(loaderDeps.value) - return null - } - }, -}) - -const SearchLoaderDataSubscriber = Vue.defineComponent({ - setup() { - const loaderData = searchRoute.useLoaderData({ - select: (loaderData) => - runPerfSelectorComputation(loaderData.seed + loaderData.checksum), - }) - - return () => { - void runPerfSelectorComputation(loaderData.value) - return null - } - }, -}) - -const ContextParamsSubscriber = Vue.defineComponent({ - setup() { - const params = contextRoute.useParams({ - select: (params) => runPerfSelectorComputation(Number(params.id)), - }) - - return () => { - void runPerfSelectorComputation(params.value) - return null - } - }, -}) - -const ContextRouteSubscriber = Vue.defineComponent({ - setup() { - const context = contextRoute.useRouteContext({ - select: (context) => runPerfSelectorComputation(context.sectionSeed), - }) - - return () => { - void runPerfSelectorComputation(context.value) - return null - } - }, -}) - -const ItemsPage = Vue.defineComponent({ - setup() { - return () => ( - <> - {routeSelectors.map((selector) => ( - - ))} - - Details - - - Preserve search on item - - - - ) - }, -}) - -const ItemDetailsPage = Vue.defineComponent({ - setup() { - return () => ( - <> - {routeSelectors.map((selector) => ( - - ))} - - Back to item - - - ) - }, -}) - -const SearchPage = Vue.defineComponent({ - setup() { - return () => ( - <> - {routeSelectors.map((selector) => ( - - ))} - {routeSelectors.map((selector) => ( - - ))} - {routeSelectors.map((selector) => ( - - ))} - ({ - page: prev.page + 1, - filter: prev.filter, - junk: 'local-updater', - })} - activeOptions={{ includeSearch: true }} - activeProps={{ class: 'active-link' }} - inactiveProps={{ class: 'inactive-link' }} - > - Next page - - - ) - }, -}) - -const ContextPage = Vue.defineComponent({ - setup() { - return () => ( - <> - {routeSelectors.map((selector) => ( - - ))} - {routeSelectors.map((selector) => ( - - ))} - - ) - }, -}) - -const itemsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/items/$id', - params: { - parse: (params) => ({ - ...params, - id: normalizePage(params.id), - }), - stringify: (params) => ({ - ...params, - id: `${params.id}`, - }), - }, - onEnter: noop, - onStay: noop, - onLeave: noop, - component: ItemsPage, -}) - -const itemDetailsRoute = createRoute({ - getParentRoute: () => itemsRoute, - path: 'details', - component: ItemDetailsPage, -}) - -const searchRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/search', - validateSearch: (search: Record) => ({ - page: normalizePage(search.page), - filter: normalizeFilter(search.filter), - }), - search: { - middlewares: [ - ({ search, next }) => { - const result = next(search) - return { - page: result.page, - filter: result.filter, - } - }, - ], - }, - loaderDeps: ({ search }) => ({ - page: search.page, - filter: search.filter, - }), - loader: ({ deps }) => ({ - seed: deps.page * 31 + deps.filter.length, - checksum: deps.page * 17 + deps.filter.length, - }), - staleTime: 60_000, - gcTime: 60_000, - component: SearchPage, -}) - -const contextRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/ctx/$id', - beforeLoad: ({ params }) => ({ - sectionSeed: Number(params.id) * 13 + 1, - }), - component: ContextPage, -}) - -export function mountTestApp(container: Element) { - const router = createRouter({ - history: createMemoryHistory({ - initialEntries: ['/items/0'], - }), - scrollRestoration: true, - routeTree: rootRoute.addChildren([ - itemsRoute.addChildren([itemDetailsRoute]), - searchRoute, - contextRoute, - ]), - }) - - const component = - const app = Vue.createApp({ - render: () => component, - }) - - app.mount(container) - - return { - router, - unmount() { - app.unmount() - }, - } -} diff --git a/benchmarks/client-nav/vue/setup.ts b/benchmarks/client-nav/vue/setup.ts deleted file mode 100644 index 75a633f629..0000000000 --- a/benchmarks/client-nav/vue/setup.ts +++ /dev/null @@ -1,112 +0,0 @@ -import type { NavigateOptions } from '@tanstack/router-core' -import type * as App from './app' -import { getRequiredLink, waitForRequiredLink } from '../setup-helpers' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export function setup() { - if (process.env.NODE_ENV !== 'production') { - console.warn( - 'client-nav benchmark is running without NODE_ENV=production; Vue dev overhead will dominate results.', - ) - } - - let container: HTMLDivElement | undefined = undefined - let unmount: (() => void) | undefined = undefined - let unsub = () => {} - let stepIndex = 0 - let next: () => Promise = () => Promise.reject('Test not initialized') - - async function before() { - stepIndex = 0 - container = document.createElement('div') - document.body.append(container) - - const { router, unmount: dispose } = mountTestApp(container) - unmount = dispose - - let resolveRendered: () => void = () => {} - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - const navigate = (opts: NavigateOptions) => - new Promise((resolveNext) => { - resolveRendered = resolveNext - router.navigate(opts) - }) - - const click = (testId: string, cache?: Map) => - new Promise((resolveNext) => { - resolveRendered = resolveNext - - getRequiredLink(container!, testId, cache).dispatchEvent( - new MouseEvent('click', { - bubbles: true, - cancelable: true, - button: 0, - }), - ) - }) - - await router.load() - - const cachedLinks = new Map() - for (const testId of ['go-items-1', 'go-items-2', 'go-search', 'go-ctx']) { - await waitForRequiredLink(container, testId, cachedLinks) - } - - const steps = [ - () => click('go-items-1', cachedLinks), - () => click('items-details'), - () => - navigate({ - to: '/items/$id/details', - params: { id: 2 }, - replace: true, - }), - () => click('items-parent'), - () => click('go-search', cachedLinks), - () => click('search-next-page'), - () => - navigate({ - to: '/search', - search: { page: 1, filter: 'all' }, - replace: true, - }), - () => click('go-ctx', cachedLinks), - () => - navigate({ - to: '/ctx/$id', - params: { id: 2 }, - replace: true, - }), - () => click('go-items-2', cachedLinks), - ] as const - - next = () => { - const step = steps[stepIndex % steps.length]! - stepIndex += 1 - return step() - } - } - - function after() { - unmount?.() - container?.remove() - unsub() - } - - function tick() { - return next() - } - - return { - before, - tick, - after, - } -} diff --git a/benchmarks/client-nav/vue/speed.bench.ts b/benchmarks/client-nav/vue/speed.bench.ts deleted file mode 100644 index 503e91e7b7..0000000000 --- a/benchmarks/client-nav/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { setup } from './setup' - -test('client-nav', async ({ bench }) => { - const scenario = setup() - - await bench( - 'client-side navigation loop (vue)', - { beforeAll: scenario.before, afterAll: scenario.after }, - async () => { - for (let i = 0; i < 10; i++) { - await scenario.tick() - } - }, - ).run({ - warmupIterations: 100, - time: 10_000, - }) -}) diff --git a/benchmarks/client-nav/vue/speed.flame.ts b/benchmarks/client-nav/vue/speed.flame.ts deleted file mode 100644 index 285ccc63d7..0000000000 --- a/benchmarks/client-nav/vue/speed.flame.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { window } from '../jsdom.ts' -import { setup } from './setup.ts' - -const DURATION_MS = 10_000 - -const test = setup() - -try { - await test.before() - - const startedAt = performance.now() - while (performance.now() - startedAt < DURATION_MS) { - await test.tick() - } -} finally { - test.after() - window.close() -} diff --git a/benchmarks/client-nav/vue/tsconfig.json b/benchmarks/client-nav/vue/tsconfig.json deleted file mode 100644 index d8c92cfc17..0000000000 --- a/benchmarks/client-nav/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "speed.flame.ts", - "../jsdom.ts", - "setup.ts", - "vite.config.ts", - "../vitest.setup.ts" - ] -} diff --git a/benchmarks/client-nav/vue/vite.config.ts b/benchmarks/client-nav/vue/vite.config.ts deleted file mode 100644 index 78d8ae5638..0000000000 --- a/benchmarks/client-nav/vue/vite.config.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { cpuSimulationExecArgv } from '../../cpu-simulation' - -// Anchor the project root to the package directory so this config resolves -// identically when run directly and as part of an aggregate `projects` config. -const rootDir = fileURLToPath(new URL('..', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './vue/dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './vue/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - execArgv: cpuSimulationExecArgv(), - name: '@benchmarks/client-nav (vue)', - 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 deleted file mode 100644 index 9b8859f74d..0000000000 --- a/benchmarks/cpu-simulation.ts +++ /dev/null @@ -1,53 +0,0 @@ -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 = 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. - // Compile baseline code on first use, so warmup does not leave functions - // near Sparkplug's later tier-up/batch-compilation thresholds. - // V8 renamed --scavenge-task in Node 20; CodSpeed's old flag is omitted. - // Keep minor GC tied to allocations instead of scheduled foreground tasks. - // Fix the initial/minimum old-generation allocation budget. This can skip - // automatic full collections below the budget; minor GC remains enabled. - return [ - '--no-maglev', - '--always-sparkplug', - '--no-minor-gc-task', - '--initial-old-space-size=512', - ] - } - 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 deleted file mode 100644 index 18b68768f9..0000000000 --- a/benchmarks/memory/README.md +++ /dev/null @@ -1,273 +0,0 @@ -# Memory Benchmarks - -Dedicated memory benchmarks for TanStack Router / Start, measured with the -CodSpeed **memory instrument** (`mode: memory` in -`.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 -flags phantom regressions on every PR until the next run lands. (Falling back -across a docs-only commit is safe: the previous run's benchmark-relevant code -is identical.) Two separate benchmarks: - -- `server/` (`@benchmarks/memory-server`) — React/Solid/Vue Start apps, requests against - the built server handler (`handler.fetch`), Node environment. -- `client/` (`@benchmarks/memory-client`) — router-only React/Solid/Vue apps in jsdom. - -These deliberately do **not** reuse the CPU scenarios in `benchmarks/ssr` and -`benchmarks/client-nav`: memory benches need their own iteration counts, -payload sizes, and route shapes, and tuning those must never shift the CPU -baselines. Each scenario keeps a framework level (`react/`, `solid/`, `vue/`) -so framework ports can be added without renames. - -## Layout - -```text -benchmarks/memory// - package.json Nx targets: build:, test:perf:, test:flame:, test:types - bench-utils.ts memoryBenchOptions, seeded LCG (+ sequential request loop on the server side) - vitest..config.ts aggregates scenarios/*//vite.config.ts - scenarios/// - one isolated app per scenario + setup.ts + memory.bench.ts + memory.flame.ts -``` - -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 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 - -- The bench function is warmed up, then **measured exactly once**, starting - 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. 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, 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 - how much work to do. Both introduce allocator activity from the harness into - the measurement. Footprint scenarios run exactly one large request per - invocation; churn scenarios retain their fixed sequential request counts. -- Error-path cases use separate isolated workers so one case's module and - allocator history cannot contaminate the next case. -- Keep each bench under **~1.5M allocations** (instrument overhead grows past - 2M); this is the main constraint when tuning iteration counts. - -## Worker settings - -All scenarios use [`memoryConfig`](./runtime.ts). It adds these flags only in -memory mode: - -- `--no-maglev` -- `--no-flush-bytecode` -- `--no-minor-gc-task` -- `--no-incremental-marking` -- `--initial-old-space-size=512` - -`--jitless` was removed after repeated CI comparisons. Ten unchanged-commit -repetitions with the last four flags kept all 48 peak-memory results within 1% -(worst spread: 0.834%). With JIT enabled, all 16 subsets of the four flags were -tested. Removing bytecode, minor-GC-task, incremental-marking, or heap-budget -overrides from this profile produced worst client peak spreads of 6.616%, 2.714%, -2.109%, and 10.669%, respectively. Smaller combinations also exceeded 1% in at -least one tracked metric. This supports retaining the four-flag profile; it does -not establish that every override is required in every individual scenario. - -A server-only heap-budget profile initially passed five repetitions, but further -confirmation produced a 24.46% server peak outlier. That configuration was -rejected. Allocated bytes and allocation counts remain imperfectly repeatable: -a client confirmation with the retained four flags showed a 6.77% allocated-byte -spread and a 5.91% allocation-count spread. Client peaks remained within 0.834% -across all 15 observations with the retained profile. Experiment details and CI runs are recorded in -[PR #8260](https://github.com/TanStack/router/pull/8260). - -These settings trade production GC behavior for repeatable regression signals. -They suppress bytecode reclamation and change collection scheduling. The 512 MiB -initial/minimum old-generation allocation budget can postpone automatic full -collections. This does not preallocate 512 MiB, and the smallest sufficient budget -was not determined. Results describe this controlled worker profile, not a -production application's absolute memory footprint. - -CodSpeed's `--no-opt` only disables TurboFan on Node 24 (V8 13); Maglev still -compiles. Under CodSpeed's `--predictable` there is no background compilation, -so Maglev compiles run synchronously inside whichever request triggers them, and -the forced GC before the measured call can discard optimized code so recompiles -land inside the measured window. Maglev's malloc'd Zone scratch (32 KiB -segments) then dominates allocation metrics, and its size depends on -per-process feedback state. `--no-maglev` was added for this: the bimodal -+32,792 B / +1 allocation in `mem server error-paths unmatched (react)` was one -Maglev Zone segment allocated while compiling React Fizz's per-request stream -`write` closure, and compiler scratch made up ~97% of that bench's allocated -bytes. Retained-object measurements are unaffected because Zone memory is freed -after each compile. The repeatability figures above predate this flag. - -## Bench shapes and signals - -- **Churn:** a fixed number of sequential operations, measuring native - allocation activity and peak outstanding native allocations. -- **Peak (footprint):** one large operation, measuring its native footprint. - -CodSpeed reports native allocator activity, not individual JavaScript object -allocations or retained JS heap size. V8 can reuse heap pages without a visible -native allocation. These benchmarks can detect native buffering and allocator -regressions, but a flat graph does not establish that route data or JS objects -are collectable. Absolute numbers include Node/framework/jsdom activity under -benchmark-specific V8 settings; compare identical harness versions. - -## Scenarios - -### Server - -| Scenario | Shape | Exercises | -| ----------------------- | ----- | --------------------------------------------------------- | -| `request-churn` | churn | cross-request retention in document SSR (unique URLs) | -| `server-fn-churn` | churn | retention in the server-function RPC path | -| `error-paths` | churn | redirect/notFound/error/unmatched paths pinning contexts | -| `aborted-requests` | churn | dangling streams/listeners after mid-stream client aborts | -| `peak-large-page` | peak | per-request peak scaling with page size | -| `streaming-peak` | peak | streaming buffering O(document) instead of O(chunk) | -| `serialization-payload` | peak | double-buffering / string-copy blowups in dehydration | - -### Client - -| Scenario | Shape | Exercises | -| ------------------------- | ----- | -------------------------------------------------------- | -| `navigation-churn` | churn | per-navigation retention at steady state | -| `unique-location-churn` | churn | unbounded href/search-keyed caches (never-repeated URLs) | -| `preload-churn` | churn | preload-cache eviction not releasing memory | -| `loader-data-retention` | churn | departed routes' loader data staying pinned (gcTime 0) | -| `mount-unmount` | churn | router instances not collectable after dispose | -| `interrupted-navigations` | churn | superseded navigations retaining closures/contexts | - -## Conventions - -- Strictly sequential work: at most one request/navigation in flight; each - server response is fully consumed before the next request. Pairing a single - navigation with its render signal via `Promise.all([navigate, rendered])` - is fine — never overlap distinct work items. -- Randomness only via the seeded LCG in `bench-utils.ts`. Deferred streaming - uses counted zero-delay timer hops to stage work. Timers still depend on the - event loop, so validate repeatability on CI instead of assuming deterministic - ordering from a zero delay alone. -- Sanity assertions run once at module load and throw on wrong - status/markers, so a bench can never silently measure the wrong thing. -- Server requests follow `benchmarks/ssr` conventions: document GETs send - `accept: text/html`, server-fn requests send `sec-fetch-site: same-origin` - with bodies precomputed at module level. -- Client apps export `mountTestApp` from `app.tsx`; benches import the built - `dist/app.js`; navigations use `replace: true`; unmount does full teardown - (framework root, `__TSR_ROUTER__`, `history.destroy()`); large loader payloads - are never rendered into the DOM. -- `NODE_ENV=production` everywhere (the Nx targets set it). - -## Run - -Smoke-test the CodSpeed/Vitest benchmark entrypoints and typecheck the -scenarios: - -```bash -pnpm nx run @benchmarks/memory-server:test:perf:react --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-server:test:perf:solid --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-server:test:perf:vue --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-client:test:perf:react --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-client:test:perf:solid --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-client:test:perf:vue --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-server:test:types --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-client:test:types --outputStyle=stream --skipRemoteCache -``` - -Local attribution profiling, without CodSpeed CLI/login/sudo/upload, uses -`@datadog/pprof` heap sampling and `@platformatic/flame` only to render the -captured pprof files as HTML/Markdown. These targets rebuild the scenarios with -`--sourcemap true` so the generated profile reports can point back to source; -the normal CodSpeed benchmark builds are unchanged. Local aggregate scripts run -with `--parallel=1`, and scenario `test:flame` targets opt out of Nx parallelism -so profiling workloads do not overlap and bias each other. The Vitest aggregate -configs also set `fileParallelism: false` so benchmark files run sequentially -inside `test:perf:react`. - -```bash -pnpm benchmark:memory:server:flame -pnpm benchmark:memory:client:flame -pnpm benchmark:memory:server:flame:solid -pnpm benchmark:memory:client:flame:solid -pnpm benchmark:memory:server:flame:vue -pnpm benchmark:memory:client:flame:vue -``` - -To profile one scenario, run its `test:flame` target directly: - -```bash -pnpm nx run @benchmarks/memory-server-request-churn-react:test:flame --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/memory-client-navigation-churn-react:test:flame --outputStyle=stream --skipRemoteCache -``` - -Flame writes reports under the scenario's ignored `.profiles//` -directory, including `heap-profile-*.html` and `heap-profile-*.md`. The -`memory.flame.ts` entrypoints run the same workload shape as `memory.bench.ts` -but manually start profiling after sanity/setup work and stop it after the -measured workload. Treat these profiles as diagnostic heap-sampling attribution; -they are not CodSpeed memory metrics such as peak memory, allocated bytes, or -allocation counts. The heap sampler is stopped before profile conversion and -Flame report generation, so Flame/pprof report-generation work should not appear -as part of the captured workload. Flame runs do not force GC before profiling; -doing so would perturb the workload and still would not make heap sampling -equivalent to CodSpeed memory metrics. - -Clean local Flame profile output with: - -```bash -pnpm --filter @benchmarks/memory-server clean:profiles -pnpm --filter @benchmarks/memory-client clean:profiles -``` - -Client memory benches are useful for regression tracking of router/React/jsdom -integration behavior and native allocation activity. They are not pure -browser-memory measurements, and local Flame attribution can include jsdom, -React DOM, and profiler shutdown frames. - -Real memory measurement, locally (requires the CodSpeed CLI, `codspeed setup` -once to install the memory executor, and sudo; **uploads results to the -CodSpeed dashboard** — local runs do not affect PR baselines): - -```bash -WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-server:test:perf:react -WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-server:test:perf:solid -WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-server:test:perf:vue -WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-client:test:perf:react -WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-client:test:perf:solid -WITH_INSTRUMENTATION=1 codspeed run --mode memory -- pnpm nx run @benchmarks/memory-client:test:perf:vue -``` - -Run the benchmark workflow on an experiment branch: - -```bash -gh workflow run benchmarks.yml --ref -``` - -Repeat at the same commit, using distinct branch names if runs should overlap -(the workflow serializes runs on the same ref). Compare all 48 fresh memory -results: 18 client and 30 server. Exclude CPU simulation results, inherited -CodSpeed results, and failed or incomplete repetitions. For each workload, calculate -`100 * (max / min - 1)` across runs for peak bytes, allocated bytes, and -allocation counts; aggregate averages hide unstable cases. - -Observed spreads below 1% establish repeatability in the tested sample, not a -bound on future runs. Changes to worker flags or workload lifecycles establish -new measurement baselines. diff --git a/benchmarks/memory/client/bench-utils.ts b/benchmarks/memory/client/bench-utils.ts deleted file mode 100644 index 785e8fac7f..0000000000 --- a/benchmarks/memory/client/bench-utils.ts +++ /dev/null @@ -1,22 +0,0 @@ -export { memoryBenchHooks } from '../turn' - -export const memoryBenchOptions = { - iterations: 1, - warmupIterations: 1, - time: 0, - warmupTime: 0, - throws: true, -} - -export function createDeterministicRandom(seed: number) { - let state = seed >>> 0 - - return () => { - state = (state * 1664525 + 1013904223) >>> 0 - return state / 0x100000000 - } -} - -export function randomSegment(random: () => number) { - return Math.floor(random() * 1_000_000_000).toString(36) -} diff --git a/benchmarks/memory/client/benchmark.ts b/benchmarks/memory/client/benchmark.ts deleted file mode 100644 index 463047f4d9..0000000000 --- a/benchmarks/memory/client/benchmark.ts +++ /dev/null @@ -1,11 +0,0 @@ -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/flame-runner.ts b/benchmarks/memory/client/flame-runner.ts deleted file mode 100644 index 04941fda67..0000000000 --- a/benchmarks/memory/client/flame-runner.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { profileFlameWorkload } from '../flame-control.ts' -import { window } from './jsdom.ts' -import type { ClientMemoryWorkload } from './benchmark.ts' - -export async function runClientFlameBenchmark(workload: ClientMemoryWorkload) { - try { - await workload.sanity() - await workload.before?.() - await profileFlameWorkload(workload.run, workload.name) - } finally { - await workload.after?.() - window.close() - } -} diff --git a/benchmarks/memory/client/jsdom.ts b/benchmarks/memory/client/jsdom.ts deleted file mode 100644 index 4df480df68..0000000000 --- a/benchmarks/memory/client/jsdom.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { JSDOM } from 'jsdom' - -const dom = new JSDOM('', { - url: 'http://localhost/', -}) - -const { window } = dom - -function setGlobal(name: string, value: unknown) { - Object.defineProperty(globalThis, name, { - value, - configurable: true, - writable: true, - }) -} - -setGlobal('window', window) -setGlobal('document', window.document) -setGlobal('self', window) -setGlobal('navigator', window.navigator) -setGlobal('location', window.location) -setGlobal('history', window.history) -setGlobal('HTMLElement', window.HTMLElement) -setGlobal('Element', window.Element) -setGlobal('SVGElement', window.SVGElement) -setGlobal('DocumentFragment', window.DocumentFragment) -setGlobal('Node', window.Node) -setGlobal('MouseEvent', window.MouseEvent) -setGlobal('MutationObserver', window.MutationObserver) -setGlobal('sessionStorage', window.sessionStorage) -setGlobal('localStorage', window.localStorage) -setGlobal('getComputedStyle', window.getComputedStyle.bind(window)) - -setGlobal( - 'requestAnimationFrame', - window.requestAnimationFrame?.bind(window) ?? - ((callback: (time: number) => void) => - setTimeout(() => callback(performance.now()), 16)), -) - -setGlobal( - 'cancelAnimationFrame', - window.cancelAnimationFrame?.bind(window) ?? - ((handle: number) => clearTimeout(handle)), -) - -const scrollTo = () => {} -window.scrollTo = scrollTo -setGlobal('scrollTo', scrollTo) - -export { window } diff --git a/benchmarks/memory/client/lifecycle.ts b/benchmarks/memory/client/lifecycle.ts deleted file mode 100644 index c4a62f0f96..0000000000 --- a/benchmarks/memory/client/lifecycle.ts +++ /dev/null @@ -1,46 +0,0 @@ -export type Framework = 'react' | 'solid' | 'vue' - -export type MountedApp = { - router: unknown - unmount: () => void -} - -export type MountTestApp = (container: HTMLDivElement) => MountedApp - -const frameworkNames = { - react: 'React', - solid: 'Solid', - vue: 'Vue', -} satisfies Record - -export function noop() {} - -export function warnClientMemoryDevMode(framework: Framework) { - if (process.env.NODE_ENV !== 'production') { - console.warn( - `memory client benchmark is running without NODE_ENV=production; ${frameworkNames[framework]} dev overhead will dominate results.`, - ) - } -} - -export function createBenchContainer() { - const container = document.createElement('div') - document.body.append(container) - - return container -} - -export function removeBenchContainer(container: HTMLDivElement | undefined) { - container?.remove() -} - -export function nextAnimationFrame() { - return new Promise((resolve) => { - requestAnimationFrame(() => resolve()) - }) -} - -export async function drainMicrotasks() { - await Promise.resolve() - await Promise.resolve() -} diff --git a/benchmarks/memory/client/package.json b/benchmarks/memory/client/package.json deleted file mode 100644 index 4dc6246183..0000000000 --- a/benchmarks/memory/client/package.json +++ /dev/null @@ -1,274 +0,0 @@ -{ - "name": "@benchmarks/memory-client", - "private": true, - "type": "module", - "scripts": { - "clean:profiles": "rm -rf scenarios/*/*/.profiles" - }, - "imports": { - "#memory-client/benchmark": "./benchmark.ts", - "#memory-client/bench-utils": "./bench-utils.ts", - "#memory-client/flame-runner": "./flame-runner.ts", - "#memory-client/lifecycle": "./lifecycle.ts" - }, - "dependencies": { - "@tanstack/react-router": "workspace:*", - "@tanstack/router-core": "workspace:*", - "@tanstack/solid-router": "workspace:*", - "@tanstack/vue-router": "workspace:*", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "solid-js": "^1.9.10", - "vue": "^3.5.16" - }, - "devDependencies": { - "@codspeed/vitest-plugin": "^6.0.1", - "@datadog/pprof": "^5.13.2", - "@platformatic/flame": "^1.6.0", - "@testing-library/react": "^16.2.0", - "@vitejs/plugin-react": "^6.0.1", - "@vitejs/plugin-vue": "^6.0.5", - "@vitejs/plugin-vue-jsx": "^5.1.5", - "@types/jsdom": "28.0.0", - "@types/react": "catalog:", - "@types/react-dom": "catalog:", - "jsdom": "29.1.1", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "vitest": "catalog:" - }, - "nx": { - "targets": { - "build:react": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-react", - "@benchmarks/memory-client-unique-location-churn-react", - "@benchmarks/memory-client-preload-churn-react", - "@benchmarks/memory-client-loader-data-retention-react", - "@benchmarks/memory-client-mount-unmount-react", - "@benchmarks/memory-client-interrupted-navigations-react" - ], - "target": "build:client" - } - ] - }, - "build:solid": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-solid", - "@benchmarks/memory-client-unique-location-churn-solid", - "@benchmarks/memory-client-preload-churn-solid", - "@benchmarks/memory-client-loader-data-retention-solid", - "@benchmarks/memory-client-mount-unmount-solid", - "@benchmarks/memory-client-interrupted-navigations-solid" - ], - "target": "build:client" - } - ] - }, - "build:vue": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-vue", - "@benchmarks/memory-client-unique-location-churn-vue", - "@benchmarks/memory-client-preload-churn-vue", - "@benchmarks/memory-client-loader-data-retention-vue", - "@benchmarks/memory-client-mount-unmount-vue", - "@benchmarks/memory-client-interrupted-navigations-vue" - ], - "target": "build:client" - } - ] - }, - "build:react:flame": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-react", - "@benchmarks/memory-client-unique-location-churn-react", - "@benchmarks/memory-client-preload-churn-react", - "@benchmarks/memory-client-loader-data-retention-react", - "@benchmarks/memory-client-mount-unmount-react", - "@benchmarks/memory-client-interrupted-navigations-react" - ], - "target": "build:client:flame" - } - ] - }, - "build:solid:flame": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-solid", - "@benchmarks/memory-client-unique-location-churn-solid", - "@benchmarks/memory-client-preload-churn-solid", - "@benchmarks/memory-client-loader-data-retention-solid", - "@benchmarks/memory-client-mount-unmount-solid", - "@benchmarks/memory-client-interrupted-navigations-solid" - ], - "target": "build:client:flame" - } - ] - }, - "build:vue:flame": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-vue", - "@benchmarks/memory-client-unique-location-churn-vue", - "@benchmarks/memory-client-preload-churn-vue", - "@benchmarks/memory-client-loader-data-retention-vue", - "@benchmarks/memory-client-mount-unmount-vue", - "@benchmarks/memory-client-interrupted-navigations-vue" - ], - "target": "build:client:flame" - } - ] - }, - "test:flame:react": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-react", - "@benchmarks/memory-client-unique-location-churn-react", - "@benchmarks/memory-client-preload-churn-react", - "@benchmarks/memory-client-loader-data-retention-react", - "@benchmarks/memory-client-mount-unmount-react", - "@benchmarks/memory-client-interrupted-navigations-react" - ], - "target": "test:flame" - } - ] - }, - "test:flame:solid": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-solid", - "@benchmarks/memory-client-unique-location-churn-solid", - "@benchmarks/memory-client-preload-churn-solid", - "@benchmarks/memory-client-loader-data-retention-solid", - "@benchmarks/memory-client-mount-unmount-solid", - "@benchmarks/memory-client-interrupted-navigations-solid" - ], - "target": "test:flame" - } - ] - }, - "test:flame:vue": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-vue", - "@benchmarks/memory-client-unique-location-churn-vue", - "@benchmarks/memory-client-preload-churn-vue", - "@benchmarks/memory-client-loader-data-retention-vue", - "@benchmarks/memory-client-mount-unmount-vue", - "@benchmarks/memory-client-interrupted-navigations-vue" - ], - "target": "test:flame" - } - ] - }, - "test:perf:react": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": [ - "build:react" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts", - "cwd": "benchmarks/memory/client" - } - }, - "test:perf:solid": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": [ - "build:solid" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts", - "cwd": "benchmarks/memory/client" - } - }, - "test:perf:vue": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": [ - "build:vue" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts", - "cwd": "benchmarks/memory/client" - } - }, - "test:types": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-client-navigation-churn-react", - "@benchmarks/memory-client-unique-location-churn-react", - "@benchmarks/memory-client-preload-churn-react", - "@benchmarks/memory-client-loader-data-retention-react", - "@benchmarks/memory-client-mount-unmount-react", - "@benchmarks/memory-client-interrupted-navigations-react", - "@benchmarks/memory-client-navigation-churn-solid", - "@benchmarks/memory-client-unique-location-churn-solid", - "@benchmarks/memory-client-preload-churn-solid", - "@benchmarks/memory-client-loader-data-retention-solid", - "@benchmarks/memory-client-mount-unmount-solid", - "@benchmarks/memory-client-interrupted-navigations-solid", - "@benchmarks/memory-client-navigation-churn-vue", - "@benchmarks/memory-client-unique-location-churn-vue", - "@benchmarks/memory-client-preload-churn-vue", - "@benchmarks/memory-client-loader-data-retention-vue", - "@benchmarks/memory-client-mount-unmount-vue", - "@benchmarks/memory-client-interrupted-navigations-vue" - ], - "target": "test:types:client" - } - ], - "options": { - "command": "tsc -p ./tsconfig.json --noEmit", - "cwd": "benchmarks/memory/client" - }, - "inputs": [ - "default", - "^production", - "{workspaceRoot}/eslint.config.js", - "dependentTaskOutputs", - "{workspaceRoot}/benchmarks/memory/*.ts" - ] - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(workload), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.flame.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/project.json b/benchmarks/memory/client/scenarios/interrupted-navigations/react/project.json deleted file mode 100644 index 0ed437c9ca..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-interrupted-navigations-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/setup.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/setup.ts deleted file mode 100644 index 6e072ad5f3..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/setup.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { - mountTestApp, - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -} = (await import(/* @vite-ignore */ appModulePath)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'react', - mountTestApp, - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/app.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/app.tsx deleted file mode 100644 index bd605a78ee..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/app.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { getRouter } from './router' - -export { - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -} from '../../slow-loaders' - -export function mountTestApp(container: Element) { - const router = getRouter() - const reactRoot = createRoot(container) - let didUnmount = false - - reactRoot.render() - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - reactRoot.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routeTree.gen.ts deleted file mode 100644 index 475085a433..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 SlowIdRouteImport } from './routes/slow.$id' -import { Route as FastIdRouteImport } from './routes/fast.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const SlowIdRoute = SlowIdRouteImport.update({ - id: '/slow/$id', - path: '/slow/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FastIdRoute = FastIdRouteImport.update({ - id: '/fast/$id', - path: '/fast/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/fast/$id' | '/slow/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/fast/$id' | '/slow/$id' - id: '__root__' | '/' | '/fast/$id' | '/slow/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - FastIdRoute: typeof FastIdRoute - SlowIdRoute: typeof SlowIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/slow/$id': { - id: '/slow/$id' - path: '/slow/$id' - fullPath: '/slow/$id' - preLoaderRoute: typeof SlowIdRouteImport - parentRoute: typeof rootRouteImport - } - '/fast/$id': { - id: '/fast/$id' - path: '/fast/$id' - fullPath: '/fast/$id' - preLoaderRoute: typeof FastIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - FastIdRoute: FastIdRoute, - SlowIdRoute: SlowIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/router.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/router.tsx deleted file mode 100644 index ac27b20f79..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/'], - }), - routeTree, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/fast.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/fast.$id.tsx deleted file mode 100644 index d5fd7ade46..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/fast.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { fixedTimestamp } from '../../../slow-loaders' - -export const Route = createFileRoute('/fast/$id')({ - loader: ({ params }) => ({ - id: params.id, - kind: 'fast' as const, - ts: fixedTimestamp, - }), - component: FastComponent, -}) - -function FastComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data.kind}:${data.id}:${data.ts}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/index.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/index.tsx deleted file mode 100644 index a425ac79c4..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
shell
-} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/slow.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/slow.$id.tsx deleted file mode 100644 index 61bbf328b7..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/src/routes/slow.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { getSlowLoaderDeferred } from '../../../slow-loaders' - -export const Route = createFileRoute('/slow/$id')({ - loader: async ({ params }) => { - const deferred = getSlowLoaderDeferred(params.id) - - return await deferred.promise - }, - component: SlowComponent, -}) - -function SlowComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data.kind}:${data.id}:${data.ts}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/tsconfig.json b/benchmarks/memory/client/scenarios/interrupted-navigations/react/tsconfig.json deleted file mode 100644 index ea566061d9..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts deleted file mode 100644 index 0f05cedf40..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client interrupted-navigations (react)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/shared.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/shared.ts deleted file mode 100644 index 80f234f0c8..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/shared.ts +++ /dev/null @@ -1,297 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, -} from '#memory-client/bench-utils' -import { - createBenchContainer, - drainMicrotasks, - nextAnimationFrame, - noop, - removeBenchContainer, - warnClientMemoryDevMode, -} from '#memory-client/lifecycle' -import type { Framework, MountTestApp } from '#memory-client/lifecycle' - -type NavigationSettlement = - | { - status: 'fulfilled' - value: void - } - | { - status: 'rejected' - reason: unknown - } - -type ResolveAllSlowLoaders = () => void -type ResolveSlowLoader = (id: string) => void -type SlowLoaderRegistry = { - has: (id: string) => boolean -} - -type RenderedEvent = { - toLocation: { - pathname: string - } -} - -type InterruptedNavigationRouter = { - load: () => Promise - navigate: (options: { - to: '/fast/$id' | '/slow/$id' - params: { id: string } - replace: true - }) => Promise - subscribe: ( - event: 'onRendered', - listener: (event: RenderedEvent) => void, - ) => () => void -} - -const interruptedNavigationIterations = 150 -const interruptedNavigationPairs = createInterruptedNavigationPairs( - interruptedNavigationIterations, -) - -const uninitialized = () => - Promise.reject( - new Error('interrupted-navigations benchmark is not initialized'), - ) - -const uninitializedSettlement = () => - Promise.resolve({ - status: 'rejected', - reason: new Error('interrupted-navigations benchmark is not initialized'), - }) - -function createInterruptedNavigationPairs(iterations: number) { - const random = createDeterministicRandom(13) - - return Array.from({ length: iterations }, (_, index) => ({ - slowId: `slow-${index}-${randomSegment(random)}`, - fastId: `fast-${index}-${randomSegment(random)}`, - })) -} - -function formatReason(reason: unknown) { - if (reason instanceof Error) { - return `${reason.name}: ${reason.message}` - } - - return String(reason) -} - -function assertSlowNavigationSettlement(settlement: NavigationSettlement) { - if (settlement.status === 'fulfilled') { - if (settlement.value !== undefined) { - throw new Error('Expected slow navigation to fulfill with undefined') - } - - return - } - - if ( - reasonHasAbortShape(settlement.reason) || - reasonHasCancellationShape(settlement.reason) - ) { - return - } - - throw new Error( - `Expected slow navigation to settle as void or cancellation, got ${formatReason( - settlement.reason, - )}`, - ) -} - -function reasonHasAbortShape(reason: unknown) { - return reason instanceof DOMException && reason.name === 'AbortError' -} - -function reasonHasCancellationShape(reason: unknown) { - return ( - reason instanceof Error && - (reason.name === 'AbortError' || reason.name === 'CancelledError') - ) -} - -export function createWorkload( - framework: Framework, - mountTestApp: MountTestApp, - resolveAllSlowLoaders: ResolveAllSlowLoaders, - resolveSlowLoader: ResolveSlowLoader, - slowLoaderRegistry: SlowLoaderRegistry, -) { - warnClientMemoryDevMode(framework) - - let container: HTMLDivElement | undefined = undefined - let unmount = noop - let unsub = noop - let resolveRendered: () => void = noop - let expectedRenderedPath: string | undefined = undefined - let navigateFast: (id: string) => Promise = uninitialized - let startSlowNavigation: (id: string) => Promise = - uninitializedSettlement - - function assertRenderedPage(page: 'shell' | 'fast', id?: string) { - const element = container?.querySelector('[data-bench-page]') - const actualPage = element?.dataset.benchPage - const actualId = element?.dataset.benchId - - if (actualPage !== page) { - throw new Error(`Expected rendered page ${page}, got ${actualPage}`) - } - - if (id !== undefined && actualId !== id) { - throw new Error(`Expected rendered id ${id}, got ${actualId}`) - } - } - - async function waitForRenderedPage(page: 'shell' | 'fast', id?: string) { - for (let attempt = 0; attempt < 10; attempt++) { - try { - assertRenderedPage(page, id) - return - } catch { - await nextAnimationFrame() - } - } - - assertRenderedPage(page, id) - } - - async function waitForSlowLoader(id: string) { - for (let attempt = 0; attempt < 20; attempt++) { - if (slowLoaderRegistry.has(id)) { - return - } - - await drainMicrotasks() - } - - throw new Error(`Slow loader was not registered for id: ${id}`) - } - - function waitForNextRender(pathname: string) { - expectedRenderedPath = pathname - - return new Promise((resolve) => { - resolveRendered = resolve - }) - } - - async function before() { - if (container) { - after() - } - - container = createBenchContainer() - - const mounted = mountTestApp(container) - const router = mounted.router as InterruptedNavigationRouter - unmount = mounted.unmount - - unsub = router.subscribe('onRendered', (event) => { - if ( - expectedRenderedPath && - event.toLocation.pathname !== expectedRenderedPath - ) { - return - } - - const resolve = resolveRendered - resolveRendered = noop - expectedRenderedPath = undefined - resolve() - }) - - navigateFast = async (id) => { - const rendered = waitForNextRender(`/fast/${id}`) - await Promise.all([ - router.navigate({ - to: '/fast/$id', - params: { id }, - replace: true, - }), - rendered, - ]) - } - - startSlowNavigation = (id) => { - const navigation = router.navigate({ - to: '/slow/$id', - params: { id }, - replace: true, - }) - - return navigation - .then((value): NavigationSettlement => ({ status: 'fulfilled', value })) - .catch( - (reason: unknown): NavigationSettlement => ({ - status: 'rejected', - reason, - }), - ) - } - - await router.load() - await waitForRenderedPage('shell') - } - - function after() { - resolveAllSlowLoaders() - unmount() - removeBenchContainer(container) - unsub() - - container = undefined - unmount = noop - unsub = noop - resolveRendered = noop - expectedRenderedPath = undefined - navigateFast = uninitialized - startSlowNavigation = uninitializedSettlement - } - - async function interrupt( - slowId: string, - fastId: string, - assertSettlement = true, - ) { - const slowNavigation = startSlowNavigation(slowId) - - await waitForSlowLoader(slowId) - await navigateFast(fastId) - resolveSlowLoader(slowId) - - const settlement = await slowNavigation - - if (assertSettlement) { - assertSlowNavigationSettlement(settlement) - } - - await drainMicrotasks() - } - - return { - name: `mem client interrupted-navigations (${framework})`, - before, - interrupt, - async run() { - for (const pair of interruptedNavigationPairs) { - await interrupt(pair.slowId, pair.fastId) - } - }, - async sanity() { - await before() - - try { - assertRenderedPage('shell') - await interrupt('sanity-slow', 'sanity-fast', false) - assertRenderedPage('fast', 'sanity-fast') - } finally { - after() - } - }, - after, - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/slow-loaders.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/slow-loaders.ts deleted file mode 100644 index c70ccac3da..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/slow-loaders.ts +++ /dev/null @@ -1,54 +0,0 @@ -export const fixedTimestamp = 1_700_000_000_000 - -type SlowLoaderPayload = { - id: string - kind: 'slow' - ts: number -} - -type SlowLoaderDeferred = { - promise: Promise - resolve: () => void -} - -export const slowLoaderRegistry = new Map() - -export function getSlowLoaderDeferred(id: string) { - const existing = slowLoaderRegistry.get(id) - - if (existing) { - return existing - } - - let resolvePromise!: (payload: SlowLoaderPayload) => void - const promise = new Promise((resolve) => { - resolvePromise = resolve - }) - - const deferred: SlowLoaderDeferred = { - promise, - resolve() { - slowLoaderRegistry.delete(id) - resolvePromise({ id, kind: 'slow', ts: fixedTimestamp }) - }, - } - - slowLoaderRegistry.set(id, deferred) - return deferred -} - -export function resolveSlowLoader(id: string) { - const deferred = slowLoaderRegistry.get(id) - - if (!deferred) { - throw new Error(`No pending slow loader for id: ${id}`) - } - - deferred.resolve() -} - -export function resolveAllSlowLoaders() { - for (const id of Array.from(slowLoaderRegistry.keys())) { - resolveSlowLoader(id) - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/project.json b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/project.json deleted file mode 100644 index 4aff39500e..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-interrupted-navigations-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/setup.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/setup.ts deleted file mode 100644 index e736111663..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/setup.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { - mountTestApp, - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -} = (await import(/* @vite-ignore */ appModulePath)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'solid', - mountTestApp, - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx deleted file mode 100644 index 6288b5fab1..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/app.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { getRouter } from './router' - -export { - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -} from '../../slow-loaders' - -export function mountTestApp(container: Element) { - const router = getRouter() - const dispose = render(() => , container) - let didUnmount = false - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - dispose() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routeTree.gen.ts deleted file mode 100644 index f42255963c..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 SlowIdRouteImport } from './routes/slow.$id' -import { Route as FastIdRouteImport } from './routes/fast.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const SlowIdRoute = SlowIdRouteImport.update({ - id: '/slow/$id', - path: '/slow/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FastIdRoute = FastIdRouteImport.update({ - id: '/fast/$id', - path: '/fast/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/fast/$id' | '/slow/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/fast/$id' | '/slow/$id' - id: '__root__' | '/' | '/fast/$id' | '/slow/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - FastIdRoute: typeof FastIdRoute - SlowIdRoute: typeof SlowIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/slow/$id': { - id: '/slow/$id' - path: '/slow/$id' - fullPath: '/slow/$id' - preLoaderRoute: typeof SlowIdRouteImport - parentRoute: typeof rootRouteImport - } - '/fast/$id': { - id: '/fast/$id' - path: '/fast/$id' - fullPath: '/fast/$id' - preLoaderRoute: typeof FastIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - FastIdRoute: FastIdRoute, - SlowIdRoute: SlowIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/router.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/router.tsx deleted file mode 100644 index 884aa3438f..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/'], - }), - routeTree, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/fast.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/fast.$id.tsx deleted file mode 100644 index 511e4712b7..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/fast.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { fixedTimestamp } from '../../../slow-loaders' - -export const Route = createFileRoute('/fast/$id')({ - loader: ({ params }) => ({ - id: params.id, - kind: 'fast' as const, - ts: fixedTimestamp, - }), - component: FastComponent, -}) - -function FastComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data().kind}:${data().id}:${data().ts}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/index.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/index.tsx deleted file mode 100644 index 592b2d666e..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
shell
-} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/slow.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/slow.$id.tsx deleted file mode 100644 index 9aaaef5568..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/src/routes/slow.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { getSlowLoaderDeferred } from '../../../slow-loaders' - -export const Route = createFileRoute('/slow/$id')({ - loader: async ({ params }) => { - const deferred = getSlowLoaderDeferred(params.id) - - return await deferred.promise - }, - component: SlowComponent, -}) - -function SlowComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data().kind}:${data().id}:${data().ts}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json deleted file mode 100644 index b12dcb7ade..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts deleted file mode 100644 index 26ff0b5c8c..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/solid/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client interrupted-navigations (solid)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/project.json b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/project.json deleted file mode 100644 index 01288cb235..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-interrupted-navigations-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/setup.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/setup.ts deleted file mode 100644 index 260e45b64b..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/setup.ts +++ /dev/null @@ -1,19 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { - mountTestApp, - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -} = (await import(/* @vite-ignore */ appModulePath)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'vue', - mountTestApp, - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/app.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/app.tsx deleted file mode 100644 index 1abb4410dc..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/app.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { RouterProvider } from '@tanstack/vue-router' -import { createApp } from 'vue' -import { getRouter } from './router' -import type {} from '@tanstack/router-core' - -export { - resolveAllSlowLoaders, - resolveSlowLoader, - slowLoaderRegistry, -} from '../../slow-loaders' - -export function mountTestApp(container: Element) { - const router = getRouter() - const vueApp = createApp({ - setup() { - return () => - }, - }) - let didUnmount = false - - vueApp.mount(container) - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - vueApp.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routeTree.gen.ts deleted file mode 100644 index 5ea61a89a3..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 SlowIdRouteImport } from './routes/slow.$id' -import { Route as FastIdRouteImport } from './routes/fast.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const SlowIdRoute = SlowIdRouteImport.update({ - id: '/slow/$id', - path: '/slow/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FastIdRoute = FastIdRouteImport.update({ - id: '/fast/$id', - path: '/fast/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/fast/$id': typeof FastIdRoute - '/slow/$id': typeof SlowIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/fast/$id' | '/slow/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/fast/$id' | '/slow/$id' - id: '__root__' | '/' | '/fast/$id' | '/slow/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - FastIdRoute: typeof FastIdRoute - SlowIdRoute: typeof SlowIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/slow/$id': { - id: '/slow/$id' - path: '/slow/$id' - fullPath: '/slow/$id' - preLoaderRoute: typeof SlowIdRouteImport - parentRoute: typeof rootRouteImport - } - '/fast/$id': { - id: '/fast/$id' - path: '/fast/$id' - fullPath: '/fast/$id' - preLoaderRoute: typeof FastIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - FastIdRoute: FastIdRoute, - SlowIdRoute: SlowIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/router.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/router.tsx deleted file mode 100644 index 4655fe8424..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/'], - }), - routeTree, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx deleted file mode 100644 index f6dc9ac3bd..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/fast.$id.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { fixedTimestamp } from '../../../slow-loaders' - -const FastComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
- {`${data.value.kind}:${data.value.id}:${data.value.ts}`} -
- ) - }, -}) - -export const Route = createFileRoute('/fast/$id')({ - loader: ({ params }: { params: { id: string } }) => ({ - id: params.id, - kind: 'fast' as const, - ts: fixedTimestamp, - }), - component: FastComponent, -}) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/index.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/index.tsx deleted file mode 100644 index c30a51e1e5..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
shell
-} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx deleted file mode 100644 index 3b5bb75ede..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/src/routes/slow.$id.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { getSlowLoaderDeferred } from '../../../slow-loaders' - -const SlowComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
- {`${data.value.kind}:${data.value.id}:${data.value.ts}`} -
- ) - }, -}) - -export const Route = createFileRoute('/slow/$id')({ - loader: async ({ params }: { params: { id: string } }) => { - const deferred = getSlowLoaderDeferred(params.id) - - return await deferred.promise - }, - component: SlowComponent, -}) diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/tsconfig.json b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/tsconfig.json deleted file mode 100644 index 9a5872a4c0..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts b/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts deleted file mode 100644 index 02574908d2..0000000000 --- a/benchmarks/memory/client/scenarios/interrupted-navigations/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client interrupted-navigations (vue)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/loader-data.ts b/benchmarks/memory/client/scenarios/loader-data-retention/loader-data.ts deleted file mode 100644 index 3bd59c82ef..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/loader-data.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, -} from '#memory-client/bench-utils' - -export const loaderPayloadRecordCount = 512 - -const loaderPayloadCharsPerRecord = 1024 - -type LoaderRecord = { - key: string - value: string -} - -export function createLoaderData(id: string) { - const random = createDeterministicRandom(hashId(id)) - const records: Array = [] - - for (let index = 0; index < loaderPayloadRecordCount; index++) { - records.push({ - key: `${id}:${index}:${randomSegment(random)}`, - value: createRecordValue(id, index, random), - }) - } - - return { id, records } -} - -function createRecordValue(id: string, index: number, random: () => number) { - const firstSegment = randomSegment(random) - const secondSegment = randomSegment(random) - const segment = `${id}:${index}:${firstSegment}:${secondSegment}:` - - return segment - .repeat(Math.ceil(loaderPayloadCharsPerRecord / segment.length)) - .slice(0, loaderPayloadCharsPerRecord) -} - -function hashId(id: string) { - let hash = 2166136261 - - for (let index = 0; index < id.length; index++) { - hash ^= id.charCodeAt(index) - hash = Math.imul(hash, 16777619) - } - - return hash >>> 0 -} 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 deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/project.json b/benchmarks/memory/client/scenarios/loader-data-retention/react/project.json deleted file mode 100644 index 713038e20f..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-loader-data-retention-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/setup.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/setup.ts deleted file mode 100644 index fafaf13e6f..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { loaderPayloadRecordCount, mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'react', - mountTestApp, - loaderPayloadRecordCount, -) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/app.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/app.tsx deleted file mode 100644 index 5eef150c2c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/app.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { getRouter } from './router' - -export { loaderPayloadRecordCount } from '../../loader-data' - -export function mountTestApp(container: Element) { - const router = getRouter() - const reactRoot = createRoot(container) - let didUnmount = false - - reactRoot.render() - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - reactRoot.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routeTree.gen.ts deleted file mode 100644 index ea96d809c8..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routeTree.gen.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* 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 ShellRouteImport } from './routes/shell' -import { Route as PageIdRouteImport } from './routes/page.$id' -import { Route as ShellIndexRouteImport } from './routes/shell.index' - -const ShellRoute = ShellRouteImport.update({ - id: '/shell', - path: '/shell', - getParentRoute: () => rootRouteImport, -} as any) -const PageIdRoute = PageIdRouteImport.update({ - id: '/page/$id', - path: '/page/$id', - getParentRoute: () => rootRouteImport, -} as any) -const ShellIndexRoute = ShellIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => ShellRoute, -} as any) - -export interface FileRoutesByFullPath { - '/shell': typeof ShellRouteWithChildren - '/page/$id': typeof PageIdRoute - '/shell/': typeof ShellIndexRoute -} -export interface FileRoutesByTo { - '/page/$id': typeof PageIdRoute - '/shell': typeof ShellIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/shell': typeof ShellRouteWithChildren - '/page/$id': typeof PageIdRoute - '/shell/': typeof ShellIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/shell' | '/page/$id' | '/shell/' - fileRoutesByTo: FileRoutesByTo - to: '/page/$id' | '/shell' - id: '__root__' | '/shell' | '/page/$id' | '/shell/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ShellRoute: typeof ShellRouteWithChildren - PageIdRoute: typeof PageIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/shell': { - id: '/shell' - path: '/shell' - fullPath: '/shell' - preLoaderRoute: typeof ShellRouteImport - parentRoute: typeof rootRouteImport - } - '/page/$id': { - id: '/page/$id' - path: '/page/$id' - fullPath: '/page/$id' - preLoaderRoute: typeof PageIdRouteImport - parentRoute: typeof rootRouteImport - } - '/shell/': { - id: '/shell/' - path: '/' - fullPath: '/shell/' - preLoaderRoute: typeof ShellIndexRouteImport - parentRoute: typeof ShellRoute - } - } -} - -interface ShellRouteChildren { - ShellIndexRoute: typeof ShellIndexRoute -} - -const ShellRouteChildren: ShellRouteChildren = { - ShellIndexRoute: ShellIndexRoute, -} - -const ShellRouteWithChildren = ShellRoute._addFileChildren(ShellRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ShellRoute: ShellRouteWithChildren, - PageIdRoute: PageIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/router.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/router.tsx deleted file mode 100644 index 5a5c8210d9..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/router.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/shell'], - }), - routeTree, - defaultGcTime: 0, - defaultPreloadGcTime: 0, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/page.$id.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/page.$id.tsx deleted file mode 100644 index 63af9ed429..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/page.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { createLoaderData } from '../../../loader-data' - -export const Route = createFileRoute('/page/$id')({ - loader: ({ params }) => createLoaderData(params.id), - component: PageComponent, -}) - -function PageComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data.id}:${data.records.length}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/shell.index.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/shell.index.tsx deleted file mode 100644 index d78bb8bfb9..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/shell.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/shell/')({ - component: ShellIndexComponent, -}) - -function ShellIndexComponent() { - return
ready
-} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/shell.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/shell.tsx deleted file mode 100644 index 024a58c243..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/src/routes/shell.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/shell')({ - component: ShellComponent, -}) - -function ShellComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/tsconfig.json b/benchmarks/memory/client/scenarios/loader-data-retention/react/tsconfig.json deleted file mode 100644 index ea566061d9..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts b/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts deleted file mode 100644 index 8630417936..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client loader-data-retention (react)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/shared.ts b/benchmarks/memory/client/scenarios/loader-data-retention/shared.ts deleted file mode 100644 index bd90c023f0..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/shared.ts +++ /dev/null @@ -1,187 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, -} from '#memory-client/bench-utils' -import { - createBenchContainer, - nextAnimationFrame, - noop, - removeBenchContainer, - warnClientMemoryDevMode, -} from '#memory-client/lifecycle' -import type { Framework, MountTestApp } from '#memory-client/lifecycle' - -type RenderEvent = { - toLocation: { - pathname: string - } -} - -type LoaderDataRouter = { - load: () => Promise - navigate: (options: { - to: '/page/$id' - params: { id: string } - replace: true - }) => Promise - subscribe: ( - event: 'onRendered', - listener: (event: RenderEvent) => void, - ) => () => void -} - -const loaderDataRetentionNavigationCount = 20 -const pageIds = createPageIds() - -const uninitialized = () => - Promise.reject( - new Error('loader-data-retention benchmark is not initialized'), - ) - -function createPageIds() { - const random = createDeterministicRandom(11) - - return Array.from( - { length: loaderDataRetentionNavigationCount }, - (_, index) => `${index}-${randomSegment(random)}`, - ) -} - -export function createWorkload( - framework: Framework, - mountTestApp: MountTestApp, - loaderPayloadRecordCount: number, -) { - warnClientMemoryDevMode(framework) - - let container: HTMLDivElement | undefined = undefined - let unmount = noop - let unsub = noop - let resolveRendered: () => void = noop - let expectedRenderedPath: string | undefined = undefined - let navigateTo: (id: string) => Promise = uninitialized - - function assertRenderedShell() { - const actual = - container?.querySelector('[data-bench-page]')?.dataset - .benchPage - - if (actual !== 'shell') { - throw new Error(`Expected rendered shell page, got ${actual}`) - } - } - - function assertRenderedPage(id: string) { - const page = container?.querySelector( - '[data-bench-page="page"]', - ) - const actualId = page?.dataset.benchId - const actualCount = page?.dataset.benchCount - const expectedCount = String(loaderPayloadRecordCount) - - if (actualId !== id || actualCount !== expectedCount) { - throw new Error( - `Expected rendered page ${id}:${expectedCount}, got ${actualId}:${actualCount}`, - ) - } - } - - async function waitForRenderedShell() { - for (let attempt = 0; attempt < 10; attempt++) { - try { - assertRenderedShell() - return - } catch { - await nextAnimationFrame() - } - } - - assertRenderedShell() - } - - function waitForNextRender(pathname: string) { - expectedRenderedPath = pathname - - return new Promise((resolve) => { - resolveRendered = resolve - }) - } - - async function before() { - if (container) { - after() - } - - container = createBenchContainer() - - const mounted = mountTestApp(container) - const router = mounted.router as LoaderDataRouter - unmount = mounted.unmount - - unsub = router.subscribe('onRendered', (event) => { - if ( - expectedRenderedPath && - event.toLocation.pathname !== expectedRenderedPath - ) { - return - } - - const resolve = resolveRendered - resolveRendered = noop - expectedRenderedPath = undefined - resolve() - }) - - navigateTo = async (id) => { - const pathname = `/page/${id}` - const rendered = waitForNextRender(pathname) - - await router.navigate({ - to: '/page/$id', - params: { id }, - replace: true, - }) - await rendered - assertRenderedPage(id) - } - - await router.load() - await waitForRenderedShell() - } - - function after() { - unmount() - removeBenchContainer(container) - unsub() - - container = undefined - unmount = noop - unsub = noop - resolveRendered = noop - expectedRenderedPath = undefined - navigateTo = uninitialized - } - - return { - name: `mem client loader-data-retention (${framework})`, - before, - navigate: (id: string) => navigateTo(id), - async run() { - for (const id of pageIds) { - await navigateTo(id) - } - }, - async sanity() { - await before() - - try { - assertRenderedShell() - await navigateTo('sanity-a') - assertRenderedPage('sanity-a') - } finally { - after() - } - }, - after, - } -} 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 deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/project.json b/benchmarks/memory/client/scenarios/loader-data-retention/solid/project.json deleted file mode 100644 index 6c85f51896..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-loader-data-retention-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/setup.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/setup.ts deleted file mode 100644 index b7c80a3e49..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { loaderPayloadRecordCount, mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'solid', - mountTestApp, - loaderPayloadRecordCount, -) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx deleted file mode 100644 index 4315a4b15c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/app.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { getRouter } from './router' - -export { loaderPayloadRecordCount } from '../../loader-data' - -export function mountTestApp(container: Element) { - const router = getRouter() - const dispose = render(() => , container) - let didUnmount = false - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - dispose() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routeTree.gen.ts deleted file mode 100644 index a1946d187d..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* 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 ShellRouteImport } from './routes/shell' -import { Route as ShellIndexRouteImport } from './routes/shell.index' -import { Route as PageIdRouteImport } from './routes/page.$id' - -const ShellRoute = ShellRouteImport.update({ - id: '/shell', - path: '/shell', - getParentRoute: () => rootRouteImport, -} as any) -const ShellIndexRoute = ShellIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => ShellRoute, -} as any) -const PageIdRoute = PageIdRouteImport.update({ - id: '/page/$id', - path: '/page/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/shell': typeof ShellRouteWithChildren - '/page/$id': typeof PageIdRoute - '/shell/': typeof ShellIndexRoute -} -export interface FileRoutesByTo { - '/page/$id': typeof PageIdRoute - '/shell': typeof ShellIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/shell': typeof ShellRouteWithChildren - '/page/$id': typeof PageIdRoute - '/shell/': typeof ShellIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/shell' | '/page/$id' | '/shell/' - fileRoutesByTo: FileRoutesByTo - to: '/page/$id' | '/shell' - id: '__root__' | '/shell' | '/page/$id' | '/shell/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ShellRoute: typeof ShellRouteWithChildren - PageIdRoute: typeof PageIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/shell': { - id: '/shell' - path: '/shell' - fullPath: '/shell' - preLoaderRoute: typeof ShellRouteImport - parentRoute: typeof rootRouteImport - } - '/shell/': { - id: '/shell/' - path: '/' - fullPath: '/shell/' - preLoaderRoute: typeof ShellIndexRouteImport - parentRoute: typeof ShellRoute - } - '/page/$id': { - id: '/page/$id' - path: '/page/$id' - fullPath: '/page/$id' - preLoaderRoute: typeof PageIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -interface ShellRouteChildren { - ShellIndexRoute: typeof ShellIndexRoute -} - -const ShellRouteChildren: ShellRouteChildren = { - ShellIndexRoute: ShellIndexRoute, -} - -const ShellRouteWithChildren = ShellRoute._addFileChildren(ShellRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ShellRoute: ShellRouteWithChildren, - PageIdRoute: PageIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/router.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/router.tsx deleted file mode 100644 index 06afdb10d3..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/router.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/shell'], - }), - routeTree, - defaultGcTime: 0, - defaultPreloadGcTime: 0, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/page.$id.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/page.$id.tsx deleted file mode 100644 index fb6c438fa5..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/page.$id.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createLoaderData } from '../../../loader-data' - -export const Route = createFileRoute('/page/$id')({ - loader: ({ params }) => createLoaderData(params.id), - component: PageComponent, -}) - -function PageComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data().id}:${data().records.length}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/shell.index.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/shell.index.tsx deleted file mode 100644 index 2f4f5daee2..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/shell.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/shell/')({ - component: ShellIndexComponent, -}) - -function ShellIndexComponent() { - return
ready
-} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/shell.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/shell.tsx deleted file mode 100644 index c1e38a1aaf..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/src/routes/shell.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/shell')({ - component: ShellComponent, -}) - -function ShellComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json b/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json deleted file mode 100644 index b12dcb7ade..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts b/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts deleted file mode 100644 index 5dfd5b53fe..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/solid/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client loader-data-retention (solid)', - watch: false, - environment: 'jsdom', - }, -}) 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 deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/project.json b/benchmarks/memory/client/scenarios/loader-data-retention/vue/project.json deleted file mode 100644 index 22504c906f..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-loader-data-retention-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/setup.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/setup.ts deleted file mode 100644 index a83a1f70d1..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { loaderPayloadRecordCount, mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'vue', - mountTestApp, - loaderPayloadRecordCount, -) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/app.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/app.tsx deleted file mode 100644 index c843b4feb5..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/app.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { RouterProvider } from '@tanstack/vue-router' -import { createApp } from 'vue' -import { getRouter } from './router' -import type {} from '@tanstack/router-core' - -export { loaderPayloadRecordCount } from '../../loader-data' - -export function mountTestApp(container: Element) { - const router = getRouter() - const vueApp = createApp({ - setup() { - return () => - }, - }) - let didUnmount = false - - vueApp.mount(container) - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - vueApp.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routeTree.gen.ts deleted file mode 100644 index 5b09d365e7..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,102 +0,0 @@ -/* 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 ShellRouteImport } from './routes/shell' -import { Route as PageIdRouteImport } from './routes/page.$id' -import { Route as ShellIndexRouteImport } from './routes/shell.index' - -const ShellRoute = ShellRouteImport.update({ - id: '/shell', - path: '/shell', - getParentRoute: () => rootRouteImport, -} as any) -const PageIdRoute = PageIdRouteImport.update({ - id: '/page/$id', - path: '/page/$id', - getParentRoute: () => rootRouteImport, -} as any) -const ShellIndexRoute = ShellIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => ShellRoute, -} as any) - -export interface FileRoutesByFullPath { - '/shell': typeof ShellRouteWithChildren - '/page/$id': typeof PageIdRoute - '/shell/': typeof ShellIndexRoute -} -export interface FileRoutesByTo { - '/page/$id': typeof PageIdRoute - '/shell': typeof ShellIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/shell': typeof ShellRouteWithChildren - '/page/$id': typeof PageIdRoute - '/shell/': typeof ShellIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/shell' | '/page/$id' | '/shell/' - fileRoutesByTo: FileRoutesByTo - to: '/page/$id' | '/shell' - id: '__root__' | '/shell' | '/page/$id' | '/shell/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ShellRoute: typeof ShellRouteWithChildren - PageIdRoute: typeof PageIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/shell': { - id: '/shell' - path: '/shell' - fullPath: '/shell' - preLoaderRoute: typeof ShellRouteImport - parentRoute: typeof rootRouteImport - } - '/page/$id': { - id: '/page/$id' - path: '/page/$id' - fullPath: '/page/$id' - preLoaderRoute: typeof PageIdRouteImport - parentRoute: typeof rootRouteImport - } - '/shell/': { - id: '/shell/' - path: '/' - fullPath: '/shell/' - preLoaderRoute: typeof ShellIndexRouteImport - parentRoute: typeof ShellRoute - } - } -} - -interface ShellRouteChildren { - ShellIndexRoute: typeof ShellIndexRoute -} - -const ShellRouteChildren: ShellRouteChildren = { - ShellIndexRoute: ShellIndexRoute, -} - -const ShellRouteWithChildren = ShellRoute._addFileChildren(ShellRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ShellRoute: ShellRouteWithChildren, - PageIdRoute: PageIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/router.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/router.tsx deleted file mode 100644 index 84286e1dae..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/router.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/shell'], - }), - routeTree, - defaultGcTime: 0, - defaultPreloadGcTime: 0, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx deleted file mode 100644 index 38f1d2614c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/page.$id.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { createLoaderData } from '../../../loader-data' - -const PageComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
- {`${data.value.id}:${data.value.records.length}`} -
- ) - }, -}) - -export const Route = createFileRoute('/page/$id')({ - loader: ({ params }: { params: { id: string } }) => - createLoaderData(params.id), - component: PageComponent, -}) diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/shell.index.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/shell.index.tsx deleted file mode 100644 index 640ffeeb5c..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/shell.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/shell/')({ - component: ShellIndexComponent, -}) - -function ShellIndexComponent() { - return
ready
-} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/shell.tsx b/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/shell.tsx deleted file mode 100644 index f8a598bc34..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/src/routes/shell.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/shell')({ - component: ShellComponent, -}) - -function ShellComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/tsconfig.json b/benchmarks/memory/client/scenarios/loader-data-retention/vue/tsconfig.json deleted file mode 100644 index 9a5872a4c0..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts b/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts deleted file mode 100644 index 006636eaa0..0000000000 --- a/benchmarks/memory/client/scenarios/loader-data-retention/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client loader-data-retention (vue)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/project.json b/benchmarks/memory/client/scenarios/mount-unmount/react/project.json deleted file mode 100644 index 05d8aaa4bf..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-mount-unmount-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/setup.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/setup.ts deleted file mode 100644 index 70603b5c34..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'react', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/src/app.tsx b/benchmarks/memory/client/scenarios/mount-unmount/react/src/app.tsx deleted file mode 100644 index bdf76eaa24..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/src/app.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { getRouter } from './router' - -export function mountTestApp(container: Element) { - const router = getRouter() - const reactRoot = createRoot(container) - let didUnmount = false - - reactRoot.render() - - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - reactRoot.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/src/routeTree.gen.ts deleted file mode 100644 index 5efcb2cf72..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/src/routeTree.gen.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 ARouteImport } from './routes/a' - -const ARoute = ARouteImport.update({ - id: '/a', - path: '/a', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/a': typeof ARoute -} -export interface FileRoutesByTo { - '/a': typeof ARoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a': typeof ARoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a' - fileRoutesByTo: FileRoutesByTo - to: '/a' - id: '__root__' | '/a' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/a': { - id: '/a' - path: '/a' - fullPath: '/a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/src/router.tsx b/benchmarks/memory/client/scenarios/mount-unmount/react/src/router.tsx deleted file mode 100644 index 9cb85c5a1b..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/a'], - }), - routeTree, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/mount-unmount/react/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/src/routes/a.tsx b/benchmarks/memory/client/scenarios/mount-unmount/react/src/routes/a.tsx deleted file mode 100644 index 1e268d3c42..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/src/routes/a.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/a')({ - loader: () => ({ id: 'a' }), - component: AComponent, -}) - -function AComponent() { - const data = Route.useLoaderData() - - return
{data.id}
-} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/tsconfig.json b/benchmarks/memory/client/scenarios/mount-unmount/react/tsconfig.json deleted file mode 100644 index ea566061d9..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts b/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts deleted file mode 100644 index a08352a837..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client mount-unmount (react)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/shared.ts b/benchmarks/memory/client/scenarios/mount-unmount/shared.ts deleted file mode 100644 index 01cfe8c46a..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/shared.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - createBenchContainer, - drainMicrotasks, - noop, - removeBenchContainer, - warnClientMemoryDevMode, -} from '#memory-client/lifecycle' -import type { Framework, MountTestApp } from '#memory-client/lifecycle' - -type RenderRouter = { - load: () => Promise - subscribe: (event: 'onRendered', listener: () => void) => () => void -} - -const mountUnmountIterations = 100 - -function assertEmptyBody() { - if (document.body.childNodes.length !== 0) { - throw new Error( - `Expected document.body to be empty, found ${document.body.childNodes.length} child node(s)`, - ) - } -} - -export function createWorkload( - framework: Framework, - mountTestApp: MountTestApp, -) { - warnClientMemoryDevMode(framework) - - async function cycle() { - const container = createBenchContainer() - - let unmount = noop - let unsubscribe = noop - - try { - const mounted = mountTestApp(container) - const router = mounted.router as RenderRouter - unmount = mounted.unmount - - const rendered = new Promise((resolve) => { - unsubscribe = router.subscribe('onRendered', () => { - resolve() - }) - }) - - await router.load() - await rendered - unsubscribe() - unsubscribe = noop - } finally { - unmount() - removeBenchContainer(container) - unsubscribe() - await drainMicrotasks() - } - } - - return { - name: `mem client mount-unmount (${framework})`, - cycle, - async run() { - for (let index = 0; index < mountUnmountIterations; index++) { - await cycle() - } - }, - async sanity() { - assertEmptyBody() - await cycle() - assertEmptyBody() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/project.json b/benchmarks/memory/client/scenarios/mount-unmount/solid/project.json deleted file mode 100644 index 63e8e950db..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-mount-unmount-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/setup.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/setup.ts deleted file mode 100644 index 493425c6a2..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'solid', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx deleted file mode 100644 index b23bc126d5..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/app.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { getRouter } from './router' - -export function mountTestApp(container: Element) { - const router = getRouter() - const dispose = render(() => , container) - let didUnmount = false - - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - dispose() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routeTree.gen.ts deleted file mode 100644 index a3f9739290..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 ARouteImport } from './routes/a' - -const ARoute = ARouteImport.update({ - id: '/a', - path: '/a', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/a': typeof ARoute -} -export interface FileRoutesByTo { - '/a': typeof ARoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a': typeof ARoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a' - fileRoutesByTo: FileRoutesByTo - to: '/a' - id: '__root__' | '/a' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/a': { - id: '/a' - path: '/a' - fullPath: '/a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/router.tsx b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/router.tsx deleted file mode 100644 index e8c14f12f6..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/a'], - }), - routeTree, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routes/a.tsx b/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routes/a.tsx deleted file mode 100644 index 36c4be538c..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/src/routes/a.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/a')({ - loader: () => ({ id: 'a' }), - component: AComponent, -}) - -function AComponent() { - const data = Route.useLoaderData() - - return
{data().id}
-} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json b/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json deleted file mode 100644 index b12dcb7ade..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts b/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts deleted file mode 100644 index 33699639de..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/solid/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client mount-unmount (solid)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/project.json b/benchmarks/memory/client/scenarios/mount-unmount/vue/project.json deleted file mode 100644 index 157673cf16..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-mount-unmount-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/setup.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/setup.ts deleted file mode 100644 index a38df04788..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'vue', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/app.tsx b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/app.tsx deleted file mode 100644 index 27b82fcbe1..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/app.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { RouterProvider } from '@tanstack/vue-router' -import { createApp } from 'vue' -import { getRouter } from './router' -import type {} from '@tanstack/router-core' - -export function mountTestApp(container: Element) { - const router = getRouter() - const vueApp = createApp({ - setup() { - return () => - }, - }) - let didUnmount = false - - vueApp.mount(container) - - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - vueApp.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routeTree.gen.ts deleted file mode 100644 index 1a54b81033..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 ARouteImport } from './routes/a' - -const ARoute = ARouteImport.update({ - id: '/a', - path: '/a', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/a': typeof ARoute -} -export interface FileRoutesByTo { - '/a': typeof ARoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a': typeof ARoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a' - fileRoutesByTo: FileRoutesByTo - to: '/a' - id: '__root__' | '/a' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/a': { - id: '/a' - path: '/a' - fullPath: '/a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/router.tsx b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/router.tsx deleted file mode 100644 index e083495cd2..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/a'], - }), - routeTree, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx b/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx deleted file mode 100644 index 0dd650e1dd..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/src/routes/a.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const AComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () =>
{data.value.id}
- }, -}) - -export const Route = createFileRoute('/a')({ - loader: () => ({ id: 'a' }), - component: AComponent, -}) diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/tsconfig.json b/benchmarks/memory/client/scenarios/mount-unmount/vue/tsconfig.json deleted file mode 100644 index 9a5872a4c0..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts b/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts deleted file mode 100644 index a3f0eeaa8c..0000000000 --- a/benchmarks/memory/client/scenarios/mount-unmount/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client mount-unmount (vue)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/project.json b/benchmarks/memory/client/scenarios/navigation-churn/react/project.json deleted file mode 100644 index b424277bc6..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-navigation-churn-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/setup.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/setup.ts deleted file mode 100644 index 70603b5c34..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'react', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/src/app.tsx b/benchmarks/memory/client/scenarios/navigation-churn/react/src/app.tsx deleted file mode 100644 index d714e7bfdd..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/src/app.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { getRouter } from './router' - -export function mountTestApp(container: Element) { - const router = getRouter() - const reactRoot = createRoot(container) - let didUnmount = false - - reactRoot.render() - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - reactRoot.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/src/routeTree.gen.ts deleted file mode 100644 index 3cca81cabb..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 BRouteImport } from './routes/b' -import { Route as ARouteImport } from './routes/a' - -const BRoute = BRouteImport.update({ - id: '/b', - path: '/b', - getParentRoute: () => rootRouteImport, -} as any) -const ARoute = ARouteImport.update({ - id: '/a', - path: '/a', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRoutesByTo { - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a' | '/b' - fileRoutesByTo: FileRoutesByTo - to: '/a' | '/b' - id: '__root__' | '/a' | '/b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARoute - BRoute: typeof BRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/b': { - id: '/b' - path: '/b' - fullPath: '/b' - preLoaderRoute: typeof BRouteImport - parentRoute: typeof rootRouteImport - } - '/a': { - id: '/a' - path: '/a' - fullPath: '/a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARoute, - BRoute: BRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/src/router.tsx b/benchmarks/memory/client/scenarios/navigation-churn/react/src/router.tsx deleted file mode 100644 index 9cb85c5a1b..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/a'], - }), - routeTree, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/a.tsx b/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/a.tsx deleted file mode 100644 index bdd32d0b81..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/a.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -const fixedTimestamp = 1_700_000_000_000 - -export const Route = createFileRoute('/a')({ - loader: () => ({ name: 'a', ts: fixedTimestamp }), - component: AComponent, -}) - -function AComponent() { - const data = Route.useLoaderData() - - return
{`${data.name}:${data.ts}`}
-} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/b.tsx b/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/b.tsx deleted file mode 100644 index 05deef729d..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/src/routes/b.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -const fixedTimestamp = 1_700_000_000_000 - -export const Route = createFileRoute('/b')({ - loader: () => ({ name: 'b', ts: fixedTimestamp }), - component: BComponent, -}) - -function BComponent() { - const data = Route.useLoaderData() - - return
{`${data.name}:${data.ts}`}
-} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/tsconfig.json b/benchmarks/memory/client/scenarios/navigation-churn/react/tsconfig.json deleted file mode 100644 index ea566061d9..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts b/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts deleted file mode 100644 index eef60a658e..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client navigation-churn (react)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/shared.ts b/benchmarks/memory/client/scenarios/navigation-churn/shared.ts deleted file mode 100644 index 7eaf1a8b66..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/shared.ts +++ /dev/null @@ -1,129 +0,0 @@ -import { - createBenchContainer, - nextAnimationFrame, - noop, - removeBenchContainer, - warnClientMemoryDevMode, -} from '#memory-client/lifecycle' -import type { Framework, MountTestApp } from '#memory-client/lifecycle' - -type Target = '/a' | '/b' - -type NavigationRouter = { - load: () => Promise - navigate: (options: { to: Target; replace: true }) => Promise - subscribe: (event: 'onRendered', listener: () => void) => () => void -} - -const navigationChurnIterations = 300 - -const uninitialized = () => - Promise.reject(new Error('navigation-churn benchmark is not initialized')) - -export function createWorkload( - framework: Framework, - mountTestApp: MountTestApp, -) { - warnClientMemoryDevMode(framework) - - let container: HTMLDivElement | undefined = undefined - let unmount = noop - let unsub = noop - let resolveRendered: () => void = noop - let navigateTo: (target: Target) => Promise = uninitialized - - function assertRenderedPage(target: Target) { - const expected = target.slice(1) - const actual = - container?.querySelector('[data-bench-page]')?.dataset - .benchPage - - if (actual !== expected) { - throw new Error(`Expected rendered page ${expected}, got ${actual}`) - } - } - - async function waitForRenderedPage(target: Target) { - for (let attempt = 0; attempt < 10; attempt++) { - try { - assertRenderedPage(target) - return - } catch { - await nextAnimationFrame() - } - } - - assertRenderedPage(target) - } - - function waitForNextRender() { - return new Promise((resolve) => { - resolveRendered = resolve - }) - } - - async function before() { - if (container) { - after() - } - - container = createBenchContainer() - - const mounted = mountTestApp(container) - const router = mounted.router as NavigationRouter - unmount = mounted.unmount - - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - navigateTo = async (target) => { - const rendered = waitForNextRender() - await Promise.all([ - router.navigate({ - to: target, - replace: true, - }), - rendered, - ]) - } - - await router.load() - await waitForRenderedPage('/a') - } - - function after() { - unmount() - removeBenchContainer(container) - unsub() - - container = undefined - unmount = noop - unsub = noop - resolveRendered = noop - navigateTo = uninitialized - } - - return { - name: `mem client navigation-churn (${framework})`, - before, - navigate: (target: Target) => navigateTo(target), - async run() { - for (let index = 0; index < navigationChurnIterations; index++) { - await navigateTo(index % 2 === 0 ? '/b' : '/a') - } - }, - async sanity() { - await before() - - try { - assertRenderedPage('/a') - await navigateTo('/b') - assertRenderedPage('/b') - } finally { - after() - } - }, - after, - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/project.json b/benchmarks/memory/client/scenarios/navigation-churn/solid/project.json deleted file mode 100644 index 2c581e6188..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-navigation-churn-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/setup.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/setup.ts deleted file mode 100644 index 493425c6a2..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'solid', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx deleted file mode 100644 index 16000c90a1..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/app.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { getRouter } from './router' - -export function mountTestApp(container: Element) { - const router = getRouter() - const dispose = render(() => , container) - let didUnmount = false - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - dispose() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routeTree.gen.ts deleted file mode 100644 index 59d7fad058..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 BRouteImport } from './routes/b' -import { Route as ARouteImport } from './routes/a' - -const BRoute = BRouteImport.update({ - id: '/b', - path: '/b', - getParentRoute: () => rootRouteImport, -} as any) -const ARoute = ARouteImport.update({ - id: '/a', - path: '/a', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRoutesByTo { - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a' | '/b' - fileRoutesByTo: FileRoutesByTo - to: '/a' | '/b' - id: '__root__' | '/a' | '/b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARoute - BRoute: typeof BRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/b': { - id: '/b' - path: '/b' - fullPath: '/b' - preLoaderRoute: typeof BRouteImport - parentRoute: typeof rootRouteImport - } - '/a': { - id: '/a' - path: '/a' - fullPath: '/a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARoute, - BRoute: BRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/router.tsx b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/router.tsx deleted file mode 100644 index e8c14f12f6..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/a'], - }), - routeTree, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/a.tsx b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/a.tsx deleted file mode 100644 index 0b7838fdbe..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/a.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -const fixedTimestamp = 1_700_000_000_000 - -export const Route = createFileRoute('/a')({ - loader: () => ({ name: 'a', ts: fixedTimestamp }), - component: AComponent, -}) - -function AComponent() { - const data = Route.useLoaderData() - - return
{`${data().name}:${data().ts}`}
-} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/b.tsx b/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/b.tsx deleted file mode 100644 index ec9b513ba9..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/src/routes/b.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -const fixedTimestamp = 1_700_000_000_000 - -export const Route = createFileRoute('/b')({ - loader: () => ({ name: 'b', ts: fixedTimestamp }), - component: BComponent, -}) - -function BComponent() { - const data = Route.useLoaderData() - - return
{`${data().name}:${data().ts}`}
-} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json b/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json deleted file mode 100644 index b12dcb7ade..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts b/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts deleted file mode 100644 index 7dfb186b2e..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/solid/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client navigation-churn (solid)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/project.json b/benchmarks/memory/client/scenarios/navigation-churn/vue/project.json deleted file mode 100644 index f96d03d7d3..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-navigation-churn-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/setup.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/setup.ts deleted file mode 100644 index a38df04788..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'vue', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/app.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/app.tsx deleted file mode 100644 index fad2251cc0..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/app.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { RouterProvider } from '@tanstack/vue-router' -import { createApp } from 'vue' -import { getRouter } from './router' -import type {} from '@tanstack/router-core' - -export function mountTestApp(container: Element) { - const router = getRouter() - const vueApp = createApp({ - setup() { - return () => - }, - }) - let didUnmount = false - - vueApp.mount(container) - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - vueApp.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routeTree.gen.ts deleted file mode 100644 index 12c9640358..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 BRouteImport } from './routes/b' -import { Route as ARouteImport } from './routes/a' - -const BRoute = BRouteImport.update({ - id: '/b', - path: '/b', - getParentRoute: () => rootRouteImport, -} as any) -const ARoute = ARouteImport.update({ - id: '/a', - path: '/a', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRoutesByTo { - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a': typeof ARoute - '/b': typeof BRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a' | '/b' - fileRoutesByTo: FileRoutesByTo - to: '/a' | '/b' - id: '__root__' | '/a' | '/b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARoute - BRoute: typeof BRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/b': { - id: '/b' - path: '/b' - fullPath: '/b' - preLoaderRoute: typeof BRouteImport - parentRoute: typeof rootRouteImport - } - '/a': { - id: '/a' - path: '/a' - fullPath: '/a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARoute, - BRoute: BRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/router.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/router.tsx deleted file mode 100644 index e083495cd2..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/a'], - }), - routeTree, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx deleted file mode 100644 index c1a9cfb244..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/a.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const fixedTimestamp = 1_700_000_000_000 - -const AComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
{`${data.value.name}:${data.value.ts}`}
- ) - }, -}) - -export const Route = createFileRoute('/a')({ - loader: () => ({ name: 'a', ts: fixedTimestamp }), - component: AComponent, -}) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx b/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx deleted file mode 100644 index 3a20799f3b..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/src/routes/b.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const fixedTimestamp = 1_700_000_000_000 - -const BComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
{`${data.value.name}:${data.value.ts}`}
- ) - }, -}) - -export const Route = createFileRoute('/b')({ - loader: () => ({ name: 'b', ts: fixedTimestamp }), - component: BComponent, -}) diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/tsconfig.json b/benchmarks/memory/client/scenarios/navigation-churn/vue/tsconfig.json deleted file mode 100644 index 9a5872a4c0..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts b/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts deleted file mode 100644 index b3bdd39dd2..0000000000 --- a/benchmarks/memory/client/scenarios/navigation-churn/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client navigation-churn (vue)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/preload-churn/item-payload.ts b/benchmarks/memory/client/scenarios/preload-churn/item-payload.ts deleted file mode 100644 index 4a86ea7244..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/item-payload.ts +++ /dev/null @@ -1,51 +0,0 @@ -const payloadByteLength = 20 * 1024 -const payloadChunkCount = 32 -const payloadChunkSize = payloadByteLength / payloadChunkCount -const trackedLoaderIdPrefix = 'sanity-' -const trackedItemLoaderCalls = new Map() - -export function createItemPayload(id: string) { - let seed = hashId(id) - const chunks = new Array(payloadChunkCount) - - for (let index = 0; index < payloadChunkCount; index++) { - seed = (seed * 1664525 + 1013904223) >>> 0 - chunks[index] = createPayloadChunk(id, index, seed) - } - - return { - id, - chunks, - byteLength: payloadByteLength, - } -} - -export function trackItemLoaderCall(id: string) { - if (!id.startsWith(trackedLoaderIdPrefix)) { - return - } - - trackedItemLoaderCalls.set(id, (trackedItemLoaderCalls.get(id) ?? 0) + 1) -} - -export function getTrackedItemLoaderCount(id: string) { - return trackedItemLoaderCalls.get(id) ?? 0 -} - -function createPayloadChunk(id: string, index: number, seed: number) { - const token = `${id}:${index.toString(36)}:${seed.toString(36)}:` - const repeatCount = Math.ceil(payloadChunkSize / token.length) - - return token.repeat(repeatCount).slice(0, payloadChunkSize) -} - -function hashId(id: string) { - let hash = 2166136261 - - for (let index = 0; index < id.length; index++) { - hash ^= id.charCodeAt(index) - hash = Math.imul(hash, 16777619) - } - - return hash >>> 0 -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/preload-churn/react/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/project.json b/benchmarks/memory/client/scenarios/preload-churn/react/project.json deleted file mode 100644 index 238d98c816..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-preload-churn-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/setup.ts b/benchmarks/memory/client/scenarios/preload-churn/react/setup.ts deleted file mode 100644 index 31cd97d135..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { getTrackedItemLoaderCount, mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'react', - mountTestApp, - getTrackedItemLoaderCount, -) diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/src/app.tsx b/benchmarks/memory/client/scenarios/preload-churn/react/src/app.tsx deleted file mode 100644 index b75d1fe34d..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/src/app.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { getRouter } from './router' - -export { getTrackedItemLoaderCount } from '../../item-payload' - -export function mountTestApp(container: Element) { - const router = getRouter() - const reactRoot = createRoot(container) - let didUnmount = false - - reactRoot.render() - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - reactRoot.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/preload-churn/react/src/routeTree.gen.ts deleted file mode 100644 index 84aaebb9c9..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/items/$id' - id: '__root__' | '/' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/src/router.tsx b/benchmarks/memory/client/scenarios/preload-churn/react/src/router.tsx deleted file mode 100644 index 69e3180173..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/src/router.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/'], - }), - routeTree, - defaultPreloadGcTime: 0, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/index.tsx b/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/index.tsx deleted file mode 100644 index af735d705b..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
index
-} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/items.$id.tsx deleted file mode 100644 index 2f52acd528..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/src/routes/items.$id.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { createItemPayload, trackItemLoaderCall } from '../../../item-payload' - -export const Route = createFileRoute('/items/$id')({ - loader: ({ params }) => { - trackItemLoaderCall(params.id) - return createItemPayload(params.id) - }, - component: ItemComponent, -}) - -function ItemComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data.id}:${data.byteLength}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/tsconfig.json b/benchmarks/memory/client/scenarios/preload-churn/react/tsconfig.json deleted file mode 100644 index ea566061d9..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts b/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts deleted file mode 100644 index c12995f68e..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client preload-churn (react)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/preload-churn/shared.ts b/benchmarks/memory/client/scenarios/preload-churn/shared.ts deleted file mode 100644 index 68fdfedd3f..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/shared.ts +++ /dev/null @@ -1,216 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, -} from '#memory-client/bench-utils' -import { - createBenchContainer, - drainMicrotasks, - nextAnimationFrame, - noop, - removeBenchContainer, - warnClientMemoryDevMode, -} from '#memory-client/lifecycle' -import type { Framework, MountTestApp } from '#memory-client/lifecycle' - -type GetTrackedItemLoaderCount = (id: string) => number - -type PreloadRouter = { - load: () => Promise - preloadRoute: (options: { - to: '/items/$id' - params: { id: string } - }) => Promise - navigate: ( - options: - | { - to: '/items/$id' - params: { id: string } - replace: true - } - | { - to: '/' - replace: true - }, - ) => Promise - subscribe: (event: 'onRendered', listener: () => void) => () => void -} - -// Reuse one navigation target while evicting the distinct preloaded routes. -const evictionItemId = 'nav-evict' -const preloadChurnIterations = 200 -// A navigation commit is what triggers the router's clearExpiredCache -- -// preloaded matches (defaultPreloadGcTime: 0) are only evicted then, never -// during a preload-only loop. Interleave navigation to exercise eviction. -const preloadsPerEvictionNavigation = 10 -// Keep generated URLs unique across warmup and measured invocations. -const benchmarkRandom = createDeterministicRandom(0x706c6f61) -let preloadCounter = 0 - -const uninitialized = async (_id: string) => { - throw new Error('preload-churn benchmark is not initialized') -} - -export function createWorkload( - framework: Framework, - mountTestApp: MountTestApp, - getTrackedItemLoaderCount: GetTrackedItemLoaderCount, -) { - warnClientMemoryDevMode(framework) - - let container: HTMLDivElement | undefined = undefined - let router: PreloadRouter | undefined = undefined - let unmount = noop - let unsub = noop - let resolveRendered = noop - let evictionParity = 0 - let preloadItem: (id: string) => Promise = uninitialized - let navigateToItem: (id: string) => Promise = uninitialized - let navigateToIndex: () => Promise = () => - uninitialized('navigate-to-index') - - function assertRenderedIndex() { - const actual = - container?.querySelector('[data-bench-page]')?.dataset - .benchPage - - if (actual !== 'index') { - throw new Error(`Expected rendered index page, got ${actual}`) - } - } - - async function waitForRenderedIndex() { - for (let attempt = 0; attempt < 10; attempt++) { - try { - assertRenderedIndex() - return - } catch { - await nextAnimationFrame() - } - } - - assertRenderedIndex() - } - - function waitForNextRender() { - return new Promise((resolve) => { - resolveRendered = resolve - }) - } - - async function before() { - if (container) { - after() - } - - container = createBenchContainer() - - const mounted = mountTestApp(container) - router = mounted.router as PreloadRouter - unmount = mounted.unmount - - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - preloadItem = async (id) => { - await router!.preloadRoute({ - to: '/items/$id', - params: { id }, - }) - await drainMicrotasks() - } - - navigateToItem = async (id) => { - const rendered = waitForNextRender() - await Promise.all([ - router!.navigate({ - to: '/items/$id', - params: { id }, - replace: true, - }), - rendered, - ]) - } - - navigateToIndex = async () => { - const rendered = waitForNextRender() - await Promise.all([ - router!.navigate({ - to: '/', - replace: true, - }), - rendered, - ]) - } - - await router.load() - await waitForRenderedIndex() - } - - function after() { - unmount() - removeBenchContainer(container) - unsub() - - container = undefined - router = undefined - unmount = noop - unsub = noop - resolveRendered = noop - evictionParity = 0 - preloadItem = uninitialized - navigateToItem = uninitialized - navigateToIndex = () => uninitialized('navigate-to-index') - } - - // Alternate between two distinct locations so every eviction navigation - // changes the href (a same-href navigate would never commit or render). - async function evictPreloads() { - evictionParity = (evictionParity + 1) % 2 - - if (evictionParity === 1) { - await navigateToItem(evictionItemId) - } else { - await navigateToIndex() - } - } - - return { - name: `mem client preload-churn (${framework})`, - before, - preload: (id: string) => preloadItem(id), - evictPreloads, - async run() { - for (let index = 0; index < preloadChurnIterations; index++) { - await preloadItem( - `${(preloadCounter++).toString(36)}-${randomSegment(benchmarkRandom)}`, - ) - - if ((index + 1) % preloadsPerEvictionNavigation === 0) { - await evictPreloads() - } - } - }, - async sanity() { - await before() - - try { - assertRenderedIndex() - - const id = 'sanity-preloaded-item' - const initialLoaderCount = getTrackedItemLoaderCount(id) - await preloadItem(id) - - const preloadedLoaderCount = getTrackedItemLoaderCount(id) - if (preloadedLoaderCount !== initialLoaderCount + 1) { - throw new Error( - `Expected preload to run item loader once, got ${preloadedLoaderCount - initialLoaderCount}`, - ) - } - } finally { - after() - } - }, - after, - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/project.json b/benchmarks/memory/client/scenarios/preload-churn/solid/project.json deleted file mode 100644 index 16ef8af968..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-preload-churn-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/setup.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/setup.ts deleted file mode 100644 index 4db457f561..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { getTrackedItemLoaderCount, mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'solid', - mountTestApp, - getTrackedItemLoaderCount, -) diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx b/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx deleted file mode 100644 index 18ad5b97e4..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/app.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { getRouter } from './router' - -export { getTrackedItemLoaderCount } from '../../item-payload' - -export function mountTestApp(container: Element) { - const router = getRouter() - const dispose = render(() => , container) - let didUnmount = false - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - dispose() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/src/routeTree.gen.ts deleted file mode 100644 index 27749ab2af..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/items/$id' - id: '__root__' | '/' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/router.tsx b/benchmarks/memory/client/scenarios/preload-churn/solid/src/router.tsx deleted file mode 100644 index faed87f1f4..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/router.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/'], - }), - routeTree, - defaultPreloadGcTime: 0, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/index.tsx b/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/index.tsx deleted file mode 100644 index b870b8bfd5..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
index
-} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/items.$id.tsx deleted file mode 100644 index 15fa2a34ab..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/src/routes/items.$id.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createItemPayload, trackItemLoaderCall } from '../../../item-payload' - -export const Route = createFileRoute('/items/$id')({ - loader: ({ params }) => { - trackItemLoaderCall(params.id) - return createItemPayload(params.id) - }, - component: ItemComponent, -}) - -function ItemComponent() { - const data = Route.useLoaderData() - - return ( -
- {`${data().id}:${data().byteLength}`} -
- ) -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json b/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json deleted file mode 100644 index b12dcb7ade..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts b/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts deleted file mode 100644 index efc75d2b93..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/solid/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client preload-churn (solid)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/project.json b/benchmarks/memory/client/scenarios/preload-churn/vue/project.json deleted file mode 100644 index e13388890f..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-preload-churn-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/setup.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/setup.ts deleted file mode 100644 index 4aad4af31e..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { getTrackedItemLoaderCount, mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'vue', - mountTestApp, - getTrackedItemLoaderCount, -) diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/app.tsx b/benchmarks/memory/client/scenarios/preload-churn/vue/src/app.tsx deleted file mode 100644 index 890447d88b..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/app.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { RouterProvider } from '@tanstack/vue-router' -import { createApp } from 'vue' -import { getRouter } from './router' -import type {} from '@tanstack/router-core' - -export { getTrackedItemLoaderCount } from '../../item-payload' - -export function mountTestApp(container: Element) { - const router = getRouter() - const vueApp = createApp({ - setup() { - return () => - }, - }) - let didUnmount = false - - vueApp.mount(container) - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - vueApp.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/src/routeTree.gen.ts deleted file mode 100644 index a2216f2b67..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/items/$id' - id: '__root__' | '/' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/router.tsx b/benchmarks/memory/client/scenarios/preload-churn/vue/src/router.tsx deleted file mode 100644 index 86534112d7..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/router.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/'], - }), - routeTree, - defaultPreloadGcTime: 0, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/index.tsx b/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/index.tsx deleted file mode 100644 index b4f871306c..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
index
-} diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx deleted file mode 100644 index 08254e173e..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/src/routes/items.$id.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { createItemPayload, trackItemLoaderCall } from '../../../item-payload' - -const ItemComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
- {`${data.value.id}:${data.value.byteLength}`} -
- ) - }, -}) - -export const Route = createFileRoute('/items/$id')({ - loader: ({ params }: { params: { id: string } }) => { - trackItemLoaderCall(params.id) - return createItemPayload(params.id) - }, - component: ItemComponent, -}) diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/tsconfig.json b/benchmarks/memory/client/scenarios/preload-churn/vue/tsconfig.json deleted file mode 100644 index 9a5872a4c0..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts b/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts deleted file mode 100644 index 3d56089ba7..0000000000 --- a/benchmarks/memory/client/scenarios/preload-churn/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client preload-churn (vue)', - watch: false, - environment: 'jsdom', - }, -}) 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 deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/project.json b/benchmarks/memory/client/scenarios/unique-location-churn/react/project.json deleted file mode 100644 index 1572552650..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-unique-location-churn-react", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/setup.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/setup.ts deleted file mode 100644 index 70603b5c34..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'react', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/app.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/react/src/app.tsx deleted file mode 100644 index d714e7bfdd..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/app.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { RouterProvider } from '@tanstack/react-router' -import { createRoot } from 'react-dom/client' -import { getRouter } from './router' - -export function mountTestApp(container: Element) { - const router = getRouter() - const reactRoot = createRoot(container) - let didUnmount = false - - reactRoot.render() - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - reactRoot.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routeTree.gen.ts deleted file mode 100644 index 1165f57523..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routeTree.gen.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/items/$id' - id: '__root__' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/router.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/react/src/router.tsx deleted file mode 100644 index 50ad269060..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/items/initial?q=q-initial'], - }), - routeTree, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routes/__root.tsx deleted file mode 100644 index 889395056b..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routes/items.$id.tsx deleted file mode 100644 index c9e823f6c2..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/src/routes/items.$id.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -type ItemSearch = { - q: string -} - -export const Route = createFileRoute('/items/$id')({ - validateSearch: (search: Record): ItemSearch => ({ - q: typeof search.q === 'string' ? search.q : '', - }), - loaderDeps: ({ search }) => ({ q: search.q }), - loader: ({ params, deps }) => ({ - id: params.id, - q: deps.q, - checksum: params.id.length + deps.q.length, - }), - component: ItemComponent, -}) - -function ItemComponent() { - const data = Route.useLoaderData() - - return ( -
{`${data.id}:${data.q}:${data.checksum}`}
- ) -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/tsconfig.json b/benchmarks/memory/client/scenarios/unique-location-churn/react/tsconfig.json deleted file mode 100644 index ea566061d9..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowImportingTsExtensions": true, - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts b/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts deleted file mode 100644 index 7ee67bfe30..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client unique-location-churn (react)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/shared.ts b/benchmarks/memory/client/scenarios/unique-location-churn/shared.ts deleted file mode 100644 index 3b36c7811e..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/shared.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, -} from '#memory-client/bench-utils' -import { - createBenchContainer, - nextAnimationFrame, - noop, - removeBenchContainer, - warnClientMemoryDevMode, -} from '#memory-client/lifecycle' -import type { Framework, MountTestApp } from '#memory-client/lifecycle' - -type ItemLocation = { - id: string - q: string -} - -type NavigationRouter = { - load: () => Promise - navigate: (options: { - to: '/items/$id' - params: { id: string } - search: { q: string } - replace: true - }) => Promise - subscribe: (event: 'onRendered', listener: () => void) => () => void -} - -const uniqueLocationChurnIterations = 300 -// Module-level so ids stay unique across runner invocations on one mount; the -// counter prefix removes any residual LCG birthday-collision risk. -const benchmarkRandom = createDeterministicRandom(0xdecafbad) -let locationCounter = 0 - -const uninitialized = () => - Promise.reject( - new Error('unique-location-churn benchmark is not initialized'), - ) - -export function createWorkload( - framework: Framework, - mountTestApp: MountTestApp, -) { - warnClientMemoryDevMode(framework) - - let container: HTMLDivElement | undefined = undefined - let unmount = noop - let unsub = noop - let resolveRendered: () => void = noop - let navigateTo: (location: ItemLocation) => Promise = uninitialized - - function assertRenderedId(expected: string) { - const actual = - container?.querySelector('[data-bench-id]')?.dataset.benchId - - if (actual !== expected) { - throw new Error(`Expected rendered item id ${expected}, got ${actual}`) - } - } - - async function waitForRenderedId(expected: string) { - for (let attempt = 0; attempt < 10; attempt++) { - try { - assertRenderedId(expected) - return - } catch { - await nextAnimationFrame() - } - } - - assertRenderedId(expected) - } - - function waitForNextRender() { - return new Promise((resolve) => { - resolveRendered = resolve - }) - } - - async function before() { - if (container) { - after() - } - - container = createBenchContainer() - - const mounted = mountTestApp(container) - const router = mounted.router as NavigationRouter - unmount = mounted.unmount - - unsub = router.subscribe('onRendered', () => { - resolveRendered() - }) - - navigateTo = async (location) => { - const rendered = waitForNextRender() - await Promise.all([ - router.navigate({ - to: '/items/$id', - params: { id: location.id }, - search: { q: location.q }, - replace: true, - }), - rendered, - ]) - } - - await router.load() - await waitForRenderedId('initial') - } - - function after() { - unmount() - removeBenchContainer(container) - unsub() - - container = undefined - unmount = noop - unsub = noop - resolveRendered = noop - navigateTo = uninitialized - } - - return { - name: `mem client unique-location-churn (${framework})`, - before, - navigate: (location: ItemLocation) => navigateTo(location), - async run() { - for (let index = 0; index < uniqueLocationChurnIterations; index++) { - const id = `${(locationCounter++).toString(36)}-${randomSegment(benchmarkRandom)}` - const q = `q-${randomSegment(benchmarkRandom)}` - - await navigateTo({ id, q }) - } - }, - async sanity() { - await before() - - try { - await navigateTo({ id: 'sanity-one', q: 'q-sanity-one' }) - assertRenderedId('sanity-one') - } finally { - after() - } - }, - after, - } -} 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 deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/project.json b/benchmarks/memory/client/scenarios/unique-location-churn/solid/project.json deleted file mode 100644 index 5be22de7a4..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-unique-location-churn-solid", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/setup.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/setup.ts deleted file mode 100644 index 493425c6a2..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'solid', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx deleted file mode 100644 index 16000c90a1..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/app.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { RouterProvider } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { getRouter } from './router' - -export function mountTestApp(container: Element) { - const router = getRouter() - const dispose = render(() => , container) - let didUnmount = false - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - dispose() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routeTree.gen.ts deleted file mode 100644 index 4a451735ff..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/items/$id' - id: '__root__' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/router.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/router.tsx deleted file mode 100644 index 2969b06914..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/items/initial?q=q-initial'], - }), - routeTree, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routes/__root.tsx deleted file mode 100644 index cb8d5a688d..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routes/items.$id.tsx deleted file mode 100644 index 9724922b8d..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/src/routes/items.$id.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -type ItemSearch = { - q: string -} - -export const Route = createFileRoute('/items/$id')({ - validateSearch: (search: Record): ItemSearch => ({ - q: typeof search.q === 'string' ? search.q : '', - }), - loaderDeps: ({ search }) => ({ q: search.q }), - loader: ({ params, deps }) => ({ - id: params.id, - q: deps.q, - checksum: params.id.length + deps.q.length, - }), - component: ItemComponent, -}) - -function ItemComponent() { - const data = Route.useLoaderData() - - return ( -
{`${data().id}:${data().q}:${data().checksum}`}
- ) -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json b/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json deleted file mode 100644 index b12dcb7ade..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts b/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts deleted file mode 100644 index 4db90da2d2..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/solid/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - solid({ hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client unique-location-churn (solid)', - watch: false, - environment: 'jsdom', - }, -}) 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 deleted file mode 100644 index 43ab822de3..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.bench.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-client/bench-utils' -import { workload } from './setup' - -await workload.sanity() - -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.flame.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.flame.ts deleted file mode 100644 index 952fd9a62c..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runClientFlameBenchmark } from '#memory-client/flame-runner' -import { workload } from './setup.ts' - -await runClientFlameBenchmark(workload) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/project.json b/benchmarks/memory/client/scenarios/unique-location-churn/vue/project.json deleted file mode 100644 index 6c05cf80b0..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-client-unique-location-churn-vue", - "projectType": "application", - "targets": { - "build:client": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:client:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:client:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:client": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-router"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/setup.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/setup.ts deleted file mode 100644 index a38df04788..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/setup.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { ClientMemoryWorkload } from '#memory-client/benchmark' -import type * as App from './src/app' -import { createWorkload } from '../shared.ts' - -const appModulePath = './dist/app.js' -const { mountTestApp } = (await import( - /* @vite-ignore */ appModulePath -)) as typeof App - -export const workload: ClientMemoryWorkload = createWorkload( - 'vue', - mountTestApp, -) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/app.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/app.tsx deleted file mode 100644 index fad2251cc0..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/app.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { RouterProvider } from '@tanstack/vue-router' -import { createApp } from 'vue' -import { getRouter } from './router' -import type {} from '@tanstack/router-core' - -export function mountTestApp(container: Element) { - const router = getRouter() - const vueApp = createApp({ - setup() { - return () => - }, - }) - let didUnmount = false - - vueApp.mount(container) - - // Full teardown mirrors the mount-unmount scenario: guard double-unmounts, - // release the devtools global, and detach history listeners. - return { - router, - unmount() { - if (didUnmount) { - return - } - - didUnmount = true - vueApp.unmount() - - if (typeof self !== 'undefined' && self.__TSR_ROUTER__ === router) { - self.__TSR_ROUTER__ = undefined - } - - router.history.destroy() - }, - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routeTree.gen.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routeTree.gen.ts deleted file mode 100644 index d3e9db0345..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/items/$id' - id: '__root__' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/router.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/router.tsx deleted file mode 100644 index 72f9ab565b..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/router.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createMemoryHistory, createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - history: createMemoryHistory({ - initialEntries: ['/items/initial?q=q-initial'], - }), - routeTree, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/__root.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/__root.tsx deleted file mode 100644 index 91296e6f84..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/__root.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Outlet, createRootRoute } from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx b/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx deleted file mode 100644 index e796ee14d1..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/src/routes/items.$id.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -type ItemSearch = { - q: string -} - -const ItemComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
{`${data.value.id}:${data.value.q}:${data.value.checksum}`}
- ) - }, -}) - -export const Route = createFileRoute('/items/$id')({ - validateSearch: (search: Record): ItemSearch => ({ - q: typeof search.q === 'string' ? search.q : '', - }), - loaderDeps: ({ search }: { search: ItemSearch }) => ({ q: search.q }), - loader: ({ - params, - deps, - }: { - params: { id: string } - deps: { q: string } - }) => ({ - id: params.id, - q: deps.q, - checksum: params.id.length + deps.q.length, - }), - component: ItemComponent, -}) diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/tsconfig.json b/benchmarks/memory/client/scenarios/unique-location-churn/vue/tsconfig.json deleted file mode 100644 index 9a5872a4c0..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "allowImportingTsExtensions": true, - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "src/**/*.ts", - "src/**/*.tsx", - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../../vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts b/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts deleted file mode 100644 index d074d571b9..0000000000 --- a/benchmarks/memory/client/scenarios/unique-location-churn/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import vue from '@vitejs/plugin-vue' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - define: { - 'process.env.NODE_ENV': JSON.stringify('production'), - }, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - vue(), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - lib: { - entry: './src/app.tsx', - formats: ['es'], - fileName: 'app', - }, - }, - test: { - ...memoryConfig('client'), - name: '@benchmarks/memory-client unique-location-churn (vue)', - watch: false, - environment: 'jsdom', - }, -}) diff --git a/benchmarks/memory/client/tsconfig.json b/benchmarks/memory/client/tsconfig.json deleted file mode 100644 index eefc5c581e..0000000000 --- a/benchmarks/memory/client/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "bench-utils.ts", - "lifecycle.ts", - "vitest.setup.ts", - "scenarios/*/shared.ts" - ] -} diff --git a/benchmarks/memory/client/vitest.react.config.ts b/benchmarks/memory/client/vitest.react.config.ts deleted file mode 100644 index 44643b4d60..0000000000 --- a/benchmarks/memory/client/vitest.react.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - fileParallelism: false, - projects: ['./scenarios/*/react/vite.config.ts'], - }, -}) diff --git a/benchmarks/memory/client/vitest.setup.ts b/benchmarks/memory/client/vitest.setup.ts deleted file mode 100644 index ce3127275a..0000000000 --- a/benchmarks/memory/client/vitest.setup.ts +++ /dev/null @@ -1,9 +0,0 @@ -// @ts-expect-error -global.IS_REACT_ACT_ENVIRONMENT = true - -const scrollTo = () => {} - -window.scrollTo = scrollTo -globalThis.scrollTo = scrollTo - -export {} diff --git a/benchmarks/memory/client/vitest.solid.config.ts b/benchmarks/memory/client/vitest.solid.config.ts deleted file mode 100644 index 5c8185cdd9..0000000000 --- a/benchmarks/memory/client/vitest.solid.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - fileParallelism: false, - projects: ['./scenarios/*/solid/vite.config.ts'], - }, -}) diff --git a/benchmarks/memory/client/vitest.vue.config.ts b/benchmarks/memory/client/vitest.vue.config.ts deleted file mode 100644 index 01768185ee..0000000000 --- a/benchmarks/memory/client/vitest.vue.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - fileParallelism: false, - projects: ['./scenarios/*/vue/vite.config.ts'], - }, -}) diff --git a/benchmarks/memory/flame-control.ts b/benchmarks/memory/flame-control.ts deleted file mode 100644 index 0d6f42df33..0000000000 --- a/benchmarks/memory/flame-control.ts +++ /dev/null @@ -1,123 +0,0 @@ -import fs from 'node:fs' -import { createRequire } from 'node:module' -import path from 'node:path' - -const flameEnabled = process.env.TSR_MEMORY_FLAME === '1' -const heapIntervalBytes = 512 * 1024 -const heapStackDepth = 64 - -interface HeapProfile { - encode: () => Uint8Array -} - -interface HeapProfiler { - start: (intervalBytes: number, stackDepth: number) => void - stop: () => void - v8Profile: () => unknown - convertProfile: ( - v8Profile: unknown, - ignoreSamplePath?: string, - sourceMapper?: unknown, - ) => HeapProfile -} - -interface SourceMapperConstructor { - create: (searchDirs: Array) => Promise -} - -interface PprofModule { - heap: HeapProfiler - SourceMapper: SourceMapperConstructor -} - -function loadPprof() { - const requireFrom = process.env.TSR_MEMORY_REQUIRE_FROM - ? path.resolve(process.env.TSR_MEMORY_REQUIRE_FROM) - : import.meta.url - const require = createRequire(requireFrom) - - return require('@datadog/pprof') as PprofModule -} - -function getSourcemapDirs() { - return (process.env.TSR_MEMORY_SOURCEMAP_DIRS ?? '') - .split(path.delimiter) - .filter(Boolean) -} - -async function createSourceMapper(pprof: PprofModule) { - const sourcemapDirs = getSourcemapDirs() - - if (sourcemapDirs.length === 0) { - return undefined - } - - return pprof.SourceMapper.create(sourcemapDirs) -} - -function formatTimestamp() { - return new Date().toISOString().replace(/[:.]/g, '-') -} - -function formatProfileFileName(profileName?: string) { - const profileNameSlug = profileName - ?.trim() - .toLowerCase() - .replace(/[^a-z0-9]+/g, '-') - .replace(/^-+|-+$/g, '') - const profileNamePart = profileNameSlug ? `${profileNameSlug}-` : '' - - return `heap-profile-${profileNamePart}${formatTimestamp()}.pb` -} - -export async function profileFlameWorkload( - workload: () => Promise | void, - profileName?: string, -) { - if (!flameEnabled) { - await workload() - return - } - - const profileDir = process.env.TSR_MEMORY_PROFILE_DIR - - if (!profileDir) { - throw new Error('TSR_MEMORY_PROFILE_DIR must be set for flame profiling') - } - - fs.mkdirSync(profileDir, { recursive: true }) - - const pprof = loadPprof() - const sourceMapper = await createSourceMapper(pprof) - - pprof.heap.start(heapIntervalBytes, heapStackDepth) - - let workloadError: unknown = undefined - let v8Profile: unknown = undefined - - try { - await workload() - } catch (error) { - workloadError = error - } finally { - try { - v8Profile = pprof.heap.v8Profile() - } finally { - pprof.heap.stop() - } - } - - const heapProfile = pprof.heap.convertProfile( - v8Profile, - undefined, - sourceMapper, - ) - const profilePath = path.join(profileDir, formatProfileFileName(profileName)) - - fs.writeFileSync(profilePath, heapProfile.encode()) - console.log(`Heap profile written to: ${profilePath}`) - - if (workloadError) { - throw workloadError - } -} diff --git a/benchmarks/memory/run-flame.mjs b/benchmarks/memory/run-flame.mjs deleted file mode 100644 index cc568f3f77..0000000000 --- a/benchmarks/memory/run-flame.mjs +++ /dev/null @@ -1,117 +0,0 @@ -#!/usr/bin/env node -import { spawn } from 'node:child_process' -import fs from 'node:fs' -import { createRequire } from 'node:module' -import path from 'node:path' -import process from 'node:process' - -const [, , entrypointArg, sourcemapDirArg] = process.argv - -if (!entrypointArg || !sourcemapDirArg) { - console.error( - 'Usage: node benchmarks/memory/run-flame.mjs ', - ) - process.exit(1) -} - -const entrypointPath = path.resolve(entrypointArg) -const sourcemapDirPath = path.resolve(sourcemapDirArg) - -if (!fs.existsSync(entrypointPath)) { - console.error(`Flame entrypoint not found: ${entrypointPath}`) - process.exit(1) -} - -if (!fs.existsSync(sourcemapDirPath)) { - console.error(`Flame sourcemap directory not found: ${sourcemapDirPath}`) - process.exit(1) -} - -const profileDir = path.join( - path.dirname(entrypointPath), - '.profiles', - new Date().toISOString().replace(/[:.]/g, '-'), -) - -fs.mkdirSync(profileDir, { recursive: true }) - -const entrypointRequire = createRequire(entrypointPath) -const { generateFlamegraph, generateMarkdown } = entrypointRequire( - '@platformatic/flame', -) - -process.env.NODE_ENV = 'production' - -console.log(`Flame profile directory: ${profileDir}`) - -const childProcess = spawn(process.execPath, [entrypointPath], { - cwd: profileDir, - env: { - ...process.env, - NODE_ENV: 'production', - TSR_MEMORY_FLAME: '1', - TSR_MEMORY_PROFILE_DIR: profileDir, - TSR_MEMORY_REQUIRE_FROM: entrypointPath, - TSR_MEMORY_SOURCEMAP_DIRS: sourcemapDirPath, - }, - stdio: 'inherit', -}) - -console.log(`Flame profiling process: ${childProcess.pid}`) - -const childCode = await new Promise((resolve) => { - childProcess.on('error', (error) => { - console.error(`Failed to start Flame profiled process: ${error.message}`) - resolve(1) - }) - - childProcess.on('close', (code, signal) => { - if (signal) { - console.error(`Flame profiled process exited via signal ${signal}`) - resolve(1) - return - } - - resolve(code ?? 0) - }) -}) - -const heapProfilePaths = fs - .readdirSync(profileDir) - .filter((fileName) => /^heap-profile-.*\.pb$/.test(fileName)) - .sort() - .map((fileName) => path.join(profileDir, fileName)) - -for (const heapProfilePath of heapProfilePaths) { - const htmlPath = heapProfilePath.replace(/\.pb$/, '.html') - const mdPath = heapProfilePath.replace(/\.pb$/, '.md') - - console.log(`Generating heap flamegraph: ${htmlPath}`) - try { - await generateFlamegraph(heapProfilePath, htmlPath) - } catch (error) { - console.warn(`Failed to generate heap flamegraph: ${error.message}`) - } - - console.log(`Generating heap markdown: ${mdPath}`) - try { - await generateMarkdown(heapProfilePath, mdPath, { format: 'detailed' }) - } catch (error) { - console.warn(`Failed to generate heap markdown: ${error.message}`) - } -} - -const heapReportPaths = fs - .readdirSync(profileDir) - .filter((fileName) => /^heap-profile-.*\.(?:html|md)$/.test(fileName)) - .sort() - .map((fileName) => path.join(profileDir, fileName)) - -if (heapReportPaths.length > 0) { - console.log('Generated heap profile reports:') - for (const heapReportPath of heapReportPaths) { - console.log(` ${heapReportPath}`) - } -} - -process.exit(childCode) diff --git a/benchmarks/memory/runtime.ts b/benchmarks/memory/runtime.ts deleted file mode 100644 index 010149b4df..0000000000 --- a/benchmarks/memory/runtime.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { isMemoryInstrumented } from './turn' - -/** Worker settings for the CodSpeed memory instrument. */ -export function memoryExecArgv() { - if (!isMemoryInstrumented()) { - return [] - } - - // CodSpeed supplies --no-opt, which only disables TurboFan on Node 24. - // Under --predictable, Maglev compilations run synchronously inside the - // request that triggers them, and the forced GC before the measured call can - // discard optimized code so recompiles land in the measured window. Their - // malloc'd Zone scratch (32 KiB segments) then dominates allocation metrics - // and depends on per-process feedback state. - // Limit variation from GC scheduling and bytecode reclamation; keep a - // fixed initial old-generation budget. - return [ - '--no-maglev', - '--no-flush-bytecode', - '--no-minor-gc-task', - '--no-incremental-marking', - '--initial-old-space-size=512', - ] -} - -export function memoryConfig(side: 'client' | 'server') { - const execArgv = memoryExecArgv() - return { - execArgv, - setupFiles: - 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 deleted file mode 100644 index 9caaf63384..0000000000 --- a/benchmarks/memory/server/bench-utils.ts +++ /dev/null @@ -1,99 +0,0 @@ -export { memoryBenchHooks } from '../turn' - -export interface StartRequestHandler { - fetch: (request: Request) => Promise | Response -} - -type RunSequentialRequestLoopRandomOptions = - | { - seed: number - random?: never - } - | { - random: () => number - seed?: never - } - -export type RunSequentialRequestLoopOptions = - RunSequentialRequestLoopRandomOptions & { - iterations?: number - buildRequest: (random: () => number, index: number) => Request - validateResponse?: (response: Response, request: Request) => void - } - -export const memoryBenchOptions = { - iterations: 1, - warmupIterations: 1, - time: 0, - warmupTime: 0, - throws: true, -} - -export function createDeterministicRandom(seed: number) { - let state = seed >>> 0 - - return () => { - state = (state * 1664525 + 1013904223) >>> 0 - return state / 0x100000000 - } -} - -export function randomSegment(random: () => number) { - return Math.floor(random() * 1_000_000_000).toString(36) -} - -export async function drainResponse(response: Response) { - const reader = response.body?.getReader() - - if (!reader) { - return - } - - try { - for (;;) { - const result = await reader.read() - - if (result.done) { - break - } - } - } finally { - reader.releaseLock() - } -} - -export async function runSequentialRequestLoop( - handler: StartRequestHandler, - options: RunSequentialRequestLoopOptions, -) { - const { iterations = 10, buildRequest, validateResponse } = options - const random = - options.seed !== undefined - ? createDeterministicRandom(options.seed) - : options.random - const validate = - validateResponse ?? - ((response: Response, request: Request) => { - if (response.status !== 200) { - throw new Error( - `Request failed with non-200 status ${response.status} (${request.url})`, - ) - } - }) - - for (let index = 0; index < iterations; index++) { - const request = buildRequest(random, index) - const response = await handler.fetch(request) - - validate(response, request) - - await drainResponse(response) - } -} - -// Cancellation can leave deferred loaders and renderer teardown queued. -export async function settle() { - for (let turn = 0; turn < 16; turn++) { - await new Promise((resolve) => setTimeout(resolve, 0)) - } -} diff --git a/benchmarks/memory/server/benchmark.ts b/benchmarks/memory/server/benchmark.ts deleted file mode 100644 index 9b8dc2c76f..0000000000 --- a/benchmarks/memory/server/benchmark.ts +++ /dev/null @@ -1,13 +0,0 @@ -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 -} - -export interface ServerMemoryWorkloadGroup { - sanity: () => Promise | void - workloads: Array -} diff --git a/benchmarks/memory/server/flame-runner.ts b/benchmarks/memory/server/flame-runner.ts deleted file mode 100644 index 1930085aad..0000000000 --- a/benchmarks/memory/server/flame-runner.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { profileFlameWorkload } from '../flame-control.ts' -import type { ServerMemoryWorkloadGroup } from './benchmark.ts' - -export async function runServerFlameBenchmark( - workloadGroup: ServerMemoryWorkloadGroup, -) { - await workloadGroup.sanity() - - for (const workload of workloadGroup.workloads) { - await profileFlameWorkload(workload.run, workload.name) - } -} diff --git a/benchmarks/memory/server/package.json b/benchmarks/memory/server/package.json deleted file mode 100644 index d09343c7b6..0000000000 --- a/benchmarks/memory/server/package.json +++ /dev/null @@ -1,283 +0,0 @@ -{ - "name": "@benchmarks/memory-server", - "private": true, - "type": "module", - "scripts": { - "clean:profiles": "rm -rf scenarios/*/*/.profiles" - }, - "imports": { - "#memory-server/benchmark": "./benchmark.ts", - "#memory-server/bench-utils": "./bench-utils.ts", - "#memory-server/flame-runner": "./flame-runner.ts" - }, - "dependencies": { - "@tanstack/react-router": "workspace:*", - "@tanstack/react-start": "workspace:*", - "@tanstack/solid-router": "workspace:*", - "@tanstack/solid-start": "workspace:*", - "@tanstack/vue-router": "workspace:*", - "@tanstack/vue-start": "workspace:*", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "solid-js": "^1.9.10", - "vue": "^3.5.16" - }, - "devDependencies": { - "@codspeed/vitest-plugin": "^6.0.1", - "@datadog/pprof": "^5.13.2", - "@platformatic/flame": "^1.6.0", - "@vitejs/plugin-react": "^6.0.1", - "@vitejs/plugin-vue-jsx": "^5.1.5", - "@types/react": "catalog:", - "@typescript/native": "npm:typescript@^7.0.2", - "jsdom": "29.1.1", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "vitest": "catalog:" - }, - "nx": { - "targets": { - "build:react": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-react", - "@benchmarks/memory-server-server-fn-churn-react", - "@benchmarks/memory-server-error-paths-react", - "@benchmarks/memory-server-aborted-requests-react", - "@benchmarks/memory-server-peak-large-page-react", - "@benchmarks/memory-server-streaming-peak-react", - "@benchmarks/memory-server-serialization-payload-react" - ], - "target": "build:ssr" - } - ] - }, - "build:solid": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-solid", - "@benchmarks/memory-server-server-fn-churn-solid", - "@benchmarks/memory-server-error-paths-solid", - "@benchmarks/memory-server-aborted-requests-solid", - "@benchmarks/memory-server-peak-large-page-solid", - "@benchmarks/memory-server-streaming-peak-solid", - "@benchmarks/memory-server-serialization-payload-solid" - ], - "target": "build:ssr" - } - ] - }, - "build:vue": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-vue", - "@benchmarks/memory-server-server-fn-churn-vue", - "@benchmarks/memory-server-error-paths-vue", - "@benchmarks/memory-server-aborted-requests-vue", - "@benchmarks/memory-server-peak-large-page-vue", - "@benchmarks/memory-server-streaming-peak-vue", - "@benchmarks/memory-server-serialization-payload-vue" - ], - "target": "build:ssr" - } - ] - }, - "build:react:flame": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-react", - "@benchmarks/memory-server-server-fn-churn-react", - "@benchmarks/memory-server-error-paths-react", - "@benchmarks/memory-server-aborted-requests-react", - "@benchmarks/memory-server-peak-large-page-react", - "@benchmarks/memory-server-streaming-peak-react", - "@benchmarks/memory-server-serialization-payload-react" - ], - "target": "build:ssr:flame" - } - ] - }, - "build:solid:flame": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-solid", - "@benchmarks/memory-server-server-fn-churn-solid", - "@benchmarks/memory-server-error-paths-solid", - "@benchmarks/memory-server-aborted-requests-solid", - "@benchmarks/memory-server-peak-large-page-solid", - "@benchmarks/memory-server-streaming-peak-solid", - "@benchmarks/memory-server-serialization-payload-solid" - ], - "target": "build:ssr:flame" - } - ] - }, - "build:vue:flame": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-vue", - "@benchmarks/memory-server-server-fn-churn-vue", - "@benchmarks/memory-server-error-paths-vue", - "@benchmarks/memory-server-aborted-requests-vue", - "@benchmarks/memory-server-peak-large-page-vue", - "@benchmarks/memory-server-streaming-peak-vue", - "@benchmarks/memory-server-serialization-payload-vue" - ], - "target": "build:ssr:flame" - } - ] - }, - "test:flame:react": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-react", - "@benchmarks/memory-server-server-fn-churn-react", - "@benchmarks/memory-server-error-paths-react", - "@benchmarks/memory-server-aborted-requests-react", - "@benchmarks/memory-server-peak-large-page-react", - "@benchmarks/memory-server-streaming-peak-react", - "@benchmarks/memory-server-serialization-payload-react" - ], - "target": "test:flame" - } - ] - }, - "test:flame:solid": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-solid", - "@benchmarks/memory-server-server-fn-churn-solid", - "@benchmarks/memory-server-error-paths-solid", - "@benchmarks/memory-server-aborted-requests-solid", - "@benchmarks/memory-server-peak-large-page-solid", - "@benchmarks/memory-server-streaming-peak-solid", - "@benchmarks/memory-server-serialization-payload-solid" - ], - "target": "test:flame" - } - ] - }, - "test:flame:vue": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-vue", - "@benchmarks/memory-server-server-fn-churn-vue", - "@benchmarks/memory-server-error-paths-vue", - "@benchmarks/memory-server-aborted-requests-vue", - "@benchmarks/memory-server-peak-large-page-vue", - "@benchmarks/memory-server-streaming-peak-vue", - "@benchmarks/memory-server-serialization-payload-vue" - ], - "target": "test:flame" - } - ] - }, - "test:perf:react": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": [ - "build:react" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts", - "cwd": "benchmarks/memory/server" - } - }, - "test:perf:solid": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": [ - "build:solid" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts", - "cwd": "benchmarks/memory/server" - } - }, - "test:perf:vue": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": [ - "build:vue" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts", - "cwd": "benchmarks/memory/server" - } - }, - "test:types": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": [ - "@benchmarks/memory-server-request-churn-react", - "@benchmarks/memory-server-server-fn-churn-react", - "@benchmarks/memory-server-error-paths-react", - "@benchmarks/memory-server-aborted-requests-react", - "@benchmarks/memory-server-peak-large-page-react", - "@benchmarks/memory-server-streaming-peak-react", - "@benchmarks/memory-server-serialization-payload-react", - "@benchmarks/memory-server-request-churn-solid", - "@benchmarks/memory-server-server-fn-churn-solid", - "@benchmarks/memory-server-error-paths-solid", - "@benchmarks/memory-server-aborted-requests-solid", - "@benchmarks/memory-server-peak-large-page-solid", - "@benchmarks/memory-server-streaming-peak-solid", - "@benchmarks/memory-server-serialization-payload-solid", - "@benchmarks/memory-server-request-churn-vue", - "@benchmarks/memory-server-server-fn-churn-vue", - "@benchmarks/memory-server-error-paths-vue", - "@benchmarks/memory-server-aborted-requests-vue", - "@benchmarks/memory-server-peak-large-page-vue", - "@benchmarks/memory-server-streaming-peak-vue", - "@benchmarks/memory-server-serialization-payload-vue" - ], - "target": "test:types:ssr" - } - ], - "options": { - "command": "tsc -p ./tsconfig.json --noEmit", - "cwd": "benchmarks/memory/server" - }, - "inputs": [ - "default", - "^production", - "{workspaceRoot}/eslint.config.js", - "dependentTaskOutputs", - "{workspaceRoot}/benchmarks/memory/*.ts" - ] - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts b/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts deleted file mode 100644 index 7a1cd6d254..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/deferred-records.ts +++ /dev/null @@ -1,57 +0,0 @@ -const recordCount = 20 - -export type RecordGroup = 'alpha' | 'beta' - -export interface DeferredRecord { - id: string - label: string -} - -export function makeAbortedRequestRecords( - id: string, - group: RecordGroup, -): Array { - return Array.from({ length: recordCount }, (_, index) => ({ - id: `${group}-${id}-${index}`, - label: `deferred-${group}-${id}-${index}`, - })) -} - -// Abort probes keep their deferred payload pending until the request is -// cancelled. Timer chains can outlive cancellation and spill into the next -// measured request; route-loader signals stop observing the request after load. -export function makeDeferredRecords( - id: string, - group: RecordGroup, - signal: AbortSignal, -): Promise> { - return new Promise((resolve) => { - if (signal.aborted) { - resolve([]) - return - } - - let timeoutId: ReturnType | undefined - const onAbort = () => { - clearTimeout(timeoutId) - resolve([]) - } - signal.addEventListener('abort', onAbort, { once: true }) - - if (id === 'sanity-mid-stream' || id.startsWith('abort-')) { - return - } - - let remaining = group === 'alpha' ? 4 : 6 - const step = () => { - remaining -= 1 - if (remaining === 0) { - signal.removeEventListener('abort', onAbort) - resolve(makeAbortedRequestRecords(id, group)) - return - } - timeoutId = setTimeout(step, 0) - } - timeoutId = setTimeout(step, 0) - }) -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.flame.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/project.json b/benchmarks/memory/server/scenarios/aborted-requests/react/project.json deleted file mode 100644 index bea90c8766..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-aborted-requests-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/setup.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/src/routeTree.gen.ts deleted file mode 100644 index fbbc25ecfb..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/stream/$id' - id: '__root__' | '/' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/src/router.tsx b/benchmarks/memory/server/scenarios/aborted-requests/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/index.tsx b/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/index.tsx deleted file mode 100644 index 08d534a779..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
aborted-requests-index
-} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/stream.$id.tsx deleted file mode 100644 index ecd9ef524d..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/src/routes/stream.$id.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/react-router' -import { Suspense } from 'react' -import { makeAbortedRequestRecords } from '../../../deferred-records' - -function resolveAfterMicrotasks(microtasks: number, value: () => T) { - let promise = Promise.resolve() - - for (let index = 0; index < microtasks; index++) { - promise = promise.then(() => undefined) - } - - return promise.then(value) -} - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - eager: `eager-${params.id}`, - alpha: resolveAfterMicrotasks(32, () => - makeAbortedRequestRecords(params.id, 'alpha'), - ), - beta: resolveAfterMicrotasks(64, () => - makeAbortedRequestRecords(params.id, 'beta'), - ), - }), - component: StreamComponent, -}) - -function StreamComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data.eager}

- loading-alpha

- } - > - - {(records) => ( -
    - {records.map((record) => ( -
  • {record.label}
  • - ))} -
- )} -
-
- loading-beta

- } - > - - {(records) => ( -
    - {records.map((record) => ( -
  • {record.label}
  • - ))} -
- )} -
-
-
- ) -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/tsconfig.json b/benchmarks/memory/server/scenarios/aborted-requests/react/tsconfig.json deleted file mode 100644 index 11ddcce4ea..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts b/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts deleted file mode 100644 index eff0d0e043..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/react/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server aborted-requests (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/shared.ts b/benchmarks/memory/server/scenarios/aborted-requests/shared.ts deleted file mode 100644 index 29eca99e00..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/shared.ts +++ /dev/null @@ -1,235 +0,0 @@ -import { settle } from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -type AbortedRequestReadMode = 'first-chunk' | 'shell-before-deferred' -const abortedRequestIterations = 40 -let abortedRequestCounter = 0 -const eagerMarker = 'data-bench="aborted-requests-eager"' -const alphaFallbackMarker = 'data-bench="aborted-requests-alpha-fallback"' -const betaFallbackMarker = 'data-bench="aborted-requests-beta-fallback"' -const alphaFirstRecord = (id: string) => `deferred-alpha-${id}-0` -const alphaLastRecord = (id: string) => `deferred-alpha-${id}-19` -const betaFirstRecord = (id: string) => `deferred-beta-${id}-0` -const betaLastRecord = (id: string) => `deferred-beta-${id}-19` - -const textDecoder = new TextDecoder() -const abortedRequestModes: Record = { - react: 'first-chunk', - solid: 'first-chunk', - vue: 'shell-before-deferred', -} - -const documentRequestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildStreamRequest(id: string, signal?: AbortSignal) { - const init: RequestInit = { ...documentRequestInit } - - if (signal) { - init.signal = signal - } - - return new Request(`http://localhost/stream/${id}`, init) -} - -function validateDocumentResponse(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Expected status 200 for ${request.url}, got ${response.status}`, - ) - } -} - -async function readFirstChunk(response: Response, request: Request) { - if (!response.body) { - throw new Error(`Expected response body for ${request.url}`) - } - - const reader = response.body.getReader() - const result = await reader.read() - const value = result.value - - if (result.done || !value || value.byteLength === 0) { - await reader.cancel() - throw new Error(`Expected a non-empty first chunk for ${request.url}`) - } - - return { - reader, - value, - } -} - -async function readShellBeforeDeferred( - response: Response, - request: Request, - id: string, -) { - if (!response.body) { - throw new Error(`Expected response body for ${request.url}`) - } - - const reader = response.body.getReader() - let text = '' - - for (;;) { - const result = await reader.read() - const value = result.value - - if (result.done || !value || value.byteLength === 0) { - await reader.cancel() - throw new Error(`Expected shell content for ${request.url}`) - } - - text += textDecoder.decode(value, { stream: true }) - - for (const marker of [ - alphaFirstRecord(id), - alphaLastRecord(id), - betaFirstRecord(id), - betaLastRecord(id), - ]) { - if (text.includes(marker)) { - await reader.cancel() - throw new Error( - `Shell chunks already included deferred content ${marker}`, - ) - } - } - - if ( - text.includes(eagerMarker) && - text.includes(alphaFallbackMarker) && - text.includes(betaFallbackMarker) - ) { - return { - reader, - text, - } - } - } -} - -async function readSanityStream( - response: Response, - request: Request, - mode: AbortedRequestReadMode, - id: string, -) { - if (mode === 'shell-before-deferred') { - return readShellBeforeDeferred(response, request, id) - } - - const { reader, value } = await readFirstChunk(response, request) - - return { - reader, - text: textDecoder.decode(value), - } -} - -function readLoopStream( - mode: AbortedRequestReadMode, - response: Response, - request: Request, - id: string, -) { - if (mode === 'shell-before-deferred') { - return readShellBeforeDeferred(response, request, id) - } - - return readFirstChunk(response, request) -} - -async function cancelReader(reader: ReadableStreamDefaultReader) { - try { - await reader.cancel() - } catch (error) { - if (!(error instanceof DOMException && error.name === 'AbortError')) { - throw error - } - } -} - -async function assertAbortedRequestsSanity( - handler: StartRequestHandler, - mode: AbortedRequestReadMode, -) { - const fullId = 'sanity-full' - const fullRequest = buildStreamRequest(fullId) - const fullResponse = await handler.fetch(fullRequest) - validateDocumentResponse(fullResponse, fullRequest) - - const fullBody = await fullResponse.text() - - if (!fullBody.includes(eagerMarker)) { - throw new Error('Expected full sanity response to include the eager marker') - } - - const midStreamId = 'sanity-mid-stream' - const controller = new AbortController() - const midStreamRequest = buildStreamRequest(midStreamId, controller.signal) - const midStreamResponse = await handler.fetch(midStreamRequest) - validateDocumentResponse(midStreamResponse, midStreamRequest) - - const { reader, text } = await readSanityStream( - midStreamResponse, - midStreamRequest, - mode, - midStreamId, - ) - - if (!text.includes(eagerMarker)) { - throw new Error('Expected sanity stream to include the eager marker') - } - - // reader.cancel() is the response-stream cancellation path if the handler - // does not observe Request.signal for this in-process request. - controller.abort() - await cancelReader(reader) - await settle() -} - -async function runAbortedRequestLoop( - handler: StartRequestHandler, - mode: AbortedRequestReadMode, -) { - for (let index = 0; index < abortedRequestIterations; index++) { - const controller = new AbortController() - const id = `abort-${(abortedRequestCounter++).toString(36)}` - const request = buildStreamRequest(id, controller.signal) - const response = await handler.fetch(request) - validateDocumentResponse(response, request) - - const { reader } = await readLoopStream(mode, response, request, id) - controller.abort() - await cancelReader(reader) - await settle() - } -} - -export function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - const mode = abortedRequestModes[framework] - const run = async () => runAbortedRequestLoop(handler, mode) - - return { - sanity: () => assertAbortedRequestsSanity(handler, mode), - workloads: [ - { - name: `mem server aborted-requests (${framework})`, - run, - }, - ], - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/project.json b/benchmarks/memory/server/scenarios/aborted-requests/solid/project.json deleted file mode 100644 index 345fcc0720..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-aborted-requests-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/setup.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routeTree.gen.ts deleted file mode 100644 index 04ebed80f0..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/stream/$id' - id: '__root__' | '/' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/router.tsx b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/index.tsx b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/index.tsx deleted file mode 100644 index 3aac56e824..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
aborted-requests-index
-} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx deleted file mode 100644 index bf6af17f31..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/src/routes/stream.$id.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { createServerOnlyFn } from '@tanstack/solid-start' -import { getRequest } from '@tanstack/solid-start/server' -import { createFileRoute } from '@tanstack/solid-router' -import { Show, Suspense, createResource } from 'solid-js' -import { makeDeferredRecords } from '../../../deferred-records' -import type { DeferredRecord } from '../../../deferred-records' - -const getRequestSignal = createServerOnlyFn(() => getRequest().signal) - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - eager: `eager-${params.id}`, - alpha: makeDeferredRecords(params.id, 'alpha', getRequestSignal()), - beta: makeDeferredRecords(params.id, 'beta', getRequestSignal()), - }), - component: StreamComponent, -}) - -function StreamComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data().eager}

- loading-alpha

- } - > - -
- loading-beta

- } - > - -
-
- ) -} - -function DeferredRecords(props: { - promise: Promise> - dataBench: string -}) { - const [records] = createResource( - () => props.promise, - (promise) => promise, - ) - - return ( - - {(resolvedRecords) => ( -
    - {resolvedRecords().map((record) => ( -
  • {record.label}
  • - ))} -
- )} -
- ) -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json b/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json deleted file mode 100644 index 4b61264e11..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts b/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts deleted file mode 100644 index d7fd3459ee..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/solid/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server aborted-requests (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/project.json b/benchmarks/memory/server/scenarios/aborted-requests/vue/project.json deleted file mode 100644 index 8ca7d84660..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-aborted-requests-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/setup.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routeTree.gen.ts deleted file mode 100644 index 192f1d6dc7..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/stream/$id' - id: '__root__' | '/' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/router.tsx b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/index.tsx b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/index.tsx deleted file mode 100644 index af662b29f7..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
aborted-requests-index
-} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx deleted file mode 100644 index e41af03c16..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/src/routes/stream.$id.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { createServerOnlyFn } from '@tanstack/vue-start' -import { getRequest } from '@tanstack/vue-start/server' -import { Await, createFileRoute } from '@tanstack/vue-router' -import { Suspense, defineComponent } from 'vue' -import { makeDeferredRecords } from '../../../deferred-records' -import type { DeferredRecord } from '../../../deferred-records' - -const getRequestSignal = createServerOnlyFn(() => getRequest().signal) - -const StreamComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.eager}

-

loading-alpha

-

loading-beta

- - {{ - default: () => ( - ) => ( -
    - {records.map((record) => ( -
  • {record.label}
  • - ))} -
- )} - /> - ), - fallback: () => null, - }} -
- - {{ - default: () => ( - ) => ( -
    - {records.map((record) => ( -
  • {record.label}
  • - ))} -
- )} - /> - ), - fallback: () => null, - }} -
-
- ) - }, -}) - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - eager: `eager-${params.id}`, - alpha: makeDeferredRecords(params.id, 'alpha', getRequestSignal()), - beta: makeDeferredRecords(params.id, 'beta', getRequestSignal()), - }), - component: StreamComponent, -}) diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/tsconfig.json b/benchmarks/memory/server/scenarios/aborted-requests/vue/tsconfig.json deleted file mode 100644 index 9ad6481342..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts b/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts deleted file mode 100644 index e4e1eb66d4..0000000000 --- a/benchmarks/memory/server/scenarios/aborted-requests/vue/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server aborted-requests (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts deleted file mode 100644 index a6f07b97be..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[0]! - -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 deleted file mode 100644 index 89071137c3..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/memory.error.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[2]! - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/react/memory.flame.ts b/benchmarks/memory/server/scenarios/error-paths/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) 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 deleted file mode 100644 index fa6a6693ed..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/memory.not-found.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[1]! - -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 deleted file mode 100644 index b2c3d24200..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/memory.unmatched.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[3]! - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/react/project.json b/benchmarks/memory/server/scenarios/error-paths/react/project.json deleted file mode 100644 index 6a399fe41e..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-error-paths-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/setup.ts b/benchmarks/memory/server/scenarios/error-paths/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/error-paths/react/src/routeTree.gen.ts deleted file mode 100644 index 4e8e4ce0e4..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routeTree.gen.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 BoomIdRouteImport } from './routes/boom.$id' -import { Route as FromIdRouteImport } from './routes/from.$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 BoomIdRoute = BoomIdRouteImport.update({ - id: '/boom/$id', - path: '/boom/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FromIdRoute = FromIdRouteImport.update({ - id: '/from/$id', - path: '/from/$id', - getParentRoute: () => rootRouteImport, -} as any) -const 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) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/boom/$id' | '/from/$id' | '/missing/$id' | '/target/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/boom/$id' | '/from/$id' | '/missing/$id' | '/target/$id' - id: - | '__root__' - | '/' - | '/boom/$id' - | '/from/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BoomIdRoute: typeof BoomIdRoute - FromIdRoute: typeof FromIdRoute - MissingIdRoute: typeof MissingIdRoute - TargetIdRoute: typeof TargetIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/boom/$id': { - id: '/boom/$id' - path: '/boom/$id' - fullPath: '/boom/$id' - preLoaderRoute: typeof BoomIdRouteImport - parentRoute: typeof rootRouteImport - } - '/from/$id': { - id: '/from/$id' - path: '/from/$id' - fullPath: '/from/$id' - preLoaderRoute: typeof FromIdRouteImport - parentRoute: typeof rootRouteImport - } - '/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 - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BoomIdRoute: BoomIdRoute, - FromIdRoute: FromIdRoute, - MissingIdRoute: MissingIdRoute, - TargetIdRoute: TargetIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/router.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/router.tsx deleted file mode 100644 index e31bd0abf7..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/router.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - defaultNotFoundComponent: DefaultNotFound, - }) -} - -// Without this, every unmatched-URL request logs a router warning in -// non-production ad-hoc runs. -function DefaultNotFound() { - return

error-paths-unmatched

-} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/boom.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/routes/boom.$id.tsx deleted file mode 100644 index fafa81a9bb..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/boom.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/boom/$id')({ - loader: ({ params }) => { - throw new Error(`boom-${params.id}`) - }, - errorComponent: BoomErrorComponent, - component: BoomComponent, -}) - -function BoomErrorComponent() { - return
error-paths-error-boundary
-} - -function BoomComponent() { - return null -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/from.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/routes/from.$id.tsx deleted file mode 100644 index 4c45e76c92..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/from.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/from/$id')({ - loader: ({ params }) => { - const { id } = params - - throw redirect({ to: '/target/$id', params: { id }, statusCode: 302 }) - }, - component: FromComponent, -}) - -function FromComponent() { - return null -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/index.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/routes/index.tsx deleted file mode 100644 index c5492486b4..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
error-paths-index
-} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/missing.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/routes/missing.$id.tsx deleted file mode 100644 index 84640e9712..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/missing.$id.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/react-router' - -export const Route = createFileRoute('/missing/$id')({ - loader: () => { - throw notFound() - }, - notFoundComponent: MissingNotFoundComponent, - component: MissingComponent, -}) - -function MissingNotFoundComponent() { - return ( -
error-paths-not-found-boundary
- ) -} - -function MissingComponent() { - return null -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/target.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/react/src/routes/target.$id.tsx deleted file mode 100644 index 1c13394cb2..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/src/routes/target.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/target/$id')({ - component: TargetComponent, -}) - -function TargetComponent() { - const params = Route.useParams() - - return
{`target-${params.id}`}
-} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json b/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json deleted file mode 100644 index 2dba47fc99..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory*.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts b/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts deleted file mode 100644 index c00de7727a..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - isolate: true, - ...memoryConfig('server'), - name: '@benchmarks/memory-server error-paths (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/shared.ts b/benchmarks/memory/server/scenarios/error-paths/shared.ts deleted file mode 100644 index 11ed293d22..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/shared.ts +++ /dev/null @@ -1,192 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, - runSequentialRequestLoop, -} from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -const errorPathsIterations = 18 -const redirectSeed = 0xdecafbad -const notFoundSeed = 0xdecafb0d -const errorSeed = 0xdecafbed -const unmatchedSeed = 0xdecaf00d -const redirectStatus = 302 -const notFoundStatus = 404 -const errorStatus = 500 -// Module-level so each error-path bench keeps advancing across runner invocations. -const redirectRandom = createDeterministicRandom(redirectSeed) -const notFoundRandom = createDeterministicRandom(notFoundSeed) -const errorRandom = createDeterministicRandom(errorSeed) -const unmatchedRandom = createDeterministicRandom(unmatchedSeed) -let redirectCounter = 0 -let notFoundCounter = 0 -let errorCounter = 0 -let unmatchedCounter = 0 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildRedirectRequest(random: () => number) { - const id = `${(redirectCounter++).toString(36)}-${randomSegment(random)}` - - return new Request(`http://localhost/from/${id}`, requestInit) -} - -function buildNotFoundRequest(random: () => number) { - const id = `${(notFoundCounter++).toString(36)}-${randomSegment(random)}` - - return new Request(`http://localhost/missing/${id}`, requestInit) -} - -function buildErrorRequest(random: () => number) { - const id = `${(errorCounter++).toString(36)}-${randomSegment(random)}` - - return new Request(`http://localhost/boom/${id}`, requestInit) -} - -function buildUnmatchedRequest(random: () => number) { - const id = `${(unmatchedCounter++).toString(36)}-${randomSegment(random)}` - - return new Request(`http://localhost/nope/${id}`, requestInit) -} - -function getRequestId(request: Request) { - const id = new URL(request.url).pathname.split('/').pop() - - if (!id) { - throw new Error(`Expected request id in ${request.url}`) - } - - return id -} - -function validateRedirectResponse(response: Response, request: Request) { - if (response.status !== redirectStatus) { - throw new Error( - `Expected status ${redirectStatus} for ${request.url}, got ${response.status}`, - ) - } - - const id = getRequestId(request) - const location = response.headers.get('location') - - if (location !== `/target/${id}`) { - throw new Error(`Expected redirect location /target/${id}, got ${location}`) - } -} - -function validateNotFoundResponse(response: Response, request: Request) { - if (response.status !== notFoundStatus) { - throw new Error( - `Expected status ${notFoundStatus} for ${request.url}, got ${response.status}`, - ) - } -} - -function validateErrorResponse(response: Response, request: Request) { - if (response.status !== errorStatus) { - throw new Error( - `Expected status ${errorStatus} for ${request.url}, got ${response.status}`, - ) - } -} - -async function assertStatusSanity( - handler: StartRequestHandler, - request: Request, - validateResponse: (response: Response, request: Request) => void, -) { - const response = await handler.fetch(request) - validateResponse(response, request) - await response.text() -} - -async function assertErrorPathsSanity(handler: StartRequestHandler) { - await assertStatusSanity( - handler, - new Request('http://localhost/from/sanity-redirect', requestInit), - validateRedirectResponse, - ) - await assertStatusSanity( - handler, - new Request('http://localhost/missing/sanity-missing', requestInit), - validateNotFoundResponse, - ) - await assertStatusSanity( - handler, - new Request('http://localhost/boom/sanity-error', requestInit), - validateErrorResponse, - ) - await assertStatusSanity( - handler, - new Request('http://localhost/nope/sanity-unmatched', requestInit), - validateNotFoundResponse, - ) -} - -export function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - const runRedirect = async () => - runSequentialRequestLoop(handler, { - random: redirectRandom, - iterations: errorPathsIterations, - buildRequest: buildRedirectRequest, - validateResponse: validateRedirectResponse, - }) - - const runNotFound = async () => - runSequentialRequestLoop(handler, { - random: notFoundRandom, - iterations: errorPathsIterations, - buildRequest: buildNotFoundRequest, - validateResponse: validateNotFoundResponse, - }) - - const runError = async () => - runSequentialRequestLoop(handler, { - random: errorRandom, - iterations: errorPathsIterations, - buildRequest: buildErrorRequest, - validateResponse: validateErrorResponse, - }) - - const runUnmatched = async () => - runSequentialRequestLoop(handler, { - random: unmatchedRandom, - iterations: errorPathsIterations, - buildRequest: buildUnmatchedRequest, - validateResponse: validateNotFoundResponse, - }) - - return { - sanity: () => assertErrorPathsSanity(handler), - workloads: [ - { - name: `mem server error-paths redirect (${framework})`, - run: runRedirect, - }, - { - name: `mem server error-paths not-found (${framework})`, - run: runNotFound, - }, - { - name: `mem server error-paths error (${framework})`, - run: runError, - }, - { - name: `mem server error-paths unmatched (${framework})`, - run: runUnmatched, - }, - ], - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts deleted file mode 100644 index a6f07b97be..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[0]! - -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 deleted file mode 100644 index 89071137c3..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.error.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[2]! - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/error-paths/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) 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 deleted file mode 100644 index fa6a6693ed..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.not-found.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[1]! - -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 deleted file mode 100644 index b2c3d24200..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/memory.unmatched.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[3]! - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/project.json b/benchmarks/memory/server/scenarios/error-paths/solid/project.json deleted file mode 100644 index 77fcfaf578..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-error-paths-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/setup.ts b/benchmarks/memory/server/scenarios/error-paths/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/error-paths/solid/src/routeTree.gen.ts deleted file mode 100644 index 32a4d56d3a..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 TargetIdRouteImport } from './routes/target.$id' -import { Route as MissingIdRouteImport } from './routes/missing.$id' -import { Route as FromIdRouteImport } from './routes/from.$id' -import { Route as BoomIdRouteImport } from './routes/boom.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const 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 FromIdRoute = FromIdRouteImport.update({ - id: '/from/$id', - path: '/from/$id', - getParentRoute: () => rootRouteImport, -} as any) -const BoomIdRoute = BoomIdRouteImport.update({ - id: '/boom/$id', - path: '/boom/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/boom/$id' | '/from/$id' | '/missing/$id' | '/target/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/boom/$id' | '/from/$id' | '/missing/$id' | '/target/$id' - id: - | '__root__' - | '/' - | '/boom/$id' - | '/from/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BoomIdRoute: typeof BoomIdRoute - FromIdRoute: typeof FromIdRoute - MissingIdRoute: typeof MissingIdRoute - TargetIdRoute: typeof TargetIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - 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 - } - '/from/$id': { - id: '/from/$id' - path: '/from/$id' - fullPath: '/from/$id' - preLoaderRoute: typeof FromIdRouteImport - parentRoute: typeof rootRouteImport - } - '/boom/$id': { - id: '/boom/$id' - path: '/boom/$id' - fullPath: '/boom/$id' - preLoaderRoute: typeof BoomIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BoomIdRoute: BoomIdRoute, - FromIdRoute: FromIdRoute, - MissingIdRoute: MissingIdRoute, - TargetIdRoute: TargetIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/router.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/router.tsx deleted file mode 100644 index ae51f8b5e9..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/router.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - defaultNotFoundComponent: DefaultNotFound, - }) -} - -// Without this, every unmatched-URL request logs a router warning in -// non-production ad-hoc runs. -function DefaultNotFound() { - return

error-paths-unmatched

-} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/boom.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/boom.$id.tsx deleted file mode 100644 index bebc638caa..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/boom.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/boom/$id')({ - loader: ({ params }) => { - throw new Error(`boom-${params.id}`) - }, - errorComponent: BoomErrorComponent, - component: BoomComponent, -}) - -function BoomErrorComponent() { - return
error-paths-error-boundary
-} - -function BoomComponent() { - return null -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/from.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/from.$id.tsx deleted file mode 100644 index e96b7864f2..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/from.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/from/$id')({ - loader: ({ params }) => { - const { id } = params - - throw redirect({ to: '/target/$id', params: { id }, statusCode: 302 }) - }, - component: FromComponent, -}) - -function FromComponent() { - return null -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/index.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/index.tsx deleted file mode 100644 index 43282af801..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
error-paths-index
-} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/missing.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/missing.$id.tsx deleted file mode 100644 index 1b9ec5e29d..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/missing.$id.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/solid-router' - -export const Route = createFileRoute('/missing/$id')({ - loader: () => { - throw notFound() - }, - notFoundComponent: MissingNotFoundComponent, - component: MissingComponent, -}) - -function MissingNotFoundComponent() { - return ( -
error-paths-not-found-boundary
- ) -} - -function MissingComponent() { - return null -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/target.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/target.$id.tsx deleted file mode 100644 index 4196fc1183..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/src/routes/target.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/target/$id')({ - component: TargetComponent, -}) - -function TargetComponent() { - const params = Route.useParams() - - return
{`target-${params().id}`}
-} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json b/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json deleted file mode 100644 index 1e8103127a..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory*.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts b/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts deleted file mode 100644 index d7a0bb51b0..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - isolate: true, - ...memoryConfig('server'), - name: '@benchmarks/memory-server error-paths (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts deleted file mode 100644 index a6f07b97be..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[0]! - -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 deleted file mode 100644 index 89071137c3..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.error.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[2]! - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/error-paths/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) 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 deleted file mode 100644 index fa6a6693ed..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.not-found.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[1]! - -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 deleted file mode 100644 index b2c3d24200..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/memory.unmatched.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -const workload = workloadGroup.workloads[3]! - -test('memory', async ({ bench }) => { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/project.json b/benchmarks/memory/server/scenarios/error-paths/vue/project.json deleted file mode 100644 index 8472470bde..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-error-paths-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/setup.ts b/benchmarks/memory/server/scenarios/error-paths/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/error-paths/vue/src/routeTree.gen.ts deleted file mode 100644 index ea5bafa386..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 TargetIdRouteImport } from './routes/target.$id' -import { Route as MissingIdRouteImport } from './routes/missing.$id' -import { Route as FromIdRouteImport } from './routes/from.$id' -import { Route as BoomIdRouteImport } from './routes/boom.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const 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 FromIdRoute = FromIdRouteImport.update({ - id: '/from/$id', - path: '/from/$id', - getParentRoute: () => rootRouteImport, -} as any) -const BoomIdRoute = BoomIdRouteImport.update({ - id: '/boom/$id', - path: '/boom/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/boom/$id' | '/from/$id' | '/missing/$id' | '/target/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/boom/$id' | '/from/$id' | '/missing/$id' | '/target/$id' - id: - | '__root__' - | '/' - | '/boom/$id' - | '/from/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BoomIdRoute: typeof BoomIdRoute - FromIdRoute: typeof FromIdRoute - MissingIdRoute: typeof MissingIdRoute - TargetIdRoute: typeof TargetIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - 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 - } - '/from/$id': { - id: '/from/$id' - path: '/from/$id' - fullPath: '/from/$id' - preLoaderRoute: typeof FromIdRouteImport - parentRoute: typeof rootRouteImport - } - '/boom/$id': { - id: '/boom/$id' - path: '/boom/$id' - fullPath: '/boom/$id' - preLoaderRoute: typeof BoomIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BoomIdRoute: BoomIdRoute, - FromIdRoute: FromIdRoute, - MissingIdRoute: MissingIdRoute, - TargetIdRoute: TargetIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/router.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/boom.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/boom.$id.tsx deleted file mode 100644 index d933b93df2..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/boom.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/boom/$id')({ - loader: ({ params }) => { - throw new Error(`boom-${params.id}`) - }, - errorComponent: BoomErrorComponent, - component: BoomComponent, -}) - -function BoomErrorComponent() { - return
error-paths-error-boundary
-} - -function BoomComponent() { - return <> -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/from.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/from.$id.tsx deleted file mode 100644 index 6ffba96bce..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/from.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/vue-router' - -export const Route = createFileRoute('/from/$id')({ - loader: ({ params }) => { - const { id } = params - - throw redirect({ to: '/target/$id', params: { id }, statusCode: 302 }) - }, - component: FromComponent, -}) - -function FromComponent() { - return <> -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/index.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/index.tsx deleted file mode 100644 index 53fb604c60..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
error-paths-index
-} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/missing.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/missing.$id.tsx deleted file mode 100644 index 0e4972f5c6..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/missing.$id.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/vue-router' - -export const Route = createFileRoute('/missing/$id')({ - loader: () => { - throw notFound() - }, - notFoundComponent: MissingNotFoundComponent, - component: MissingComponent, -}) - -function MissingNotFoundComponent() { - return ( -
error-paths-not-found-boundary
- ) -} - -function MissingComponent() { - return <> -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx b/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx deleted file mode 100644 index 0bbf4a3dc6..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/src/routes/target.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const TargetComponent = defineComponent({ - setup() { - const params = Route.useParams() - - return () =>
{`target-${params.value.id}`}
- }, -}) - -export const Route = createFileRoute('/target/$id')({ - component: TargetComponent, -}) diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json b/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json deleted file mode 100644 index af8b83005c..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory*.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts b/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts deleted file mode 100644 index 3dc0762aa0..0000000000 --- a/benchmarks/memory/server/scenarios/error-paths/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - isolate: true, - ...memoryConfig('server'), - name: '@benchmarks/memory-server error-paths (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/large-page-data.ts b/benchmarks/memory/server/scenarios/peak-large-page/large-page-data.ts deleted file mode 100644 index 8f77c58731..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/large-page-data.ts +++ /dev/null @@ -1,111 +0,0 @@ -export interface LargePageRecord { - id: string - name: string - description: string -} - -export interface LargePageLevelData { - level: number - marker: string - records: Array -} - -const recordCount = 200 -const descriptionLength = 104 - -export function makeLargePageLevelData(level: number, seed: number) { - const random = createDeterministicRandom(seed) - - return { - level, - marker: makeLargePageMarker(level), - records: Array.from({ length: recordCount }, (_, index) => { - const idToken = randomSegment(random) - const descriptionTokenA = randomSegment(random) - const descriptionTokenB = randomSegment(random) - - return { - id: `l${level}-${index}-${idToken}`, - name: makeLargePageRecordName(level, index), - description: makeDescription( - level, - index, - descriptionTokenA, - descriptionTokenB, - ), - } - }), - } satisfies LargePageLevelData -} - -export function makeLargePageHead(loaderData: LargePageLevelData | undefined) { - if (!loaderData) { - return { - meta: [{ title: 'Peak Large Page' }], - } - } - - const first = loaderData.records[0]! - const last = loaderData.records[loaderData.records.length - 1]! - - return { - meta: [ - { title: `Peak Large Page L${loaderData.level} ${first.name}` }, - { - name: `peak-large-page-l${loaderData.level}-count`, - content: String(loaderData.records.length), - }, - { - name: `peak-large-page-l${loaderData.level}-first-id`, - content: first.id, - }, - { - name: `peak-large-page-l${loaderData.level}-first-name`, - content: first.name, - }, - { - name: `peak-large-page-l${loaderData.level}-last-id`, - content: last.id, - }, - { - name: `peak-large-page-l${loaderData.level}-description`, - content: first.description, - }, - ], - } -} - -function makeLargePageRecordName(level: number, index: number) { - return `peak-large-page-l${level}-record-${index}` -} - -function makeLargePageMarker(level: number) { - return `peak-large-page-level-${level}` -} - -function makeDescription( - level: number, - index: number, - tokenA: string, - tokenB: string, -) { - return `Level ${level} record ${index} uses seeded fragments ${tokenA} and ${tokenB} to keep a fresh deterministic loader payload.`.padEnd( - descriptionLength, - 'x', - ) -} - -// Local copy of the LCG from benchmarks/memory/server/bench-utils.ts - app -// source cannot import from outside the app root. Keep in sync. -function createDeterministicRandom(seed: number) { - let state = seed >>> 0 - - return () => { - state = (state * 1664525 + 1013904223) >>> 0 - return state / 0x100000000 - } -} - -function randomSegment(random: () => number) { - return Math.floor(random() * 1_000_000_000).toString(36) -} 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 deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.flame.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/project.json b/benchmarks/memory/server/scenarios/peak-large-page/react/project.json deleted file mode 100644 index 699a243a03..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-peak-large-page-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/setup.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routeTree.gen.ts deleted file mode 100644 index 6004590f9b..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routeTree.gen.ts +++ /dev/null @@ -1,305 +0,0 @@ -/* 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 L1RouteImport } from './routes/l1' -import { Route as L1L2RouteImport } from './routes/l1.l2' -import { Route as L1L2L3RouteImport } from './routes/l1.l2.l3' -import { Route as L1L2L3L4RouteImport } from './routes/l1.l2.l3.l4' -import { Route as L1L2L3L4L5RouteImport } from './routes/l1.l2.l3.l4.l5' -import { Route as L1L2L3L4L5L6RouteImport } from './routes/l1.l2.l3.l4.l5.l6' -import { Route as L1L2L3L4L5L6L7RouteImport } from './routes/l1.l2.l3.l4.l5.l6.l7' -import { Route as L1L2L3L4L5L6L7L8RouteImport } from './routes/l1.l2.l3.l4.l5.l6.l7.l8' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const L1Route = L1RouteImport.update({ - id: '/l1', - path: '/l1', - getParentRoute: () => rootRouteImport, -} as any) -const L1L2Route = L1L2RouteImport.update({ - id: '/l2', - path: '/l2', - getParentRoute: () => L1Route, -} as any) -const L1L2L3Route = L1L2L3RouteImport.update({ - id: '/l3', - path: '/l3', - getParentRoute: () => L1L2Route, -} as any) -const L1L2L3L4Route = L1L2L3L4RouteImport.update({ - id: '/l4', - path: '/l4', - getParentRoute: () => L1L2L3Route, -} as any) -const L1L2L3L4L5Route = L1L2L3L4L5RouteImport.update({ - id: '/l5', - path: '/l5', - getParentRoute: () => L1L2L3L4Route, -} as any) -const L1L2L3L4L5L6Route = L1L2L3L4L5L6RouteImport.update({ - id: '/l6', - path: '/l6', - getParentRoute: () => L1L2L3L4L5Route, -} as any) -const L1L2L3L4L5L6L7Route = L1L2L3L4L5L6L7RouteImport.update({ - id: '/l7', - path: '/l7', - getParentRoute: () => L1L2L3L4L5L6Route, -} as any) -const L1L2L3L4L5L6L7L8Route = L1L2L3L4L5L6L7L8RouteImport.update({ - id: '/l8', - path: '/l8', - getParentRoute: () => L1L2L3L4L5L6L7Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - id: - | '__root__' - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - L1Route: typeof L1RouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/l1': { - id: '/l1' - path: '/l1' - fullPath: '/l1' - preLoaderRoute: typeof L1RouteImport - parentRoute: typeof rootRouteImport - } - '/l1/l2': { - id: '/l1/l2' - path: '/l2' - fullPath: '/l1/l2' - preLoaderRoute: typeof L1L2RouteImport - parentRoute: typeof L1Route - } - '/l1/l2/l3': { - id: '/l1/l2/l3' - path: '/l3' - fullPath: '/l1/l2/l3' - preLoaderRoute: typeof L1L2L3RouteImport - parentRoute: typeof L1L2Route - } - '/l1/l2/l3/l4': { - id: '/l1/l2/l3/l4' - path: '/l4' - fullPath: '/l1/l2/l3/l4' - preLoaderRoute: typeof L1L2L3L4RouteImport - parentRoute: typeof L1L2L3Route - } - '/l1/l2/l3/l4/l5': { - id: '/l1/l2/l3/l4/l5' - path: '/l5' - fullPath: '/l1/l2/l3/l4/l5' - preLoaderRoute: typeof L1L2L3L4L5RouteImport - parentRoute: typeof L1L2L3L4Route - } - '/l1/l2/l3/l4/l5/l6': { - id: '/l1/l2/l3/l4/l5/l6' - path: '/l6' - fullPath: '/l1/l2/l3/l4/l5/l6' - preLoaderRoute: typeof L1L2L3L4L5L6RouteImport - parentRoute: typeof L1L2L3L4L5Route - } - '/l1/l2/l3/l4/l5/l6/l7': { - id: '/l1/l2/l3/l4/l5/l6/l7' - path: '/l7' - fullPath: '/l1/l2/l3/l4/l5/l6/l7' - preLoaderRoute: typeof L1L2L3L4L5L6L7RouteImport - parentRoute: typeof L1L2L3L4L5L6Route - } - '/l1/l2/l3/l4/l5/l6/l7/l8': { - id: '/l1/l2/l3/l4/l5/l6/l7/l8' - path: '/l8' - fullPath: '/l1/l2/l3/l4/l5/l6/l7/l8' - preLoaderRoute: typeof L1L2L3L4L5L6L7L8RouteImport - parentRoute: typeof L1L2L3L4L5L6L7Route - } - } -} - -interface L1L2L3L4L5L6L7RouteChildren { - L1L2L3L4L5L6L7L8Route: typeof L1L2L3L4L5L6L7L8Route -} - -const L1L2L3L4L5L6L7RouteChildren: L1L2L3L4L5L6L7RouteChildren = { - L1L2L3L4L5L6L7L8Route: L1L2L3L4L5L6L7L8Route, -} - -const L1L2L3L4L5L6L7RouteWithChildren = L1L2L3L4L5L6L7Route._addFileChildren( - L1L2L3L4L5L6L7RouteChildren, -) - -interface L1L2L3L4L5L6RouteChildren { - L1L2L3L4L5L6L7Route: typeof L1L2L3L4L5L6L7RouteWithChildren -} - -const L1L2L3L4L5L6RouteChildren: L1L2L3L4L5L6RouteChildren = { - L1L2L3L4L5L6L7Route: L1L2L3L4L5L6L7RouteWithChildren, -} - -const L1L2L3L4L5L6RouteWithChildren = L1L2L3L4L5L6Route._addFileChildren( - L1L2L3L4L5L6RouteChildren, -) - -interface L1L2L3L4L5RouteChildren { - L1L2L3L4L5L6Route: typeof L1L2L3L4L5L6RouteWithChildren -} - -const L1L2L3L4L5RouteChildren: L1L2L3L4L5RouteChildren = { - L1L2L3L4L5L6Route: L1L2L3L4L5L6RouteWithChildren, -} - -const L1L2L3L4L5RouteWithChildren = L1L2L3L4L5Route._addFileChildren( - L1L2L3L4L5RouteChildren, -) - -interface L1L2L3L4RouteChildren { - L1L2L3L4L5Route: typeof L1L2L3L4L5RouteWithChildren -} - -const L1L2L3L4RouteChildren: L1L2L3L4RouteChildren = { - L1L2L3L4L5Route: L1L2L3L4L5RouteWithChildren, -} - -const L1L2L3L4RouteWithChildren = L1L2L3L4Route._addFileChildren( - L1L2L3L4RouteChildren, -) - -interface L1L2L3RouteChildren { - L1L2L3L4Route: typeof L1L2L3L4RouteWithChildren -} - -const L1L2L3RouteChildren: L1L2L3RouteChildren = { - L1L2L3L4Route: L1L2L3L4RouteWithChildren, -} - -const L1L2L3RouteWithChildren = - L1L2L3Route._addFileChildren(L1L2L3RouteChildren) - -interface L1L2RouteChildren { - L1L2L3Route: typeof L1L2L3RouteWithChildren -} - -const L1L2RouteChildren: L1L2RouteChildren = { - L1L2L3Route: L1L2L3RouteWithChildren, -} - -const L1L2RouteWithChildren = L1L2Route._addFileChildren(L1L2RouteChildren) - -interface L1RouteChildren { - L1L2Route: typeof L1L2RouteWithChildren -} - -const L1RouteChildren: L1RouteChildren = { - L1L2Route: L1L2RouteWithChildren, -} - -const L1RouteWithChildren = L1Route._addFileChildren(L1RouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - L1Route: L1RouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/router.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/index.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/index.tsx deleted file mode 100644 index 25099720e4..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
peak-large-page-index
-} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx deleted file mode 100644 index 0651ba886d..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7/l8')({ - loader: () => makeLargePageLevelData(8, 0x5eed_1008), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelEightComponent, -}) - -function LevelEightComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
-
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx deleted file mode 100644 index 1f89e6f454..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7')({ - loader: () => makeLargePageLevelData(7, 0x5eed_1007), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelSevenComponent, -}) - -function LevelSevenComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.tsx deleted file mode 100644 index 1a8c98ceb2..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.l6.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6')({ - loader: () => makeLargePageLevelData(6, 0x5eed_1006), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelSixComponent, -}) - -function LevelSixComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.tsx deleted file mode 100644 index 3e9afad0b9..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.l5.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5')({ - loader: () => makeLargePageLevelData(5, 0x5eed_1005), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelFiveComponent, -}) - -function LevelFiveComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.tsx deleted file mode 100644 index 73c29bc402..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.l4.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4')({ - loader: () => makeLargePageLevelData(4, 0x5eed_1004), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelFourComponent, -}) - -function LevelFourComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.tsx deleted file mode 100644 index e5b57463ad..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.l3.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3')({ - loader: () => makeLargePageLevelData(3, 0x5eed_1003), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelThreeComponent, -}) - -function LevelThreeComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.tsx deleted file mode 100644 index 18999233cc..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.l2.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2')({ - loader: () => makeLargePageLevelData(2, 0x5eed_1002), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelTwoComponent, -}) - -function LevelTwoComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.tsx b/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.tsx deleted file mode 100644 index 8fa7a5e0dc..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/src/routes/l1.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1')({ - loader: () => makeLargePageLevelData(1, 0x5eed_1001), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelOneComponent, -}) - -function LevelOneComponent() { - const data = Route.useLoaderData() - const first = data.records[0]! - - return ( -
-

{data.marker}

-

records: {data.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/tsconfig.json b/benchmarks/memory/server/scenarios/peak-large-page/react/tsconfig.json deleted file mode 100644 index 11ddcce4ea..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts b/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts deleted file mode 100644 index dcfcf1f92b..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/react/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server peak-large-page (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/shared.ts b/benchmarks/memory/server/scenarios/peak-large-page/shared.ts deleted file mode 100644 index 085e576244..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/shared.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { runSequentialRequestLoop } from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -const benchmarkSeed = 0x5eed_0005 -const peakLargePageIterations = 1 -const peakLargePageUrl = 'http://localhost/l1/l2/l3/l4/l5/l6/l7/l8' -const levelEightMarker = 'data-bench="peak-large-page-level-8"' - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildPeakLargePageRequest() { - return new Request(peakLargePageUrl, requestInit) -} - -function validatePeakLargePageResponse(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Expected status 200 for ${request.url}, got ${response.status}`, - ) - } -} - -function validatePeakLargePageBody(body: string) { - if (!body.includes(levelEightMarker)) { - throw new Error('Expected peak-large-page level-8 marker in response body') - } -} - -async function assertPeakLargePageSanity(handler: StartRequestHandler) { - const request = new Request(peakLargePageUrl, requestInit) - const response = await handler.fetch(request) - const body = await response.text() - - validatePeakLargePageResponse(response, request) - validatePeakLargePageBody(body) -} - -export function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - const run = async () => - runSequentialRequestLoop(handler, { - seed: benchmarkSeed, - iterations: peakLargePageIterations, - buildRequest: buildPeakLargePageRequest, - validateResponse: validatePeakLargePageResponse, - }) - - return { - sanity: () => assertPeakLargePageSanity(handler), - workloads: [ - { - name: `mem server peak-large-page (${framework})`, - run, - }, - ], - } -} 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 deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/project.json b/benchmarks/memory/server/scenarios/peak-large-page/solid/project.json deleted file mode 100644 index 85e8f83224..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-peak-large-page-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/setup.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routeTree.gen.ts deleted file mode 100644 index c3ccdaaa0e..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,305 +0,0 @@ -/* 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 L1RouteImport } from './routes/l1' -import { Route as IndexRouteImport } from './routes/index' -import { Route as L1L2RouteImport } from './routes/l1.l2' -import { Route as L1L2L3RouteImport } from './routes/l1.l2.l3' -import { Route as L1L2L3L4RouteImport } from './routes/l1.l2.l3.l4' -import { Route as L1L2L3L4L5RouteImport } from './routes/l1.l2.l3.l4.l5' -import { Route as L1L2L3L4L5L6RouteImport } from './routes/l1.l2.l3.l4.l5.l6' -import { Route as L1L2L3L4L5L6L7RouteImport } from './routes/l1.l2.l3.l4.l5.l6.l7' -import { Route as L1L2L3L4L5L6L7L8RouteImport } from './routes/l1.l2.l3.l4.l5.l6.l7.l8' - -const L1Route = L1RouteImport.update({ - id: '/l1', - path: '/l1', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const L1L2Route = L1L2RouteImport.update({ - id: '/l2', - path: '/l2', - getParentRoute: () => L1Route, -} as any) -const L1L2L3Route = L1L2L3RouteImport.update({ - id: '/l3', - path: '/l3', - getParentRoute: () => L1L2Route, -} as any) -const L1L2L3L4Route = L1L2L3L4RouteImport.update({ - id: '/l4', - path: '/l4', - getParentRoute: () => L1L2L3Route, -} as any) -const L1L2L3L4L5Route = L1L2L3L4L5RouteImport.update({ - id: '/l5', - path: '/l5', - getParentRoute: () => L1L2L3L4Route, -} as any) -const L1L2L3L4L5L6Route = L1L2L3L4L5L6RouteImport.update({ - id: '/l6', - path: '/l6', - getParentRoute: () => L1L2L3L4L5Route, -} as any) -const L1L2L3L4L5L6L7Route = L1L2L3L4L5L6L7RouteImport.update({ - id: '/l7', - path: '/l7', - getParentRoute: () => L1L2L3L4L5L6Route, -} as any) -const L1L2L3L4L5L6L7L8Route = L1L2L3L4L5L6L7L8RouteImport.update({ - id: '/l8', - path: '/l8', - getParentRoute: () => L1L2L3L4L5L6L7Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - id: - | '__root__' - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - L1Route: typeof L1RouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/l1': { - id: '/l1' - path: '/l1' - fullPath: '/l1' - preLoaderRoute: typeof L1RouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/l1/l2': { - id: '/l1/l2' - path: '/l2' - fullPath: '/l1/l2' - preLoaderRoute: typeof L1L2RouteImport - parentRoute: typeof L1Route - } - '/l1/l2/l3': { - id: '/l1/l2/l3' - path: '/l3' - fullPath: '/l1/l2/l3' - preLoaderRoute: typeof L1L2L3RouteImport - parentRoute: typeof L1L2Route - } - '/l1/l2/l3/l4': { - id: '/l1/l2/l3/l4' - path: '/l4' - fullPath: '/l1/l2/l3/l4' - preLoaderRoute: typeof L1L2L3L4RouteImport - parentRoute: typeof L1L2L3Route - } - '/l1/l2/l3/l4/l5': { - id: '/l1/l2/l3/l4/l5' - path: '/l5' - fullPath: '/l1/l2/l3/l4/l5' - preLoaderRoute: typeof L1L2L3L4L5RouteImport - parentRoute: typeof L1L2L3L4Route - } - '/l1/l2/l3/l4/l5/l6': { - id: '/l1/l2/l3/l4/l5/l6' - path: '/l6' - fullPath: '/l1/l2/l3/l4/l5/l6' - preLoaderRoute: typeof L1L2L3L4L5L6RouteImport - parentRoute: typeof L1L2L3L4L5Route - } - '/l1/l2/l3/l4/l5/l6/l7': { - id: '/l1/l2/l3/l4/l5/l6/l7' - path: '/l7' - fullPath: '/l1/l2/l3/l4/l5/l6/l7' - preLoaderRoute: typeof L1L2L3L4L5L6L7RouteImport - parentRoute: typeof L1L2L3L4L5L6Route - } - '/l1/l2/l3/l4/l5/l6/l7/l8': { - id: '/l1/l2/l3/l4/l5/l6/l7/l8' - path: '/l8' - fullPath: '/l1/l2/l3/l4/l5/l6/l7/l8' - preLoaderRoute: typeof L1L2L3L4L5L6L7L8RouteImport - parentRoute: typeof L1L2L3L4L5L6L7Route - } - } -} - -interface L1L2L3L4L5L6L7RouteChildren { - L1L2L3L4L5L6L7L8Route: typeof L1L2L3L4L5L6L7L8Route -} - -const L1L2L3L4L5L6L7RouteChildren: L1L2L3L4L5L6L7RouteChildren = { - L1L2L3L4L5L6L7L8Route: L1L2L3L4L5L6L7L8Route, -} - -const L1L2L3L4L5L6L7RouteWithChildren = L1L2L3L4L5L6L7Route._addFileChildren( - L1L2L3L4L5L6L7RouteChildren, -) - -interface L1L2L3L4L5L6RouteChildren { - L1L2L3L4L5L6L7Route: typeof L1L2L3L4L5L6L7RouteWithChildren -} - -const L1L2L3L4L5L6RouteChildren: L1L2L3L4L5L6RouteChildren = { - L1L2L3L4L5L6L7Route: L1L2L3L4L5L6L7RouteWithChildren, -} - -const L1L2L3L4L5L6RouteWithChildren = L1L2L3L4L5L6Route._addFileChildren( - L1L2L3L4L5L6RouteChildren, -) - -interface L1L2L3L4L5RouteChildren { - L1L2L3L4L5L6Route: typeof L1L2L3L4L5L6RouteWithChildren -} - -const L1L2L3L4L5RouteChildren: L1L2L3L4L5RouteChildren = { - L1L2L3L4L5L6Route: L1L2L3L4L5L6RouteWithChildren, -} - -const L1L2L3L4L5RouteWithChildren = L1L2L3L4L5Route._addFileChildren( - L1L2L3L4L5RouteChildren, -) - -interface L1L2L3L4RouteChildren { - L1L2L3L4L5Route: typeof L1L2L3L4L5RouteWithChildren -} - -const L1L2L3L4RouteChildren: L1L2L3L4RouteChildren = { - L1L2L3L4L5Route: L1L2L3L4L5RouteWithChildren, -} - -const L1L2L3L4RouteWithChildren = L1L2L3L4Route._addFileChildren( - L1L2L3L4RouteChildren, -) - -interface L1L2L3RouteChildren { - L1L2L3L4Route: typeof L1L2L3L4RouteWithChildren -} - -const L1L2L3RouteChildren: L1L2L3RouteChildren = { - L1L2L3L4Route: L1L2L3L4RouteWithChildren, -} - -const L1L2L3RouteWithChildren = - L1L2L3Route._addFileChildren(L1L2L3RouteChildren) - -interface L1L2RouteChildren { - L1L2L3Route: typeof L1L2L3RouteWithChildren -} - -const L1L2RouteChildren: L1L2RouteChildren = { - L1L2L3Route: L1L2L3RouteWithChildren, -} - -const L1L2RouteWithChildren = L1L2Route._addFileChildren(L1L2RouteChildren) - -interface L1RouteChildren { - L1L2Route: typeof L1L2RouteWithChildren -} - -const L1RouteChildren: L1RouteChildren = { - L1L2Route: L1L2RouteWithChildren, -} - -const L1RouteWithChildren = L1Route._addFileChildren(L1RouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - L1Route: L1RouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/router.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/index.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/index.tsx deleted file mode 100644 index 111ffaa36a..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
peak-large-page-index
-} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx deleted file mode 100644 index b0f94893fb..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7/l8')({ - loader: () => makeLargePageLevelData(8, 0x5eed_1008), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelEightComponent, -}) - -function LevelEightComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
-
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx deleted file mode 100644 index f8a3819c85..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7')({ - loader: () => makeLargePageLevelData(7, 0x5eed_1007), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelSevenComponent, -}) - -function LevelSevenComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.tsx deleted file mode 100644 index 7a438ddbd2..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.l6.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6')({ - loader: () => makeLargePageLevelData(6, 0x5eed_1006), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelSixComponent, -}) - -function LevelSixComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.tsx deleted file mode 100644 index 2e05985ac5..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.l5.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4/l5')({ - loader: () => makeLargePageLevelData(5, 0x5eed_1005), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelFiveComponent, -}) - -function LevelFiveComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.tsx deleted file mode 100644 index 4f38f0cb76..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.l4.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3/l4')({ - loader: () => makeLargePageLevelData(4, 0x5eed_1004), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelFourComponent, -}) - -function LevelFourComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.tsx deleted file mode 100644 index 3f1f113fe3..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.l3.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2/l3')({ - loader: () => makeLargePageLevelData(3, 0x5eed_1003), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelThreeComponent, -}) - -function LevelThreeComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.tsx deleted file mode 100644 index bd338fd53f..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.l2.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1/l2')({ - loader: () => makeLargePageLevelData(2, 0x5eed_1002), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelTwoComponent, -}) - -function LevelTwoComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.tsx b/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.tsx deleted file mode 100644 index 9dcfd7448a..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/src/routes/l1.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -export const Route = createFileRoute('/l1')({ - loader: () => makeLargePageLevelData(1, 0x5eed_1001), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelOneComponent, -}) - -function LevelOneComponent() { - const data = Route.useLoaderData() - const first = () => data().records[0]! - - return ( -
-

{data().marker}

-

records: {data().records.length}

-
-

{first().name}

-

{first().id}

-

{first().description}

-
- -
- ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json b/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json deleted file mode 100644 index 4b61264e11..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts b/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts deleted file mode 100644 index 15b8c3a571..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/solid/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server peak-large-page (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) 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 deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/project.json b/benchmarks/memory/server/scenarios/peak-large-page/vue/project.json deleted file mode 100644 index f424a2134f..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-peak-large-page-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/setup.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routeTree.gen.ts deleted file mode 100644 index 26cc9f6058..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,305 +0,0 @@ -/* 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 L1RouteImport } from './routes/l1' -import { Route as IndexRouteImport } from './routes/index' -import { Route as L1L2RouteImport } from './routes/l1.l2' -import { Route as L1L2L3RouteImport } from './routes/l1.l2.l3' -import { Route as L1L2L3L4RouteImport } from './routes/l1.l2.l3.l4' -import { Route as L1L2L3L4L5RouteImport } from './routes/l1.l2.l3.l4.l5' -import { Route as L1L2L3L4L5L6RouteImport } from './routes/l1.l2.l3.l4.l5.l6' -import { Route as L1L2L3L4L5L6L7RouteImport } from './routes/l1.l2.l3.l4.l5.l6.l7' -import { Route as L1L2L3L4L5L6L7L8RouteImport } from './routes/l1.l2.l3.l4.l5.l6.l7.l8' - -const L1Route = L1RouteImport.update({ - id: '/l1', - path: '/l1', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const L1L2Route = L1L2RouteImport.update({ - id: '/l2', - path: '/l2', - getParentRoute: () => L1Route, -} as any) -const L1L2L3Route = L1L2L3RouteImport.update({ - id: '/l3', - path: '/l3', - getParentRoute: () => L1L2Route, -} as any) -const L1L2L3L4Route = L1L2L3L4RouteImport.update({ - id: '/l4', - path: '/l4', - getParentRoute: () => L1L2L3Route, -} as any) -const L1L2L3L4L5Route = L1L2L3L4L5RouteImport.update({ - id: '/l5', - path: '/l5', - getParentRoute: () => L1L2L3L4Route, -} as any) -const L1L2L3L4L5L6Route = L1L2L3L4L5L6RouteImport.update({ - id: '/l6', - path: '/l6', - getParentRoute: () => L1L2L3L4L5Route, -} as any) -const L1L2L3L4L5L6L7Route = L1L2L3L4L5L6L7RouteImport.update({ - id: '/l7', - path: '/l7', - getParentRoute: () => L1L2L3L4L5L6Route, -} as any) -const L1L2L3L4L5L6L7L8Route = L1L2L3L4L5L6L7L8RouteImport.update({ - id: '/l8', - path: '/l8', - getParentRoute: () => L1L2L3L4L5L6L7Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/l1': typeof L1RouteWithChildren - '/l1/l2': typeof L1L2RouteWithChildren - '/l1/l2/l3': typeof L1L2L3RouteWithChildren - '/l1/l2/l3/l4': typeof L1L2L3L4RouteWithChildren - '/l1/l2/l3/l4/l5': typeof L1L2L3L4L5RouteWithChildren - '/l1/l2/l3/l4/l5/l6': typeof L1L2L3L4L5L6RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7': typeof L1L2L3L4L5L6L7RouteWithChildren - '/l1/l2/l3/l4/l5/l6/l7/l8': typeof L1L2L3L4L5L6L7L8Route -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - id: - | '__root__' - | '/' - | '/l1' - | '/l1/l2' - | '/l1/l2/l3' - | '/l1/l2/l3/l4' - | '/l1/l2/l3/l4/l5' - | '/l1/l2/l3/l4/l5/l6' - | '/l1/l2/l3/l4/l5/l6/l7' - | '/l1/l2/l3/l4/l5/l6/l7/l8' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - L1Route: typeof L1RouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/l1': { - id: '/l1' - path: '/l1' - fullPath: '/l1' - preLoaderRoute: typeof L1RouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/l1/l2': { - id: '/l1/l2' - path: '/l2' - fullPath: '/l1/l2' - preLoaderRoute: typeof L1L2RouteImport - parentRoute: typeof L1Route - } - '/l1/l2/l3': { - id: '/l1/l2/l3' - path: '/l3' - fullPath: '/l1/l2/l3' - preLoaderRoute: typeof L1L2L3RouteImport - parentRoute: typeof L1L2Route - } - '/l1/l2/l3/l4': { - id: '/l1/l2/l3/l4' - path: '/l4' - fullPath: '/l1/l2/l3/l4' - preLoaderRoute: typeof L1L2L3L4RouteImport - parentRoute: typeof L1L2L3Route - } - '/l1/l2/l3/l4/l5': { - id: '/l1/l2/l3/l4/l5' - path: '/l5' - fullPath: '/l1/l2/l3/l4/l5' - preLoaderRoute: typeof L1L2L3L4L5RouteImport - parentRoute: typeof L1L2L3L4Route - } - '/l1/l2/l3/l4/l5/l6': { - id: '/l1/l2/l3/l4/l5/l6' - path: '/l6' - fullPath: '/l1/l2/l3/l4/l5/l6' - preLoaderRoute: typeof L1L2L3L4L5L6RouteImport - parentRoute: typeof L1L2L3L4L5Route - } - '/l1/l2/l3/l4/l5/l6/l7': { - id: '/l1/l2/l3/l4/l5/l6/l7' - path: '/l7' - fullPath: '/l1/l2/l3/l4/l5/l6/l7' - preLoaderRoute: typeof L1L2L3L4L5L6L7RouteImport - parentRoute: typeof L1L2L3L4L5L6Route - } - '/l1/l2/l3/l4/l5/l6/l7/l8': { - id: '/l1/l2/l3/l4/l5/l6/l7/l8' - path: '/l8' - fullPath: '/l1/l2/l3/l4/l5/l6/l7/l8' - preLoaderRoute: typeof L1L2L3L4L5L6L7L8RouteImport - parentRoute: typeof L1L2L3L4L5L6L7Route - } - } -} - -interface L1L2L3L4L5L6L7RouteChildren { - L1L2L3L4L5L6L7L8Route: typeof L1L2L3L4L5L6L7L8Route -} - -const L1L2L3L4L5L6L7RouteChildren: L1L2L3L4L5L6L7RouteChildren = { - L1L2L3L4L5L6L7L8Route: L1L2L3L4L5L6L7L8Route, -} - -const L1L2L3L4L5L6L7RouteWithChildren = L1L2L3L4L5L6L7Route._addFileChildren( - L1L2L3L4L5L6L7RouteChildren, -) - -interface L1L2L3L4L5L6RouteChildren { - L1L2L3L4L5L6L7Route: typeof L1L2L3L4L5L6L7RouteWithChildren -} - -const L1L2L3L4L5L6RouteChildren: L1L2L3L4L5L6RouteChildren = { - L1L2L3L4L5L6L7Route: L1L2L3L4L5L6L7RouteWithChildren, -} - -const L1L2L3L4L5L6RouteWithChildren = L1L2L3L4L5L6Route._addFileChildren( - L1L2L3L4L5L6RouteChildren, -) - -interface L1L2L3L4L5RouteChildren { - L1L2L3L4L5L6Route: typeof L1L2L3L4L5L6RouteWithChildren -} - -const L1L2L3L4L5RouteChildren: L1L2L3L4L5RouteChildren = { - L1L2L3L4L5L6Route: L1L2L3L4L5L6RouteWithChildren, -} - -const L1L2L3L4L5RouteWithChildren = L1L2L3L4L5Route._addFileChildren( - L1L2L3L4L5RouteChildren, -) - -interface L1L2L3L4RouteChildren { - L1L2L3L4L5Route: typeof L1L2L3L4L5RouteWithChildren -} - -const L1L2L3L4RouteChildren: L1L2L3L4RouteChildren = { - L1L2L3L4L5Route: L1L2L3L4L5RouteWithChildren, -} - -const L1L2L3L4RouteWithChildren = L1L2L3L4Route._addFileChildren( - L1L2L3L4RouteChildren, -) - -interface L1L2L3RouteChildren { - L1L2L3L4Route: typeof L1L2L3L4RouteWithChildren -} - -const L1L2L3RouteChildren: L1L2L3RouteChildren = { - L1L2L3L4Route: L1L2L3L4RouteWithChildren, -} - -const L1L2L3RouteWithChildren = - L1L2L3Route._addFileChildren(L1L2L3RouteChildren) - -interface L1L2RouteChildren { - L1L2L3Route: typeof L1L2L3RouteWithChildren -} - -const L1L2RouteChildren: L1L2RouteChildren = { - L1L2L3Route: L1L2L3RouteWithChildren, -} - -const L1L2RouteWithChildren = L1L2Route._addFileChildren(L1L2RouteChildren) - -interface L1RouteChildren { - L1L2Route: typeof L1L2RouteWithChildren -} - -const L1RouteChildren: L1RouteChildren = { - L1L2Route: L1L2RouteWithChildren, -} - -const L1RouteWithChildren = L1Route._addFileChildren(L1RouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - L1Route: L1RouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/router.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/index.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/index.tsx deleted file mode 100644 index e9a57d46fd..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
peak-large-page-index
-} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx deleted file mode 100644 index 7f7a42d645..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.l8.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelEightComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
-
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7/l8')({ - loader: () => makeLargePageLevelData(8, 0x5eed_1008), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelEightComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx deleted file mode 100644 index a99c56e529..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.l7.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelSevenComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6/l7')({ - loader: () => makeLargePageLevelData(7, 0x5eed_1007), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelSevenComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx deleted file mode 100644 index 3de3f03427..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.l6.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelSixComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2/l3/l4/l5/l6')({ - loader: () => makeLargePageLevelData(6, 0x5eed_1006), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelSixComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx deleted file mode 100644 index 5d936f83b5..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.l5.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelFiveComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2/l3/l4/l5')({ - loader: () => makeLargePageLevelData(5, 0x5eed_1005), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelFiveComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx deleted file mode 100644 index 8e10331f2d..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.l4.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelFourComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2/l3/l4')({ - loader: () => makeLargePageLevelData(4, 0x5eed_1004), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelFourComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx deleted file mode 100644 index d69529c50c..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.l3.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelThreeComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2/l3')({ - loader: () => makeLargePageLevelData(3, 0x5eed_1003), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelThreeComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx deleted file mode 100644 index d04bc7f827..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.l2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelTwoComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1/l2')({ - loader: () => makeLargePageLevelData(2, 0x5eed_1002), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelTwoComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx b/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx deleted file mode 100644 index a95ae7f9b0..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/src/routes/l1.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { - makeLargePageHead, - makeLargePageLevelData, -} from '../../../large-page-data' - -const LevelOneComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const first = data.value.records[0]! - - return ( -
-

{data.value.marker}

-

records: {data.value.records.length}

-
-

{first.name}

-

{first.id}

-

{first.description}

-
- -
- ) - } - }, -}) - -export const Route = createFileRoute('/l1')({ - loader: () => makeLargePageLevelData(1, 0x5eed_1001), - head: ({ loaderData }) => makeLargePageHead(loaderData), - component: LevelOneComponent, -}) diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/tsconfig.json b/benchmarks/memory/server/scenarios/peak-large-page/vue/tsconfig.json deleted file mode 100644 index 9ad6481342..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts b/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts deleted file mode 100644 index 3fab2aff9e..0000000000 --- a/benchmarks/memory/server/scenarios/peak-large-page/vue/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server peak-large-page (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/react/memory.flame.ts b/benchmarks/memory/server/scenarios/request-churn/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/request-churn/react/project.json b/benchmarks/memory/server/scenarios/request-churn/react/project.json deleted file mode 100644 index d997054b95..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-request-churn-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/setup.ts b/benchmarks/memory/server/scenarios/request-churn/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/request-churn/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/request-churn/react/src/routeTree.gen.ts deleted file mode 100644 index d22f1bee18..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/items/$id' - id: '__root__' | '/' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/src/router.tsx b/benchmarks/memory/server/scenarios/request-churn/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/request-churn/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/src/routes/index.tsx b/benchmarks/memory/server/scenarios/request-churn/react/src/routes/index.tsx deleted file mode 100644 index e6335b0d83..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
request-churn-index
-} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/src/routes/items.$id.tsx b/benchmarks/memory/server/scenarios/request-churn/react/src/routes/items.$id.tsx deleted file mode 100644 index 5fd86ee5fb..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/src/routes/items.$id.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -const itemIndexes = Array.from({ length: 5 }, (_, index) => index) - -type ItemSearch = { - q: string -} - -export const Route = createFileRoute('/items/$id')({ - validateSearch: (search: Record): ItemSearch => ({ - q: typeof search.q === 'string' ? search.q : '', - }), - loaderDeps: ({ search }) => ({ q: search.q }), - loader: ({ params, deps }) => ({ - id: params.id, - title: `Item ${params.id}`, - q: deps.q, - items: itemIndexes.map((index) => ({ - id: `${params.id}-${index}`, - label: `${deps.q}-${index}`, - })), - }), - component: ItemComponent, -}) - -function ItemComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data.title}

-

{data.q}

-
    - {data.items.map((item) => ( -
  • {item.label}
  • - ))} -
-
- ) -} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/tsconfig.json b/benchmarks/memory/server/scenarios/request-churn/react/tsconfig.json deleted file mode 100644 index 11ddcce4ea..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts b/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts deleted file mode 100644 index 35adf6a249..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/react/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server request-churn (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/shared.ts b/benchmarks/memory/server/scenarios/request-churn/shared.ts deleted file mode 100644 index b200c96ed6..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/shared.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, - runSequentialRequestLoop, -} from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -const benchmarkSeed = 0xdecafbad -const requestChurnIterations = 40 -const itemPageMarker = 'data-bench="request-churn-item"' -// Module-level so CodSpeed warmups and measurement never replay URLs. -const benchmarkRandom = createDeterministicRandom(benchmarkSeed) -let requestCounter = 0 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function validateItemResponse(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Expected status 200 for ${request.url}, got ${response.status}`, - ) - } -} - -function validateItemBody(body: string) { - if (!body.includes(itemPageMarker)) { - throw new Error('Expected request-churn item marker in response body') - } -} - -async function assertRequestChurnSanity(handler: StartRequestHandler) { - const response = await handler.fetch( - new Request('http://localhost/items/sanity-item?q=q-sanity', requestInit), - ) - const body = await response.text() - - if (response.status !== 200) { - throw new Error(`Expected sanity status 200, got ${response.status}`) - } - - validateItemBody(body) -} - -export function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - function buildItemRequest(random: () => number) { - const counter = (requestCounter++).toString(36) - const id = `${counter}-${randomSegment(random)}` - const q = `q-${randomSegment(random)}` - - return new Request(`http://localhost/items/${id}?q=${q}`, requestInit) - } - - const run = async () => - runSequentialRequestLoop(handler, { - random: benchmarkRandom, - iterations: requestChurnIterations, - buildRequest: buildItemRequest, - validateResponse: validateItemResponse, - }) - - return { - sanity: () => assertRequestChurnSanity(handler), - workloads: [ - { - name: `mem server request-churn (${framework})`, - run, - }, - ], - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/request-churn/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/project.json b/benchmarks/memory/server/scenarios/request-churn/solid/project.json deleted file mode 100644 index 3f3434ee24..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-request-churn-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/setup.ts b/benchmarks/memory/server/scenarios/request-churn/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/request-churn/solid/src/routeTree.gen.ts deleted file mode 100644 index 8f49ec5d1f..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/items/$id' - id: '__root__' | '/' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/src/router.tsx b/benchmarks/memory/server/scenarios/request-churn/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/index.tsx b/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/index.tsx deleted file mode 100644 index d32d31f301..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
request-churn-index
-} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/items.$id.tsx b/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/items.$id.tsx deleted file mode 100644 index e687e22741..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/src/routes/items.$id.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -const itemIndexes = Array.from({ length: 5 }, (_, index) => index) - -type ItemSearch = { - q: string -} - -export const Route = createFileRoute('/items/$id')({ - validateSearch: (search: Record): ItemSearch => ({ - q: typeof search.q === 'string' ? search.q : '', - }), - loaderDeps: ({ search }) => ({ q: search.q }), - loader: ({ params, deps }) => ({ - id: params.id, - title: `Item ${params.id}`, - q: deps.q, - items: itemIndexes.map((index) => ({ - id: `${params.id}-${index}`, - label: `${deps.q}-${index}`, - })), - }), - component: ItemComponent, -}) - -function ItemComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data().title}

-

{data().q}

-
    - {data().items.map((item) => ( -
  • {item.label}
  • - ))} -
-
- ) -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json b/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json deleted file mode 100644 index 4b61264e11..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts b/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts deleted file mode 100644 index 6601309a74..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/solid/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server request-churn (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/request-churn/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/project.json b/benchmarks/memory/server/scenarios/request-churn/vue/project.json deleted file mode 100644 index 11eb1d868b..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-request-churn-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/setup.ts b/benchmarks/memory/server/scenarios/request-churn/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/request-churn/vue/src/routeTree.gen.ts deleted file mode 100644 index 86ccc14a0c..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ItemsIdRouteImport } from './routes/items.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ItemsIdRoute = ItemsIdRouteImport.update({ - id: '/items/$id', - path: '/items/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/items/$id': typeof ItemsIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/items/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/items/$id' - id: '__root__' | '/' | '/items/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ItemsIdRoute: typeof ItemsIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/items/$id': { - id: '/items/$id' - path: '/items/$id' - fullPath: '/items/$id' - preLoaderRoute: typeof ItemsIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ItemsIdRoute: ItemsIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/src/router.tsx b/benchmarks/memory/server/scenarios/request-churn/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/index.tsx b/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/index.tsx deleted file mode 100644 index 30751100a4..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
request-churn-index
-} diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx b/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx deleted file mode 100644 index 570561f2a8..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/src/routes/items.$id.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const itemIndexes = Array.from({ length: 5 }, (_, index) => index) - -type ItemSearch = { - q: string -} - -const ItemComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.title}

-

{data.value.q}

-
    - {data.value.items.map((item) => ( -
  • {item.label}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/items/$id')({ - validateSearch: (search: Record): ItemSearch => ({ - q: typeof search.q === 'string' ? search.q : '', - }), - loaderDeps: ({ search }) => ({ q: search.q }), - loader: ({ params, deps }) => ({ - id: params.id, - title: `Item ${params.id}`, - q: deps.q, - items: itemIndexes.map((index) => ({ - id: `${params.id}-${index}`, - label: `${deps.q}-${index}`, - })), - }), - component: ItemComponent, -}) diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/tsconfig.json b/benchmarks/memory/server/scenarios/request-churn/vue/tsconfig.json deleted file mode 100644 index 9ad6481342..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts b/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts deleted file mode 100644 index 7f15c5c7af..0000000000 --- a/benchmarks/memory/server/scenarios/request-churn/vue/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server request-churn (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.flame.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/project.json b/benchmarks/memory/server/scenarios/serialization-payload/react/project.json deleted file mode 100644 index 467b40d734..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-serialization-payload-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/setup.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/src/routeTree.gen.ts deleted file mode 100644 index 7e370fd84c..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 DataIdRouteImport } from './routes/data.$id' - -const DataIdRoute = DataIdRouteImport.update({ - id: '/data/$id', - path: '/data/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/data/$id': typeof DataIdRoute -} -export interface FileRoutesByTo { - '/data/$id': typeof DataIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/data/$id': typeof DataIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/data/$id' - fileRoutesByTo: FileRoutesByTo - to: '/data/$id' - id: '__root__' | '/data/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - DataIdRoute: typeof DataIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/data/$id': { - id: '/data/$id' - path: '/data/$id' - fullPath: '/data/$id' - preLoaderRoute: typeof DataIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - DataIdRoute: DataIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/src/router.tsx b/benchmarks/memory/server/scenarios/serialization-payload/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/serialization-payload/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/src/routes/data.$id.tsx b/benchmarks/memory/server/scenarios/serialization-payload/react/src/routes/data.$id.tsx deleted file mode 100644 index cfba0dbd62..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/src/routes/data.$id.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { makeSerializationPayload } from '../../../serialization-payload' - -export const Route = createFileRoute('/data/$id')({ - loader: ({ params }) => makeSerializationPayload(params.id), - component: DataComponent, -}) - -function DataComponent() { - const data = Route.useLoaderData() - - return ( -
Map size: {data.lookup.size}
- ) -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/tsconfig.json b/benchmarks/memory/server/scenarios/serialization-payload/react/tsconfig.json deleted file mode 100644 index 11ddcce4ea..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts b/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts deleted file mode 100644 index 1ed3bcc335..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/react/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server serialization-payload (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/serialization-payload.ts b/benchmarks/memory/server/scenarios/serialization-payload/serialization-payload.ts deleted file mode 100644 index b6f401640e..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/serialization-payload.ts +++ /dev/null @@ -1,115 +0,0 @@ -const mapEntryCount = 500 -const setEntryCount = 500 -const temporalEntryCount = 500 -const nestedTreeDepth = 5 -const nestedTreeBreadth = 6 -const payloadTextLength = 150 - -export interface MapPayloadValue { - index: number - label: string - createdAt: Date - count: bigint - text: string -} - -export interface NestedPayloadNode { - id: string - depth: number - text: string - values: Array - children: Array -} - -export interface SerializationPayload { - id: string - lookup: Map - tags: Set - dates: Array - bigints: Array - tree: NestedPayloadNode -} - -export function makeSerializationPayload(id: string): SerializationPayload { - const hash = hashId(id) - const baseTimestamp = Date.UTC(2024, 0, 1) + hash - - return { - id, - lookup: new Map( - Array.from( - { length: mapEntryCount }, - (_, index): [string, MapPayloadValue] => [ - makeMapKey(id, index), - { - index, - label: `${id}-map-${index}`, - createdAt: new Date(baseTimestamp + index * 1_000), - count: BigInt(hash) * 10_000n + BigInt(index), - text: makePayloadText(id, `map-${index}`), - }, - ], - ), - ), - tags: new Set( - Array.from({ length: setEntryCount }, (_, index) => - makePayloadText(id, `set-${index}`), - ), - ), - dates: Array.from( - { length: temporalEntryCount }, - (_, index) => new Date(baseTimestamp + index * 60_000), - ), - bigints: Array.from( - { length: temporalEntryCount }, - (_, index) => BigInt(hash) * 1_000_000n + BigInt(index), - ), - tree: makeNestedTree(id, 0, 'root', hash), - } -} - -function makeMapKey(id: string, index: number) { - return `map-${id}-${index.toString().padStart(3, '0')}` -} - -function makeNestedTree( - id: string, - depth: number, - path: string, - hash: number, -): NestedPayloadNode { - return { - id: `${id}-node-${path}`, - depth, - text: makePayloadText(id, `tree-${depth}-${path}`), - values: [hash, depth, path.length], - children: - depth === nestedTreeDepth - ? [] - : Array.from({ length: nestedTreeBreadth }, (_, index) => - makeNestedTree(id, depth + 1, `${path}-${index}`, hash), - ), - } -} - -function makePayloadText(id: string, segment: string) { - const filler = 'abcdefghijklmnopqrstuvwxyz0123456789' - let value = `${id}|${segment}|` - - while (value.length < payloadTextLength) { - value += filler - } - - return value.slice(0, payloadTextLength) -} - -function hashId(id: string) { - let hash = 2_166_136_261 - - for (let index = 0; index < id.length; index++) { - hash ^= id.charCodeAt(index) - hash = Math.imul(hash, 16_777_619) - } - - return hash >>> 0 -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/shared.ts b/benchmarks/memory/server/scenarios/serialization-payload/shared.ts deleted file mode 100644 index 14ec8f7e0a..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/shared.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { - randomSegment, - runSequentialRequestLoop, -} from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -const benchmarkSeed = 0x51eaa11 -const serializationPayloadIterations = 1 -const payloadPageMarker = 'data-bench="serialization-payload"' - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildPayloadRequest(random: () => number, index: number) { - const id = `payload-${index}-${randomSegment(random)}` - - return new Request(`http://localhost/data/${id}`, requestInit) -} - -function validatePayloadResponse(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Expected status 200 for ${request.url}, got ${response.status}`, - ) - } -} - -function validatePayloadBody(body: string) { - if (!body.includes(payloadPageMarker)) { - throw new Error('Expected serialization-payload marker in response body') - } -} - -async function assertSerializationPayloadSanity(handler: StartRequestHandler) { - const request = new Request( - 'http://localhost/data/sanity-payload', - requestInit, - ) - const response = await handler.fetch(request) - const body = await response.text() - - validatePayloadResponse(response, request) - validatePayloadBody(body) -} - -export function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - const run = async () => - runSequentialRequestLoop(handler, { - seed: benchmarkSeed, - iterations: serializationPayloadIterations, - buildRequest: buildPayloadRequest, - validateResponse: validatePayloadResponse, - }) - - return { - sanity: () => assertSerializationPayloadSanity(handler), - workloads: [ - { - name: `mem server serialization-payload (${framework})`, - run, - }, - ], - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/project.json b/benchmarks/memory/server/scenarios/serialization-payload/solid/project.json deleted file mode 100644 index 6f381ef389..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-serialization-payload-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/setup.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routeTree.gen.ts deleted file mode 100644 index 082cbb290c..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 DataIdRouteImport } from './routes/data.$id' - -const DataIdRoute = DataIdRouteImport.update({ - id: '/data/$id', - path: '/data/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/data/$id': typeof DataIdRoute -} -export interface FileRoutesByTo { - '/data/$id': typeof DataIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/data/$id': typeof DataIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/data/$id' - fileRoutesByTo: FileRoutesByTo - to: '/data/$id' - id: '__root__' | '/data/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - DataIdRoute: typeof DataIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/data/$id': { - id: '/data/$id' - path: '/data/$id' - fullPath: '/data/$id' - preLoaderRoute: typeof DataIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - DataIdRoute: DataIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/router.tsx b/benchmarks/memory/server/scenarios/serialization-payload/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/data.$id.tsx b/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/data.$id.tsx deleted file mode 100644 index 8cdbdb9046..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/src/routes/data.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { makeSerializationPayload } from '../../../serialization-payload' - -export const Route = createFileRoute('/data/$id')({ - loader: ({ params }) => makeSerializationPayload(params.id), - component: DataComponent, -}) - -function DataComponent() { - const data = Route.useLoaderData() - - return ( -
- Map size: {data().lookup.size} -
- ) -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json b/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json deleted file mode 100644 index 4b61264e11..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts b/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts deleted file mode 100644 index a2d04b986c..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/solid/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server serialization-payload (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/project.json b/benchmarks/memory/server/scenarios/serialization-payload/vue/project.json deleted file mode 100644 index 425b50a0d5..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-serialization-payload-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/setup.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routeTree.gen.ts deleted file mode 100644 index 8adce01d75..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 DataIdRouteImport } from './routes/data.$id' - -const DataIdRoute = DataIdRouteImport.update({ - id: '/data/$id', - path: '/data/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/data/$id': typeof DataIdRoute -} -export interface FileRoutesByTo { - '/data/$id': typeof DataIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/data/$id': typeof DataIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/data/$id' - fileRoutesByTo: FileRoutesByTo - to: '/data/$id' - id: '__root__' | '/data/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - DataIdRoute: typeof DataIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/data/$id': { - id: '/data/$id' - path: '/data/$id' - fullPath: '/data/$id' - preLoaderRoute: typeof DataIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - DataIdRoute: DataIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/router.tsx b/benchmarks/memory/server/scenarios/serialization-payload/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx b/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx deleted file mode 100644 index 37b1a590e4..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/src/routes/data.$id.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { makeSerializationPayload } from '../../../serialization-payload' - -const DataComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
- Map size: {data.value.lookup.size} -
- ) - }, -}) - -export const Route = createFileRoute('/data/$id')({ - loader: ({ params }) => makeSerializationPayload(params.id), - component: DataComponent, -}) diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/tsconfig.json b/benchmarks/memory/server/scenarios/serialization-payload/vue/tsconfig.json deleted file mode 100644 index 9ad6481342..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts b/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts deleted file mode 100644 index b63a561228..0000000000 --- a/benchmarks/memory/server/scenarios/serialization-payload/vue/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server serialization-payload (vue)', - watch: false, - environment: 'node', - }, -}) 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 deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.flame.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/project.json b/benchmarks/memory/server/scenarios/server-fn-churn/react/project.json deleted file mode 100644 index 841bbedca0..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-server-fn-churn-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/setup.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/fns.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/src/fns.ts deleted file mode 100644 index 22770278cd..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/fns.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createMiddleware, createServerFn } from '@tanstack/react-start' -import { - makeServerFnChurnPayload, - validateServerFnInput, -} from '../../server-fn-payload' - -const contextMiddleware = createMiddleware({ type: 'function' }).server( - ({ next }) => - next({ - context: { - ctx: 'ctx-server-fn-churn', - }, - }), -) - -export const churnGet = createServerFn({ method: 'GET' }) - .middleware([contextMiddleware]) - .validator(validateServerFnInput) - .handler(({ data, context }) => makeServerFnChurnPayload(data, context)) - -export const churnPost = createServerFn({ method: 'POST' }) - .middleware([contextMiddleware]) - .validator(validateServerFnInput) - .handler(({ data, context }) => makeServerFnChurnPayload(data, context)) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routeTree.gen.ts deleted file mode 100644 index 10e933da3d..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiFnUrlsRouteImport } from './routes/api.fn-urls' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' - id: '__root__' | '/' | '/api/fn-urls' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/router.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/api.fn-urls.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/api.fn-urls.ts deleted file mode 100644 index da74a20f62..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { churnGet, churnPost } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - get: churnGet.url, - post: churnPost.url, - }), - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/index.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/index.tsx deleted file mode 100644 index de0acfc2b3..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { churnGet, churnPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- memory-server-fn-churn-index -
- ) -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/tsconfig.json b/benchmarks/memory/server/scenarios/server-fn-churn/react/tsconfig.json deleted file mode 100644 index 11ddcce4ea..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts b/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts deleted file mode 100644 index f72cc53d6f..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/react/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server server-fn-churn (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/server-fn-payload.ts b/benchmarks/memory/server/scenarios/server-fn-churn/server-fn-payload.ts deleted file mode 100644 index 0f23390a6c..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/server-fn-payload.ts +++ /dev/null @@ -1,33 +0,0 @@ -export type ServerFnInput = { - id: string -} - -export type ServerFnChurnContext = { - ctx: string -} - -const recordIndexes = Array.from({ length: 5 }, (_, index) => index) - -export function validateServerFnInput(input: unknown): ServerFnInput { - const payload = input as Partial | null - - if (typeof payload?.id !== 'string') { - throw new Error('invalid server-fn churn input') - } - - return { id: payload.id } -} - -export function makeServerFnChurnPayload( - data: ServerFnInput, - context: ServerFnChurnContext, -) { - return { - id: data.id, - ctx: context.ctx, - payload: recordIndexes.map((index) => ({ - id: `${data.id}-${index}`, - label: `record-${index}`, - })), - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts b/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts deleted file mode 100644 index 167b24d3b6..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/shared.ts +++ /dev/null @@ -1,232 +0,0 @@ -import { - createDeterministicRandom, - randomSegment, - runSequentialRequestLoop, -} from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -type FnUrls = { - get: string - post: string -} - -type PayloadFixture = { - id: string - body: string - query: string -} - -type SerovalNode = - | { - t: 1 - s: string - } - | { - t: 10 - i: number - p: { - k: Array - v: Array - } - o: number - } - -const benchmarkSeed = 0xdecafbad -const payloadSeed = 0x51f0cafe -const fixtureCount = 16 -const serverFnChurnIterations = 30 -const origin = 'http://localhost' -const tssContentTypeFramed = 'application/x-tss-framed' -const acceptHeader = `${tssContentTypeFramed}, application/x-ndjson, application/json` -const xTssSerialized = 'x-tss-serialized' -const contextMarker = 'ctx-server-fn-churn' - -const commonHeaders = { - 'x-tsr-serverFn': 'true', - 'sec-fetch-site': 'same-origin', - accept: acceptHeader, -} satisfies HeadersInit - -const postHeaders = { - ...commonHeaders, - 'content-type': 'application/json', -} satisfies HeadersInit - -// Hand-rolled copy of Start's seroval RPC wire format so POST bodies can be -// precomputed at module level. Coupled to the internal protocol on purpose; -// the module-load sanity check below throws loudly if the protocol drifts. -function stringNode(value: string): SerovalNode { - return { t: 1, s: value } -} - -function objectNode( - id: number, - entries: Array, -): SerovalNode { - return { - t: 10, - i: id, - p: { - k: entries.map(([key]) => key), - v: entries.map(([, value]) => value), - }, - o: 0, - } -} - -function serializePayload(id: string) { - return JSON.stringify({ - t: objectNode(0, [['data', objectNode(1, [['id', stringNode(id)]])]]), - f: 63, - m: [], - }) -} - -function createFixtures(kind: 'get' | 'post') { - const random = createDeterministicRandom(payloadSeed ^ kind.length) - - return Array.from({ length: fixtureCount }, (_, index): PayloadFixture => { - const id = [kind, index, randomSegment(random), randomSegment(random)].join( - '-', - ) - const body = serializePayload(id) - - return { - id, - body, - query: `?${new URLSearchParams({ payload: body })}`, - } - }) -} - -const getFixtures = createFixtures('get') -const postFixtures = createFixtures('post') - -async function discoverUrls(handler: StartRequestHandler) { - const response = await handler.fetch(new Request(`${origin}/api/fn-urls`)) - const text = await response.text() - - if (response.status !== 200) { - throw new Error( - `URL discovery failed with status ${response.status}: ${text}`, - ) - } - - let urls: Partial - - try { - urls = JSON.parse(text) as Partial - } catch (error) { - throw new Error(`URL discovery returned invalid JSON: ${text}`, { - cause: error, - }) - } - - if (typeof urls.get !== 'string' || typeof urls.post !== 'string') { - throw new Error(`URL discovery returned invalid payload: ${text}`) - } - - return urls as FnUrls -} - -function buildGetRequest(url: string, fixture: PayloadFixture) { - return new Request(`${origin}${url}${fixture.query}`, { - method: 'GET', - headers: commonHeaders, - }) -} - -function buildPostRequest(url: string, fixture: PayloadFixture) { - return new Request(`${origin}${url}`, { - method: 'POST', - headers: postHeaders, - body: fixture.body, - }) -} - -function validateServerFnResponse(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Expected status 200 for ${request.url}, got ${response.status}`, - ) - } - - if (!response.headers.get(xTssSerialized)) { - throw new Error(`Expected ${xTssSerialized} header for ${request.url}`) - } -} - -function validateEchoedBody( - body: string, - request: Request, - expectedId: string, -) { - if (!body.includes(expectedId)) { - throw new Error(`Expected echoed id ${expectedId} in ${request.url}`) - } - - if (!body.includes(contextMarker)) { - throw new Error( - `Expected context marker ${contextMarker} in ${request.url}`, - ) - } -} - -async function assertServerFnChurnSanity( - handler: StartRequestHandler, - urls: FnUrls, -) { - const getFixture = getFixtures[0]! - const getRequest = buildGetRequest(urls.get, getFixture) - const getResponse = await handler.fetch(getRequest) - const getBody = await getResponse.text() - - validateServerFnResponse(getResponse, getRequest) - validateEchoedBody(getBody, getRequest, getFixture.id) - - const postFixture = postFixtures[0]! - const postRequest = buildPostRequest(urls.post, postFixture) - const postResponse = await handler.fetch(postRequest) - const postBody = await postResponse.text() - - validateServerFnResponse(postResponse, postRequest) - validateEchoedBody(postBody, postRequest, postFixture.id) -} - -export async function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - const urls = await discoverUrls(handler) - const run = async () => - runSequentialRequestLoop(handler, { - seed: benchmarkSeed, - iterations: serverFnChurnIterations, - buildRequest: (_random, index) => { - const fixtureIndex = Math.floor(index / 2) % fixtureCount - - if (index % 2 === 0) { - const fixture = getFixtures[fixtureIndex]! - return buildGetRequest(urls.get, fixture) - } else { - const fixture = postFixtures[fixtureIndex]! - return buildPostRequest(urls.post, fixture) - } - }, - validateResponse: validateServerFnResponse, - }) - - return { - sanity: () => assertServerFnChurnSanity(handler, urls), - workloads: [ - { - name: `mem server server-fn-churn (${framework})`, - run, - }, - ], - } -} 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 deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/project.json b/benchmarks/memory/server/scenarios/server-fn-churn/solid/project.json deleted file mode 100644 index 53aca0cea6..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-server-fn-churn-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/fns.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/fns.ts deleted file mode 100644 index 31669dff50..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/fns.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createMiddleware, createServerFn } from '@tanstack/solid-start' -import { - makeServerFnChurnPayload, - validateServerFnInput, -} from '../../server-fn-payload' - -const contextMiddleware = createMiddleware({ type: 'function' }).server( - ({ next }) => - next({ - context: { - ctx: 'ctx-server-fn-churn', - }, - }), -) - -export const churnGet = createServerFn({ method: 'GET' }) - .middleware([contextMiddleware]) - .validator(validateServerFnInput) - .handler(({ data, context }) => makeServerFnChurnPayload(data, context)) - -export const churnPost = createServerFn({ method: 'POST' }) - .middleware([contextMiddleware]) - .validator(validateServerFnInput) - .handler(({ data, context }) => makeServerFnChurnPayload(data, context)) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routeTree.gen.ts deleted file mode 100644 index 298ac3168d..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiFnUrlsRouteImport } from './routes/api.fn-urls' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' - id: '__root__' | '/' | '/api/fn-urls' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/router.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/api.fn-urls.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/api.fn-urls.ts deleted file mode 100644 index 2063684034..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { churnGet, churnPost } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - get: churnGet.url, - post: churnPost.url, - }), - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/index.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/index.tsx deleted file mode 100644 index 99fea371f8..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { churnGet, churnPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- memory-server-fn-churn-index -
- ) -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json b/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json deleted file mode 100644 index 4b61264e11..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts b/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts deleted file mode 100644 index 4fba196bd2..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/solid/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server server-fn-churn (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) 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 deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/project.json b/benchmarks/memory/server/scenarios/server-fn-churn/vue/project.json deleted file mode 100644 index c5809a259b..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-server-fn-churn-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/setup.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/fns.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/fns.ts deleted file mode 100644 index 0fa679f76f..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/fns.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createMiddleware, createServerFn } from '@tanstack/vue-start' -import { - makeServerFnChurnPayload, - validateServerFnInput, -} from '../../server-fn-payload' - -const contextMiddleware = createMiddleware({ type: 'function' }).server( - ({ next }) => - next({ - context: { - ctx: 'ctx-server-fn-churn', - }, - }), -) - -export const churnGet = createServerFn({ method: 'GET' }) - .middleware([contextMiddleware]) - .validator(validateServerFnInput) - .handler(({ data, context }) => makeServerFnChurnPayload(data, context)) - -export const churnPost = createServerFn({ method: 'POST' }) - .middleware([contextMiddleware]) - .validator(validateServerFnInput) - .handler(({ data, context }) => makeServerFnChurnPayload(data, context)) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routeTree.gen.ts deleted file mode 100644 index b226f0a25a..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiFnUrlsRouteImport } from './routes/api.fn-urls' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' - id: '__root__' | '/' | '/api/fn-urls' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/router.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/api.fn-urls.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/api.fn-urls.ts deleted file mode 100644 index ff99e89e4c..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { churnGet, churnPost } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - get: churnGet.url, - post: churnPost.url, - }), - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/index.tsx b/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/index.tsx deleted file mode 100644 index 0a39b9301c..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { churnGet, churnPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- memory-server-fn-churn-index -
- ) -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/tsconfig.json b/benchmarks/memory/server/scenarios/server-fn-churn/vue/tsconfig.json deleted file mode 100644 index 9ad6481342..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts b/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts deleted file mode 100644 index 5ab5ec37e3..0000000000 --- a/benchmarks/memory/server/scenarios/server-fn-churn/vue/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server server-fn-churn (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/deferred-section-data.ts b/benchmarks/memory/server/scenarios/streaming-peak/deferred-section-data.ts deleted file mode 100644 index b30352ef39..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/deferred-section-data.ts +++ /dev/null @@ -1,37 +0,0 @@ -const deferredRecordCount = 250 -const recordValueLength = 128 - -interface DeferredRecord { - id: string - value: string -} - -export interface DeferredSectionPayload { - index: number - records: Array -} - -export function makeDeferredSectionPayload( - id: string, - sectionIndex: number, -): DeferredSectionPayload { - return { - index: sectionIndex, - records: Array.from({ length: deferredRecordCount }, (_, recordIndex) => ({ - id: `${id}-${sectionIndex}-${recordIndex}`, - value: makeRecordValue(id, sectionIndex, recordIndex), - })), - } -} - -function makeRecordValue( - id: string, - sectionIndex: number, - recordIndex: number, -) { - const token = `${id}:${sectionIndex}:${recordIndex}:streaming-peak-record;` - - return token - .repeat(Math.ceil(recordValueLength / token.length)) - .slice(0, recordValueLength) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.flame.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/project.json b/benchmarks/memory/server/scenarios/streaming-peak/react/project.json deleted file mode 100644 index 6fc1dcdda0..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-streaming-peak-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/setup.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/setup.ts deleted file mode 100644 index 0c98f54ddd..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('react', handler) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/src/routeTree.gen.ts deleted file mode 100644 index fbbc25ecfb..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/stream/$id' - id: '__root__' | '/' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/src/router.tsx b/benchmarks/memory/server/scenarios/streaming-peak/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/__root.tsx deleted file mode 100644 index c5f9de6922..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/index.tsx b/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/index.tsx deleted file mode 100644 index 669fdef2e1..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
streaming-peak-index
-} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/stream.$id.tsx deleted file mode 100644 index 886cb64d45..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/src/routes/stream.$id.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/react-router' -import { Suspense } from 'react' -import { - makeDeferredSectionPayload, - type DeferredSectionPayload, -} from '../../../deferred-section-data' - -const fallbackFlushTicks = 4 - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - eager: `streaming-peak-eager-${params.id}`, - deferred0: makeDeferredSection(params.id, 0), - deferred1: makeDeferredSection(params.id, 1), - deferred2: makeDeferredSection(params.id, 2), - deferred3: makeDeferredSection(params.id, 3), - }), - component: StreamComponent, -}) - -// Deferred sections must settle strictly AFTER React's shell flush, which -// React schedules via setImmediate internally. Microtask chains drain during -// router load (sections resolve before the Suspense boundaries are even -// reached) and setImmediate chains registered at loader time win the race -// against React's flush — either way no fallback ever streams and the bench -// stops exercising multi-flush streaming. Timers-phase callbacks reliably -// lose that race, but a millisecond delay makes the loss margin wall-clock -// dependent, so this chains 0ms hops instead: each hop yields one full -// event-loop turn (immediates and microtasks included), making the flush -// ordering a function of turn count, not runner speed. Distinct hop counts -// keep section ordering deterministic. -function afterFallbackFlush(sectionIndex: number) { - return new Promise((resolve) => { - let remaining = fallbackFlushTicks + sectionIndex - - const step = () => { - remaining -= 1 - - if (remaining <= 0) { - resolve() - return - } - - setTimeout(step, 0) - } - - setTimeout(step, 0) - }) -} - -function makeDeferredSection(id: string, sectionIndex: number) { - return afterFallbackFlush(sectionIndex).then(() => - makeDeferredSectionPayload(id, sectionIndex), - ) -} - -function StreamComponent() { - const data = Route.useLoaderData() - const deferredSections = [ - { index: 0, promise: data.deferred0 }, - { index: 1, promise: data.deferred1 }, - { index: 2, promise: data.deferred2 }, - { index: 3, promise: data.deferred3 }, - ] as const - - return ( -
-

{data.eager}

- {deferredSections.map(({ index, promise }) => ( - - streaming-peak-fallback-{index} -

- } - > - - {(section) => } - -
- ))} -
- ) -} - -function DeferredSection({ section }: { section: DeferredSectionPayload }) { - const marker = `streaming-peak-deferred-${section.index}` - - return ( -
-

{marker}

- {section.records.map((record) => ( -

{record.value}

- ))} -
- ) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/tsconfig.json b/benchmarks/memory/server/scenarios/streaming-peak/react/tsconfig.json deleted file mode 100644 index 11ddcce4ea..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts b/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts deleted file mode 100644 index 5d555441b6..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/react/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server streaming-peak (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/shared.ts b/benchmarks/memory/server/scenarios/streaming-peak/shared.ts deleted file mode 100644 index c027047408..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/shared.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { - randomSegment, - runSequentialRequestLoop, -} from '#memory-server/bench-utils' -import type { StartRequestHandler } from '#memory-server/bench-utils' - -export type { StartRequestHandler } - -type Framework = 'react' | 'solid' | 'vue' - -const benchmarkSeed = 0xdecafbad -const streamingPeakIterations = 1 -const fallbackMarker = 'streaming-peak-fallback-0' - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildStreamingRequest(random: () => number, index: number) { - return new Request( - `http://localhost/stream/${index}-${randomSegment(random)}`, - requestInit, - ) -} - -function validateStreamingResponse(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Expected status 200 for ${request.url}, got ${response.status}`, - ) - } -} - -function getResponseReader(response: Response) { - const reader = response.body?.getReader() - - if (!reader) { - throw new Error('Expected streaming response body') - } - - return reader -} - -async function readStreamingBody(response: Response) { - const reader = getResponseReader(response) - const decoder = new TextDecoder() - let body = '' - let chunkCount = 0 - - for (;;) { - const result = await reader.read() - - if (result.done) { - break - } - - chunkCount++ - body += decoder.decode(result.value, { stream: true }) - } - - body += decoder.decode() - - return { body, chunkCount } -} - -async function assertStreamingPeakSanity(handler: StartRequestHandler) { - const chunkedRequest = new Request( - 'http://localhost/stream/sanity-chunked', - requestInit, - ) - const chunkedResponse = await handler.fetch(chunkedRequest) - - validateStreamingResponse(chunkedResponse, chunkedRequest) - - const chunked = await readStreamingBody(chunkedResponse) - - if (chunked.chunkCount <= 1) { - throw new Error( - `Expected chunked sanity response to produce multiple chunks, got ${chunked.chunkCount}`, - ) - } - - if (!chunked.body.includes(fallbackMarker)) { - throw new Error('Expected streaming-peak fallback marker in response body') - } -} - -export function createWorkloadGroup( - framework: Framework, - handler: StartRequestHandler, -) { - const run = async () => - runSequentialRequestLoop(handler, { - seed: benchmarkSeed, - iterations: streamingPeakIterations, - buildRequest: buildStreamingRequest, - validateResponse: validateStreamingResponse, - }) - - return { - sanity: async () => { - // Import the route chunks before checking streaming. Cold disk I/O can - // otherwise outlast the deferred payload and collapse the first response. - await run() - await assertStreamingPeakSanity(handler) - }, - workloads: [ - { - name: `mem server streaming-peak chunked (${framework})`, - run, - }, - ], - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.flame.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/project.json b/benchmarks/memory/server/scenarios/streaming-peak/solid/project.json deleted file mode 100644 index 80f44d1063..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-streaming-peak-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/setup.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/setup.ts deleted file mode 100644 index 4fe85c3f00..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('solid', handler) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routeTree.gen.ts deleted file mode 100644 index 04ebed80f0..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/stream/$id' - id: '__root__' | '/' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/router.tsx b/benchmarks/memory/server/scenarios/streaming-peak/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/__root.tsx deleted file mode 100644 index aaf7dfdd89..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charset: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/index.tsx b/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/index.tsx deleted file mode 100644 index 5815e36b3d..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
streaming-peak-index
-} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/stream.$id.tsx deleted file mode 100644 index 977f43061e..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/src/routes/stream.$id.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { Suspense } from 'solid-js' -import { - makeDeferredSectionPayload, - type DeferredSectionPayload, -} from '../../../deferred-section-data' - -const fallbackFlushTicks = 12 - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - eager: `streaming-peak-eager-${params.id}`, - deferred0: makeDeferredSection(params.id, 0), - deferred1: makeDeferredSection(params.id, 1), - deferred2: makeDeferredSection(params.id, 2), - deferred3: makeDeferredSection(params.id, 3), - }), - component: StreamComponent, -}) - -// Deferred sections must settle after the framework shell flush so the bench -// continues exercising multi-flush streaming with visible fallback chunks. -// Chained 0ms timers-phase hops give the renderer a deterministic number of -// full event-loop turns to flush, instead of a wall-clock delay whose margin -// varies with runner load; distinct hop counts keep section ordering stable. -function afterFallbackFlush(sectionIndex: number) { - return new Promise((resolve) => { - let remaining = fallbackFlushTicks + sectionIndex - - const step = () => { - remaining -= 1 - - if (remaining <= 0) { - resolve() - return - } - - setTimeout(step, 0) - } - - setTimeout(step, 0) - }) -} - -function makeDeferredSection(id: string, sectionIndex: number) { - return afterFallbackFlush(sectionIndex).then(() => - makeDeferredSectionPayload(id, sectionIndex), - ) -} - -function StreamComponent() { - const data = Route.useLoaderData() - const deferredSections = () => - [ - { index: 0, promise: data().deferred0 }, - { index: 1, promise: data().deferred1 }, - { index: 2, promise: data().deferred2 }, - { index: 3, promise: data().deferred3 }, - ] as const - - return ( -
-

{data().eager}

- {deferredSections().map(({ index, promise }) => ( - <> -

- streaming-peak-fallback-{index} -

- - - {(section) => } - - - - ))} -
- ) -} - -function DeferredSection(props: { section: DeferredSectionPayload }) { - const marker = () => `streaming-peak-deferred-${props.section.index}` - - return ( -
-

{marker()}

- {props.section.records.map((record) => ( -

{record.value}

- ))} -
- ) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/tsconfig.json b/benchmarks/memory/server/scenarios/streaming-peak/solid/tsconfig.json deleted file mode 100644 index 4b61264e11..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/solid/vite.config.ts b/benchmarks/memory/server/scenarios/streaming-peak/solid/vite.config.ts deleted file mode 100644 index 5fbdb48c23..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/solid/vite.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server streaming-peak (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts b/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts deleted file mode 100644 index 8b5f16ad63..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.bench.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { test } from 'vitest' -import { - memoryBenchHooks, - memoryBenchOptions, -} from '#memory-server/bench-utils' -import { workloadGroup } from './setup' - -await workloadGroup.sanity() - -test('memory', async ({ bench }) => { - for (const workload of workloadGroup.workloads) { - await bench(workload.name, memoryBenchHooks(), workload.run).run( - memoryBenchOptions, - ) - } -}) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.flame.ts b/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.flame.ts deleted file mode 100644 index 0182c472a8..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/memory.flame.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { runServerFlameBenchmark } from '#memory-server/flame-runner' -import { workloadGroup } from './setup.ts' - -await runServerFlameBenchmark(workloadGroup) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/project.json b/benchmarks/memory/server/scenarios/streaming-peak/vue/project.json deleted file mode 100644 index 55771aebe3..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/project.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "@benchmarks/memory-server-streaming-peak-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "build:ssr:flame": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts --sourcemap true" - } - }, - "test:flame": { - "executor": "nx:run-commands", - "parallelism": false, - "cache": false, - "dependsOn": ["build:ssr:flame"], - "options": { - "command": "NODE_ENV=production node benchmarks/memory/run-flame.mjs {projectRoot}/memory.flame.ts {projectRoot}/dist", - "cwd": "." - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/setup.ts b/benchmarks/memory/server/scenarios/streaming-peak/vue/setup.ts deleted file mode 100644 index 6683dafe6b..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/setup.ts +++ /dev/null @@ -1,14 +0,0 @@ -import type { ServerMemoryWorkloadGroup } from '#memory-server/benchmark' -import { createWorkloadGroup } from '../shared.ts' -import type { StartRequestHandler } from '../shared.ts' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -export const workloadGroup: ServerMemoryWorkloadGroup = - await createWorkloadGroup('vue', handler) diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routeTree.gen.ts b/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routeTree.gen.ts deleted file mode 100644 index 192f1d6dc7..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/stream/$id' - id: '__root__' | '/' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/router.tsx b/benchmarks/memory/server/scenarios/streaming-peak/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/__root.tsx b/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/__root.tsx deleted file mode 100644 index de29ee1612..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [{ charSet: 'utf-8' }], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/index.tsx b/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/index.tsx deleted file mode 100644 index bc55b49adc..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
streaming-peak-index
-} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/stream.$id.tsx b/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/stream.$id.tsx deleted file mode 100644 index 750d1cb47d..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/src/routes/stream.$id.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/vue-router' -import { Suspense, defineComponent } from 'vue' -import { - makeDeferredSectionPayload, - type DeferredSectionPayload, -} from '../../../deferred-section-data' - -const fallbackFlushTicks = 20 - -const StreamComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => { - const deferredSections = [ - { index: 0, promise: data.value.deferred0 }, - { index: 1, promise: data.value.deferred1 }, - { index: 2, promise: data.value.deferred2 }, - { index: 3, promise: data.value.deferred3 }, - ] as const - - return ( -
-

{data.value.eager}

- {deferredSections.map(({ index, promise }) => ( - <> -

- streaming-peak-fallback-{index} -

- - {{ - default: () => ( - ( - - )} - /> - ), - fallback: () => null, - }} - - - ))} -
- ) - } - }, -}) - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - eager: `streaming-peak-eager-${params.id}`, - deferred0: makeDeferredSection(params.id, 0), - deferred1: makeDeferredSection(params.id, 1), - deferred2: makeDeferredSection(params.id, 2), - deferred3: makeDeferredSection(params.id, 3), - }), - component: StreamComponent, -}) - -// Deferred sections must settle strictly AFTER Vue's shell has a chance to -// flush, so fallbacks are emitted before deferred section content. -// Chained 0ms timers-phase hops give the renderer a deterministic number of -// full event-loop turns to flush, instead of a wall-clock delay whose margin -// varies with runner load; distinct hop counts keep section ordering stable. -function afterFallbackFlush(sectionIndex: number) { - return new Promise((resolve) => { - let remaining = fallbackFlushTicks + sectionIndex - - const step = () => { - remaining -= 1 - - if (remaining <= 0) { - resolve() - return - } - - setTimeout(step, 0) - } - - setTimeout(step, 0) - }) -} - -function makeDeferredSection(id: string, sectionIndex: number) { - return afterFallbackFlush(sectionIndex).then(() => - makeDeferredSectionPayload(id, sectionIndex), - ) -} - -function DeferredSection({ section }: { section: DeferredSectionPayload }) { - const marker = `streaming-peak-deferred-${section.index}` - - return ( -
-

{marker}

- {section.records.map((record) => ( -

{record.value}

- ))} -
- ) -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/tsconfig.json b/benchmarks/memory/server/scenarios/streaming-peak/vue/tsconfig.json deleted file mode 100644 index 9ad6481342..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "extends": "../../../../../../tsconfig.json", - "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "memory.bench.ts", - "memory.flame.ts", - "setup.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/memory/server/scenarios/streaming-peak/vue/vite.config.ts b/benchmarks/memory/server/scenarios/streaming-peak/vue/vite.config.ts deleted file mode 100644 index cd848584a5..0000000000 --- a/benchmarks/memory/server/scenarios/streaming-peak/vue/vite.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { memoryConfig } from '../../../../runtime' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - ...memoryConfig('server'), - name: '@benchmarks/memory-server streaming-peak (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/memory/server/tsconfig.json b/benchmarks/memory/server/tsconfig.json deleted file mode 100644 index 86d36f047a..0000000000 --- a/benchmarks/memory/server/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "bench-utils.ts", - "scenarios/*/shared.ts", - "../runtime.ts", - "vitest.setup.ts" - ] -} diff --git a/benchmarks/memory/server/vitest.react.config.ts b/benchmarks/memory/server/vitest.react.config.ts deleted file mode 100644 index 44643b4d60..0000000000 --- a/benchmarks/memory/server/vitest.react.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - fileParallelism: false, - projects: ['./scenarios/*/react/vite.config.ts'], - }, -}) diff --git a/benchmarks/memory/server/vitest.solid.config.ts b/benchmarks/memory/server/vitest.solid.config.ts deleted file mode 100644 index 5c8185cdd9..0000000000 --- a/benchmarks/memory/server/vitest.solid.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - fileParallelism: false, - projects: ['./scenarios/*/solid/vite.config.ts'], - }, -}) diff --git a/benchmarks/memory/server/vitest.vue.config.ts b/benchmarks/memory/server/vitest.vue.config.ts deleted file mode 100644 index 01768185ee..0000000000 --- a/benchmarks/memory/server/vitest.vue.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - fileParallelism: false, - projects: ['./scenarios/*/vue/vite.config.ts'], - }, -}) diff --git a/benchmarks/memory/tsconfig.json b/benchmarks/memory/tsconfig.json deleted file mode 100644 index 5a325f3b6c..0000000000 --- a/benchmarks/memory/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "types": ["node"] - }, - "include": ["runtime.ts"] -} diff --git a/benchmarks/memory/turn.ts b/benchmarks/memory/turn.ts deleted file mode 100644 index 08729685fe..0000000000 --- a/benchmarks/memory/turn.ts +++ /dev/null @@ -1,34 +0,0 @@ -export function isMemoryInstrumented() { - return ( - process.env.CODSPEED_ENV !== undefined && - process.env.CODSPEED_RUNNER_MODE === 'memory' - ) -} - -// CodSpeed calls beforeEach before its forced GC and measurement marker. End -// the previous warmup's job so WeakRef targets can be released by that GC. -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/README.md b/benchmarks/ssr/README.md deleted file mode 100644 index 3d90af1598..0000000000 --- a/benchmarks/ssr/README.md +++ /dev/null @@ -1,115 +0,0 @@ -# SSR Benchmarks - -Cross-framework SSR request-loop benchmarks for: - -- `@tanstack/react-start` -- `@tanstack/solid-start` -- `@tanstack/vue-start` - -Each benchmark builds a Start app with file-based routes and runs Vitest benches against the built server handler. - -## Layout - -- `react/` - React Start baseline benchmark + Vitest config -- `solid/` - Solid Start baseline benchmark + Vitest config -- `vue/` - Vue Start baseline benchmark + Vitest config -- `vitest.react.config.ts`, `vitest.solid.config.ts`, `vitest.vue.config.ts` - per-framework aggregate configs that run the baseline first, then scenario projects -- `scenarios///` - isolated scenario apps - -Scenario app layout: - -```text -scenarios/// - vite.config.ts - speed.bench.ts - tsconfig.json - src/ - router.tsx - routes/ - routeTree.gen.ts -``` - -Each scenario uses one app per framework instead of sharing routes in the baseline app. This keeps route-tree size, middleware, Start options, and generated route trees isolated so one scenario cannot shift another scenario's numbers. The existing baseline apps and bench names stay stable for CodSpeed continuity. - -## Scenario Responsibilities - -Each scenario isolates one Start server-side responsibility so benchmark changes can be attributed to a specific feature area. - -| Scenario | Start server-side responsibility | -| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `react/`, `solid/`, `vue/` baseline apps | Document SSR for nested file routes, route matching, search parsing, and full-page HTML response generation. | -| `assets` | Per-request asset pipeline work: CSS inlining, CDN asset URL transforms with uncached manifest resolution, and response `Link` header collection for early hints. | -| `before-load` | Nested `beforeLoad` execution: sequential per-match context building, context merging across matches, and context consumption by loaders during document SSR. | -| `control-flow` | Loader-thrown `redirect`, `notFound`, plain errors, unmatched routes, and route `headers()` emission, including HTTP status selection, redirect `location` headers, route error boundaries, and not-found HTML rendering. | -| `global-middleware` | Global `createStart` middleware registration: request middleware wrapping document SSR, server-function, and server-route requests, plus global function middleware on server functions. | -| `head` | Nested route `head` evaluation, title/meta/link serialization, and head-entry deduplication during SSR. | -| `loaders` | Nested route loader execution, loader deps from search params, router context reads, and dehydrated loader payload generation. | -| `rewrites` | Composed location rewrites from router `basepath` plus locale input/output rewrites; unprefixed URLs redirect to `/app/*` when the basepath output rewrite canonicalizes them. | -| `serialization` | Dehydration and RPC serialization of rich non-plain-JSON types: seroval native types in loader payloads, custom serialization adapters, and shallow-error serialization. | -| `selective-ssr` | Route-level `ssr` modes: rendered server HTML with `ssr: true`, dehydrated data without HTML with `ssr: 'data-only'`, and client-only omission with `ssr: false`. | -| `server-fn-transport` | Non-JSON server-function transport: multipart/FormData request decoding, raw `Response` returns, and `RawStream` streamed responses through the binary frame protocol. | -| `server-fns` | `createServerFn` GET/POST request handling, thrown redirect/notFound results, sendContext serialization, SSR-time direct calls, middleware context, input validation, and URL discovery. | -| `server-routes` | File route `server.handlers` dispatch for parameterized JSON API routes without document HTML rendering. | -| `server-routes-middleware` | Server route request middleware chains, middleware-provided context merging, and handler access to accumulated context. | -| `streaming` | Deferred loader data, `Await`/Suspense fallback output, larger streamed HTML body scanning, streamed HTML ordering, and later dehydration payload emission. | - -## Run - -Run all benchmarks through Nx so dependency builds are part of the graph: - -```bash -pnpm nx run @benchmarks/ssr:test:perf --outputStyle=stream --skipRemoteCache -``` - -Run framework-specific benchmarks: - -```bash -pnpm nx run @benchmarks/ssr:test:perf:react --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/ssr:test:perf:solid --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/ssr:test:perf:vue --outputStyle=stream --skipRemoteCache -``` - -Build framework-specific benchmark apps: - -```bash -pnpm nx run @benchmarks/ssr:build:react --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/ssr:build:solid --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/ssr:build:vue --outputStyle=stream --skipRemoteCache -``` - -Typecheck benchmark sources: - -```bash -pnpm nx run @benchmarks/ssr:test:types --outputStyle=stream --skipRemoteCache -``` - -Run one scenario app manually through Nx: - -```bash -pnpm nx run @benchmarks/ssr--:build:ssr --outputStyle=stream --skipRemoteCache -pnpm nx run @benchmarks/ssr--:test:types:ssr --outputStyle=stream --skipRemoteCache -``` - -Use `react`, `solid`, or `vue` for ``. The baseline projects use `@benchmarks/ssr-` without a scenario segment. - -## Request Conventions - -- Document GET loops use `accept: text/html`, matching the baseline request shape. -- Server-function loops must include `sec-fetch-site: same-origin` so the default CSRF middleware accepts the request. -- Loops that expect non-200 responses pass a custom `validateResponse` to `runRequestLoop`. -- Bench loops must build deterministic requests from the seeded random helper and consume response bodies through `runRequestLoop` or `runSsrRequestLoop`. - -## Optional React Link workloads - -The [opt-in Link suite](../client-nav/README.md#opt-in-react-link-performance-suite) -adds focused standalone React Router SSR coverage for params/updaters, -inheritance, search middlewares, optional/splat segments, encoding, masks, -rewrites, and active props. Each timed batch creates four fresh routers and -renders their Links to HTML; it does not measure Start HTTP/streaming overhead. - -```bash -CI=1 NX_DAEMON=false pnpm nx run @benchmarks/react-link-performance:test:perf:ssr --outputStyle=stream --skipRemoteCache -- --run -``` - -These cases are excluded from this directory's aggregate projects and normal -CodSpeed dependency graph; they only run through the dedicated target above. diff --git a/benchmarks/ssr/bench-utils.test.ts b/benchmarks/ssr/bench-utils.test.ts deleted file mode 100644 index c6a520447b..0000000000 --- a/benchmarks/ssr/bench-utils.test.ts +++ /dev/null @@ -1,145 +0,0 @@ -import { describe, expect, it } from 'vitest' -import { buildRequestSequences, runRequestLoop } from './bench-utils' -import type { StartRequestHandler } from './bench-utils' - -function deferred() { - let resolve = () => {} - const promise = new Promise((resolvePromise) => { - resolve = resolvePromise - }) - return { promise, resolve } -} - -describe('runRequestLoop', () => { - it('caps fixed concurrency and waits for every streaming body', async () => { - const concurrency = 4 - const totalRequests = 20 - const firstWaveStarted = deferred() - let builtRequests = 0 - let executedRequests = 0 - let validatedResponses = 0 - let finishedBodies = 0 - let inFlightRequests = 0 - let maximumInFlightRequests = 0 - - const handler: StartRequestHandler = { - fetch() { - expect(builtRequests).toBe(totalRequests) - executedRequests += 1 - inFlightRequests += 1 - maximumInFlightRequests = Math.max( - maximumInFlightRequests, - inFlightRequests, - ) - - if (inFlightRequests === concurrency) { - firstWaveStarted.resolve() - } - - const body = new ReadableStream({ - async start(controller) { - await firstWaveStarted.promise - controller.enqueue(new Uint8Array([1])) - controller.close() - finishedBodies += 1 - inFlightRequests -= 1 - }, - }) - - return new Response(body) - }, - } - - await runRequestLoop(handler, { - seed: 123, - concurrency, - totalRequests, - buildRequest: (_random, index) => { - builtRequests += 1 - return new Request(`http://localhost/request/${index}`) - }, - validateResponse: () => { - validatedResponses += 1 - }, - }) - - expect(builtRequests).toBe(totalRequests) - expect(executedRequests).toBe(totalRequests) - expect(validatedResponses).toBe(totalRequests) - expect(maximumInFlightRequests).toBe(concurrency) - expect(inFlightRequests).toBe(0) - expect(finishedBodies).toBe(totalRequests) - }) - - it('builds identical predetermined worker sequences from identical seeds', () => { - const buildSequences = (seed: number) => - buildRequestSequences({ - seed, - concurrency: 4, - totalRequests: 12, - buildRequest: (random, index) => - new Request( - `http://localhost/request/${index}?value=${random().toString(36)}`, - ), - }).map((requests) => requests.map((request) => request.url)) - - const first = buildSequences(456) - const second = buildSequences(456) - - expect(second).toEqual(first) - expect(first.map((requests) => requests.map(requestIndex))).toEqual([ - [0, 4, 8], - [1, 5, 9], - [2, 6, 10], - [3, 7, 11], - ]) - }) - - it('drains every started body before reporting a worker failure', async () => { - const concurrency = 4 - const firstWaveStarted = deferred() - let executedRequests = 0 - let finishedBodies = 0 - let inFlightRequests = 0 - - const handler: StartRequestHandler = { - fetch(request) { - executedRequests += 1 - inFlightRequests += 1 - if (inFlightRequests === concurrency) { - firstWaveStarted.resolve() - } - - const body = new ReadableStream({ - async start(controller) { - await firstWaveStarted.promise - controller.close() - finishedBodies += 1 - inFlightRequests -= 1 - }, - }) - - return new Response(body, { - status: request.url.endsWith('/0') ? 500 : 200, - }) - }, - } - - await expect( - runRequestLoop(handler, { - seed: 789, - concurrency, - totalRequests: 12, - buildRequest: (_random, index) => - new Request(`http://localhost/request/${index}`), - }), - ).rejects.toThrow('non-200 status 500') - - expect(finishedBodies).toBe(executedRequests) - expect(inFlightRequests).toBe(0) - }) -}) - -function requestIndex(url: string) { - return Number(new URL(url).pathname.split('/').at(-1)) -} diff --git a/benchmarks/ssr/bench-utils.ts b/benchmarks/ssr/bench-utils.ts deleted file mode 100644 index 7a54fce897..0000000000 --- a/benchmarks/ssr/bench-utils.ts +++ /dev/null @@ -1,205 +0,0 @@ -export interface StartRequestHandler { - fetch: (request: Request) => Promise | Response -} - -export interface RunSsrRequestLoopOptions { - seed: number - iterations?: number -} - -export interface RunRequestLoopOptions { - seed: number - concurrency: number - totalRequests: number - buildRequest: (random: () => number, index: number) => Request - validateResponse?: (response: Response, request: Request) => void -} - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function createDeterministicRandom(seed: number) { - let state = seed >>> 0 - - return () => { - state = (state * 1664525 + 1013904223) >>> 0 - return state / 0x100000000 - } -} - -function randomSegment(random: () => number) { - return Math.floor(random() * 1_000_000_000).toString(36) -} - -export { createDeterministicRandom, randomSegment } - -export async function drainResponse(response: Response) { - const reader = response.body?.getReader() - - if (!reader) { - return - } - - try { - while (true) { - const result = await reader.read() - - if (result.done) { - break - } - } - } finally { - reader.releaseLock() - } -} - -function randomSearchValue(random: () => number) { - return `q-${randomSegment(random)}` -} - -function randomRequestUrl(random: () => number) { - const a = randomSegment(random) - const b = randomSegment(random) - const c = randomSegment(random) - const d = randomSegment(random) - const q = randomSearchValue(random) - - return `http://localhost/${a}/${b}/${c}/${d}?q=${q}` -} - -export async function runSsrRequestLoop( - handler: StartRequestHandler, - { seed, iterations = 10 }: RunSsrRequestLoopOptions, -) { - const random = createDeterministicRandom(seed) - const pendingBodyReads: Array> = [] - - for (let index = 0; index < iterations; index++) { - const requestUrl = randomRequestUrl(random) - const response = await handler.fetch(new Request(requestUrl, requestInit)) - - if (response.status !== 200) { - await Promise.allSettled(pendingBodyReads) - - throw new Error( - `Request failed with non-200 status ${response.status} (${requestUrl})`, - ) - } - - pendingBodyReads.push(drainResponse(response)) - } - - await Promise.all(pendingBodyReads) -} - -export async function runRequestLoop( - handler: StartRequestHandler, - { - seed, - concurrency, - totalRequests, - buildRequest, - validateResponse, - }: RunRequestLoopOptions, -) { - const requestSequences = buildRequestSequences({ - seed, - concurrency, - totalRequests, - buildRequest, - }) - const validate = - validateResponse ?? - ((response: Response, request: Request) => { - if (response.status !== 200) { - throw new Error( - `Request failed with non-200 status ${response.status} (${request.url})`, - ) - } - }) - - let startWorkers = () => {} - const startBarrier = new Promise((resolve) => { - startWorkers = resolve - }) - - const workers = requestSequences.map(async (requests) => { - await startBarrier - - for (const request of requests) { - const response = await handler.fetch(request) - let validationFailure: { error: unknown } | undefined - - try { - validate(response, request) - } catch (error) { - validationFailure = { error } - } - - await drainResponse(response) - - if (validationFailure) { - throw validationFailure.error - } - } - }) - - startWorkers() - const results = await Promise.allSettled(workers) - const failedWorker = results.find( - (result): result is PromiseRejectedResult => result.status === 'rejected', - ) - - if (failedWorker) { - throw failedWorker.reason - } -} - -export type BuildRequestSequencesOptions = Pick< - RunRequestLoopOptions, - 'seed' | 'concurrency' | 'totalRequests' | 'buildRequest' -> - -/** - * Build the entire seeded workload before any request starts, then partition - * it round-robin so completion timing can never change a worker's next input. - */ -export function buildRequestSequences({ - seed, - concurrency, - totalRequests, - buildRequest, -}: BuildRequestSequencesOptions): Array> { - assertPositiveInteger('concurrency', concurrency) - assertPositiveInteger('totalRequests', totalRequests) - - if (concurrency > totalRequests) { - throw new RangeError( - `concurrency (${concurrency}) cannot exceed totalRequests (${totalRequests})`, - ) - } - - const random = createDeterministicRandom(seed) - const requestSequences = Array.from( - { length: concurrency }, - () => new Array(), - ) - - for (let index = 0; index < totalRequests; index++) { - requestSequences[index % concurrency]!.push(buildRequest(random, index)) - } - - return requestSequences -} - -function assertPositiveInteger(name: string, value: number) { - if (!Number.isSafeInteger(value) || value < 1) { - throw new RangeError( - `${name} must be a positive integer; received ${value}`, - ) - } -} diff --git a/benchmarks/ssr/package.json b/benchmarks/ssr/package.json deleted file mode 100644 index 20c1837468..0000000000 --- a/benchmarks/ssr/package.json +++ /dev/null @@ -1,231 +0,0 @@ -{ - "name": "@benchmarks/ssr", - "private": true, - "type": "module", - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-start": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "@tanstack/vue-router": "workspace:^", - "@tanstack/vue-start": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "solid-js": "^1.9.10", - "vue": "^3.5.16" - }, - "devDependencies": { - "@codspeed/vitest-plugin": "^6.0.1", - "@vitejs/plugin-react": "^6.0.1", - "@vitejs/plugin-vue-jsx": "^5.1.5", - "@types/react": "catalog:", - "seroval": "^1.6.7", - "@typescript/native": "npm:typescript@^7.0.2", - "jsdom": "29.1.1", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "vitest": "catalog:" - }, - "nx": { - "targets": { - "build:react": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/ssr-react", - "@benchmarks/ssr-assets-react", - "@benchmarks/ssr-before-load-react", - "@benchmarks/ssr-control-flow-react", - "@benchmarks/ssr-global-middleware-react", - "@benchmarks/ssr-head-react", - "@benchmarks/ssr-loaders-react", - "@benchmarks/ssr-rewrites-react", - "@benchmarks/ssr-serialization-react", - "@benchmarks/ssr-selective-ssr-react", - "@benchmarks/ssr-server-fn-transport-react", - "@benchmarks/ssr-server-fns-react", - "@benchmarks/ssr-server-routes-react", - "@benchmarks/ssr-server-routes-middleware-react", - "@benchmarks/ssr-streaming-react" - ], - "target": "build:ssr" - } - ] - }, - "build:solid": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/ssr-solid", - "@benchmarks/ssr-assets-solid", - "@benchmarks/ssr-before-load-solid", - "@benchmarks/ssr-control-flow-solid", - "@benchmarks/ssr-global-middleware-solid", - "@benchmarks/ssr-head-solid", - "@benchmarks/ssr-loaders-solid", - "@benchmarks/ssr-rewrites-solid", - "@benchmarks/ssr-serialization-solid", - "@benchmarks/ssr-selective-ssr-solid", - "@benchmarks/ssr-server-fn-transport-solid", - "@benchmarks/ssr-server-fns-solid", - "@benchmarks/ssr-server-routes-solid", - "@benchmarks/ssr-server-routes-middleware-solid", - "@benchmarks/ssr-streaming-solid" - ], - "target": "build:ssr" - } - ] - }, - "build:vue": { - "executor": "nx:noop", - "cache": false, - "dependsOn": [ - { - "projects": [ - "@benchmarks/ssr-vue", - "@benchmarks/ssr-assets-vue", - "@benchmarks/ssr-before-load-vue", - "@benchmarks/ssr-control-flow-vue", - "@benchmarks/ssr-global-middleware-vue", - "@benchmarks/ssr-head-vue", - "@benchmarks/ssr-loaders-vue", - "@benchmarks/ssr-rewrites-vue", - "@benchmarks/ssr-serialization-vue", - "@benchmarks/ssr-selective-ssr-vue", - "@benchmarks/ssr-server-fn-transport-vue", - "@benchmarks/ssr-server-fns-vue", - "@benchmarks/ssr-server-routes-vue", - "@benchmarks/ssr-server-routes-middleware-vue", - "@benchmarks/ssr-streaming-vue" - ], - "target": "build:ssr" - } - ] - }, - "test:perf": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - "build:react", - "build:solid", - "build:vue" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark", - "cwd": "benchmarks/ssr" - } - }, - "test:unit": { - "executor": "nx:run-commands", - "options": { - "command": "vitest run --config ./vitest.unit.config.ts", - "cwd": "benchmarks/ssr" - } - }, - "test:perf:react": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - "build:react" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.react.config.ts", - "cwd": "benchmarks/ssr" - } - }, - "test:perf:solid": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - "build:solid" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.solid.config.ts", - "cwd": "benchmarks/ssr" - } - }, - "test:perf:vue": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - "build:vue" - ], - "options": { - "command": "NODE_ENV=production vitest bench --mode benchmark --config ./vitest.vue.config.ts", - "cwd": "benchmarks/ssr" - } - }, - "test:types": { - "executor": "nx:run-commands", - "options": { - "command": "tsc -p ./tsconfig.json --noEmit", - "cwd": "benchmarks/ssr" - }, - "dependsOn": [ - { - "projects": [ - "@benchmarks/ssr-react", - "@benchmarks/ssr-assets-react", - "@benchmarks/ssr-before-load-react", - "@benchmarks/ssr-control-flow-react", - "@benchmarks/ssr-global-middleware-react", - "@benchmarks/ssr-head-react", - "@benchmarks/ssr-loaders-react", - "@benchmarks/ssr-rewrites-react", - "@benchmarks/ssr-serialization-react", - "@benchmarks/ssr-selective-ssr-react", - "@benchmarks/ssr-server-fn-transport-react", - "@benchmarks/ssr-server-fns-react", - "@benchmarks/ssr-server-routes-react", - "@benchmarks/ssr-server-routes-middleware-react", - "@benchmarks/ssr-streaming-react", - "@benchmarks/ssr-solid", - "@benchmarks/ssr-assets-solid", - "@benchmarks/ssr-before-load-solid", - "@benchmarks/ssr-control-flow-solid", - "@benchmarks/ssr-global-middleware-solid", - "@benchmarks/ssr-head-solid", - "@benchmarks/ssr-loaders-solid", - "@benchmarks/ssr-rewrites-solid", - "@benchmarks/ssr-serialization-solid", - "@benchmarks/ssr-selective-ssr-solid", - "@benchmarks/ssr-server-fn-transport-solid", - "@benchmarks/ssr-server-fns-solid", - "@benchmarks/ssr-server-routes-solid", - "@benchmarks/ssr-server-routes-middleware-solid", - "@benchmarks/ssr-streaming-solid", - "@benchmarks/ssr-vue", - "@benchmarks/ssr-assets-vue", - "@benchmarks/ssr-before-load-vue", - "@benchmarks/ssr-control-flow-vue", - "@benchmarks/ssr-global-middleware-vue", - "@benchmarks/ssr-head-vue", - "@benchmarks/ssr-loaders-vue", - "@benchmarks/ssr-rewrites-vue", - "@benchmarks/ssr-serialization-vue", - "@benchmarks/ssr-selective-ssr-vue", - "@benchmarks/ssr-server-fn-transport-vue", - "@benchmarks/ssr-server-fns-vue", - "@benchmarks/ssr-server-routes-vue", - "@benchmarks/ssr-server-routes-middleware-vue", - "@benchmarks/ssr-streaming-vue" - ], - "target": "test:types:ssr" - } - ], - "inputs": [ - "default", - "^production", - "{workspaceRoot}/eslint.config.js", - "{workspaceRoot}/benchmarks/cpu-simulation.ts", - "dependentTaskOutputs" - ] - } - } - } -} diff --git a/benchmarks/ssr/react/project.json b/benchmarks/ssr/react/project.json deleted file mode 100644 index d7f674cc83..0000000000 --- a/benchmarks/ssr/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/react/speed.bench.ts b/benchmarks/ssr/react/speed.bench.ts deleted file mode 100644 index 6825a7ddfb..0000000000 --- a/benchmarks/ssr/react/speed.bench.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test } from 'vitest' -import { runSsrRequestLoop } from '../bench-utils' -import type { StartRequestHandler } from '../bench-utils' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href -const benchmarkSeed = 0xdecafbad - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -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/react/src/routeTree.gen.ts b/benchmarks/ssr/react/src/routeTree.gen.ts deleted file mode 100644 index 9f110bba31..0000000000 --- a/benchmarks/ssr/react/src/routeTree.gen.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' -import { Route as ABCDRouteImport } from './routes/$a.$b.$c.$d' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) -const ABCDRoute = ABCDRouteImport.update({ - id: '/$d', - path: '/$d', - getParentRoute: () => ABCRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - '/$a/$b/$c/$d': { - id: '/$a/$b/$c/$d' - path: '/$d' - fullPath: '/$a/$b/$c/$d' - preLoaderRoute: typeof ABCDRouteImport - parentRoute: typeof ABCRoute - } - } -} - -interface ABCRouteChildren { - ABCDRoute: typeof ABCDRoute -} - -const ABCRouteChildren: ABCRouteChildren = { - ABCDRoute: ABCDRoute, -} - -const ABCRouteWithChildren = ABCRoute._addFileChildren(ABCRouteChildren) - -interface ABRouteChildren { - ABCRoute: typeof ABCRouteWithChildren -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRouteWithChildren, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/react/src/router.tsx b/benchmarks/ssr/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/react/src/routes/$a.$b.$c.$d.tsx b/benchmarks/ssr/react/src/routes/$a.$b.$c.$d.tsx deleted file mode 100644 index 056f1c308e..0000000000 --- a/benchmarks/ssr/react/src/routes/$a.$b.$c.$d.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b/$c/$d')({ - component: LevelDComponent, -}) - -function LevelDComponent() { - return -} diff --git a/benchmarks/ssr/react/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/react/src/routes/$a.$b.$c.tsx deleted file mode 100644 index b73ede60f4..0000000000 --- a/benchmarks/ssr/react/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b/$c')({ - component: LevelCComponent, -}) - -function LevelCComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/react/src/routes/$a.$b.tsx b/benchmarks/ssr/react/src/routes/$a.$b.tsx deleted file mode 100644 index 649b0f0a46..0000000000 --- a/benchmarks/ssr/react/src/routes/$a.$b.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b')({ - component: LevelBComponent, -}) - -function LevelBComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/react/src/routes/$a.tsx b/benchmarks/ssr/react/src/routes/$a.tsx deleted file mode 100644 index cc2fa1483b..0000000000 --- a/benchmarks/ssr/react/src/routes/$a.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a')({ - component: LevelAComponent, -}) - -function LevelAComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/react/src/routes/__root.tsx b/benchmarks/ssr/react/src/routes/__root.tsx deleted file mode 100644 index 1973ca20bb..0000000000 --- a/benchmarks/ssr/react/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/react/src/workload.tsx b/benchmarks/ssr/react/src/workload.tsx deleted file mode 100644 index 2cc5c9f1ae..0000000000 --- a/benchmarks/ssr/react/src/workload.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { Link, useParams, useSearch } from '@tanstack/react-router' - -const probes = Array.from({ length: 10 }, (_, index) => index) - -function runSelectorWork(input: string, salt: number) { - let value = salt - - for (let index = 0; index < input.length; index++) { - value = (value * 33 + input.charCodeAt(index) + index) >>> 0 - } - - for (let index = 0; index < 16; index++) { - value = (value ^ (value << 13)) >>> 0 - value = (value ^ (value >> 17)) >>> 0 - value = (value ^ (value << 5)) >>> 0 - } - - return value -} - -function ParamsProbe({ salt }: { salt: number }) { - const params = useParams({ - strict: false, - select: (nextParams) => - runSelectorWork( - `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`, - salt, - ), - }) - - void params - - return null -} - -function SearchProbe({ salt }: { salt: number }) { - const search = useSearch({ - strict: false, - select: (nextSearch) => runSelectorWork(String(nextSearch.q ?? ''), salt), - }) - - void search - - return null -} - -function LinkProbe({ salt }: { salt: number }) { - const value = String((salt % 97) + 1) - - return ( - - Link - - ) -} - -export function RouteWorkload() { - return ( - <> - {probes.map((probe) => ( - - ))} - {probes.map((probe) => ( - - ))} - {probes.map((probe) => ( - - ))} - - ) -} diff --git a/benchmarks/ssr/react/tsconfig.json b/benchmarks/ssr/react/tsconfig.json deleted file mode 100644 index 4de88f2eb4..0000000000 --- a/benchmarks/ssr/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/react/vite.config.ts b/benchmarks/ssr/react/vite.config.ts deleted file mode 100644 index e607db366b..0000000000 --- a/benchmarks/ssr/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/assets/react/project.json b/benchmarks/ssr/scenarios/assets/react/project.json deleted file mode 100644 index a2d5a6c8ba..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-assets-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} 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 deleted file mode 100644 index 0496613afb..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/speed.assets-linked-css-control.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertAssetsScenario, - assetsBenchOptions, - runAssetsLinkedControlLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertAssetsScenario(handler) - -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 deleted file mode 100644 index 7dc57d89f1..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertAssetsScenario, - assetsBenchOptions, - runAssetsInlineLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertAssetsScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr assets inline-css cdn (react)', async () => - runAssetsInlineLoop(handler), - ).run(assetsBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts deleted file mode 100644 index 201df5fd3b..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/routeTree.gen.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 AXRouteImport } from './routes/a.$x' -import { Route as AXYRouteImport } from './routes/a.$x.$y' - -const AXRoute = AXRouteImport.update({ - id: '/a/$x', - path: '/a/$x', - getParentRoute: () => rootRouteImport, -} as any) -const AXYRoute = AXYRouteImport.update({ - id: '/$y', - path: '/$y', - getParentRoute: () => AXRoute, -} as any) - -export interface FileRoutesByFullPath { - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRoutesByTo { - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a/$x' | '/a/$x/$y' - fileRoutesByTo: FileRoutesByTo - to: '/a/$x' | '/a/$x/$y' - id: '__root__' | '/a/$x' | '/a/$x/$y' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - AXRoute: typeof AXRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/a/$x': { - id: '/a/$x' - path: '/a/$x' - fullPath: '/a/$x' - preLoaderRoute: typeof AXRouteImport - parentRoute: typeof rootRouteImport - } - '/a/$x/$y': { - id: '/a/$x/$y' - path: '/$y' - fullPath: '/a/$x/$y' - preLoaderRoute: typeof AXYRouteImport - parentRoute: typeof AXRoute - } - } -} - -interface AXRouteChildren { - AXYRoute: typeof AXYRoute -} - -const AXRouteChildren: AXRouteChildren = { - AXYRoute: AXYRoute, -} - -const AXRouteWithChildren = AXRoute._addFileChildren(AXRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - AXRoute: AXRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/assets/react/src/router.tsx b/benchmarks/ssr/scenarios/assets/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/assets/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/assets/react/src/routes/__root.tsx deleted file mode 100644 index 8c46c7060a..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/routes/__root.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: 'SSR assets benchmark' }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.$y.tsx b/benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.$y.tsx deleted file mode 100644 index be709e53e6..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.$y.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import '../styles/assets-leaf.css' - -export const Route = createFileRoute('/a/$x/$y')({ - head: ({ params }) => ({ - meta: [{ title: `SSR Assets ${params.x} ${params.y}` }], - links: Array.from({ length: 3 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/asset-preload/${params.y}-${index}.png`, - })), - }), - component: LeafComponent, -}) - -function LeafComponent() { - const { x, y } = Route.useParams() - - return ( -
-

- assets-leaf-{x}-{y} -

-
- ) -} diff --git a/benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.tsx b/benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.tsx deleted file mode 100644 index ecc7de680a..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/routes/a.$x.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import '../styles/assets-a.css' - -export const Route = createFileRoute('/a/$x')({ - head: ({ params }) => ({ - meta: [{ title: `SSR Assets ${params.x}` }], - links: Array.from({ length: 2 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/asset-preload/${params.x}-${index}.png`, - })), - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - const { x } = Route.useParams() - - return ( -
-

assets-level-a-{x}

- -
- ) -} diff --git a/benchmarks/ssr/scenarios/assets/react/src/server.ts b/benchmarks/ssr/scenarios/assets/react/src/server.ts deleted file mode 100644 index 64fb21708c..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/server.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - createStartHandler, - defaultStreamHandler, -} from '@tanstack/react-start/server' -import { createServerEntry } from '@tanstack/react-start/server-entry' -import type { - TransformAssets, - TransformAssetsFn, -} from '@tanstack/react-start/server' - -type CreateTransformContext = - | { warmup: true } - | { request: Request; warmup: false } - -const cdnOrigin = 'https://cdn.example.com' - -const createCdnTransform = (prefix: string): TransformAssetsFn => { - return ({ url }) => `${prefix}${url}` -} - -const transformAssets: TransformAssets = { - createTransform: (ctx: CreateTransformContext) => { - const prefix = ctx.warmup - ? cdnOrigin - : (ctx.request.headers.get('x-assets-cdn') ?? cdnOrigin) - - return createCdnTransform(prefix) - }, - cache: false, -} - -const handler = createStartHandler({ - handler: defaultStreamHandler, - inlineCss: true, - transformAssets, -}) - -export default createServerEntry({ - fetch(request) { - return handler(request, { - inlineCss: request.headers.get('x-inline-css') !== 'false', - responseLinkHeader: true, - }) - }, -}) diff --git a/benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css b/benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css deleted file mode 100644 index d3511ddd85..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/styles/assets-a.css +++ /dev/null @@ -1,8 +0,0 @@ -.assets-level-a { - color: #1f2937; - background-image: url('/asset-bg-a.svg'); -} - -.assets-level-a::before { - content: 'assets-level-a-css'; -} diff --git a/benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css b/benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css deleted file mode 100644 index 55e051b9a5..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/src/styles/assets-leaf.css +++ /dev/null @@ -1,8 +0,0 @@ -.assets-leaf { - border-color: #2563eb; - background-image: url('/asset-bg-leaf.svg'); -} - -.assets-leaf::before { - content: 'assets-leaf-css'; -} diff --git a/benchmarks/ssr/scenarios/assets/react/tsconfig.json b/benchmarks/ssr/scenarios/assets/react/tsconfig.json deleted file mode 100644 index cf14e1d440..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/assets/react/vite.config.ts b/benchmarks/ssr/scenarios/assets/react/vite.config.ts deleted file mode 100644 index 5990bba6d3..0000000000 --- a/benchmarks/ssr/scenarios/assets/react/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - server: { - build: { - inlineCss: { enabled: true, transformAssets: true }, - }, - }, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr assets (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/assets/shared.ts b/benchmarks/ssr/scenarios/assets/shared.ts deleted file mode 100644 index ec811794e3..0000000000 --- a/benchmarks/ssr/scenarios/assets/shared.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { expect } from 'vitest' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const origin = 'http://localhost' -const cdnOrigin = 'https://cdn.example.com' -const inlineCssLoopTotalRequests = 32 -const linkedCssLoopTotalRequests = 32 - -const inlineRequestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -const linkedRequestInit = { - method: 'GET', - headers: { - accept: 'text/html', - 'x-inline-css': 'false', - }, -} satisfies RequestInit - -export const assetsBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -function buildAssetsRequest(random: () => number, requestInit: RequestInit) { - return new Request( - `${origin}/a/${randomSegment(random)}/${randomSegment(random)}`, - requestInit, - ) -} - -export function runAssetsInlineLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: inlineCssLoopTotalRequests, - buildRequest: (random) => buildAssetsRequest(random, inlineRequestInit), - }) -} - -export function runAssetsLinkedControlLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: linkedCssLoopTotalRequests, - buildRequest: (random) => buildAssetsRequest(random, linkedRequestInit), - }) -} - -export async function assertAssetsScenario(handler: StartRequestHandler) { - const inlineResponse = await handler.fetch( - new Request(`${origin}/a/sanity-x/sanity-y`, inlineRequestInit), - ) - const inlineBody = await inlineResponse.text() - const inlineLinkHeader = inlineResponse.headers.get('link') ?? '' - - expect(inlineResponse.status).toBe(200) - expect(inlineBody).toContain('SSR Assets sanity-x sanity-y') - expect(inlineBody).toContain(' { - 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 deleted file mode 100644 index 47f483df11..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertAssetsScenario, - assetsBenchOptions, - runAssetsInlineLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertAssetsScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr assets inline-css cdn (solid)', async () => - runAssetsInlineLoop(handler), - ).run(assetsBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts deleted file mode 100644 index f6f7ffe57e..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 AXRouteImport } from './routes/a.$x' -import { Route as AXYRouteImport } from './routes/a.$x.$y' - -const AXRoute = AXRouteImport.update({ - id: '/a/$x', - path: '/a/$x', - getParentRoute: () => rootRouteImport, -} as any) -const AXYRoute = AXYRouteImport.update({ - id: '/$y', - path: '/$y', - getParentRoute: () => AXRoute, -} as any) - -export interface FileRoutesByFullPath { - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRoutesByTo { - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a/$x' | '/a/$x/$y' - fileRoutesByTo: FileRoutesByTo - to: '/a/$x' | '/a/$x/$y' - id: '__root__' | '/a/$x' | '/a/$x/$y' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - AXRoute: typeof AXRouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/a/$x': { - id: '/a/$x' - path: '/a/$x' - fullPath: '/a/$x' - preLoaderRoute: typeof AXRouteImport - parentRoute: typeof rootRouteImport - } - '/a/$x/$y': { - id: '/a/$x/$y' - path: '/$y' - fullPath: '/a/$x/$y' - preLoaderRoute: typeof AXYRouteImport - parentRoute: typeof AXRoute - } - } -} - -interface AXRouteChildren { - AXYRoute: typeof AXYRoute -} - -const AXRouteChildren: AXRouteChildren = { - AXYRoute: AXYRoute, -} - -const AXRouteWithChildren = AXRoute._addFileChildren(AXRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - AXRoute: AXRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/assets/solid/src/router.tsx b/benchmarks/ssr/scenarios/assets/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx deleted file mode 100644 index ca760406ce..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/routes/__root.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: 'SSR assets benchmark' }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.$y.tsx b/benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.$y.tsx deleted file mode 100644 index 2a3d35cb68..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.$y.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import '../styles/assets-leaf.css' - -export const Route = createFileRoute('/a/$x/$y')({ - head: ({ params }) => ({ - meta: [{ title: `SSR Assets ${params.x} ${params.y}` }], - links: Array.from({ length: 3 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/asset-preload/${params.y}-${index}.png`, - })), - }), - component: LeafComponent, -}) - -function LeafComponent() { - const params = Route.useParams() - - return ( -
-

- assets-leaf-{params().x}-{params().y} -

-
- ) -} diff --git a/benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx b/benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx deleted file mode 100644 index 2209addcbe..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/routes/a.$x.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import '../styles/assets-a.css' - -export const Route = createFileRoute('/a/$x')({ - head: ({ params }) => ({ - meta: [{ title: `SSR Assets ${params.x}` }], - links: Array.from({ length: 2 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/asset-preload/${params.x}-${index}.png`, - })), - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - const params = Route.useParams() - - return ( -
-

assets-level-a-{params().x}

- -
- ) -} diff --git a/benchmarks/ssr/scenarios/assets/solid/src/server.ts b/benchmarks/ssr/scenarios/assets/solid/src/server.ts deleted file mode 100644 index 541e776a79..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/server.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - createStartHandler, - defaultStreamHandler, -} from '@tanstack/solid-start/server' -import { createServerEntry } from '@tanstack/solid-start/server-entry' -import type { - TransformAssets, - TransformAssetsFn, -} from '@tanstack/solid-start/server' - -type CreateTransformContext = - | { warmup: true } - | { request: Request; warmup: false } - -const cdnOrigin = 'https://cdn.example.com' - -const createCdnTransform = (prefix: string): TransformAssetsFn => { - return ({ url }) => `${prefix}${url}` -} - -const transformAssets: TransformAssets = { - createTransform: (ctx: CreateTransformContext) => { - const prefix = ctx.warmup - ? cdnOrigin - : (ctx.request.headers.get('x-assets-cdn') ?? cdnOrigin) - - return createCdnTransform(prefix) - }, - cache: false, -} - -const handler = createStartHandler({ - handler: defaultStreamHandler, - inlineCss: true, - transformAssets, -}) - -export default createServerEntry({ - fetch(request) { - return handler(request, { - inlineCss: request.headers.get('x-inline-css') !== 'false', - responseLinkHeader: true, - }) - }, -}) diff --git a/benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css b/benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css deleted file mode 100644 index d3511ddd85..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/styles/assets-a.css +++ /dev/null @@ -1,8 +0,0 @@ -.assets-level-a { - color: #1f2937; - background-image: url('/asset-bg-a.svg'); -} - -.assets-level-a::before { - content: 'assets-level-a-css'; -} diff --git a/benchmarks/ssr/scenarios/assets/solid/src/styles/assets-leaf.css b/benchmarks/ssr/scenarios/assets/solid/src/styles/assets-leaf.css deleted file mode 100644 index 55e051b9a5..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/src/styles/assets-leaf.css +++ /dev/null @@ -1,8 +0,0 @@ -.assets-leaf { - border-color: #2563eb; - background-image: url('/asset-bg-leaf.svg'); -} - -.assets-leaf::before { - content: 'assets-leaf-css'; -} diff --git a/benchmarks/ssr/scenarios/assets/solid/tsconfig.json b/benchmarks/ssr/scenarios/assets/solid/tsconfig.json deleted file mode 100644 index 42c3a2160f..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/assets/solid/vite.config.ts b/benchmarks/ssr/scenarios/assets/solid/vite.config.ts deleted file mode 100644 index 3ee54e5ae2..0000000000 --- a/benchmarks/ssr/scenarios/assets/solid/vite.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - server: { - build: { - inlineCss: { enabled: true, transformAssets: true }, - }, - }, - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr assets (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/assets/vue/project.json b/benchmarks/ssr/scenarios/assets/vue/project.json deleted file mode 100644 index 9667ff902c..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-assets-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} 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 deleted file mode 100644 index e56d41df6b..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/speed.assets-linked-css-control.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertAssetsScenario, - assetsBenchOptions, - runAssetsLinkedControlLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertAssetsScenario(handler) - -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 deleted file mode 100644 index 3f77a0dcc1..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertAssetsScenario, - assetsBenchOptions, - runAssetsInlineLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertAssetsScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr assets inline-css cdn (vue)', async () => - runAssetsInlineLoop(handler), - ).run(assetsBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/assets/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/assets/vue/src/routeTree.gen.ts deleted file mode 100644 index 2a6eb91f50..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 AXRouteImport } from './routes/a.$x' -import { Route as AXYRouteImport } from './routes/a.$x.$y' - -const AXRoute = AXRouteImport.update({ - id: '/a/$x', - path: '/a/$x', - getParentRoute: () => rootRouteImport, -} as any) -const AXYRoute = AXYRouteImport.update({ - id: '/$y', - path: '/$y', - getParentRoute: () => AXRoute, -} as any) - -export interface FileRoutesByFullPath { - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRoutesByTo { - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/a/$x': typeof AXRouteWithChildren - '/a/$x/$y': typeof AXYRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/a/$x' | '/a/$x/$y' - fileRoutesByTo: FileRoutesByTo - to: '/a/$x' | '/a/$x/$y' - id: '__root__' | '/a/$x' | '/a/$x/$y' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - AXRoute: typeof AXRouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/a/$x': { - id: '/a/$x' - path: '/a/$x' - fullPath: '/a/$x' - preLoaderRoute: typeof AXRouteImport - parentRoute: typeof rootRouteImport - } - '/a/$x/$y': { - id: '/a/$x/$y' - path: '/$y' - fullPath: '/a/$x/$y' - preLoaderRoute: typeof AXYRouteImport - parentRoute: typeof AXRoute - } - } -} - -interface AXRouteChildren { - AXYRoute: typeof AXYRoute -} - -const AXRouteChildren: AXRouteChildren = { - AXYRoute: AXYRoute, -} - -const AXRouteWithChildren = AXRoute._addFileChildren(AXRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - AXRoute: AXRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/assets/vue/src/router.tsx b/benchmarks/ssr/scenarios/assets/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/assets/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/assets/vue/src/routes/__root.tsx deleted file mode 100644 index 760545d248..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/routes/__root.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: 'SSR assets benchmark' }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.$y.tsx b/benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.$y.tsx deleted file mode 100644 index a29fe59f22..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.$y.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import '../styles/assets-leaf.css' - -const LeafComponent = defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

- assets-leaf-{params.value.x}-{params.value.y} -

-
- ) - }, -}) - -export const Route = createFileRoute('/a/$x/$y')({ - head: ({ params }) => ({ - meta: [{ title: `SSR Assets ${params.x} ${params.y}` }], - links: Array.from({ length: 3 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/asset-preload/${params.y}-${index}.png`, - })), - }), - component: LeafComponent, -}) diff --git a/benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.tsx b/benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.tsx deleted file mode 100644 index e1fe0418e4..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/routes/a.$x.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import '../styles/assets-a.css' - -const LevelAComponent = defineComponent({ - setup() { - const params = Route.useParams() - - return () => ( -
-

assets-level-a-{params.value.x}

- -
- ) - }, -}) - -export const Route = createFileRoute('/a/$x')({ - head: ({ params }) => ({ - meta: [{ title: `SSR Assets ${params.x}` }], - links: Array.from({ length: 2 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/asset-preload/${params.x}-${index}.png`, - })), - }), - component: LevelAComponent, -}) diff --git a/benchmarks/ssr/scenarios/assets/vue/src/server.ts b/benchmarks/ssr/scenarios/assets/vue/src/server.ts deleted file mode 100644 index fd1e83d6b8..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/server.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { - createStartHandler, - defaultStreamHandler, -} from '@tanstack/vue-start/server' -import { createServerEntry } from '@tanstack/vue-start/server-entry' -import type { - TransformAssets, - TransformAssetsFn, -} from '@tanstack/vue-start/server' - -type CreateTransformContext = - | { warmup: true } - | { request: Request; warmup: false } - -const cdnOrigin = 'https://cdn.example.com' - -const createCdnTransform = (prefix: string): TransformAssetsFn => { - return ({ url }) => `${prefix}${url}` -} - -const transformAssets: TransformAssets = { - createTransform: (ctx: CreateTransformContext) => { - const prefix = ctx.warmup - ? cdnOrigin - : (ctx.request.headers.get('x-assets-cdn') ?? cdnOrigin) - - return createCdnTransform(prefix) - }, - cache: false, -} - -const handler = createStartHandler({ - handler: defaultStreamHandler, - inlineCss: true, - transformAssets, -}) - -export default createServerEntry({ - fetch(request) { - return handler(request, { - inlineCss: request.headers.get('x-inline-css') !== 'false', - responseLinkHeader: true, - }) - }, -}) diff --git a/benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css b/benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css deleted file mode 100644 index d3511ddd85..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/styles/assets-a.css +++ /dev/null @@ -1,8 +0,0 @@ -.assets-level-a { - color: #1f2937; - background-image: url('/asset-bg-a.svg'); -} - -.assets-level-a::before { - content: 'assets-level-a-css'; -} diff --git a/benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css b/benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css deleted file mode 100644 index 55e051b9a5..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/src/styles/assets-leaf.css +++ /dev/null @@ -1,8 +0,0 @@ -.assets-leaf { - border-color: #2563eb; - background-image: url('/asset-bg-leaf.svg'); -} - -.assets-leaf::before { - content: 'assets-leaf-css'; -} diff --git a/benchmarks/ssr/scenarios/assets/vue/tsconfig.json b/benchmarks/ssr/scenarios/assets/vue/tsconfig.json deleted file mode 100644 index 08c94853f4..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/assets/vue/vite.config.ts b/benchmarks/ssr/scenarios/assets/vue/vite.config.ts deleted file mode 100644 index e664b9b02b..0000000000 --- a/benchmarks/ssr/scenarios/assets/vue/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - server: { - build: { - inlineCss: { enabled: true, transformAssets: true }, - }, - }, - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr assets (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/before-load/react/project.json b/benchmarks/ssr/scenarios/before-load/react/project.json deleted file mode 100644 index df2004f1f5..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-before-load-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts b/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts deleted file mode 100644 index 8a4355a168..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertBeforeLoadScenario, - beforeLoadBenchOptions, - runBeforeLoadLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertBeforeLoadScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr before-load chain (react)', async () => - runBeforeLoadLoop(handler), - ).run(beforeLoadBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts deleted file mode 100644 index 068b5a5433..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - } -} - -interface ABRouteChildren { - ABCRoute: typeof ABCRoute -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRoute, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/before-load/react/src/router.tsx b/benchmarks/ssr/scenarios/before-load/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 71719a4f88..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { makeBeforeLoadMarker, type BeforeLoadContext } from '../../../shared' - -export const Route = createFileRoute('/$a/$b/$c')({ - beforeLoad: ({ params, context }) => { - const parent = context as BeforeLoadContext - - return { - chainToken: `${parent.chainToken}.${params.c}`, - ctxC: params.c, - } - }, - loader: ({ context }) => ({ - marker: makeBeforeLoadMarker(context as BeforeLoadContext), - }), - component: LevelCComponent, -}) - -function LevelCComponent() { - const data = Route.useLoaderData() - - return
{data.marker}
-} diff --git a/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.tsx b/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.tsx deleted file mode 100644 index 1a148e05fa..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.$b.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import type { BeforeLoadContext } from '../../../shared' - -export const Route = createFileRoute('/$a/$b')({ - beforeLoad: ({ params, context }) => { - const parent = context as BeforeLoadContext - - return { - chainToken: `${parent.chainToken}.${params.b}`, - ctxB: params.b, - } - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - return -} diff --git a/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.tsx b/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.tsx deleted file mode 100644 index b5dcca33c3..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/src/routes/$a.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/$a')({ - beforeLoad: ({ params }) => ({ - chainToken: params.a, - ctxA: params.a, - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - return -} diff --git a/benchmarks/ssr/scenarios/before-load/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/before-load/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/before-load/react/tsconfig.json b/benchmarks/ssr/scenarios/before-load/react/tsconfig.json deleted file mode 100644 index 232763bbe1..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared.ts", - "../shared-bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/before-load/react/vite.config.ts b/benchmarks/ssr/scenarios/before-load/react/vite.config.ts deleted file mode 100644 index 3fd72c5f1d..0000000000 --- a/benchmarks/ssr/scenarios/before-load/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr before-load (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/before-load/shared-bench.ts b/benchmarks/ssr/scenarios/before-load/shared-bench.ts deleted file mode 100644 index cf3a02f114..0000000000 --- a/benchmarks/ssr/scenarios/before-load/shared-bench.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { makeBeforeLoadMarker } from './shared' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const beforeLoadLoopTotalRequests = 32 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildBeforeLoadRequest(random: () => number, index: number) { - const suffix = index.toString(36) - const a = `${randomSegment(random)}-${suffix}` - const b = `${randomSegment(random)}-${suffix}` - const c = `${randomSegment(random)}-${suffix}` - - return new Request(`http://localhost/${a}/${b}/${c}`, requestInit) -} - -export async function assertBeforeLoadScenario(handler: StartRequestHandler) { - const response = await handler.fetch( - new Request('http://localhost/a-sanity/b-sanity/c-sanity', requestInit), - ) - const body = await response.text() - const expectedMarker = makeBeforeLoadMarker({ - ctxA: 'a-sanity', - ctxB: 'b-sanity', - ctxC: 'c-sanity', - chainToken: 'a-sanity.b-sanity.c-sanity', - }) - - if (response.status !== 200) { - throw new Error( - `Expected beforeLoad setup status 200, received ${response.status}`, - ) - } - - if (!body.includes(expectedMarker)) { - throw new Error( - `Expected beforeLoad setup response to include ${expectedMarker}`, - ) - } -} - -export const beforeLoadBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runBeforeLoadLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: beforeLoadLoopTotalRequests, - buildRequest: buildBeforeLoadRequest, - }) -} diff --git a/benchmarks/ssr/scenarios/before-load/shared.ts b/benchmarks/ssr/scenarios/before-load/shared.ts deleted file mode 100644 index 3c895aca03..0000000000 --- a/benchmarks/ssr/scenarios/before-load/shared.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface BeforeLoadContext { - chainToken?: string - ctxA?: string - ctxB?: string - ctxC?: string -} - -export function makeBeforeLoadMarker(context: BeforeLoadContext) { - return `ctx:${context.ctxA}:${context.ctxB}:${context.ctxC}:${context.chainToken}` -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/project.json b/benchmarks/ssr/scenarios/before-load/solid/project.json deleted file mode 100644 index 804cd9c1b0..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-before-load-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts b/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts deleted file mode 100644 index 27e0d3a64c..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertBeforeLoadScenario, - beforeLoadBenchOptions, - runBeforeLoadLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertBeforeLoadScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr before-load chain (solid)', async () => - runBeforeLoadLoop(handler), - ).run(beforeLoadBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts deleted file mode 100644 index 7b299cfcd1..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - } -} - -interface ABRouteChildren { - ABCRoute: typeof ABCRoute -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRoute, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/src/router.tsx b/benchmarks/ssr/scenarios/before-load/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 7966bcc4c2..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { makeBeforeLoadMarker, type BeforeLoadContext } from '../../../shared' - -export const Route = createFileRoute('/$a/$b/$c')({ - beforeLoad: ({ params, context }) => { - const parent = context as BeforeLoadContext - - return { - chainToken: `${parent.chainToken}.${params.c}`, - ctxC: params.c, - } - }, - loader: ({ context }) => ({ - marker: makeBeforeLoadMarker(context as BeforeLoadContext), - }), - component: LevelCComponent, -}) - -function LevelCComponent() { - const data = Route.useLoaderData() - - return
{data().marker}
-} diff --git a/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.tsx b/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.tsx deleted file mode 100644 index 90656dc7a1..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.$b.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import type { BeforeLoadContext } from '../../../shared' - -export const Route = createFileRoute('/$a/$b')({ - beforeLoad: ({ params, context }) => { - const parent = context as BeforeLoadContext - - return { - chainToken: `${parent.chainToken}.${params.b}`, - ctxB: params.b, - } - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - return -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx b/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx deleted file mode 100644 index 6336f56640..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/src/routes/$a.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/$a')({ - beforeLoad: ({ params }) => ({ - chainToken: params.a, - ctxA: params.a, - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - return -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/before-load/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/tsconfig.json b/benchmarks/ssr/scenarios/before-load/solid/tsconfig.json deleted file mode 100644 index 0995292743..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared.ts", - "../shared-bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/before-load/solid/vite.config.ts b/benchmarks/ssr/scenarios/before-load/solid/vite.config.ts deleted file mode 100644 index a20e32742e..0000000000 --- a/benchmarks/ssr/scenarios/before-load/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr before-load (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/before-load/vue/project.json b/benchmarks/ssr/scenarios/before-load/vue/project.json deleted file mode 100644 index 92d724821e..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-before-load-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts b/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts deleted file mode 100644 index 8684c159eb..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertBeforeLoadScenario, - beforeLoadBenchOptions, - runBeforeLoadLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertBeforeLoadScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr before-load chain (vue)', async () => - runBeforeLoadLoop(handler), - ).run(beforeLoadBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts deleted file mode 100644 index 24ee6c3b9d..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - } -} - -interface ABRouteChildren { - ABCRoute: typeof ABCRoute -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRoute, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/src/router.tsx b/benchmarks/ssr/scenarios/before-load/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 178d4071eb..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { makeBeforeLoadMarker, type BeforeLoadContext } from '../../../shared' - -const LevelCComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () =>
{data.value.marker}
- }, -}) - -export const Route = createFileRoute('/$a/$b/$c')({ - beforeLoad: ({ params, context }) => { - const parent = context as BeforeLoadContext - - return { - chainToken: `${parent.chainToken}.${params.c}`, - ctxC: params.c, - } - }, - loader: ({ context }) => ({ - marker: makeBeforeLoadMarker(context as BeforeLoadContext), - }), - component: LevelCComponent, -}) diff --git a/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.tsx b/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.tsx deleted file mode 100644 index 43ea0dcf87..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.$b.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import type { BeforeLoadContext } from '../../../shared' - -export const Route = createFileRoute('/$a/$b')({ - beforeLoad: ({ params, context }) => { - const parent = context as BeforeLoadContext - - return { - chainToken: `${parent.chainToken}.${params.b}`, - ctxB: params.b, - } - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - return -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.tsx b/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.tsx deleted file mode 100644 index 7f036dceac..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/src/routes/$a.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/$a')({ - beforeLoad: ({ params }) => ({ - chainToken: params.a, - ctxA: params.a, - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - return -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/before-load/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/tsconfig.json b/benchmarks/ssr/scenarios/before-load/vue/tsconfig.json deleted file mode 100644 index 33e5cc442d..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared.ts", - "../shared-bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/before-load/vue/vite.config.ts b/benchmarks/ssr/scenarios/before-load/vue/vite.config.ts deleted file mode 100644 index 093776869f..0000000000 --- a/benchmarks/ssr/scenarios/before-load/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr before-load (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/control-flow/react/project.json b/benchmarks/ssr/scenarios/control-flow/react/project.json deleted file mode 100644 index 80086788eb..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-control-flow-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts b/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts deleted file mode 100644 index 899f400799..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runRedirectLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(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 deleted file mode 100644 index 0a93c5eac3..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-error-500.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runErrorLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 53e09fd34e..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-route-headers.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runRouteHeadersLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 1cd7c1044c..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/speed.control-flow-unmatched-404.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runUnmatchedLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 1e8abfd318..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/speed.not-found.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runNotFoundLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr not-found (react)', async () => - runNotFoundLoop(handler), - ).run(controlFlowBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts deleted file mode 100644 index 4d4424c222..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routeTree.gen.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* 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 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 BoomIdRoute = BoomIdRouteImport.update({ - id: '/boom/$id', - path: '/boom/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FromIdRoute = FromIdRouteImport.update({ - id: '/from/$id', - path: '/from/$id', - getParentRoute: () => rootRouteImport, -} as any) -const HeadersIdRoute = HeadersIdRouteImport.update({ - id: '/headers/$id', - path: '/headers/$id', - 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) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - id: - | '__root__' - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BoomIdRoute: typeof BoomIdRoute - FromIdRoute: typeof FromIdRoute - HeadersIdRoute: typeof HeadersIdRoute - MissingIdRoute: typeof MissingIdRoute - TargetIdRoute: typeof TargetIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/boom/$id': { - id: '/boom/$id' - path: '/boom/$id' - fullPath: '/boom/$id' - preLoaderRoute: typeof BoomIdRouteImport - parentRoute: typeof rootRouteImport - } - '/from/$id': { - id: '/from/$id' - path: '/from/$id' - fullPath: '/from/$id' - preLoaderRoute: typeof FromIdRouteImport - parentRoute: typeof rootRouteImport - } - '/headers/$id': { - id: '/headers/$id' - path: '/headers/$id' - fullPath: '/headers/$id' - preLoaderRoute: typeof HeadersIdRouteImport - 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 - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BoomIdRoute: BoomIdRoute, - FromIdRoute: FromIdRoute, - HeadersIdRoute: HeadersIdRoute, - MissingIdRoute: MissingIdRoute, - TargetIdRoute: TargetIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/router.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/__root.tsx deleted file mode 100644 index e08ff06361..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/__root.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: RootNotFoundComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootNotFoundComponent() { - return
root-not-found-marker
-} - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx deleted file mode 100644 index eb47d34070..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/boom.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/boom/$id')({ - loader: ({ params }) => { - throw new Error(`boom-${params.id}`) - }, - errorComponent: BoomErrorComponent, - component: BoomComponent, -}) - -function BoomErrorComponent() { - return
control-flow-error-boundary
-} - -function BoomComponent() { - return null -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/from.$id.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/from.$id.tsx deleted file mode 100644 index e9289fce30..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/from.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/from/$id')({ - loader: ({ params }) => { - const { id } = params - - throw redirect({ to: '/target/$id', params: { id } }) - }, - component: FromComponent, -}) - -function FromComponent() { - return null -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/headers.$id.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/headers.$id.tsx deleted file mode 100644 index 412d056d85..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/headers.$id.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/headers/$id')({ - headers: ({ params }) => ({ - 'x-bench-route-header': `route-header-${params.id}`, - 'x-bench-route-static': 'control-flow-route-headers', - }), - component: HeadersComponent, -}) - -function HeadersComponent() { - const params = Route.useParams() - - return
{`headers-${params.id}`}
-} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/index.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/index.tsx deleted file mode 100644 index e9886f60c4..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
control-flow-index
-} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/missing.$id.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/missing.$id.tsx deleted file mode 100644 index b7d760e562..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/missing.$id.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/react-router' - -export const Route = createFileRoute('/missing/$id')({ - loader: () => { - throw notFound() - }, - component: MissingComponent, -}) - -function MissingComponent() { - return null -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/src/routes/target.$id.tsx b/benchmarks/ssr/scenarios/control-flow/react/src/routes/target.$id.tsx deleted file mode 100644 index 1c13394cb2..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/src/routes/target.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/target/$id')({ - component: TargetComponent, -}) - -function TargetComponent() { - const params = Route.useParams() - - return
{`target-${params.id}`}
-} diff --git a/benchmarks/ssr/scenarios/control-flow/react/tsconfig.json b/benchmarks/ssr/scenarios/control-flow/react/tsconfig.json deleted file mode 100644 index cf14e1d440..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/control-flow/react/vite.config.ts b/benchmarks/ssr/scenarios/control-flow/react/vite.config.ts deleted file mode 100644 index 273d7d9d80..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr control-flow (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/control-flow/shared.ts b/benchmarks/ssr/scenarios/control-flow/shared.ts deleted file mode 100644 index 307665d59d..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/shared.ts +++ /dev/null @@ -1,230 +0,0 @@ -import { expect } from 'vitest' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const redirectLoopTotalRequests = 112 -const notFoundLoopTotalRequests = 48 -const errorLoopTotalRequests = 48 -const unmatchedLoopTotalRequests = 64 -const routeHeadersLoopTotalRequests = 64 - -// Pinned to the current built handler responses for these control-flow routes. -const OK_STATUS = 200 -const REDIRECT_STATUS = 307 -const NOT_FOUND_STATUS = 404 -const ERROR_STATUS = 500 -const ROUTE_HEADERS_STATIC_VALUE = 'control-flow-route-headers' - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -export const controlFlowBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -function buildRedirectRequest(random: () => number) { - return new Request( - `http://localhost/from/${randomSegment(random)}`, - requestInit, - ) -} - -function buildNotFoundRequest(random: () => number) { - return new Request( - `http://localhost/missing/${randomSegment(random)}`, - requestInit, - ) -} - -function buildErrorRequest(random: () => number) { - return new Request( - `http://localhost/boom/${randomSegment(random)}`, - requestInit, - ) -} - -function buildUnmatchedRequest(random: () => number) { - return new Request( - `http://localhost/definitely-not-a-route/${randomSegment(random)}`, - requestInit, - ) -} - -function buildRouteHeadersRequest(random: () => number) { - return new Request( - `http://localhost/headers/${randomSegment(random)}`, - requestInit, - ) -} - -function getRequestId(request: Request) { - const id = new URL(request.url).pathname.split('/').pop() - - if (!id) { - throw new Error(`expected request id in ${request.url}`) - } - - return id -} - -function validateRedirectResponse(response: Response) { - if (response.status !== REDIRECT_STATUS) { - throw new Error(`expected ${REDIRECT_STATUS}, got ${response.status}`) - } -} - -function validateNotFoundResponse(response: Response) { - if (response.status !== NOT_FOUND_STATUS) { - throw new Error(`expected ${NOT_FOUND_STATUS}, got ${response.status}`) - } -} - -function validateErrorResponse(response: Response) { - if (response.status !== ERROR_STATUS) { - throw new Error(`expected ${ERROR_STATUS}, got ${response.status}`) - } -} - -function validateUnmatchedResponse(response: Response) { - if (response.status !== NOT_FOUND_STATUS) { - throw new Error(`expected ${NOT_FOUND_STATUS}, got ${response.status}`) - } -} - -function validateRouteHeadersResponse(response: Response, request: Request) { - if (response.status !== OK_STATUS) { - throw new Error(`expected ${OK_STATUS}, got ${response.status}`) - } - - const id = getRequestId(request) - const routeHeader = response.headers.get('x-bench-route-header') - - if (routeHeader !== `route-header-${id}`) { - throw new Error(`expected route header for ${id}, got ${routeHeader}`) - } - - const staticHeader = response.headers.get('x-bench-route-static') - - if (staticHeader !== ROUTE_HEADERS_STATIC_VALUE) { - throw new Error( - `expected route static header ${ROUTE_HEADERS_STATIC_VALUE}, got ${staticHeader}`, - ) - } -} - -export function runRedirectLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: redirectLoopTotalRequests, - buildRequest: buildRedirectRequest, - validateResponse: validateRedirectResponse, - }) -} - -export function runNotFoundLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: notFoundLoopTotalRequests, - buildRequest: buildNotFoundRequest, - validateResponse: validateNotFoundResponse, - }) -} - -export function runErrorLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: errorLoopTotalRequests, - buildRequest: buildErrorRequest, - validateResponse: validateErrorResponse, - }) -} - -export function runUnmatchedLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: unmatchedLoopTotalRequests, - buildRequest: buildUnmatchedRequest, - validateResponse: validateUnmatchedResponse, - }) -} - -export function runRouteHeadersLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: routeHeadersLoopTotalRequests, - buildRequest: buildRouteHeadersRequest, - validateResponse: validateRouteHeadersResponse, - }) -} - -export async function assertControlFlowSanity(handler: StartRequestHandler) { - const redirectId = 'sanity-redirect' - const redirectResponse = await handler.fetch( - new Request(`http://localhost/from/${redirectId}`, requestInit), - ) - - expect(redirectResponse.status).toBe(REDIRECT_STATUS) - expect(redirectResponse.headers.get('location')).toBe(`/target/${redirectId}`) - - const notFoundResponse = await handler.fetch( - new Request('http://localhost/missing/sanity-missing', requestInit), - ) - const notFoundBody = await notFoundResponse.text() - - expect(notFoundResponse.status).toBe(NOT_FOUND_STATUS) - expect(notFoundBody).toContain('root-not-found-marker') - - const errorId = 'sanity-error' - const errorResponse = await handler.fetch( - new Request(`http://localhost/boom/${errorId}`, requestInit), - ) - const errorBody = await errorResponse.text() - - expect(errorResponse.status).toBe(ERROR_STATUS) - expect(errorBody).toContain('data-bench="error-boundary"') - const firstScriptIndex = errorBody.indexOf(' { - 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 deleted file mode 100644 index 57a2f0fbe9..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-error-500.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runErrorLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 6581e92b39..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-route-headers.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runRouteHeadersLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 40f1679320..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/speed.control-flow-unmatched-404.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runUnmatchedLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index efcb7cc229..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/speed.not-found.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runNotFoundLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 3cec17d9c8..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* 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 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 BoomIdRoute = BoomIdRouteImport.update({ - id: '/boom/$id', - path: '/boom/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FromIdRoute = FromIdRouteImport.update({ - id: '/from/$id', - path: '/from/$id', - getParentRoute: () => rootRouteImport, -} as any) -const HeadersIdRoute = HeadersIdRouteImport.update({ - id: '/headers/$id', - path: '/headers/$id', - 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) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - id: - | '__root__' - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BoomIdRoute: typeof BoomIdRoute - FromIdRoute: typeof FromIdRoute - HeadersIdRoute: typeof HeadersIdRoute - MissingIdRoute: typeof MissingIdRoute - TargetIdRoute: typeof TargetIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/boom/$id': { - id: '/boom/$id' - path: '/boom/$id' - fullPath: '/boom/$id' - preLoaderRoute: typeof BoomIdRouteImport - parentRoute: typeof rootRouteImport - } - '/from/$id': { - id: '/from/$id' - path: '/from/$id' - fullPath: '/from/$id' - preLoaderRoute: typeof FromIdRouteImport - parentRoute: typeof rootRouteImport - } - '/headers/$id': { - id: '/headers/$id' - path: '/headers/$id' - fullPath: '/headers/$id' - preLoaderRoute: typeof HeadersIdRouteImport - 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 - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BoomIdRoute: BoomIdRoute, - FromIdRoute: FromIdRoute, - HeadersIdRoute: HeadersIdRoute, - MissingIdRoute: MissingIdRoute, - TargetIdRoute: TargetIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/router.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/__root.tsx deleted file mode 100644 index dc8b783e76..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/__root.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: RootNotFoundComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootNotFoundComponent() { - return
root-not-found-marker
-} - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/boom.$id.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/boom.$id.tsx deleted file mode 100644 index 0bcc4dc02b..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/boom.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/boom/$id')({ - loader: ({ params }) => { - throw new Error(`boom-${params.id}`) - }, - errorComponent: BoomErrorComponent, - component: BoomComponent, -}) - -function BoomErrorComponent() { - return
control-flow-error-boundary
-} - -function BoomComponent() { - return null -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/from.$id.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/from.$id.tsx deleted file mode 100644 index a319375db3..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/from.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/from/$id')({ - loader: ({ params }) => { - const { id } = params - - throw redirect({ to: '/target/$id', params: { id } }) - }, - component: FromComponent, -}) - -function FromComponent() { - return null -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx deleted file mode 100644 index 9d87b4a354..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/headers.$id.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/headers/$id')({ - headers: ({ params }) => ({ - 'x-bench-route-header': `route-header-${params.id}`, - 'x-bench-route-static': 'control-flow-route-headers', - }), - component: HeadersComponent, -}) - -function HeadersComponent() { - const params = Route.useParams() - - return
{`headers-${params().id}`}
-} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/index.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/index.tsx deleted file mode 100644 index 96b26a2d6c..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
control-flow-index
-} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/missing.$id.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/missing.$id.tsx deleted file mode 100644 index e5c42b56dc..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/missing.$id.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/solid-router' - -export const Route = createFileRoute('/missing/$id')({ - loader: () => { - throw notFound() - }, - component: MissingComponent, -}) - -function MissingComponent() { - return null -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/target.$id.tsx b/benchmarks/ssr/scenarios/control-flow/solid/src/routes/target.$id.tsx deleted file mode 100644 index 4196fc1183..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/src/routes/target.$id.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/target/$id')({ - component: TargetComponent, -}) - -function TargetComponent() { - const params = Route.useParams() - - return
{`target-${params().id}`}
-} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/tsconfig.json b/benchmarks/ssr/scenarios/control-flow/solid/tsconfig.json deleted file mode 100644 index 42c3a2160f..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/control-flow/solid/vite.config.ts b/benchmarks/ssr/scenarios/control-flow/solid/vite.config.ts deleted file mode 100644 index c75c957466..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr control-flow (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/control-flow/vue/project.json b/benchmarks/ssr/scenarios/control-flow/vue/project.json deleted file mode 100644 index e0e014e588..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-control-flow-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts b/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts deleted file mode 100644 index 0b95f426f2..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runRedirectLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(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 deleted file mode 100644 index 262ca951af..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-error-500.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runErrorLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index bf8c90a8a1..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-route-headers.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runRouteHeadersLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index d7f8ebeb9e..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/speed.control-flow-unmatched-404.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runUnmatchedLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -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 deleted file mode 100644 index 4b84fb594c..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/speed.not-found.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertControlFlowSanity, - controlFlowBenchOptions, - runNotFoundLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertControlFlowSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr not-found (vue)', async () => runNotFoundLoop(handler)).run( - controlFlowBenchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts deleted file mode 100644 index 6dcf0d095e..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,177 +0,0 @@ -/* 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 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 BoomIdRoute = BoomIdRouteImport.update({ - id: '/boom/$id', - path: '/boom/$id', - getParentRoute: () => rootRouteImport, -} as any) -const FromIdRoute = FromIdRouteImport.update({ - id: '/from/$id', - path: '/from/$id', - getParentRoute: () => rootRouteImport, -} as any) -const HeadersIdRoute = HeadersIdRouteImport.update({ - id: '/headers/$id', - path: '/headers/$id', - 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) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/boom/$id': typeof BoomIdRoute - '/from/$id': typeof FromIdRoute - '/headers/$id': typeof HeadersIdRoute - '/missing/$id': typeof MissingIdRoute - '/target/$id': typeof TargetIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - id: - | '__root__' - | '/' - | '/boom/$id' - | '/from/$id' - | '/headers/$id' - | '/missing/$id' - | '/target/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - BoomIdRoute: typeof BoomIdRoute - FromIdRoute: typeof FromIdRoute - HeadersIdRoute: typeof HeadersIdRoute - MissingIdRoute: typeof MissingIdRoute - TargetIdRoute: typeof TargetIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/boom/$id': { - id: '/boom/$id' - path: '/boom/$id' - fullPath: '/boom/$id' - preLoaderRoute: typeof BoomIdRouteImport - parentRoute: typeof rootRouteImport - } - '/from/$id': { - id: '/from/$id' - path: '/from/$id' - fullPath: '/from/$id' - preLoaderRoute: typeof FromIdRouteImport - parentRoute: typeof rootRouteImport - } - '/headers/$id': { - id: '/headers/$id' - path: '/headers/$id' - fullPath: '/headers/$id' - preLoaderRoute: typeof HeadersIdRouteImport - 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 - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - BoomIdRoute: BoomIdRoute, - FromIdRoute: FromIdRoute, - HeadersIdRoute: HeadersIdRoute, - MissingIdRoute: MissingIdRoute, - TargetIdRoute: TargetIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/router.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx deleted file mode 100644 index 815466918a..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/__root.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: RootNotFoundComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootNotFoundComponent() { - return
root-not-found-marker
-} - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/boom.$id.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/boom.$id.tsx deleted file mode 100644 index dfae636ae7..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/boom.$id.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/boom/$id')({ - loader: ({ params }) => { - throw new Error(`boom-${params.id}`) - }, - errorComponent: BoomErrorComponent, - component: BoomComponent, -}) - -function BoomErrorComponent() { - return
control-flow-error-boundary
-} - -function BoomComponent() { - return <> -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/from.$id.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/from.$id.tsx deleted file mode 100644 index dfb90a51f8..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/from.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/vue-router' - -export const Route = createFileRoute('/from/$id')({ - loader: ({ params }) => { - const { id } = params - - throw redirect({ to: '/target/$id', params: { id } }) - }, - component: FromComponent, -}) - -function FromComponent() { - return <> -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/headers.$id.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/headers.$id.tsx deleted file mode 100644 index 20c1bbe5ac..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/headers.$id.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const HeadersComponent = defineComponent({ - setup() { - const params = Route.useParams() - - return () =>
{`headers-${params.value.id}`}
- }, -}) - -export const Route = createFileRoute('/headers/$id')({ - headers: ({ params }) => ({ - 'x-bench-route-header': `route-header-${params.id}`, - 'x-bench-route-static': 'control-flow-route-headers', - }), - component: HeadersComponent, -}) diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/index.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/index.tsx deleted file mode 100644 index 51a503a1d1..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
control-flow-index
-} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/missing.$id.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/missing.$id.tsx deleted file mode 100644 index b15333f5a3..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/missing.$id.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/vue-router' - -export const Route = createFileRoute('/missing/$id')({ - loader: () => { - throw notFound() - }, - component: MissingComponent, -}) - -function MissingComponent() { - return <> -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/target.$id.tsx b/benchmarks/ssr/scenarios/control-flow/vue/src/routes/target.$id.tsx deleted file mode 100644 index 0bbf4a3dc6..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/src/routes/target.$id.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' - -const TargetComponent = defineComponent({ - setup() { - const params = Route.useParams() - - return () =>
{`target-${params.value.id}`}
- }, -}) - -export const Route = createFileRoute('/target/$id')({ - component: TargetComponent, -}) diff --git a/benchmarks/ssr/scenarios/control-flow/vue/tsconfig.json b/benchmarks/ssr/scenarios/control-flow/vue/tsconfig.json deleted file mode 100644 index 08c94853f4..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/control-flow/vue/vite.config.ts b/benchmarks/ssr/scenarios/control-flow/vue/vite.config.ts deleted file mode 100644 index 1b77968d96..0000000000 --- a/benchmarks/ssr/scenarios/control-flow/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr control-flow (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/bench.ts b/benchmarks/ssr/scenarios/global-middleware/bench.ts deleted file mode 100644 index d2784aed38..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/bench.ts +++ /dev/null @@ -1,309 +0,0 @@ -import { toJSONAsync } from 'seroval' -import { - createDeterministicRandom, - randomSegment, - runRequestLoop, -} from '../../bench-utils' -import { - expectedFunctionTotal, - expectedRequestTotal, - getExpectedRequestContext, - makeDocumentMarker, - makeServerFnMarker, - makeServerRouteMarker, - setRequestMiddlewareCount, -} from './shared' -import type { RequestMiddlewareCount } from './shared' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -type Payload = { - q: string - n: number - nested: { list: Array } -} - -type FnUrls = { - post: string -} - -export interface GlobalMiddlewareBenchContext { - urls: FnUrls - bodies: Array - expectedFnMarker: string -} - -const benchmarkSeed = 0xdecafbad -const origin = 'http://localhost' -const tssContentTypeFramed = 'application/x-tss-framed' -const xTssSerialized = 'x-tss-serialized' -const acceptHeader = `${tssContentTypeFramed}, application/x-ndjson, application/json` -const documentRequestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit -const apiRequestInit = { - method: 'GET', - headers: { - accept: 'application/json', - }, -} satisfies RequestInit -const postHeaders = { - 'x-tsr-serverFn': 'true', - 'sec-fetch-site': 'same-origin', - accept: acceptHeader, - 'content-type': 'application/json', -} satisfies HeadersInit -const documentLoopTotalRequests = 64 -const serverFnLoopTotalRequests = 128 -const serverRouteLoopTotalRequests = 256 - -export const globalMiddlewareBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} as const - -function createPayloads() { - const random = createDeterministicRandom(benchmarkSeed) - - return Array.from({ length: 10 }, (_, index): Payload => { - const queryParts = Array.from({ length: 6 }, () => randomSegment(random)) - - return { - q: `q-${index}-${queryParts.join('-')}`, - n: 100 + index, - nested: { - list: Array.from( - { length: 5 }, - () => `l-${index}-${randomSegment(random)}-${randomSegment(random)}`, - ), - }, - } - }) -} - -async function createBodies(payloads: Array) { - return await Promise.all( - payloads.map(async (payload) => - JSON.stringify(await toJSONAsync({ data: payload })), - ), - ) -} - -async function discoverUrls(handler: StartRequestHandler) { - const response = await handler.fetch(new Request(`${origin}/api/fn-urls`)) - - if (response.status === 404) { - throw new Error('URL discovery route returned 404 for /api/fn-urls') - } - - if (response.status !== 200) { - throw new Error( - `URL discovery failed with status ${response.status}: ${await response.text()}`, - ) - } - - const urls = (await response.json()) as Partial - - if (typeof urls.post !== 'string') { - throw new Error( - `URL discovery returned invalid payload: ${JSON.stringify(urls)}`, - ) - } - - return { post: urls.post } -} - -function buildDocumentRequest(random: () => number, index: number) { - return new Request( - `${origin}/page/${randomSegment(random)}-${index.toString(36)}`, - documentRequestInit, - ) -} - -function buildServerRouteRequest(random: () => number, index: number) { - return new Request( - `${origin}/api/ping/${randomSegment(random)}-${index.toString(36)}`, - apiRequestInit, - ) -} - -function buildPostRequest(urls: FnUrls, bodies: Array, index: number) { - return new Request(`${origin}${urls.post}`, { - method: 'POST', - headers: postHeaders, - body: bodies[index % bodies.length], - }) -} - -export async function setupGlobalMiddlewareBench( - handler: StartRequestHandler, -): Promise { - setRequestMiddlewareCount(3) - const urls = await discoverUrls(handler) - const payloads = createPayloads() - const bodies = await createBodies(payloads) - const expectedFnMarker = makeServerFnMarker(payloads[0]!.q, { - requestTrace: 'req.r1.r2.r3', - requestTotal: expectedRequestTotal, - functionTrace: 'fn.f1.f2', - functionTotal: expectedFunctionTotal, - }) - - return { urls, bodies, expectedFnMarker } -} - -async function assertDocumentResponse(handler: StartRequestHandler) { - setRequestMiddlewareCount(3) - const id = 'page-sanity' - const response = await handler.fetch( - new Request(`${origin}/page/${id}`, documentRequestInit), - ) - const body = await response.text() - const expectedMarker = makeDocumentMarker(id, { - requestTrace: 'req.r1.r2.r3', - requestTotal: expectedRequestTotal, - }) - - if (response.status !== 200) { - throw new Error(`Expected document status 200, received ${response.status}`) - } - - if (!body.includes(expectedMarker)) { - throw new Error( - `Expected document response to include global middleware marker ${expectedMarker}`, - ) - } -} - -async function assertServerRouteResponseForCount( - handler: StartRequestHandler, - count: RequestMiddlewareCount, -) { - setRequestMiddlewareCount(count) - const id = 'route-sanity' - const response = await handler.fetch( - new Request(`${origin}/api/ping/${id}`, apiRequestInit), - ) - - if (response.status !== 200) { - throw new Error( - `Expected server route status 200, received ${response.status}`, - ) - } - - const contentType = response.headers.get('content-type') - - if (!contentType?.includes('application/json')) { - throw new Error( - `Expected JSON server route response, received ${contentType}`, - ) - } - - const body = (await response.json()) as { - marker?: string - requestTotal?: number - } - const expectedContext = getExpectedRequestContext(count) - const expectedMarker = makeServerRouteMarker(id, expectedContext) - - if (body.marker !== expectedMarker) { - throw new Error( - `Expected server route marker ${expectedMarker}, received ${body.marker}`, - ) - } - - if (body.requestTotal !== expectedContext.requestTotal) { - throw new Error( - `Expected server route requestTotal ${expectedContext.requestTotal}, received ${body.requestTotal}`, - ) - } -} - -async function assertServerFnResponse( - handler: StartRequestHandler, - context: GlobalMiddlewareBenchContext, -) { - setRequestMiddlewareCount(3) - const response = await handler.fetch( - buildPostRequest(context.urls, context.bodies, 0), - ) - const text = await response.text() - - if (response.status === 403) { - throw new Error('Server function sanity check failed with 403') - } - - if (response.status === 404) { - throw new Error('Server function sanity check failed with 404') - } - - if (response.status !== 200) { - throw new Error( - `Server function sanity check failed with status ${response.status}: ${text}`, - ) - } - - if (!response.headers.get(xTssSerialized)) { - throw new Error(`Server function response missing ${xTssSerialized} header`) - } - - if (!text.includes(context.expectedFnMarker)) { - throw new Error( - `Expected server function response to include ${context.expectedFnMarker}: ${text}`, - ) - } -} - -export async function assertGlobalMiddlewareScenario( - handler: StartRequestHandler, - context: GlobalMiddlewareBenchContext, -) { - await assertDocumentResponse(handler) - await assertServerFnResponse(handler, context) - for (const count of [0, 1, 2, 3] as const) { - await assertServerRouteResponseForCount(handler, count) - } - setRequestMiddlewareCount(3) -} - -export function runGlobalMiddlewareDocumentLoop(handler: StartRequestHandler) { - setRequestMiddlewareCount(3) - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: documentLoopTotalRequests, - buildRequest: buildDocumentRequest, - }) -} - -export function runGlobalMiddlewareServerFnLoop( - handler: StartRequestHandler, - context: GlobalMiddlewareBenchContext, -) { - setRequestMiddlewareCount(3) - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnLoopTotalRequests, - buildRequest: (_random, index) => - buildPostRequest(context.urls, context.bodies, index), - }) -} - -export function runGlobalMiddlewareServerRouteLoop( - handler: StartRequestHandler, - count: RequestMiddlewareCount = 3, -) { - setRequestMiddlewareCount(count) - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverRouteLoopTotalRequests, - buildRequest: buildServerRouteRequest, - }) -} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/project.json b/benchmarks/ssr/scenarios/global-middleware/react/project.json deleted file mode 100644 index bded6925fd..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-global-middleware-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts b/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts deleted file mode 100644 index cb3f9f427c..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/speed.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareDocumentLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 48c444de77..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-fn.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerFnLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 22f53883ee..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-0-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index f01b48d66e..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-1-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index b01957f806..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route-2-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 08d97fcaf6..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/speed.global-mw-server-route.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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/react/src/fns.ts b/benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts deleted file mode 100644 index 68cfd992c6..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/fns.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createServerFn } from '@tanstack/react-start' -import { makeServerFnMarker, type GlobalMiddlewareContext } from '../../shared' - -type Payload = { q: string; n: number; nested: { list: Array } } - -const validate = (input: unknown): Payload => { - const payload = input as Payload - - if ( - typeof payload?.q !== 'string' || - typeof payload?.n !== 'number' || - !Array.isArray(payload?.nested?.list) - ) { - throw new Error('invalid payload') - } - - return payload -} - -export const echoPost = createServerFn({ method: 'POST' }) - .validator(validate) - .handler(({ data, context }) => { - const middlewareContext = (context ?? {}) as GlobalMiddlewareContext - - return { - echoed: data, - marker: makeServerFnMarker(data.q, middlewareContext), - sum: - data.n + - (middlewareContext.requestTotal ?? 0) + - (middlewareContext.functionTotal ?? 0), - list: data.nested.list.map((item) => `global-${item}`), - } - }) diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts deleted file mode 100644 index 8dfaa80562..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/routeTree.gen.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* 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 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({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) -const PageIdRoute = PageIdRouteImport.update({ - id: '/page/$id', - path: '/page/$id', - getParentRoute: () => rootRouteImport, -} as any) -const ApiPingIdRoute = ApiPingIdRouteImport.update({ - id: '/api/ping/$id', - path: '/api/ping/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - id: '__root__' | '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute - PageIdRoute: typeof PageIdRoute - ApiPingIdRoute: typeof ApiPingIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - '/page/$id': { - id: '/page/$id' - path: '/page/$id' - fullPath: '/page/$id' - preLoaderRoute: typeof PageIdRouteImport - parentRoute: typeof rootRouteImport - } - '/api/ping/$id': { - id: '/api/ping/$id' - path: '/api/ping/$id' - fullPath: '/api/ping/$id' - preLoaderRoute: typeof ApiPingIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, - PageIdRoute: PageIdRoute, - ApiPingIdRoute: ApiPingIdRoute, -} -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/benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx b/benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/global-middleware/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.fn-urls.ts deleted file mode 100644 index bcb2111930..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { echoPost } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => Response.json({ post: echoPost.url }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.ping.$id.ts b/benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.ping.$id.ts deleted file mode 100644 index 434833f018..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/api.ping.$id.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { - makeServerRouteMarker, - type GlobalMiddlewareContext, -} from '../../../shared' - -export const Route = createFileRoute('/api/ping/$id')({ - server: { - handlers: { - GET: ({ params, context }) => { - const middlewareContext = (context ?? {}) as GlobalMiddlewareContext - - return Response.json({ - id: params.id, - marker: makeServerRouteMarker(params.id, middlewareContext), - requestTrace: middlewareContext.requestTrace, - requestTotal: middlewareContext.requestTotal, - }) - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx b/benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx deleted file mode 100644 index a0d3aec869..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { echoPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
global-middleware
-} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/page.$id.tsx b/benchmarks/ssr/scenarios/global-middleware/react/src/routes/page.$id.tsx deleted file mode 100644 index 6b7a42c12e..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/routes/page.$id.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { - getGlobalMiddlewareContext, - makeDocumentMarker, - type GlobalMiddlewareContext, -} from '../../../shared' - -export const Route = createFileRoute('/page/$id')({ - beforeLoad: ({ serverContext }) => ({ - globalMiddlewareContext: (serverContext ?? {}) as GlobalMiddlewareContext, - }), - loader: ({ params, context }) => ({ - marker: makeDocumentMarker(params.id, getGlobalMiddlewareContext(context)), - }), - component: PageComponent, -}) - -function PageComponent() { - const data = Route.useLoaderData() - - return
{data.marker}
-} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/src/start.ts b/benchmarks/ssr/scenarios/global-middleware/react/src/start.ts deleted file mode 100644 index 8dfb2dd3c4..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/src/start.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { createMiddleware, createStart } from '@tanstack/react-start' -import { getRequestMiddlewareCount } from '../../shared' -import type { GlobalMiddlewareContext } from '../../shared' - -function appendTrace( - trace: string | undefined, - fallback: string, - label: string, -) { - return `${trace ?? fallback}.${label}` -} - -const requestMiddlewareA = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r1'), - requestTotal: (ctx.requestTotal ?? 0) + 1, - }, - }) - }, -) - -const requestMiddlewareB = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r2'), - requestTotal: (ctx.requestTotal ?? 0) + 2, - }, - }) - }, -) - -const requestMiddlewareC = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r3'), - requestTotal: (ctx.requestTotal ?? 0) + 3, - }, - }) - }, -) - -const requestMiddlewareSets: Array> = [ - [], - [requestMiddlewareA], - [requestMiddlewareA, requestMiddlewareB], - [requestMiddlewareA, requestMiddlewareB, requestMiddlewareC], -] - -const functionMiddlewareA = createMiddleware({ type: 'function' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - functionTrace: appendTrace(ctx.functionTrace, 'fn', 'f1'), - functionTotal: (ctx.functionTotal ?? 0) + 10, - }, - }) - }, -) - -const functionMiddlewareB = createMiddleware({ type: 'function' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - functionTrace: appendTrace(ctx.functionTrace, 'fn', 'f2'), - functionTotal: (ctx.functionTotal ?? 0) + 20, - }, - }) - }, -) - -export const startInstance = createStart(() => ({ - requestMiddleware: requestMiddlewareSets[getRequestMiddlewareCount()], - functionMiddleware: [functionMiddlewareA, functionMiddlewareB], -})) diff --git a/benchmarks/ssr/scenarios/global-middleware/react/tsconfig.json b/benchmarks/ssr/scenarios/global-middleware/react/tsconfig.json deleted file mode 100644 index de4a3204b9..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared.ts", - "../bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts b/benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts deleted file mode 100644 index 968a8a24e9..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr global-middleware (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/shared.ts b/benchmarks/ssr/scenarios/global-middleware/shared.ts deleted file mode 100644 index 8fbe788911..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/shared.ts +++ /dev/null @@ -1,77 +0,0 @@ -export interface GlobalMiddlewareContext { - requestTrace?: string - requestTotal?: number - functionTrace?: string - functionTotal?: number -} - -export interface GlobalMiddlewareRouteContext extends GlobalMiddlewareContext { - serverContext?: GlobalMiddlewareContext - globalMiddlewareContext?: GlobalMiddlewareContext -} - -export type RequestMiddlewareCount = 0 | 1 | 2 | 3 - -const requestMiddlewareCountKey = '__TSR_SSR_BENCH_REQUEST_MIDDLEWARE_COUNT__' - -type BenchmarkGlobal = typeof globalThis & { - [requestMiddlewareCountKey]?: RequestMiddlewareCount -} - -const expectedRequestContexts: ReadonlyArray = [ - {}, - { requestTrace: 'req.r1', requestTotal: 1 }, - { requestTrace: 'req.r1.r2', requestTotal: 3 }, - { requestTrace: 'req.r1.r2.r3', requestTotal: 6 }, -] - -export const expectedRequestTrace = 'req.r1.r2.r3' -export const expectedRequestTotal = 6 -export const expectedFunctionTrace = 'fn.f1.f2' -export const expectedFunctionTotal = 30 - -export function setRequestMiddlewareCount(count: RequestMiddlewareCount) { - const benchmarkGlobal = globalThis as BenchmarkGlobal - benchmarkGlobal[requestMiddlewareCountKey] = count -} - -export function getRequestMiddlewareCount(): RequestMiddlewareCount { - return (globalThis as BenchmarkGlobal)[requestMiddlewareCountKey] ?? 3 -} - -export function getExpectedRequestContext( - count: RequestMiddlewareCount, -): GlobalMiddlewareContext { - return expectedRequestContexts[count]! -} - -export function makeDocumentMarker( - id: string, - context: GlobalMiddlewareContext, -) { - return `document:${context.requestTrace}:${id}:${context.requestTotal}` -} - -export function getGlobalMiddlewareContext(context: unknown) { - const routeContext = (context ?? {}) as GlobalMiddlewareRouteContext - - return ( - routeContext.globalMiddlewareContext ?? - routeContext.serverContext ?? - routeContext - ) -} - -export function makeServerRouteMarker( - id: string, - context: GlobalMiddlewareContext, -) { - return `route:${context.requestTrace}:${id}:${context.requestTotal}` -} - -export function makeServerFnMarker( - q: string, - context: GlobalMiddlewareContext, -) { - return `fn:${context.requestTrace}:${context.functionTrace}:${q}:${context.requestTotal}:${context.functionTotal}` -} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/project.json b/benchmarks/ssr/scenarios/global-middleware/solid/project.json deleted file mode 100644 index d325c15527..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-global-middleware-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts b/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts deleted file mode 100644 index 0e5f504090..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareDocumentLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 915507ef9f..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-fn.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerFnLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index a791145935..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-0-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 1baab0f344..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-1-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index d6fde20764..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route-2-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 558ebeb9a4..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/speed.global-mw-server-route.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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/fns.ts b/benchmarks/ssr/scenarios/global-middleware/solid/src/fns.ts deleted file mode 100644 index 667baf9f54..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/fns.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createServerFn } from '@tanstack/solid-start' -import { makeServerFnMarker, type GlobalMiddlewareContext } from '../../shared' - -type Payload = { q: string; n: number; nested: { list: Array } } - -const validate = (input: unknown): Payload => { - const payload = input as Payload - - if ( - typeof payload?.q !== 'string' || - typeof payload?.n !== 'number' || - !Array.isArray(payload?.nested?.list) - ) { - throw new Error('invalid payload') - } - - return payload -} - -export const echoPost = createServerFn({ method: 'POST' }) - .validator(validate) - .handler(({ data, context }) => { - const middlewareContext = (context ?? {}) as GlobalMiddlewareContext - - return { - echoed: data, - marker: makeServerFnMarker(data.q, middlewareContext), - sum: - data.n + - (middlewareContext.requestTotal ?? 0) + - (middlewareContext.functionTotal ?? 0), - list: data.nested.list.map((item) => `global-${item}`), - } - }) diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts deleted file mode 100644 index 65f7fa5848..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* 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 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({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) -const PageIdRoute = PageIdRouteImport.update({ - id: '/page/$id', - path: '/page/$id', - getParentRoute: () => rootRouteImport, -} as any) -const ApiPingIdRoute = ApiPingIdRouteImport.update({ - id: '/api/ping/$id', - path: '/api/ping/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - id: '__root__' | '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute - PageIdRoute: typeof PageIdRoute - ApiPingIdRoute: typeof ApiPingIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - '/page/$id': { - id: '/page/$id' - path: '/page/$id' - fullPath: '/page/$id' - preLoaderRoute: typeof PageIdRouteImport - parentRoute: typeof rootRouteImport - } - '/api/ping/$id': { - id: '/api/ping/$id' - path: '/api/ping/$id' - fullPath: '/api/ping/$id' - preLoaderRoute: typeof ApiPingIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, - PageIdRoute: PageIdRoute, - ApiPingIdRoute: ApiPingIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { startInstance } from './start.ts' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - config: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx b/benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts deleted file mode 100644 index 7166ea3030..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { echoPost } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => Response.json({ post: echoPost.url }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping.$id.ts b/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping.$id.ts deleted file mode 100644 index b92bcea5b0..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/api.ping.$id.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { - makeServerRouteMarker, - type GlobalMiddlewareContext, -} from '../../../shared' - -export const Route = createFileRoute('/api/ping/$id')({ - server: { - handlers: { - GET: ({ params, context }) => { - const middlewareContext = (context ?? {}) as GlobalMiddlewareContext - - return Response.json({ - id: params.id, - marker: makeServerRouteMarker(params.id, middlewareContext), - requestTrace: middlewareContext.requestTrace, - requestTotal: middlewareContext.requestTotal, - }) - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx b/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx deleted file mode 100644 index c293004539..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { echoPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
global-middleware
-} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/page.$id.tsx b/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/page.$id.tsx deleted file mode 100644 index a5781b1a6a..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/routes/page.$id.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { - getGlobalMiddlewareContext, - makeDocumentMarker, - type GlobalMiddlewareContext, -} from '../../../shared' - -export const Route = createFileRoute('/page/$id')({ - beforeLoad: ({ serverContext }) => ({ - globalMiddlewareContext: (serverContext ?? {}) as GlobalMiddlewareContext, - }), - loader: ({ params, context }) => ({ - marker: makeDocumentMarker(params.id, getGlobalMiddlewareContext(context)), - }), - component: PageComponent, -}) - -function PageComponent() { - const data = Route.useLoaderData() - - return
{data().marker}
-} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/src/start.ts b/benchmarks/ssr/scenarios/global-middleware/solid/src/start.ts deleted file mode 100644 index a6f6214b82..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/src/start.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { createMiddleware, createStart } from '@tanstack/solid-start' -import { getRequestMiddlewareCount } from '../../shared' -import type { GlobalMiddlewareContext } from '../../shared' - -function appendTrace( - trace: string | undefined, - fallback: string, - label: string, -) { - return `${trace ?? fallback}.${label}` -} - -const requestMiddlewareA = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r1'), - requestTotal: (ctx.requestTotal ?? 0) + 1, - }, - }) - }, -) - -const requestMiddlewareB = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r2'), - requestTotal: (ctx.requestTotal ?? 0) + 2, - }, - }) - }, -) - -const requestMiddlewareC = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r3'), - requestTotal: (ctx.requestTotal ?? 0) + 3, - }, - }) - }, -) - -const requestMiddlewareSets: Array> = [ - [], - [requestMiddlewareA], - [requestMiddlewareA, requestMiddlewareB], - [requestMiddlewareA, requestMiddlewareB, requestMiddlewareC], -] - -const functionMiddlewareA = createMiddleware({ type: 'function' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - functionTrace: appendTrace(ctx.functionTrace, 'fn', 'f1'), - functionTotal: (ctx.functionTotal ?? 0) + 10, - }, - }) - }, -) - -const functionMiddlewareB = createMiddleware({ type: 'function' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - functionTrace: appendTrace(ctx.functionTrace, 'fn', 'f2'), - functionTotal: (ctx.functionTotal ?? 0) + 20, - }, - }) - }, -) - -export const startInstance = createStart(() => ({ - requestMiddleware: requestMiddlewareSets[getRequestMiddlewareCount()], - functionMiddleware: [functionMiddlewareA, functionMiddlewareB], -})) diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json b/benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json deleted file mode 100644 index dce3ceae30..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared.ts", - "../bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/global-middleware/solid/vite.config.ts b/benchmarks/ssr/scenarios/global-middleware/solid/vite.config.ts deleted file mode 100644 index f3597b25d5..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr global-middleware (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/project.json b/benchmarks/ssr/scenarios/global-middleware/vue/project.json deleted file mode 100644 index 6dbc003aae..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-global-middleware-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts b/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts deleted file mode 100644 index 9660f29d07..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareDocumentLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 297e8cee7b..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-fn.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerFnLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index d023dd458a..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-0-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index 5018163631..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-1-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index f9abd8eb60..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route-2-middleware.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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 deleted file mode 100644 index adcec3019f..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/speed.global-mw-server-route.bench.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { test } from 'vitest' -import { - assertGlobalMiddlewareScenario, - globalMiddlewareBenchOptions, - runGlobalMiddlewareServerRouteLoop, - setupGlobalMiddlewareBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} -const context = await setupGlobalMiddlewareBench(handler) - -await assertGlobalMiddlewareScenario(handler, context) - -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/global-middleware/vue/src/fns.ts b/benchmarks/ssr/scenarios/global-middleware/vue/src/fns.ts deleted file mode 100644 index 557f6ee849..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/fns.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { createServerFn } from '@tanstack/vue-start' -import { makeServerFnMarker, type GlobalMiddlewareContext } from '../../shared' - -type Payload = { q: string; n: number; nested: { list: Array } } - -const validate = (input: unknown): Payload => { - const payload = input as Payload - - if ( - typeof payload?.q !== 'string' || - typeof payload?.n !== 'number' || - !Array.isArray(payload?.nested?.list) - ) { - throw new Error('invalid payload') - } - - return payload -} - -export const echoPost = createServerFn({ method: 'POST' }) - .validator(validate) - .handler(({ data, context }) => { - const middlewareContext = (context ?? {}) as GlobalMiddlewareContext - - return { - echoed: data, - marker: makeServerFnMarker(data.q, middlewareContext), - sum: - data.n + - (middlewareContext.requestTotal ?? 0) + - (middlewareContext.functionTotal ?? 0), - list: data.nested.list.map((item) => `global-${item}`), - } - }) diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts deleted file mode 100644 index 3118848e4d..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,123 +0,0 @@ -/* 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 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({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) -const PageIdRoute = PageIdRouteImport.update({ - id: '/page/$id', - path: '/page/$id', - getParentRoute: () => rootRouteImport, -} as any) -const ApiPingIdRoute = ApiPingIdRouteImport.update({ - id: '/api/ping/$id', - path: '/api/ping/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/page/$id': typeof PageIdRoute - '/api/ping/$id': typeof ApiPingIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - id: '__root__' | '/' | '/api/fn-urls' | '/page/$id' | '/api/ping/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute - PageIdRoute: typeof PageIdRoute - ApiPingIdRoute: typeof ApiPingIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - '/page/$id': { - id: '/page/$id' - path: '/page/$id' - fullPath: '/page/$id' - preLoaderRoute: typeof PageIdRouteImport - parentRoute: typeof rootRouteImport - } - '/api/ping/$id': { - id: '/api/ping/$id' - path: '/api/ping/$id' - fullPath: '/api/ping/$id' - preLoaderRoute: typeof ApiPingIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, - PageIdRoute: PageIdRoute, - ApiPingIdRoute: ApiPingIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { startInstance } from './start.ts' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - config: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx b/benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts deleted file mode 100644 index af51ea6aa3..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { echoPost } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => Response.json({ post: echoPost.url }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.ping.$id.ts b/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.ping.$id.ts deleted file mode 100644 index f599ce1e49..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/api.ping.$id.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { - makeServerRouteMarker, - type GlobalMiddlewareContext, -} from '../../../shared' - -export const Route = createFileRoute('/api/ping/$id')({ - server: { - handlers: { - GET: ({ params, context }) => { - const middlewareContext = (context ?? {}) as GlobalMiddlewareContext - - return Response.json({ - id: params.id, - marker: makeServerRouteMarker(params.id, middlewareContext), - requestTrace: middlewareContext.requestTrace, - requestTotal: middlewareContext.requestTotal, - }) - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx b/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx deleted file mode 100644 index 85d3de69a4..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { echoPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return
global-middleware
-} diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/page.$id.tsx b/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/page.$id.tsx deleted file mode 100644 index 6e837ef0a0..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/routes/page.$id.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { - getGlobalMiddlewareContext, - makeDocumentMarker, - type GlobalMiddlewareContext, -} from '../../../shared' - -const PageComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () =>
{data.value.marker}
- }, -}) - -export const Route = createFileRoute('/page/$id')({ - beforeLoad: ({ serverContext }) => ({ - globalMiddlewareContext: (serverContext ?? {}) as GlobalMiddlewareContext, - }), - loader: ({ params, context }) => ({ - marker: makeDocumentMarker(params.id, getGlobalMiddlewareContext(context)), - }), - component: PageComponent, -}) diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/src/start.ts b/benchmarks/ssr/scenarios/global-middleware/vue/src/start.ts deleted file mode 100644 index 6e4eb2c5ef..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/src/start.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { createMiddleware, createStart } from '@tanstack/vue-start' -import { getRequestMiddlewareCount } from '../../shared' -import type { GlobalMiddlewareContext } from '../../shared' - -function appendTrace( - trace: string | undefined, - fallback: string, - label: string, -) { - return `${trace ?? fallback}.${label}` -} - -const requestMiddlewareA = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r1'), - requestTotal: (ctx.requestTotal ?? 0) + 1, - }, - }) - }, -) - -const requestMiddlewareB = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r2'), - requestTotal: (ctx.requestTotal ?? 0) + 2, - }, - }) - }, -) - -const requestMiddlewareC = createMiddleware({ type: 'request' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - requestTrace: appendTrace(ctx.requestTrace, 'req', 'r3'), - requestTotal: (ctx.requestTotal ?? 0) + 3, - }, - }) - }, -) - -const requestMiddlewareSets: Array> = [ - [], - [requestMiddlewareA], - [requestMiddlewareA, requestMiddlewareB], - [requestMiddlewareA, requestMiddlewareB, requestMiddlewareC], -] - -const functionMiddlewareA = createMiddleware({ type: 'function' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - functionTrace: appendTrace(ctx.functionTrace, 'fn', 'f1'), - functionTotal: (ctx.functionTotal ?? 0) + 10, - }, - }) - }, -) - -const functionMiddlewareB = createMiddleware({ type: 'function' }).server( - ({ next, context }) => { - const ctx = (context ?? {}) as GlobalMiddlewareContext - - return next({ - context: { - functionTrace: appendTrace(ctx.functionTrace, 'fn', 'f2'), - functionTotal: (ctx.functionTotal ?? 0) + 20, - }, - }) - }, -) - -export const startInstance = createStart(() => ({ - requestMiddleware: requestMiddlewareSets[getRequestMiddlewareCount()], - functionMiddleware: [functionMiddlewareA, functionMiddlewareB], -})) diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/tsconfig.json b/benchmarks/ssr/scenarios/global-middleware/vue/tsconfig.json deleted file mode 100644 index 56800fd29e..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared.ts", - "../bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/global-middleware/vue/vite.config.ts b/benchmarks/ssr/scenarios/global-middleware/vue/vite.config.ts deleted file mode 100644 index 8e29c5ee98..0000000000 --- a/benchmarks/ssr/scenarios/global-middleware/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr global-middleware (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/head/react/project.json b/benchmarks/ssr/scenarios/head/react/project.json deleted file mode 100644 index 093046fe39..0000000000 --- a/benchmarks/ssr/scenarios/head/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-head-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/head/react/speed.bench.ts b/benchmarks/ssr/scenarios/head/react/speed.bench.ts deleted file mode 100644 index f75008506e..0000000000 --- a/benchmarks/ssr/scenarios/head/react/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { assertHeadSanity, headBenchOptions, runHeadLoop } from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertHeadSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr head (react)', async () => runHeadLoop(handler)).run( - headBenchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/head/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/head/react/src/routeTree.gen.ts deleted file mode 100644 index 3786e2137d..0000000000 --- a/benchmarks/ssr/scenarios/head/react/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 HARouteImport } from './routes/h.$a' -import { Route as HABRouteImport } from './routes/h.$a.$b' -import { Route as HABCRouteImport } from './routes/h.$a.$b.$c' - -const HARoute = HARouteImport.update({ - id: '/h/$a', - path: '/h/$a', - getParentRoute: () => rootRouteImport, -} as any) -const HABRoute = HABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => HARoute, -} as any) -const HABCRoute = HABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => HABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRoutesByTo { - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - id: '__root__' | '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - HARoute: typeof HARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/h/$a': { - id: '/h/$a' - path: '/h/$a' - fullPath: '/h/$a' - preLoaderRoute: typeof HARouteImport - parentRoute: typeof rootRouteImport - } - '/h/$a/$b': { - id: '/h/$a/$b' - path: '/$b' - fullPath: '/h/$a/$b' - preLoaderRoute: typeof HABRouteImport - parentRoute: typeof HARoute - } - '/h/$a/$b/$c': { - id: '/h/$a/$b/$c' - path: '/$c' - fullPath: '/h/$a/$b/$c' - preLoaderRoute: typeof HABCRouteImport - parentRoute: typeof HABRoute - } - } -} - -interface HABRouteChildren { - HABCRoute: typeof HABCRoute -} - -const HABRouteChildren: HABRouteChildren = { - HABCRoute: HABCRoute, -} - -const HABRouteWithChildren = HABRoute._addFileChildren(HABRouteChildren) - -interface HARouteChildren { - HABRoute: typeof HABRouteWithChildren -} - -const HARouteChildren: HARouteChildren = { - HABRoute: HABRouteWithChildren, -} - -const HARouteWithChildren = HARoute._addFileChildren(HARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - HARoute: HARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/head/react/src/router.tsx b/benchmarks/ssr/scenarios/head/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/head/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/head/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/head/react/src/routes/__root.tsx deleted file mode 100644 index 93f68352ab..0000000000 --- a/benchmarks/ssr/scenarios/head/react/src/routes/__root.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: 'SSR head benchmark' }, - { name: 'description', content: 'Head-heavy SSR benchmark scenario' }, - { name: 'theme-color', content: '#111827' }, - { property: 'og:type', content: 'website' }, - ], - }), - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.$c.tsx b/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.$c.tsx deleted file mode 100644 index ee39349452..0000000000 --- a/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.$c.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a/$b/$c')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L3 ${params.a} ${params.b} ${params.c}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-3-meta-${index}`, - content: - index === 0 ? `shared-${params.c}-level-3` : `c-${params.c}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.c}-${index}.png`, - })), - }), - component: LevelCComponent, -}) - -function LevelCComponent() { - return

head-level-c

-} diff --git a/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.tsx b/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.tsx deleted file mode 100644 index b0658c87eb..0000000000 --- a/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.$b.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a/$b')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L2 ${params.a} ${params.b}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-2-meta-${index}`, - content: - index === 0 ? `shared-${params.b}-level-2` : `c-${params.b}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.b}-${index}.png`, - })), - }), - component: LevelBComponent, -}) - -function LevelBComponent() { - return ( - <> -

head-level-b

- - - ) -} diff --git a/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.tsx b/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.tsx deleted file mode 100644 index acd5f3c3ce..0000000000 --- a/benchmarks/ssr/scenarios/head/react/src/routes/h.$a.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L1 ${params.a}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-1-meta-${index}`, - content: - index === 0 ? `shared-${params.a}-level-1` : `c-${params.a}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.a}-${index}.png`, - })), - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - return ( - <> -

head-level-a

- - - ) -} diff --git a/benchmarks/ssr/scenarios/head/react/tsconfig.json b/benchmarks/ssr/scenarios/head/react/tsconfig.json deleted file mode 100644 index 91027bfc88..0000000000 --- a/benchmarks/ssr/scenarios/head/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/head/react/vite.config.ts b/benchmarks/ssr/scenarios/head/react/vite.config.ts deleted file mode 100644 index d24fc850a1..0000000000 --- a/benchmarks/ssr/scenarios/head/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr head (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/head/shared.ts b/benchmarks/ssr/scenarios/head/shared.ts deleted file mode 100644 index 033ca47c22..0000000000 --- a/benchmarks/ssr/scenarios/head/shared.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { expect } from 'vitest' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const origin = 'http://localhost' -const dedupedMetaName = 'head-benchmark-shared' -const headLoopTotalRequests = 32 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -export const headBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -function buildHeadRequest(random: () => number) { - return new Request( - `${origin}/h/${randomSegment(random)}/${randomSegment(random)}/${randomSegment(random)}`, - requestInit, - ) -} - -export function runHeadLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: headLoopTotalRequests, - buildRequest: buildHeadRequest, - }) -} - -export async function assertHeadSanity(handler: StartRequestHandler) { - const a = 'sanity-a' - const b = 'sanity-b' - const c = 'sanity-c' - const response = await handler.fetch( - new Request(`${origin}/h/${a}/${b}/${c}`, requestInit), - ) - const body = await response.text() - const dedupedMetaCount = body.split(dedupedMetaName).length - 1 - - expect(response.status).toBe(200) - expect(body).toContain(`c-${c}-9`) - expect(dedupedMetaCount).toBe(1) - expect(body).toContain(`SSR Head L3 ${a} ${b} ${c}`) -} diff --git a/benchmarks/ssr/scenarios/head/solid/project.json b/benchmarks/ssr/scenarios/head/solid/project.json deleted file mode 100644 index c6df39998b..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-head-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/head/solid/speed.bench.ts b/benchmarks/ssr/scenarios/head/solid/speed.bench.ts deleted file mode 100644 index 333e2f091b..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { assertHeadSanity, headBenchOptions, runHeadLoop } from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertHeadSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr head (solid)', async () => runHeadLoop(handler)).run( - headBenchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/head/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/head/solid/src/routeTree.gen.ts deleted file mode 100644 index ceba45e94d..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 HARouteImport } from './routes/h.$a' -import { Route as HABRouteImport } from './routes/h.$a.$b' -import { Route as HABCRouteImport } from './routes/h.$a.$b.$c' - -const HARoute = HARouteImport.update({ - id: '/h/$a', - path: '/h/$a', - getParentRoute: () => rootRouteImport, -} as any) -const HABRoute = HABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => HARoute, -} as any) -const HABCRoute = HABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => HABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRoutesByTo { - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - id: '__root__' | '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - HARoute: typeof HARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/h/$a': { - id: '/h/$a' - path: '/h/$a' - fullPath: '/h/$a' - preLoaderRoute: typeof HARouteImport - parentRoute: typeof rootRouteImport - } - '/h/$a/$b': { - id: '/h/$a/$b' - path: '/$b' - fullPath: '/h/$a/$b' - preLoaderRoute: typeof HABRouteImport - parentRoute: typeof HARoute - } - '/h/$a/$b/$c': { - id: '/h/$a/$b/$c' - path: '/$c' - fullPath: '/h/$a/$b/$c' - preLoaderRoute: typeof HABCRouteImport - parentRoute: typeof HABRoute - } - } -} - -interface HABRouteChildren { - HABCRoute: typeof HABCRoute -} - -const HABRouteChildren: HABRouteChildren = { - HABCRoute: HABCRoute, -} - -const HABRouteWithChildren = HABRoute._addFileChildren(HABRouteChildren) - -interface HARouteChildren { - HABRoute: typeof HABRouteWithChildren -} - -const HARouteChildren: HARouteChildren = { - HABRoute: HABRouteWithChildren, -} - -const HARouteWithChildren = HARoute._addFileChildren(HARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - HARoute: HARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/head/solid/src/router.tsx b/benchmarks/ssr/scenarios/head/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/head/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/head/solid/src/routes/__root.tsx deleted file mode 100644 index 2dde9d0ddf..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/src/routes/__root.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: 'SSR head benchmark' }, - { name: 'description', content: 'Head-heavy SSR benchmark scenario' }, - { name: 'theme-color', content: '#111827' }, - { property: 'og:type', content: 'website' }, - ], - }), - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.$c.tsx b/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.$c.tsx deleted file mode 100644 index 7ec132e9a6..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.$c.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a/$b/$c')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L3 ${params.a} ${params.b} ${params.c}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-3-meta-${index}`, - content: - index === 0 ? `shared-${params.c}-level-3` : `c-${params.c}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.c}-${index}.png`, - })), - }), - component: LevelCComponent, -}) - -function LevelCComponent() { - return

head-level-c

-} diff --git a/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.tsx b/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.tsx deleted file mode 100644 index 25d443ad4e..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.$b.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a/$b')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L2 ${params.a} ${params.b}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-2-meta-${index}`, - content: - index === 0 ? `shared-${params.b}-level-2` : `c-${params.b}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.b}-${index}.png`, - })), - }), - component: LevelBComponent, -}) - -function LevelBComponent() { - return ( - <> -

head-level-b

- - - ) -} diff --git a/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.tsx b/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.tsx deleted file mode 100644 index 6c994ffed6..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/src/routes/h.$a.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L1 ${params.a}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-1-meta-${index}`, - content: - index === 0 ? `shared-${params.a}-level-1` : `c-${params.a}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.a}-${index}.png`, - })), - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - return ( - <> -

head-level-a

- - - ) -} diff --git a/benchmarks/ssr/scenarios/head/solid/tsconfig.json b/benchmarks/ssr/scenarios/head/solid/tsconfig.json deleted file mode 100644 index b1806caa67..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/head/solid/vite.config.ts b/benchmarks/ssr/scenarios/head/solid/vite.config.ts deleted file mode 100644 index 7a870bbd77..0000000000 --- a/benchmarks/ssr/scenarios/head/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr head (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/head/vue/project.json b/benchmarks/ssr/scenarios/head/vue/project.json deleted file mode 100644 index 62b17b1216..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-head-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/head/vue/speed.bench.ts b/benchmarks/ssr/scenarios/head/vue/speed.bench.ts deleted file mode 100644 index 936735a909..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/speed.bench.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { test } from 'vitest' -import { assertHeadSanity, headBenchOptions, runHeadLoop } from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertHeadSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr head (vue)', async () => runHeadLoop(handler)).run( - headBenchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/head/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/head/vue/src/routeTree.gen.ts deleted file mode 100644 index 9ec1029664..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 HARouteImport } from './routes/h.$a' -import { Route as HABRouteImport } from './routes/h.$a.$b' -import { Route as HABCRouteImport } from './routes/h.$a.$b.$c' - -const HARoute = HARouteImport.update({ - id: '/h/$a', - path: '/h/$a', - getParentRoute: () => rootRouteImport, -} as any) -const HABRoute = HABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => HARoute, -} as any) -const HABCRoute = HABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => HABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRoutesByTo { - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/h/$a': typeof HARouteWithChildren - '/h/$a/$b': typeof HABRouteWithChildren - '/h/$a/$b/$c': typeof HABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - id: '__root__' | '/h/$a' | '/h/$a/$b' | '/h/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - HARoute: typeof HARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/h/$a': { - id: '/h/$a' - path: '/h/$a' - fullPath: '/h/$a' - preLoaderRoute: typeof HARouteImport - parentRoute: typeof rootRouteImport - } - '/h/$a/$b': { - id: '/h/$a/$b' - path: '/$b' - fullPath: '/h/$a/$b' - preLoaderRoute: typeof HABRouteImport - parentRoute: typeof HARoute - } - '/h/$a/$b/$c': { - id: '/h/$a/$b/$c' - path: '/$c' - fullPath: '/h/$a/$b/$c' - preLoaderRoute: typeof HABCRouteImport - parentRoute: typeof HABRoute - } - } -} - -interface HABRouteChildren { - HABCRoute: typeof HABCRoute -} - -const HABRouteChildren: HABRouteChildren = { - HABCRoute: HABCRoute, -} - -const HABRouteWithChildren = HABRoute._addFileChildren(HABRouteChildren) - -interface HARouteChildren { - HABRoute: typeof HABRouteWithChildren -} - -const HARouteChildren: HARouteChildren = { - HABRoute: HABRouteWithChildren, -} - -const HARouteWithChildren = HARoute._addFileChildren(HARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - HARoute: HARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/head/vue/src/router.tsx b/benchmarks/ssr/scenarios/head/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/head/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/head/vue/src/routes/__root.tsx deleted file mode 100644 index 9b95d2c48e..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/src/routes/__root.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { name: 'application-name', content: 'SSR head benchmark' }, - { name: 'description', content: 'Head-heavy SSR benchmark scenario' }, - { name: 'theme-color', content: '#111827' }, - { property: 'og:type', content: 'website' }, - ], - }), - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.$c.tsx b/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.$c.tsx deleted file mode 100644 index 91b8f03f7d..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.$c.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a/$b/$c')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L3 ${params.a} ${params.b} ${params.c}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-3-meta-${index}`, - content: - index === 0 ? `shared-${params.c}-level-3` : `c-${params.c}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.c}-${index}.png`, - })), - }), - component: LevelCComponent, -}) - -function LevelCComponent() { - return

head-level-c

-} diff --git a/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.tsx b/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.tsx deleted file mode 100644 index e92a619435..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.$b.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a/$b')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L2 ${params.a} ${params.b}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-2-meta-${index}`, - content: - index === 0 ? `shared-${params.b}-level-2` : `c-${params.b}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.b}-${index}.png`, - })), - }), - component: LevelBComponent, -}) - -function LevelBComponent() { - return ( - <> -

head-level-b

- - - ) -} diff --git a/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.tsx b/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.tsx deleted file mode 100644 index ddf407e9ae..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/src/routes/h.$a.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' - -const dedupedMetaName = 'head-benchmark-shared' - -export const Route = createFileRoute('/h/$a')({ - head: ({ params }) => ({ - meta: [ - { title: `SSR Head L1 ${params.a}` }, - ...Array.from({ length: 10 }, (_, index) => ({ - name: index === 0 ? dedupedMetaName : `level-1-meta-${index}`, - content: - index === 0 ? `shared-${params.a}-level-1` : `c-${params.a}-${index}`, - })), - ], - links: Array.from({ length: 4 }, (_, index) => ({ - rel: 'preload', - as: 'image', - href: `/img/${params.a}-${index}.png`, - })), - }), - component: LevelAComponent, -}) - -function LevelAComponent() { - return ( - <> -

head-level-a

- - - ) -} diff --git a/benchmarks/ssr/scenarios/head/vue/tsconfig.json b/benchmarks/ssr/scenarios/head/vue/tsconfig.json deleted file mode 100644 index 4fe3ccecb1..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/head/vue/vite.config.ts b/benchmarks/ssr/scenarios/head/vue/vite.config.ts deleted file mode 100644 index 1434d26069..0000000000 --- a/benchmarks/ssr/scenarios/head/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr head (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/loaders/react/project.json b/benchmarks/ssr/scenarios/loaders/react/project.json deleted file mode 100644 index 0455f80c87..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-loaders-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts b/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts deleted file mode 100644 index 7acd43c635..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertLoadersSanity, - benchOptions, - runLoadersLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertLoadersSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr loaders (react)', async () => runLoadersLoop(handler)).run( - benchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/loaders/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/loaders/react/src/routeTree.gen.ts deleted file mode 100644 index 068b5a5433..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - } -} - -interface ABRouteChildren { - ABCRoute: typeof ABCRoute -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRoute, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/loaders/react/src/router.tsx b/benchmarks/ssr/scenarios/loaders/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 746a26aeb6..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { makeLevelData } from '../../../shared-data' - -export const Route = createFileRoute('/$a/$b/$c')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxC: `v-${params.c}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.c, deps.page) - }, - component: LevelCComponent, -}) - -function LevelCComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data.meta.label}

-
    - {data.items.slice(0, 10).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) -} diff --git a/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.tsx b/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.tsx deleted file mode 100644 index 79c10c06b0..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.$b.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { makeLevelData } from '../../../shared-data' - -export const Route = createFileRoute('/$a/$b')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxB: `v-${params.b}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.b, deps.page) - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data.meta.label}

-
    - {data.items.slice(0, 10).map((item) => ( -
  • {item.name}
  • - ))} -
- -
- ) -} diff --git a/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.tsx b/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.tsx deleted file mode 100644 index 980a495c32..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/src/routes/$a.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { makeLevelData } from '../../../shared-data' - -export const Route = createFileRoute('/$a')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxA: `v-${params.a}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.a, deps.page) - }, - component: LevelAComponent, -}) - -function LevelAComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data.meta.label}

-
    - {data.items.slice(0, 10).map((item) => ( -
  • {item.name}
  • - ))} -
- -
- ) -} diff --git a/benchmarks/ssr/scenarios/loaders/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/loaders/react/src/routes/__root.tsx deleted file mode 100644 index 001639cb39..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/src/routes/__root.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s: Record) => ({ - page: typeof s.page === 'number' ? s.page : 0, - tags: Array.isArray(s.tags) ? (s.tags as Array) : [], - }), -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/loaders/react/tsconfig.json b/benchmarks/ssr/scenarios/loaders/react/tsconfig.json deleted file mode 100644 index 8800818162..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/loaders/react/vite.config.ts b/benchmarks/ssr/scenarios/loaders/react/vite.config.ts deleted file mode 100644 index e761426c84..0000000000 --- a/benchmarks/ssr/scenarios/loaders/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr loaders (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/loaders/shared-bench.ts b/benchmarks/ssr/scenarios/loaders/shared-bench.ts deleted file mode 100644 index f52c51dccd..0000000000 --- a/benchmarks/ssr/scenarios/loaders/shared-bench.ts +++ /dev/null @@ -1,75 +0,0 @@ -import { makeLevelData } from './shared-data' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const loadersLoopTotalRequests = 16 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildLoaderRequest(random: () => number, index: number) { - const suffix = index.toString(36) - const a = `${randomSegment(random)}-${suffix}` - const b = `${randomSegment(random)}-${suffix}` - const c = `${randomSegment(random)}-${suffix}` - const page = Math.floor(random() * 10) - const tags = JSON.stringify([ - `t-${randomSegment(random)}-${suffix}`, - `t-${randomSegment(random)}-${suffix}`, - ]) - - return new Request( - `http://localhost/${a}/${b}/${c}?page=${page}&tags=${encodeURIComponent(tags)}`, - requestInit, - ) -} - -export async function assertLoadersSanity(handler: StartRequestHandler) { - const page = 3 - const leafSource = 'c-sanity' - const tags = JSON.stringify(['t-x', 't-y']) - const response = await handler.fetch( - new Request( - `http://localhost/a-sanity/b-sanity/${leafSource}?page=${page}&tags=${encodeURIComponent(tags)}`, - requestInit, - ), - ) - const body = await response.text() - const leafMarker = makeLevelData(leafSource, page).items[0]?.name - - if (response.status !== 200) { - throw new Error( - `Expected setup request status 200, received ${response.status}`, - ) - } - - if (!leafMarker || !body.includes(leafMarker)) { - throw new Error('Expected setup response to include the leaf loader item') - } - - if (!body.includes('$_TSR')) { - throw new Error('Expected setup response to include the dehydration marker') - } -} - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runLoadersLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: loadersLoopTotalRequests, - buildRequest: buildLoaderRequest, - }) -} diff --git a/benchmarks/ssr/scenarios/loaders/shared-data.ts b/benchmarks/ssr/scenarios/loaders/shared-data.ts deleted file mode 100644 index d907f7d66c..0000000000 --- a/benchmarks/ssr/scenarios/loaders/shared-data.ts +++ /dev/null @@ -1,54 +0,0 @@ -export interface LevelDataItem { - id: string - name: string - flags: number -} - -export interface LevelData { - items: Array - meta: { - source: string - page: number - label: string - } -} - -function hashLevelInput(input: string, salt: number) { - let value = salt >>> 0 - - for (let index = 0; index < input.length; index++) { - value = (value * 33 + input.charCodeAt(index) + index) >>> 0 - } - - for (let index = 0; index < 16; index++) { - value = (value ^ (value << 13)) >>> 0 - value = (value ^ (value >> 17)) >>> 0 - value = (value ^ (value << 5)) >>> 0 - } - - return value -} - -export function makeLevelData(source: string, page: number): LevelData { - const safePage = page | 0 - const seedInput = `${source}:${safePage}` - const seed = hashLevelInput(seedInput, 0x9e3779b9) - - return { - items: Array.from({ length: 50 }, (_, index) => { - const hash = hashLevelInput(`${seedInput}:${index}`, seed + index) - const hashLabel = (hash & 0xffff).toString(36) - - return { - id: `${index.toString(36)}-${hashLabel}`, - name: `${source}:${safePage}:item-${index}`, - flags: hash & 15, - } - }), - meta: { - source, - page: safePage, - label: `source ${source} page ${safePage}`, - }, - } -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/project.json b/benchmarks/ssr/scenarios/loaders/solid/project.json deleted file mode 100644 index 2cb0e92acd..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-loaders-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts b/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts deleted file mode 100644 index 7fc8d88389..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertLoadersSanity, - benchOptions, - runLoadersLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertLoadersSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr loaders (solid)', async () => runLoadersLoop(handler)).run( - benchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/loaders/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/loaders/solid/src/routeTree.gen.ts deleted file mode 100644 index 7b299cfcd1..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - } -} - -interface ABRouteChildren { - ABCRoute: typeof ABCRoute -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRoute, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/src/router.tsx b/benchmarks/ssr/scenarios/loaders/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 9ead32440a..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { makeLevelData } from '../../../shared-data' - -export const Route = createFileRoute('/$a/$b/$c')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxC: `v-${params.c}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.c, deps.page) - }, - component: LevelCComponent, -}) - -function LevelCComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data().meta.label}

-
    - {data() - .items.slice(0, 10) - .map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.tsx b/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.tsx deleted file mode 100644 index c0abf3da87..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.$b.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { makeLevelData } from '../../../shared-data' - -export const Route = createFileRoute('/$a/$b')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxB: `v-${params.b}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.b, deps.page) - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data().meta.label}

-
    - {data() - .items.slice(0, 10) - .map((item) => ( -
  • {item.name}
  • - ))} -
- -
- ) -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.tsx b/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.tsx deleted file mode 100644 index d4608523b8..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/src/routes/$a.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { makeLevelData } from '../../../shared-data' - -export const Route = createFileRoute('/$a')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxA: `v-${params.a}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.a, deps.page) - }, - component: LevelAComponent, -}) - -function LevelAComponent() { - const data = Route.useLoaderData() - - return ( -
-

{data().meta.label}

-
    - {data() - .items.slice(0, 10) - .map((item) => ( -
  • {item.name}
  • - ))} -
- -
- ) -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/loaders/solid/src/routes/__root.tsx deleted file mode 100644 index 2f4b1de410..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/src/routes/__root.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s: Record) => ({ - page: typeof s.page === 'number' ? s.page : 0, - tags: Array.isArray(s.tags) ? (s.tags as Array) : [], - }), -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/tsconfig.json b/benchmarks/ssr/scenarios/loaders/solid/tsconfig.json deleted file mode 100644 index 47f264ba4f..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/loaders/solid/vite.config.ts b/benchmarks/ssr/scenarios/loaders/solid/vite.config.ts deleted file mode 100644 index 64f52159c3..0000000000 --- a/benchmarks/ssr/scenarios/loaders/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr loaders (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/loaders/vue/project.json b/benchmarks/ssr/scenarios/loaders/vue/project.json deleted file mode 100644 index 2a98cb57f9..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-loaders-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts b/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts deleted file mode 100644 index 321350d98c..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertLoadersSanity, - benchOptions, - runLoadersLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertLoadersSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr loaders (vue)', async () => runLoadersLoop(handler)).run( - benchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/loaders/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/loaders/vue/src/routeTree.gen.ts deleted file mode 100644 index 24ee6c3b9d..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - } -} - -interface ABRouteChildren { - ABCRoute: typeof ABCRoute -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRoute, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/loaders/vue/src/router.tsx b/benchmarks/ssr/scenarios/loaders/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 0a52b9c542..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { makeLevelData } from '../../../shared-data' - -const LevelCComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.meta.label}

-
    - {data.value.items.slice(0, 10).map((item) => ( -
  • {item.name}
  • - ))} -
-
- ) - }, -}) - -export const Route = createFileRoute('/$a/$b/$c')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxC: `v-${params.c}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.c, deps.page) - }, - component: LevelCComponent, -}) diff --git a/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.tsx b/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.tsx deleted file mode 100644 index f3943d58e7..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.$b.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { makeLevelData } from '../../../shared-data' - -const LevelBComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.meta.label}

-
    - {data.value.items.slice(0, 10).map((item) => ( -
  • {item.name}
  • - ))} -
- -
- ) - }, -}) - -export const Route = createFileRoute('/$a/$b')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxB: `v-${params.b}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.b, deps.page) - }, - component: LevelBComponent, -}) diff --git a/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.tsx b/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.tsx deleted file mode 100644 index 63bb36949f..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/src/routes/$a.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { makeLevelData } from '../../../shared-data' - -const LevelAComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.meta.label}

-
    - {data.value.items.slice(0, 10).map((item) => ( -
  • {item.name}
  • - ))} -
- -
- ) - }, -}) - -export const Route = createFileRoute('/$a')({ - beforeLoad: ({ params, context }) => { - void context - - return { ctxA: `v-${params.a}` } - }, - loaderDeps: ({ search }) => ({ page: search.page }), - loader: async ({ params, deps, context }) => { - void context - - return makeLevelData(params.a, deps.page) - }, - component: LevelAComponent, -}) diff --git a/benchmarks/ssr/scenarios/loaders/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/loaders/vue/src/routes/__root.tsx deleted file mode 100644 index 0479fb1af4..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/src/routes/__root.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s: Record) => ({ - page: typeof s.page === 'number' ? s.page : 0, - tags: Array.isArray(s.tags) ? (s.tags as Array) : [], - }), -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/loaders/vue/tsconfig.json b/benchmarks/ssr/scenarios/loaders/vue/tsconfig.json deleted file mode 100644 index c302f63770..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/loaders/vue/vite.config.ts b/benchmarks/ssr/scenarios/loaders/vue/vite.config.ts deleted file mode 100644 index 92bf3e60f0..0000000000 --- a/benchmarks/ssr/scenarios/loaders/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr loaders (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/rewrites/react/project.json b/benchmarks/ssr/scenarios/rewrites/react/project.json deleted file mode 100644 index 84d4846ec5..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-rewrites-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts b/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts deleted file mode 100644 index 920186c5db..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertRewriteScenario, - rewriteBenchOptions, - runRewriteLocalizedLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertRewriteScenario(handler) - -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 deleted file mode 100644 index f5d09089a6..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/speed.rewrite-passthrough.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertRewriteScenario, - rewriteBenchOptions, - runRewritePassthroughLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertRewriteScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr rewrite passthrough (react)', async () => - runRewritePassthroughLoop(handler), - ).run(rewriteBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts deleted file mode 100644 index e893d06a57..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/src/routeTree.gen.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 PARouteImport } from './routes/p.$a' -import { Route as PABRouteImport } from './routes/p.$a.$b' - -const PARoute = PARouteImport.update({ - id: '/p/$a', - path: '/p/$a', - getParentRoute: () => rootRouteImport, -} as any) -const PABRoute = PABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => PARoute, -} as any) - -export interface FileRoutesByFullPath { - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesByTo { - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/p/$a' | '/p/$a/$b' - fileRoutesByTo: FileRoutesByTo - to: '/p/$a' | '/p/$a/$b' - id: '__root__' | '/p/$a' | '/p/$a/$b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - PARoute: typeof PARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/p/$a': { - id: '/p/$a' - path: '/p/$a' - fullPath: '/p/$a' - preLoaderRoute: typeof PARouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a/$b': { - id: '/p/$a/$b' - path: '/$b' - fullPath: '/p/$a/$b' - preLoaderRoute: typeof PABRouteImport - parentRoute: typeof PARoute - } - } -} - -interface PARouteChildren { - PABRoute: typeof PABRoute -} - -const PARouteChildren: PARouteChildren = { - PABRoute: PABRoute, -} - -const PARouteWithChildren = PARoute._addFileChildren(PARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - PARoute: PARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/src/router.tsx b/benchmarks/ssr/scenarios/rewrites/react/src/router.tsx deleted file mode 100644 index e9e0b2ce9a..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/src/router.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -const localePrefixRe = /^\/(fr|de|es)(\/.*)$/ - -export function getRouter() { - return createRouter({ - routeTree, - basepath: '/app', - defaultPreload: false, - scrollRestoration: false, - rewrite: { - input: ({ url }) => { - const match = url.pathname.match(localePrefixRe) - - if (match) { - url.pathname = match[2]! - url.searchParams.set('_locale', match[1]!) - return url - } - - return undefined - }, - output: ({ url }) => { - const locale = url.searchParams.get('_locale') - - if (locale) { - url.searchParams.delete('_locale') - url.pathname = `/${locale}${url.pathname}` - } - - return url - }, - }, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/rewrites/react/src/routes/__root.tsx deleted file mode 100644 index 7cdcfe1a37..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s: Record) => ({ - _locale: typeof s._locale === 'string' ? s._locale : undefined, - }), -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx b/benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx deleted file mode 100644 index 756109b844..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.$b.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/p/$a/$b')({ - loader: ({ params }) => ({ - a: params.a, - b: params.b, - nextB: `next-${params.b}`, - }), - component: LeafComponent, -}) - -function LeafComponent() { - const data = Route.useLoaderData() - - return ( -
-

- rewrite-leaf {data.a} {data.b} -

- - leaf-self-link - - - leaf-next-link - - - leaf-parent-link - -
- ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx b/benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx deleted file mode 100644 index 7b0a778a18..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/src/routes/p.$a.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/p/$a')({ - loader: ({ params }) => ({ - a: params.a, - nextB: `branch-${params.a}`, - }), - component: ParentComponent, -}) - -function ParentComponent() { - const data = Route.useLoaderData() - - return ( -
-

rewrite-parent {data.a}

- - parent-branch-link - - -
- ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/tsconfig.json b/benchmarks/ssr/scenarios/rewrites/react/tsconfig.json deleted file mode 100644 index cf14e1d440..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/rewrites/react/vite.config.ts b/benchmarks/ssr/scenarios/rewrites/react/vite.config.ts deleted file mode 100644 index 7b20340ec6..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/react/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - router: { - basepath: '/app', - }, - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr rewrites (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/rewrites/shared.ts b/benchmarks/ssr/scenarios/rewrites/shared.ts deleted file mode 100644 index 9b29bc0249..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/shared.ts +++ /dev/null @@ -1,91 +0,0 @@ -import { expect } from 'vitest' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const origin = 'http://localhost' -const localizedLoopTotalRequests = 32 -const passthroughLoopTotalRequests = 32 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -export const rewriteBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -function buildLocalizedRequest(random: () => number) { - return new Request( - `${origin}/app/fr/p/${randomSegment(random)}/${randomSegment(random)}`, - requestInit, - ) -} - -function buildPassthroughRequest(random: () => number) { - return new Request( - `${origin}/app/p/${randomSegment(random)}/${randomSegment(random)}`, - requestInit, - ) -} - -export function runRewriteLocalizedLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: localizedLoopTotalRequests, - buildRequest: buildLocalizedRequest, - }) -} - -export function runRewritePassthroughLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: passthroughLoopTotalRequests, - buildRequest: buildPassthroughRequest, - }) -} - -export async function assertRewriteScenario(handler: StartRequestHandler) { - const localizedResponse = await handler.fetch( - new Request(`${origin}/app/fr/p/sanity-a/sanity-b`, requestInit), - ) - const localizedBody = await localizedResponse.text() - - expect(localizedResponse.status).toBe(200) - expect(localizedBody).toContain('rewrite-leaf') - expect(localizedBody).toContain('sanity-a') - expect(localizedBody).toContain('sanity-b') - expect(localizedBody).toContain('href="/app/fr/p/sanity-a/sanity-b"') - expect(localizedBody).toContain('href="/app/fr/p/sanity-a/next-sanity-b"') - - const passthroughResponse = await handler.fetch( - new Request(`${origin}/app/p/sanity-a/sanity-b`, requestInit), - ) - const passthroughBody = await passthroughResponse.text() - - expect(passthroughResponse.status).toBe(200) - expect(passthroughBody).toContain('rewrite-leaf') - expect(passthroughBody).toContain('sanity-a') - expect(passthroughBody).toContain('sanity-b') - expect(passthroughBody).toContain('href="/app/fr/p/sanity-a/sanity-b"') - expect(passthroughBody).toContain('href="/app/fr/p/sanity-a/next-sanity-b"') - - const unprefixedResponse = await handler.fetch( - new Request(`${origin}/p/sanity-a/sanity-b`, requestInit), - ) - await unprefixedResponse.text() - - expect(unprefixedResponse.status).toBe(307) - expect(unprefixedResponse.headers.get('location')).toBe( - '/app/p/sanity-a/sanity-b', - ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/project.json b/benchmarks/ssr/scenarios/rewrites/solid/project.json deleted file mode 100644 index 7c993a1404..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-rewrites-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts b/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts deleted file mode 100644 index 488fb2ca52..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertRewriteScenario, - rewriteBenchOptions, - runRewriteLocalizedLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertRewriteScenario(handler) - -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 deleted file mode 100644 index 7b86e2ba11..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/speed.rewrite-passthrough.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertRewriteScenario, - rewriteBenchOptions, - runRewritePassthroughLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertRewriteScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr rewrite passthrough (solid)', async () => - runRewritePassthroughLoop(handler), - ).run(rewriteBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts deleted file mode 100644 index b3b6b24a38..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 PARouteImport } from './routes/p.$a' -import { Route as PABRouteImport } from './routes/p.$a.$b' - -const PARoute = PARouteImport.update({ - id: '/p/$a', - path: '/p/$a', - getParentRoute: () => rootRouteImport, -} as any) -const PABRoute = PABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => PARoute, -} as any) - -export interface FileRoutesByFullPath { - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesByTo { - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/p/$a' | '/p/$a/$b' - fileRoutesByTo: FileRoutesByTo - to: '/p/$a' | '/p/$a/$b' - id: '__root__' | '/p/$a' | '/p/$a/$b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - PARoute: typeof PARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/p/$a': { - id: '/p/$a' - path: '/p/$a' - fullPath: '/p/$a' - preLoaderRoute: typeof PARouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a/$b': { - id: '/p/$a/$b' - path: '/$b' - fullPath: '/p/$a/$b' - preLoaderRoute: typeof PABRouteImport - parentRoute: typeof PARoute - } - } -} - -interface PARouteChildren { - PABRoute: typeof PABRoute -} - -const PARouteChildren: PARouteChildren = { - PABRoute: PABRoute, -} - -const PARouteWithChildren = PARoute._addFileChildren(PARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - PARoute: PARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/src/router.tsx b/benchmarks/ssr/scenarios/rewrites/solid/src/router.tsx deleted file mode 100644 index 9806e59d0e..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/src/router.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -const localePrefixRe = /^\/(fr|de|es)(\/.*)$/ - -export function getRouter() { - return createRouter({ - routeTree, - basepath: '/app', - defaultPreload: false, - scrollRestoration: false, - rewrite: { - input: ({ url }) => { - const match = url.pathname.match(localePrefixRe) - - if (match) { - url.pathname = match[2]! - url.searchParams.set('_locale', match[1]!) - return url - } - - return undefined - }, - output: ({ url }) => { - const locale = url.searchParams.get('_locale') - - if (locale) { - url.searchParams.delete('_locale') - url.pathname = `/${locale}${url.pathname}` - } - - return url - }, - }, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx deleted file mode 100644 index 1a9cd6c423..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s: Record) => ({ - _locale: typeof s._locale === 'string' ? s._locale : undefined, - }), -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx b/benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx deleted file mode 100644 index eacb45a841..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.$b.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/p/$a/$b')({ - loader: ({ params }) => ({ - a: params.a, - b: params.b, - nextB: `next-${params.b}`, - }), - component: LeafComponent, -}) - -function LeafComponent() { - const data = Route.useLoaderData() - - return ( -
-

- rewrite-leaf {data().a} {data().b} -

- - leaf-self-link - - - leaf-next-link - - - leaf-parent-link - -
- ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.tsx b/benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.tsx deleted file mode 100644 index 1845e3ebba..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/src/routes/p.$a.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/p/$a')({ - loader: ({ params }) => ({ - a: params.a, - nextB: `branch-${params.a}`, - }), - component: ParentComponent, -}) - -function ParentComponent() { - const data = Route.useLoaderData() - - return ( -
-

rewrite-parent {data().a}

- - parent-branch-link - - -
- ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/tsconfig.json b/benchmarks/ssr/scenarios/rewrites/solid/tsconfig.json deleted file mode 100644 index 42c3a2160f..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/rewrites/solid/vite.config.ts b/benchmarks/ssr/scenarios/rewrites/solid/vite.config.ts deleted file mode 100644 index 963fe7132b..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/solid/vite.config.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - router: { - basepath: '/app', - }, - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr rewrites (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/rewrites/vue/project.json b/benchmarks/ssr/scenarios/rewrites/vue/project.json deleted file mode 100644 index 10fd6f4f34..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-rewrites-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts b/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts deleted file mode 100644 index 5fd4da9d3e..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertRewriteScenario, - rewriteBenchOptions, - runRewriteLocalizedLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertRewriteScenario(handler) - -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 deleted file mode 100644 index f3664b5f21..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/speed.rewrite-passthrough.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertRewriteScenario, - rewriteBenchOptions, - runRewritePassthroughLoop, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertRewriteScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr rewrite passthrough (vue)', async () => - runRewritePassthroughLoop(handler), - ).run(rewriteBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/rewrites/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/rewrites/vue/src/routeTree.gen.ts deleted file mode 100644 index 4440c1cfda..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,94 +0,0 @@ -/* 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 PARouteImport } from './routes/p.$a' -import { Route as PABRouteImport } from './routes/p.$a.$b' - -const PARoute = PARouteImport.update({ - id: '/p/$a', - path: '/p/$a', - getParentRoute: () => rootRouteImport, -} as any) -const PABRoute = PABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => PARoute, -} as any) - -export interface FileRoutesByFullPath { - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesByTo { - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/p/$a': typeof PARouteWithChildren - '/p/$a/$b': typeof PABRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/p/$a' | '/p/$a/$b' - fileRoutesByTo: FileRoutesByTo - to: '/p/$a' | '/p/$a/$b' - id: '__root__' | '/p/$a' | '/p/$a/$b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - PARoute: typeof PARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/p/$a': { - id: '/p/$a' - path: '/p/$a' - fullPath: '/p/$a' - preLoaderRoute: typeof PARouteImport - parentRoute: typeof rootRouteImport - } - '/p/$a/$b': { - id: '/p/$a/$b' - path: '/$b' - fullPath: '/p/$a/$b' - preLoaderRoute: typeof PABRouteImport - parentRoute: typeof PARoute - } - } -} - -interface PARouteChildren { - PABRoute: typeof PABRoute -} - -const PARouteChildren: PARouteChildren = { - PABRoute: PABRoute, -} - -const PARouteWithChildren = PARoute._addFileChildren(PARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - PARoute: PARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx b/benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx deleted file mode 100644 index 3a7389a5be..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/src/router.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -const localePrefixRe = /^\/(fr|de|es)(\/.*)$/ - -export function getRouter() { - return createRouter({ - routeTree, - basepath: '/app', - defaultPreload: false, - scrollRestoration: false, - rewrite: { - input: ({ url }) => { - const match = url.pathname.match(localePrefixRe) - - if (match) { - url.pathname = match[2]! - url.searchParams.set('_locale', match[1]!) - return url - } - - return undefined - }, - output: ({ url }) => { - const locale = url.searchParams.get('_locale') - - if (locale) { - url.searchParams.delete('_locale') - url.pathname = `/${locale}${url.pathname}` - } - - return url - }, - }, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/rewrites/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/rewrites/vue/src/routes/__root.tsx deleted file mode 100644 index ed4cf1300d..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/src/routes/__root.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s: Record) => ({ - _locale: typeof s._locale === 'string' ? s._locale : undefined, - }), -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx b/benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx deleted file mode 100644 index 3c9de1806e..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.$b.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { defineComponent } from 'vue' -import { Link, createFileRoute } from '@tanstack/vue-router' - -const LeafComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

- rewrite-leaf {data.value.a} {data.value.b} -

- - leaf-self-link - - - leaf-next-link - - - leaf-parent-link - -
- ) - }, -}) - -export const Route = createFileRoute('/p/$a/$b')({ - loader: ({ params }) => ({ - a: params.a, - b: params.b, - nextB: `next-${params.b}`, - }), - component: LeafComponent, -}) diff --git a/benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.tsx b/benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.tsx deleted file mode 100644 index 9702ebedd7..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/src/routes/p.$a.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { defineComponent } from 'vue' -import { Link, Outlet, createFileRoute } from '@tanstack/vue-router' - -const ParentComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

rewrite-parent {data.value.a}

- - parent-branch-link - - -
- ) - }, -}) - -export const Route = createFileRoute('/p/$a')({ - loader: ({ params }) => ({ - a: params.a, - nextB: `branch-${params.a}`, - }), - component: ParentComponent, -}) diff --git a/benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json b/benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json deleted file mode 100644 index 08c94853f4..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/rewrites/vue/vite.config.ts b/benchmarks/ssr/scenarios/rewrites/vue/vite.config.ts deleted file mode 100644 index 22399ec6b2..0000000000 --- a/benchmarks/ssr/scenarios/rewrites/vue/vite.config.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - router: { - basepath: '/app', - }, - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr rewrites (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/project.json b/benchmarks/ssr/scenarios/selective-ssr/react/project.json deleted file mode 100644 index 77858e2246..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-selective-ssr-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts b/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts deleted file mode 100644 index ba6bd4a61d..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSelectiveSanity, - benchOptions, - runSelectiveLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSelectiveSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr selective (react)', async () => - runSelectiveLoop(handler), - ).run(benchOptions) -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/selective-ssr/react/src/routeTree.gen.ts deleted file mode 100644 index 95395c294e..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 MixARouteImport } from './routes/mix.$a' -import { Route as MixABRouteImport } from './routes/mix.$a.$b' -import { Route as MixABCRouteImport } from './routes/mix.$a.$b.$c' - -const MixARoute = MixARouteImport.update({ - id: '/mix/$a', - path: '/mix/$a', - getParentRoute: () => rootRouteImport, -} as any) -const MixABRoute = MixABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => MixARoute, -} as any) -const MixABCRoute = MixABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => MixABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRoutesByTo { - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - id: '__root__' | '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - MixARoute: typeof MixARouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/mix/$a': { - id: '/mix/$a' - path: '/mix/$a' - fullPath: '/mix/$a' - preLoaderRoute: typeof MixARouteImport - parentRoute: typeof rootRouteImport - } - '/mix/$a/$b': { - id: '/mix/$a/$b' - path: '/$b' - fullPath: '/mix/$a/$b' - preLoaderRoute: typeof MixABRouteImport - parentRoute: typeof MixARoute - } - '/mix/$a/$b/$c': { - id: '/mix/$a/$b/$c' - path: '/$c' - fullPath: '/mix/$a/$b/$c' - preLoaderRoute: typeof MixABCRouteImport - parentRoute: typeof MixABRoute - } - } -} - -interface MixABRouteChildren { - MixABCRoute: typeof MixABCRoute -} - -const MixABRouteChildren: MixABRouteChildren = { - MixABCRoute: MixABCRoute, -} - -const MixABRouteWithChildren = MixABRoute._addFileChildren(MixABRouteChildren) - -interface MixARouteChildren { - MixABRoute: typeof MixABRouteWithChildren -} - -const MixARouteChildren: MixARouteChildren = { - MixABRoute: MixABRouteWithChildren, -} - -const MixARouteWithChildren = MixARoute._addFileChildren(MixARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - MixARoute: MixARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/src/router.tsx b/benchmarks/ssr/scenarios/selective-ssr/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx deleted file mode 100644 index 1973ca20bb..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.$c.tsx b/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.$c.tsx deleted file mode 100644 index e3df06149d..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.$c.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -export const Route = createFileRoute('/mix/$a/$b/$c')({ - ssr: false, - loader: async ({ params }) => { - return { - marker: `level-c-loader-${params.c}`, - data: makeLevelData(`level-c-data-${params.c}`, 3), - } - }, - component: LevelCComponent, -}) - -function LevelCComponent() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return ( -
-

{`csr-rendered-${params.c}`}

-

{data.marker}

-
- ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.tsx b/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.tsx deleted file mode 100644 index 3fe26dd70e..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.$b.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -export const Route = createFileRoute('/mix/$a/$b')({ - ssr: 'data-only', - loader: async ({ params }) => { - return { - marker: `level-b-loader-${params.b}`, - data: makeLevelData(`level-b-data-${params.b}`, 2), - } - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return ( -
-

{`data-only-rendered-${params.b}`}

-

{data.marker}

- -
- ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.tsx b/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.tsx deleted file mode 100644 index a06c9ad1b9..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/src/routes/mix.$a.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -export const Route = createFileRoute('/mix/$a')({ - ssr: true, - loader: async ({ params }) => { - return makeLevelData(`level-a-loader-${params.a}`, 1) - }, - component: LevelAComponent, -}) - -function LevelAComponent() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return ( -
-

{`level-a-rendered-${params.a}`}

-

{data.items[0]?.name}

- -
- ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/tsconfig.json b/benchmarks/ssr/scenarios/selective-ssr/react/tsconfig.json deleted file mode 100644 index 399fe944f9..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../loaders/shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/react/vite.config.ts b/benchmarks/ssr/scenarios/selective-ssr/react/vite.config.ts deleted file mode 100644 index 70c67cff81..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr selective-ssr (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts b/benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts deleted file mode 100644 index 5b2530ccab..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/shared-bench.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { makeLevelData } from '../loaders/shared-data' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const selectiveLoopTotalRequests = 32 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildSelectiveRequest(random: () => number) { - const a = randomSegment(random) - const b = randomSegment(random) - const c = randomSegment(random) - - return new Request(`http://localhost/mix/${a}/${b}/${c}`, requestInit) -} - -export async function assertSelectiveSanity(handler: StartRequestHandler) { - const a = 'a-sanity' - const b = 'b-sanity' - const c = 'c-sanity' - const response = await handler.fetch( - new Request(`http://localhost/mix/${a}/${b}/${c}`, requestInit), - ) - const body = await response.text() - const levelARenderedMarker = `level-a-rendered-${a}` - const levelALoaderMarker = makeLevelData(`level-a-loader-${a}`, 1).items[0] - ?.name - const dataOnlyRenderedMarker = `data-only-rendered-${b}` - const levelBLoaderMarker = `level-b-loader-${b}` - const csrRenderedMarker = `csr-rendered-${c}` - const levelCLoaderMarker = `level-c-loader-${c}` - - if (response.status !== 200) { - throw new Error( - `Expected setup request status 200, received ${response.status}`, - ) - } - - if (!body.includes(levelARenderedMarker)) { - throw new Error( - 'Expected setup response to include level-a rendered content', - ) - } - - if (!levelALoaderMarker || !body.includes(levelALoaderMarker)) { - throw new Error('Expected setup response to include level-a loader content') - } - - if (body.includes(dataOnlyRenderedMarker)) { - throw new Error( - 'Expected data-only route component to be absent from SSR HTML', - ) - } - - const hydrationIndex = body.indexOf('$_TSR') - - if (hydrationIndex === -1) { - throw new Error('Expected setup response to include the dehydration marker') - } - - if (!body.slice(hydrationIndex).includes(levelBLoaderMarker)) { - throw new Error('Expected level-b loader marker in the dehydration payload') - } - - if (body.includes(csrRenderedMarker)) { - throw new Error('Expected csr route component to be absent from SSR HTML') - } - - if (body.includes(levelCLoaderMarker)) { - throw new Error('Expected level-c loader marker to be absent from SSR HTML') - } -} - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runSelectiveLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: selectiveLoopTotalRequests, - buildRequest: buildSelectiveRequest, - }) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/project.json b/benchmarks/ssr/scenarios/selective-ssr/solid/project.json deleted file mode 100644 index 358cc97323..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-selective-ssr-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts b/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts deleted file mode 100644 index 76265397ab..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSelectiveSanity, - benchOptions, - runSelectiveLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSelectiveSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr selective (solid)', async () => - runSelectiveLoop(handler), - ).run(benchOptions) -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/selective-ssr/solid/src/routeTree.gen.ts deleted file mode 100644 index 22560063f6..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 MixARouteImport } from './routes/mix.$a' -import { Route as MixABRouteImport } from './routes/mix.$a.$b' -import { Route as MixABCRouteImport } from './routes/mix.$a.$b.$c' - -const MixARoute = MixARouteImport.update({ - id: '/mix/$a', - path: '/mix/$a', - getParentRoute: () => rootRouteImport, -} as any) -const MixABRoute = MixABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => MixARoute, -} as any) -const MixABCRoute = MixABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => MixABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRoutesByTo { - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - id: '__root__' | '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - MixARoute: typeof MixARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/mix/$a': { - id: '/mix/$a' - path: '/mix/$a' - fullPath: '/mix/$a' - preLoaderRoute: typeof MixARouteImport - parentRoute: typeof rootRouteImport - } - '/mix/$a/$b': { - id: '/mix/$a/$b' - path: '/$b' - fullPath: '/mix/$a/$b' - preLoaderRoute: typeof MixABRouteImport - parentRoute: typeof MixARoute - } - '/mix/$a/$b/$c': { - id: '/mix/$a/$b/$c' - path: '/$c' - fullPath: '/mix/$a/$b/$c' - preLoaderRoute: typeof MixABCRouteImport - parentRoute: typeof MixABRoute - } - } -} - -interface MixABRouteChildren { - MixABCRoute: typeof MixABCRoute -} - -const MixABRouteChildren: MixABRouteChildren = { - MixABCRoute: MixABCRoute, -} - -const MixABRouteWithChildren = MixABRoute._addFileChildren(MixABRouteChildren) - -interface MixARouteChildren { - MixABRoute: typeof MixABRouteWithChildren -} - -const MixARouteChildren: MixARouteChildren = { - MixABRoute: MixABRouteWithChildren, -} - -const MixARouteWithChildren = MixARoute._addFileChildren(MixARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - MixARoute: MixARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/src/router.tsx b/benchmarks/ssr/scenarios/selective-ssr/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/__root.tsx deleted file mode 100644 index 15de858e78..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.$c.tsx b/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.$c.tsx deleted file mode 100644 index f6a85bfdc2..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.$c.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -export const Route = createFileRoute('/mix/$a/$b/$c')({ - ssr: false, - loader: async ({ params }) => { - return { - marker: `level-c-loader-${params.c}`, - data: makeLevelData(`level-c-data-${params.c}`, 3), - } - }, - component: LevelCComponent, -}) - -function LevelCComponent() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return ( -
-

{`csr-rendered-${params().c}`}

-

{data().marker}

-
- ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.tsx b/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.tsx deleted file mode 100644 index f735b1395f..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.$b.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -export const Route = createFileRoute('/mix/$a/$b')({ - ssr: 'data-only', - loader: async ({ params }) => { - return { - marker: `level-b-loader-${params.b}`, - data: makeLevelData(`level-b-data-${params.b}`, 2), - } - }, - component: LevelBComponent, -}) - -function LevelBComponent() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return ( -
-

{`data-only-rendered-${params().b}`}

-

{data().marker}

- -
- ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.tsx b/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.tsx deleted file mode 100644 index c8c80a7a6d..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/src/routes/mix.$a.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -export const Route = createFileRoute('/mix/$a')({ - ssr: true, - loader: async ({ params }) => { - return makeLevelData(`level-a-loader-${params.a}`, 1) - }, - component: LevelAComponent, -}) - -function LevelAComponent() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return ( -
-

{`level-a-rendered-${params().a}`}

-

{data().items[0]?.name}

- -
- ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/tsconfig.json b/benchmarks/ssr/scenarios/selective-ssr/solid/tsconfig.json deleted file mode 100644 index f386c3f996..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../loaders/shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/solid/vite.config.ts b/benchmarks/ssr/scenarios/selective-ssr/solid/vite.config.ts deleted file mode 100644 index 2c0042c1ed..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr selective-ssr (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/project.json b/benchmarks/ssr/scenarios/selective-ssr/vue/project.json deleted file mode 100644 index 9ff4d99323..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-selective-ssr-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts b/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts deleted file mode 100644 index ff60341b27..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSelectiveSanity, - benchOptions, - runSelectiveLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSelectiveSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr selective (vue)', async () => runSelectiveLoop(handler)).run( - benchOptions, - ) -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/selective-ssr/vue/src/routeTree.gen.ts deleted file mode 100644 index b77209b48b..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* 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 MixARouteImport } from './routes/mix.$a' -import { Route as MixABRouteImport } from './routes/mix.$a.$b' -import { Route as MixABCRouteImport } from './routes/mix.$a.$b.$c' - -const MixARoute = MixARouteImport.update({ - id: '/mix/$a', - path: '/mix/$a', - getParentRoute: () => rootRouteImport, -} as any) -const MixABRoute = MixABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => MixARoute, -} as any) -const MixABCRoute = MixABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => MixABRoute, -} as any) - -export interface FileRoutesByFullPath { - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRoutesByTo { - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/mix/$a': typeof MixARouteWithChildren - '/mix/$a/$b': typeof MixABRouteWithChildren - '/mix/$a/$b/$c': typeof MixABCRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - fileRoutesByTo: FileRoutesByTo - to: '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - id: '__root__' | '/mix/$a' | '/mix/$a/$b' | '/mix/$a/$b/$c' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - MixARoute: typeof MixARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/mix/$a': { - id: '/mix/$a' - path: '/mix/$a' - fullPath: '/mix/$a' - preLoaderRoute: typeof MixARouteImport - parentRoute: typeof rootRouteImport - } - '/mix/$a/$b': { - id: '/mix/$a/$b' - path: '/$b' - fullPath: '/mix/$a/$b' - preLoaderRoute: typeof MixABRouteImport - parentRoute: typeof MixARoute - } - '/mix/$a/$b/$c': { - id: '/mix/$a/$b/$c' - path: '/$c' - fullPath: '/mix/$a/$b/$c' - preLoaderRoute: typeof MixABCRouteImport - parentRoute: typeof MixABRoute - } - } -} - -interface MixABRouteChildren { - MixABCRoute: typeof MixABCRoute -} - -const MixABRouteChildren: MixABRouteChildren = { - MixABCRoute: MixABCRoute, -} - -const MixABRouteWithChildren = MixABRoute._addFileChildren(MixABRouteChildren) - -interface MixARouteChildren { - MixABRoute: typeof MixABRouteWithChildren -} - -const MixARouteChildren: MixARouteChildren = { - MixABRoute: MixABRouteWithChildren, -} - -const MixARouteWithChildren = MixARoute._addFileChildren(MixARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - MixARoute: MixARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/src/router.tsx b/benchmarks/ssr/scenarios/selective-ssr/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/__root.tsx deleted file mode 100644 index 4b03519823..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.$c.tsx b/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.$c.tsx deleted file mode 100644 index 8ae7d468f1..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.$c.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -const LevelCComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return () => ( -
-

{`csr-rendered-${params.value.c}`}

-

{data.value.marker}

-
- ) - }, -}) - -export const Route = createFileRoute('/mix/$a/$b/$c')({ - ssr: false, - loader: async ({ params }) => { - return { - marker: `level-c-loader-${params.c}`, - data: makeLevelData(`level-c-data-${params.c}`, 3), - } - }, - component: LevelCComponent, -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.tsx b/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.tsx deleted file mode 100644 index c10751489e..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.$b.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -const LevelBComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return () => ( -
-

{`data-only-rendered-${params.value.b}`}

-

{data.value.marker}

- -
- ) - }, -}) - -export const Route = createFileRoute('/mix/$a/$b')({ - ssr: 'data-only', - loader: async ({ params }) => { - return { - marker: `level-b-loader-${params.b}`, - data: makeLevelData(`level-b-data-${params.b}`, 2), - } - }, - component: LevelBComponent, -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.tsx b/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.tsx deleted file mode 100644 index c96165c6d6..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/src/routes/mix.$a.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { defineComponent } from 'vue' -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { makeLevelData } from '../../../../loaders/shared-data' - -const LevelAComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - const params = Route.useParams() - - return () => ( -
-

{`level-a-rendered-${params.value.a}`}

-

{data.value.items[0]?.name}

- -
- ) - }, -}) - -export const Route = createFileRoute('/mix/$a')({ - ssr: true, - loader: async ({ params }) => { - return makeLevelData(`level-a-loader-${params.a}`, 1) - }, - component: LevelAComponent, -}) diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/tsconfig.json b/benchmarks/ssr/scenarios/selective-ssr/vue/tsconfig.json deleted file mode 100644 index 3f2809bd5a..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../../loaders/shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/selective-ssr/vue/vite.config.ts b/benchmarks/ssr/scenarios/selective-ssr/vue/vite.config.ts deleted file mode 100644 index 09bb36cb0b..0000000000 --- a/benchmarks/ssr/scenarios/selective-ssr/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr selective-ssr (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/serialization/react/project.json b/benchmarks/ssr/scenarios/serialization/react/project.json deleted file mode 100644 index 652f87cb44..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-serialization-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts b/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts deleted file mode 100644 index 8be07d2643..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSerializationScenario, - runRichSerializationLoop, - serializationBenchOptions, -} from '../shared-bench' -import type { StartRequestHandler } from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSerializationScenario(handler) - -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 deleted file mode 100644 index c70fddc6c4..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/speed.dehydrate-plain-control.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSerializationScenario, - runPlainSerializationLoop, - serializationBenchOptions, -} from '../shared-bench' -import type { StartRequestHandler } from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSerializationScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr dehydrate plain control (react)', async () => - runPlainSerializationLoop(handler), - ).run(serializationBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts deleted file mode 100644 index 49bdbd036b..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/routeTree.gen.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 PlainIdRouteImport } from './routes/plain.$id' -import { Route as RichIdRouteImport } from './routes/rich.$id' - -const PlainIdRoute = PlainIdRouteImport.update({ - id: '/plain/$id', - path: '/plain/$id', - getParentRoute: () => rootRouteImport, -} as any) -const RichIdRoute = RichIdRouteImport.update({ - id: '/rich/$id', - path: '/rich/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRoutesByTo { - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/plain/$id' | '/rich/$id' - fileRoutesByTo: FileRoutesByTo - to: '/plain/$id' | '/rich/$id' - id: '__root__' | '/plain/$id' | '/rich/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - PlainIdRoute: typeof PlainIdRoute - RichIdRoute: typeof RichIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/plain/$id': { - id: '/plain/$id' - path: '/plain/$id' - fullPath: '/plain/$id' - preLoaderRoute: typeof PlainIdRouteImport - parentRoute: typeof rootRouteImport - } - '/rich/$id': { - id: '/rich/$id' - path: '/rich/$id' - fullPath: '/rich/$id' - preLoaderRoute: typeof RichIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - PlainIdRoute: PlainIdRoute, - RichIdRoute: RichIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { startInstance } from './start.tsx' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - config: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/serialization/react/src/router.tsx b/benchmarks/ssr/scenarios/serialization/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/serialization/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/serialization/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/serialization/react/src/routes/plain.$id.tsx b/benchmarks/ssr/scenarios/serialization/react/src/routes/plain.$id.tsx deleted file mode 100644 index 88a8a0e11f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/routes/plain.$id.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { makePlainSerializationData } from '../../../shared-data' - -export const Route = createFileRoute('/plain/$id')({ - loader: ({ params }) => makePlainSerializationData(params.id), - component: PlainComponent, -}) - -function PlainComponent() { - const data = Route.useLoaderData() - const firstMapEntry = data.lookup[0]?.[1] - const firstTag = data.tags[0] - - return ( -
-

{data.label}

-

{data.createdAt}

-

{firstMapEntry?.label}

-

{firstTag}

-

{data.count}

-

{data.nested[0]?.id}

-

{data.points[0]?.label}

-

{data.problem.message}

-
- ) -} diff --git a/benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx b/benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx deleted file mode 100644 index a9bb264c48..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/routes/rich.$id.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { makeRichSerializationData } from '../../../shared-data' - -export const Route = createFileRoute('/rich/$id')({ - loader: ({ params }) => makeRichSerializationData(params.id), - component: RichComponent, -}) - -function RichComponent() { - const data = Route.useLoaderData() - const firstMapEntry = data.lookup.get('k0') - const firstTag = Array.from(data.tags)[0] - - return ( -
-

{data.label}

-

{data.createdAt.toISOString()}

-

{firstMapEntry?.label}

-

{firstTag}

-

{data.count.toString()}

-

{data.nested[0]?.id}

-

{data.points[0]?.label}

-

{data.problem.message}

-
- ) -} diff --git a/benchmarks/ssr/scenarios/serialization/react/src/serialization.ts b/benchmarks/ssr/scenarios/serialization/react/src/serialization.ts deleted file mode 100644 index 0a73c69be1..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/serialization.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createSerializationAdapter } from '@tanstack/react-router' -import { BenchPoint, benchPointAdapterKey } from '../../shared-data' - -export const benchPointAdapter = createSerializationAdapter({ - key: benchPointAdapterKey, - test: (value): value is BenchPoint => value instanceof BenchPoint, - toSerializable: (point) => ({ x: point.x, y: point.y }), - fromSerializable: (value: { x: number; y: number }) => - new BenchPoint(value.x, value.y), -}) diff --git a/benchmarks/ssr/scenarios/serialization/react/src/start.tsx b/benchmarks/ssr/scenarios/serialization/react/src/start.tsx deleted file mode 100644 index ea4513df4d..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/src/start.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createStart } from '@tanstack/react-start' -import { benchPointAdapter } from './serialization' - -export const startInstance = createStart(() => { - return { - defaultSsr: true, - serializationAdapters: [benchPointAdapter], - } -}) diff --git a/benchmarks/ssr/scenarios/serialization/react/tsconfig.json b/benchmarks/ssr/scenarios/serialization/react/tsconfig.json deleted file mode 100644 index 59499356d6..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-bench.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/serialization/react/vite.config.ts b/benchmarks/ssr/scenarios/serialization/react/vite.config.ts deleted file mode 100644 index 64568ccb7e..0000000000 --- a/benchmarks/ssr/scenarios/serialization/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr serialization (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/serialization/shared-bench.ts b/benchmarks/ssr/scenarios/serialization/shared-bench.ts deleted file mode 100644 index 25ed478f03..0000000000 --- a/benchmarks/ssr/scenarios/serialization/shared-bench.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { benchPointAdapterKey, richDateIso } from './shared-data' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const richSerializationLoopTotalRequests = 32 -const plainSerializationLoopTotalRequests = 32 - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit - -function buildSerializationRequest( - route: 'plain' | 'rich', - random: () => number, - index: number, -) { - const suffix = index.toString(36) - const id = `${randomSegment(random)}-${suffix}` - - return new Request(`http://localhost/${route}/${id}`, requestInit) -} - -async function fetchScenarioBody( - handler: StartRequestHandler, - route: 'plain' | 'rich', -) { - const response = await handler.fetch( - new Request(`http://localhost/${route}/sanity`, requestInit), - ) - const body = await response.text() - - if (response.status !== 200) { - throw new Error( - `Expected ${route} sanity request status 200, received ${response.status}: ${body}`, - ) - } - - if (!body.includes('$_TSR')) { - throw new Error(`Expected ${route} response to include dehydration marker`) - } - - return body -} - -function assertIncludes(body: string, marker: string, label: string) { - if (!body.includes(marker)) { - throw new Error(`Expected ${label} response to include ${marker}`) - } -} - -function assertExcludes(body: string, marker: string, label: string) { - if (body.includes(marker)) { - throw new Error(`Expected ${label} response not to include ${marker}`) - } -} - -export async function assertSerializationScenario( - handler: StartRequestHandler, -) { - const richBody = await fetchScenarioBody(handler, 'rich') - const plainBody = await fetchScenarioBody(handler, 'plain') - - assertIncludes(richBody, 'rich-sanity', 'rich') - assertIncludes(richBody, benchPointAdapterKey, 'rich') - assertIncludes(richBody, richDateIso, 'rich') - assertIncludes(richBody, 'new Date', 'rich') - assertIncludes(richBody, 'new Map', 'rich') - assertIncludes(richBody, 'new Error', 'rich') - - assertIncludes(plainBody, 'plain-sanity', 'plain') - assertExcludes(plainBody, benchPointAdapterKey, 'plain') - assertExcludes(plainBody, 'new Date', 'plain') - assertExcludes(plainBody, 'new Map', 'plain') - assertExcludes(plainBody, 'new Error', 'plain') -} - -export const serializationBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runRichSerializationLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: richSerializationLoopTotalRequests, - buildRequest: (random, index) => - buildSerializationRequest('rich', random, index), - }) -} - -export function runPlainSerializationLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: plainSerializationLoopTotalRequests, - buildRequest: (random, index) => - buildSerializationRequest('plain', random, index), - }) -} diff --git a/benchmarks/ssr/scenarios/serialization/shared-data.ts b/benchmarks/ssr/scenarios/serialization/shared-data.ts deleted file mode 100644 index dc1dc90b1f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/shared-data.ts +++ /dev/null @@ -1,101 +0,0 @@ -export class BenchPoint { - constructor( - public x: number, - public y: number, - ) {} - - get label() { - return `${this.x}:${this.y}` - } -} - -export interface PlainSerializationPayload { - label: string - createdAt: string - lookup: Array<[string, { index: number; label: string }]> - tags: Array - count: string - nested: Array<{ id: string; values: Array; flag: boolean }> - points: Array<{ x: number; y: number; label: string }> - problem: { message: string } -} - -export interface RichSerializationPayload { - label: string - createdAt: Date - lookup: Map - tags: Set - count: bigint - nested: Array<{ id: string; values: Array; flag: boolean }> - points: Array - problem: Error -} - -export const benchPointAdapterKey = '$bench/point' -export const richDateIso = '2024-02-03T04:05:06.000Z' - -function makeNested(id: string) { - return Array.from({ length: 16 }, (_, index) => ({ - id: `${id}-nested-${index}`, - values: [index, index + 1, index + 2], - flag: index % 2 === 0, - })) -} - -function makeLookup( - id: string, -): Array<[string, { index: number; label: string }]> { - return Array.from( - { length: 8 }, - (_, index): [string, { index: number; label: string }] => { - const key = `k${index}` - - return [key, { index, label: `${id}-map-${index}` }] - }, - ) -} - -function makeTags(id: string) { - return Array.from({ length: 8 }, (_, index) => `${id}-tag-${index}`) -} - -function makePlainPoints() { - return Array.from({ length: 4 }, (_, index) => { - const point = new BenchPoint(index * 10, index * 10 + 5) - - return { x: point.x, y: point.y, label: point.label } - }) -} - -export function makeRichSerializationData( - id: string, -): RichSerializationPayload { - return { - label: `rich-${id}`, - createdAt: new Date(richDateIso), - lookup: new Map(makeLookup(id)), - tags: new Set(makeTags(id)), - count: 9_007_199_254_740_993n, - nested: makeNested(id), - points: Array.from( - { length: 4 }, - (_, index) => new BenchPoint(index * 10, index * 10 + 5), - ), - problem: new Error(`rich-problem-${id}`), - } -} - -export function makePlainSerializationData( - id: string, -): PlainSerializationPayload { - return { - label: `plain-${id}`, - createdAt: richDateIso, - lookup: makeLookup(id), - tags: makeTags(id), - count: '9007199254740993', - nested: makeNested(id), - points: makePlainPoints(), - problem: { message: `rich-problem-${id}` }, - } -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/project.json b/benchmarks/ssr/scenarios/serialization/solid/project.json deleted file mode 100644 index 80a4b146ac..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-serialization-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts b/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts deleted file mode 100644 index 70bda8c7af..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSerializationScenario, - runRichSerializationLoop, - serializationBenchOptions, -} from '../shared-bench' -import type { StartRequestHandler } from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSerializationScenario(handler) - -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 deleted file mode 100644 index d7ccb16f6f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/speed.dehydrate-plain-control.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSerializationScenario, - runPlainSerializationLoop, - serializationBenchOptions, -} from '../shared-bench' -import type { StartRequestHandler } from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSerializationScenario(handler) - -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 deleted file mode 100644 index b9e25f918e..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 PlainIdRouteImport } from './routes/plain.$id' -import { Route as RichIdRouteImport } from './routes/rich.$id' - -const PlainIdRoute = PlainIdRouteImport.update({ - id: '/plain/$id', - path: '/plain/$id', - getParentRoute: () => rootRouteImport, -} as any) -const RichIdRoute = RichIdRouteImport.update({ - id: '/rich/$id', - path: '/rich/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRoutesByTo { - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/plain/$id' | '/rich/$id' - fileRoutesByTo: FileRoutesByTo - to: '/plain/$id' | '/rich/$id' - id: '__root__' | '/plain/$id' | '/rich/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - PlainIdRoute: typeof PlainIdRoute - RichIdRoute: typeof RichIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/plain/$id': { - id: '/plain/$id' - path: '/plain/$id' - fullPath: '/plain/$id' - preLoaderRoute: typeof PlainIdRouteImport - parentRoute: typeof rootRouteImport - } - '/rich/$id': { - id: '/rich/$id' - path: '/rich/$id' - fullPath: '/rich/$id' - preLoaderRoute: typeof RichIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - PlainIdRoute: PlainIdRoute, - RichIdRoute: RichIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { startInstance } from './start.tsx' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - config: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/router.tsx b/benchmarks/ssr/scenarios/serialization/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/serialization/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/routes/plain.$id.tsx b/benchmarks/ssr/scenarios/serialization/solid/src/routes/plain.$id.tsx deleted file mode 100644 index c16f73dc3f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/routes/plain.$id.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { makePlainSerializationData } from '../../../shared-data' - -export const Route = createFileRoute('/plain/$id')({ - loader: ({ params }) => makePlainSerializationData(params.id), - component: PlainComponent, -}) - -function PlainComponent() { - const data = Route.useLoaderData() - const firstMapEntry = () => data().lookup[0]?.[1] - const firstTag = () => data().tags[0] - - return ( -
-

{data().label}

-

{data().createdAt}

-

{firstMapEntry()?.label}

-

{firstTag()}

-

{data().count}

-

{data().nested[0]?.id}

-

{data().points[0]?.label}

-

{data().problem.message}

-
- ) -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx b/benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx deleted file mode 100644 index e08b1e4834..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/routes/rich.$id.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { makeRichSerializationData } from '../../../shared-data' - -export const Route = createFileRoute('/rich/$id')({ - loader: ({ params }) => makeRichSerializationData(params.id), - component: RichComponent, -}) - -function RichComponent() { - const data = Route.useLoaderData() - const firstMapEntry = () => data().lookup.get('k0') - const firstTag = () => Array.from(data().tags)[0] - - return ( -
-

{data().label}

-

{data().createdAt.toISOString()}

-

{firstMapEntry()?.label}

-

{firstTag()}

-

{data().count.toString()}

-

{data().nested[0]?.id}

-

{data().points[0]?.label}

-

{data().problem.message}

-
- ) -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/serialization.ts b/benchmarks/ssr/scenarios/serialization/solid/src/serialization.ts deleted file mode 100644 index ae84f12c9f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/serialization.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createSerializationAdapter } from '@tanstack/solid-router' -import { BenchPoint, benchPointAdapterKey } from '../../shared-data' - -export const benchPointAdapter = createSerializationAdapter({ - key: benchPointAdapterKey, - test: (value): value is BenchPoint => value instanceof BenchPoint, - toSerializable: (point) => ({ x: point.x, y: point.y }), - fromSerializable: (value: { x: number; y: number }) => - new BenchPoint(value.x, value.y), -}) diff --git a/benchmarks/ssr/scenarios/serialization/solid/src/start.tsx b/benchmarks/ssr/scenarios/serialization/solid/src/start.tsx deleted file mode 100644 index a539f2b168..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/src/start.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createStart } from '@tanstack/solid-start' -import { benchPointAdapter } from './serialization' - -export const startInstance = createStart(() => { - return { - defaultSsr: true, - serializationAdapters: [benchPointAdapter], - } -}) diff --git a/benchmarks/ssr/scenarios/serialization/solid/tsconfig.json b/benchmarks/ssr/scenarios/serialization/solid/tsconfig.json deleted file mode 100644 index 3ea91b977f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-bench.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/serialization/solid/vite.config.ts b/benchmarks/ssr/scenarios/serialization/solid/vite.config.ts deleted file mode 100644 index db81e2ab74..0000000000 --- a/benchmarks/ssr/scenarios/serialization/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr serialization (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/serialization/vue/project.json b/benchmarks/ssr/scenarios/serialization/vue/project.json deleted file mode 100644 index 728b5c15cc..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-serialization-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts b/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts deleted file mode 100644 index 7f733dd601..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSerializationScenario, - runRichSerializationLoop, - serializationBenchOptions, -} from '../shared-bench' -import type { StartRequestHandler } from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSerializationScenario(handler) - -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 deleted file mode 100644 index 8efdeb6c79..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/speed.dehydrate-plain-control.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertSerializationScenario, - runPlainSerializationLoop, - serializationBenchOptions, -} from '../shared-bench' -import type { StartRequestHandler } from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertSerializationScenario(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr dehydrate plain control (vue)', async () => - runPlainSerializationLoop(handler), - ).run(serializationBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/serialization/vue/src/routeTree.gen.ts deleted file mode 100644 index cd7b0b449b..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* 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 PlainIdRouteImport } from './routes/plain.$id' -import { Route as RichIdRouteImport } from './routes/rich.$id' - -const PlainIdRoute = PlainIdRouteImport.update({ - id: '/plain/$id', - path: '/plain/$id', - getParentRoute: () => rootRouteImport, -} as any) -const RichIdRoute = RichIdRouteImport.update({ - id: '/rich/$id', - path: '/rich/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRoutesByTo { - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/plain/$id': typeof PlainIdRoute - '/rich/$id': typeof RichIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/plain/$id' | '/rich/$id' - fileRoutesByTo: FileRoutesByTo - to: '/plain/$id' | '/rich/$id' - id: '__root__' | '/plain/$id' | '/rich/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - PlainIdRoute: typeof PlainIdRoute - RichIdRoute: typeof RichIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/plain/$id': { - id: '/plain/$id' - path: '/plain/$id' - fullPath: '/plain/$id' - preLoaderRoute: typeof PlainIdRouteImport - parentRoute: typeof rootRouteImport - } - '/rich/$id': { - id: '/rich/$id' - path: '/rich/$id' - fullPath: '/rich/$id' - preLoaderRoute: typeof RichIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - PlainIdRoute: PlainIdRoute, - RichIdRoute: RichIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { startInstance } from './start.tsx' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - config: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/router.tsx b/benchmarks/ssr/scenarios/serialization/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/serialization/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/routes/plain.$id.tsx b/benchmarks/ssr/scenarios/serialization/vue/src/routes/plain.$id.tsx deleted file mode 100644 index 47fdeb971f..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/routes/plain.$id.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { makePlainSerializationData } from '../../../shared-data' - -const PlainComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.label}

-

{data.value.createdAt}

-

{data.value.lookup[0]?.[1].label}

-

{data.value.tags[0]}

-

{data.value.count}

-

{data.value.nested[0]?.id}

-

{data.value.points[0]?.label}

-

{data.value.problem.message}

-
- ) - }, -}) - -export const Route = createFileRoute('/plain/$id')({ - loader: ({ params }) => makePlainSerializationData(params.id), - component: PlainComponent, -}) diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/routes/rich.$id.tsx b/benchmarks/ssr/scenarios/serialization/vue/src/routes/rich.$id.tsx deleted file mode 100644 index 1ee86cefd3..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/routes/rich.$id.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { makeRichSerializationData } from '../../../shared-data' - -const RichComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
-

{data.value.label}

-

{data.value.createdAt.toISOString()}

-

{data.value.lookup.get('k0')?.label}

-

{Array.from(data.value.tags)[0]}

-

{data.value.count.toString()}

-

{data.value.nested[0]?.id}

-

{data.value.points[0]?.label}

-

{data.value.problem.message}

-
- ) - }, -}) - -export const Route = createFileRoute('/rich/$id')({ - loader: ({ params }) => makeRichSerializationData(params.id), - component: RichComponent, -}) diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/serialization.ts b/benchmarks/ssr/scenarios/serialization/vue/src/serialization.ts deleted file mode 100644 index f8b2d8cb43..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/serialization.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { createSerializationAdapter } from '@tanstack/vue-router' -import { BenchPoint, benchPointAdapterKey } from '../../shared-data' - -export const benchPointAdapter = createSerializationAdapter({ - key: benchPointAdapterKey, - test: (value): value is BenchPoint => value instanceof BenchPoint, - toSerializable: (point) => ({ x: point.x, y: point.y }), - fromSerializable: (value: { x: number; y: number }) => - new BenchPoint(value.x, value.y), -}) diff --git a/benchmarks/ssr/scenarios/serialization/vue/src/start.tsx b/benchmarks/ssr/scenarios/serialization/vue/src/start.tsx deleted file mode 100644 index ee27feb084..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/src/start.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createStart } from '@tanstack/vue-start' -import { benchPointAdapter } from './serialization' - -export const startInstance = createStart(() => { - return { - defaultSsr: true, - serializationAdapters: [benchPointAdapter], - } -}) diff --git a/benchmarks/ssr/scenarios/serialization/vue/tsconfig.json b/benchmarks/ssr/scenarios/serialization/vue/tsconfig.json deleted file mode 100644 index 5d8c7b5b62..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-bench.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/serialization/vue/vite.config.ts b/benchmarks/ssr/scenarios/serialization/vue/vite.config.ts deleted file mode 100644 index b89537fa18..0000000000 --- a/benchmarks/ssr/scenarios/serialization/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr serialization (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/bench.ts deleted file mode 100644 index 4274c724ca..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/bench.ts +++ /dev/null @@ -1,556 +0,0 @@ -import { toJSONAsync } from 'seroval' -import { - createDeterministicRandom, - randomSegment, - runRequestLoop, -} from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -type FnUrls = { - form: string - raw: string - stream: string -} - -type MultipartPayloadSpec = { - alpha: string - beta: string - gamma: string - fileName: string - fileContents: string -} - -type MultipartPayload = MultipartPayloadSpec & { - body: ArrayBuffer - contentType: string -} - -type QueryPayload = { - query: string - expectedBody: string -} - -type FrameStats = { - jsonFrames: number - chunkFrames: number - endFrames: number - errorFrames: number - chunkBytes: number -} - -export type ServerFnTransportBenchContext = { - urls: FnUrls - multipartPayloads: Array - rawPayloads: Array - streamPayloads: Array - rawExpectedBodiesByUrl: Map -} - -const benchmarkSeed = 0xdecafbad -const origin = 'http://localhost' -const tssContentTypeFramed = 'application/x-tss-framed' -const xTssSerialized = 'x-tss-serialized' -const xTssRawResponse = 'x-tss-raw' -const acceptHeader = `${tssContentTypeFramed}, application/x-ndjson, application/json` -const frameHeaderSize = 9 -const frameTypeJson = 0 -const frameTypeChunk = 1 -const frameTypeEnd = 2 -const frameTypeError = 3 -const streamChunkCount = 8 -const streamChunkSize = 1024 -const multipartFileSize = 1024 -const commonHeaders = { - 'x-tsr-serverFn': 'true', - 'sec-fetch-site': 'same-origin', - accept: acceptHeader, -} satisfies HeadersInit -const serverFnMultipartLoopTotalRequests = 128 -const serverFnRawResponseLoopTotalRequests = 176 -const serverFnRawStreamLoopTotalRequests = 112 - -export const serverFnTransportBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} as const - -function makeFixedSizeString(seed: string, size: number) { - let value = '' - - while (value.length < size) { - value += `${seed}:${value.length.toString(36)};` - } - - return value.slice(0, size) -} - -function createMultipartPayloadSpecs() { - const random = createDeterministicRandom(benchmarkSeed) - - return Array.from({ length: 10 }, (_, index): MultipartPayloadSpec => { - const alpha = `alpha-${index}-${randomSegment(random)}` - const beta = `beta-${index}-${randomSegment(random)}` - const gamma = `gamma-${index}-${randomSegment(random)}` - - return { - alpha, - beta, - gamma, - fileName: `bench-${index}.txt`, - fileContents: makeFixedSizeString( - `${alpha}:${beta}:${gamma}`, - multipartFileSize, - ), - } - }) -} - -async function createMultipartPayload( - spec: MultipartPayloadSpec, -): Promise { - const formData = new FormData() - formData.set('alpha', spec.alpha) - formData.set('beta', spec.beta) - formData.set('gamma', spec.gamma) - formData.set( - 'upload', - new File([spec.fileContents], spec.fileName, { type: 'text/plain' }), - ) - - const request = new Request(`${origin}/__multipart-encode`, { - method: 'POST', - body: formData, - }) - const contentType = request.headers.get('content-type') - - if (!contentType?.includes('multipart/form-data')) { - throw new Error(`Expected multipart content type, received ${contentType}`) - } - - return { - ...spec, - body: await request.arrayBuffer(), - contentType, - } -} - -async function createMultipartPayloads() { - return await Promise.all( - createMultipartPayloadSpecs().map((spec) => createMultipartPayload(spec)), - ) -} - -function createTransportInputs(prefix: string) { - const random = createDeterministicRandom(benchmarkSeed ^ prefix.length) - - return Array.from( - { length: 10 }, - (_, index) => - `${prefix}-${index}-${randomSegment(random)}-${randomSegment(random)}`, - ) -} - -async function createQueryPayloads( - inputs: Array, - expectedBody: (input: string) => string, -) { - return await Promise.all( - inputs.map(async (input): Promise => { - const body = JSON.stringify(await toJSONAsync({ data: input })) - const query = `?${new URLSearchParams({ payload: body })}` - - return { - query, - expectedBody: expectedBody(input), - } - }), - ) -} - -async function discoverUrls(handler: StartRequestHandler) { - const response = await handler.fetch(new Request(`${origin}/api/fn-urls`)) - - if (response.status === 404) { - throw new Error('URL discovery route returned 404 for /api/fn-urls') - } - - if (response.status !== 200) { - throw new Error( - `URL discovery failed with status ${response.status}: ${await response.text()}`, - ) - } - - const urls = (await response.json()) as Partial - - if ( - typeof urls.form !== 'string' || - typeof urls.raw !== 'string' || - typeof urls.stream !== 'string' - ) { - throw new Error( - `URL discovery returned invalid payload: ${JSON.stringify(urls)}`, - ) - } - - return { form: urls.form, raw: urls.raw, stream: urls.stream } -} - -function buildMultipartRequest( - urls: FnUrls, - payloads: Array, - index: number, -) { - const payload = payloads[index % payloads.length]! - - return new Request(`${origin}${urls.form}`, { - method: 'POST', - headers: { - ...commonHeaders, - 'content-type': payload.contentType, - }, - body: payload.body, - }) -} - -function buildRawResponseRequest( - urls: FnUrls, - payloads: Array, - index: number, -) { - const payload = payloads[index % payloads.length]! - - return new Request(`${origin}${urls.raw}${payload.query}`, { - method: 'GET', - headers: commonHeaders, - }) -} - -function buildRawStreamRequest( - urls: FnUrls, - payloads: Array, - index: number, -) { - const payload = payloads[index % payloads.length]! - - return new Request(`${origin}${urls.stream}${payload.query}`, { - method: 'GET', - headers: commonHeaders, - }) -} - -async function assertSerializedResponse({ - response, - label, -}: { - response: Response - label: string -}) { - const text = await response.text() - - if (response.status === 403) { - throw new Error( - `${label} sanity check failed with 403. Check CSRF headers.`, - ) - } - - if (response.status === 404) { - throw new Error( - `${label} sanity check failed with 404. The discovered server function URL is stale.`, - ) - } - - if (response.status !== 200) { - throw new Error( - `${label} sanity check failed with status ${response.status}: ${text}`, - ) - } - - if (!response.headers.get(xTssSerialized)) { - throw new Error(`${label} sanity check missing ${xTssSerialized} header`) - } - - return text -} - -function assertMultipartBody(text: string, payload: MultipartPayload) { - const expectedMarkers = [ - payload.alpha, - payload.beta, - payload.gamma, - payload.fileName, - 'fileSize', - multipartFileSize.toString(), - ] - - for (const marker of expectedMarkers) { - if (!text.includes(marker)) { - throw new Error( - `Multipart sanity check missing marker ${marker}: ${text}`, - ) - } - } -} - -async function assertRawResponse(response: Response, expectedBody: string) { - const text = await response.text() - - if (response.status !== 200) { - throw new Error( - `raw-response sanity check failed with status ${response.status}: ${text}`, - ) - } - - if (response.headers.get(xTssRawResponse) !== 'true') { - throw new Error( - `raw-response sanity check missing ${xTssRawResponse} header`, - ) - } - - if (text !== expectedBody) { - throw new Error( - `raw-response sanity check expected ${expectedBody}, received ${text}`, - ) - } -} - -function readUint32(bytes: Uint8Array, offset: number) { - return ( - (((bytes[offset] ?? 0) << 24) | - ((bytes[offset + 1] ?? 0) << 16) | - ((bytes[offset + 2] ?? 0) << 8) | - (bytes[offset + 3] ?? 0)) >>> - 0 - ) -} - -function decodeFrameStats(buffer: ArrayBuffer): FrameStats { - const bytes = new Uint8Array(buffer) - let offset = 0 - const stats: FrameStats = { - jsonFrames: 0, - chunkFrames: 0, - endFrames: 0, - errorFrames: 0, - chunkBytes: 0, - } - - while (offset < bytes.length) { - if (offset + frameHeaderSize > bytes.length) { - throw new Error(`Incomplete frame header at byte ${offset}`) - } - - const type = bytes[offset] - const length = readUint32(bytes, offset + 5) - const payloadStart = offset + frameHeaderSize - const payloadEnd = payloadStart + length - - if (payloadEnd > bytes.length) { - throw new Error(`Incomplete frame payload at byte ${offset}`) - } - - if (type === frameTypeJson) { - stats.jsonFrames++ - } else if (type === frameTypeChunk) { - stats.chunkFrames++ - stats.chunkBytes += length - } else if (type === frameTypeEnd) { - stats.endFrames++ - } else if (type === frameTypeError) { - stats.errorFrames++ - } else { - throw new Error(`Unknown frame type ${type} at byte ${offset}`) - } - - offset = payloadEnd - } - - return stats -} - -async function assertRawStream(response: Response) { - if (response.status !== 200) { - throw new Error( - `raw-stream sanity check failed with status ${response.status}: ${await response.text()}`, - ) - } - - const contentType = response.headers.get('content-type') - if (!contentType?.includes(tssContentTypeFramed)) { - throw new Error( - `raw-stream sanity check expected framed content type, received ${contentType}`, - ) - } - - if (!response.headers.get(xTssSerialized)) { - throw new Error(`raw-stream sanity check missing ${xTssSerialized} header`) - } - - const stats = decodeFrameStats(await response.arrayBuffer()) - const expectedChunkBytes = streamChunkCount * streamChunkSize - - if (stats.jsonFrames < 1) { - throw new Error('raw-stream sanity check expected at least one JSON frame') - } - - if (stats.chunkFrames !== streamChunkCount) { - throw new Error( - `raw-stream sanity check expected ${streamChunkCount} chunk frames, received ${stats.chunkFrames}`, - ) - } - - if (stats.endFrames !== 1) { - throw new Error( - `raw-stream sanity check expected one END frame, received ${stats.endFrames}`, - ) - } - - if (stats.errorFrames !== 0) { - throw new Error( - `raw-stream sanity check received ${stats.errorFrames} ERROR frames`, - ) - } - - if (stats.chunkBytes !== expectedChunkBytes) { - throw new Error( - `raw-stream sanity check expected ${expectedChunkBytes} chunk bytes, received ${stats.chunkBytes}`, - ) - } -} - -function validateStatus(response: Response, request: Request) { - if (response.status !== 200) { - throw new Error( - `Request failed with non-200 status ${response.status} (${request.url})`, - ) - } -} - -function validateSerializedResponse(response: Response, request: Request) { - validateStatus(response, request) - - if (!response.headers.get(xTssSerialized)) { - throw new Error(`Request missing ${xTssSerialized} header (${request.url})`) - } -} - -function validateRawResponse(response: Response, request: Request) { - validateStatus(response, request) - - if (response.headers.get(xTssRawResponse) !== 'true') { - throw new Error( - `Request missing ${xTssRawResponse} header (${request.url})`, - ) - } -} - -function validateRawStreamResponse(response: Response, request: Request) { - validateSerializedResponse(response, request) - - const contentType = response.headers.get('content-type') - if (!contentType?.includes(tssContentTypeFramed)) { - throw new Error( - `Request missing framed content type (${request.url}): ${contentType}`, - ) - } -} - -export async function setupServerFnTransportBench( - handler: StartRequestHandler, -) { - const urls = await discoverUrls(handler) - const multipartPayloads = await createMultipartPayloads() - const rawPayloads = await createQueryPayloads( - createTransportInputs('raw'), - (input) => `raw-${input}`, - ) - const streamPayloads = await createQueryPayloads( - createTransportInputs('stream'), - (input) => `stream-${input}`, - ) - const rawExpectedBodiesByUrl = new Map( - rawPayloads.map((payload) => [ - `${origin}${urls.raw}${payload.query}`, - payload.expectedBody, - ]), - ) - - return { - urls, - multipartPayloads, - rawPayloads, - streamPayloads, - rawExpectedBodiesByUrl, - } -} - -export async function assertServerFnTransportScenario( - handler: StartRequestHandler, - context: ServerFnTransportBenchContext, -) { - const multipartPayload = context.multipartPayloads[0]! - const multipartText = await assertSerializedResponse({ - response: await handler.fetch( - buildMultipartRequest(context.urls, context.multipartPayloads, 0), - ), - label: 'multipart', - }) - assertMultipartBody(multipartText, multipartPayload) - - await assertRawResponse( - await handler.fetch( - buildRawResponseRequest(context.urls, context.rawPayloads, 0), - ), - context.rawPayloads[0]!.expectedBody, - ) - - await assertRawStream( - await handler.fetch( - buildRawStreamRequest(context.urls, context.streamPayloads, 0), - ), - ) -} - -export function runServerFnMultipartRequestLoop( - handler: StartRequestHandler, - context: ServerFnTransportBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnMultipartLoopTotalRequests, - buildRequest: (_random, index) => - buildMultipartRequest(context.urls, context.multipartPayloads, index), - validateResponse: validateSerializedResponse, - }) -} - -export function runServerFnRawResponseRequestLoop( - handler: StartRequestHandler, - context: ServerFnTransportBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnRawResponseLoopTotalRequests, - buildRequest: (_random, index) => - buildRawResponseRequest(context.urls, context.rawPayloads, index), - validateResponse: validateRawResponse, - }) -} - -export function runServerFnRawStreamRequestLoop( - handler: StartRequestHandler, - context: ServerFnTransportBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnRawStreamLoopTotalRequests, - buildRequest: (_random, index) => - buildRawStreamRequest(context.urls, context.streamPayloads, index), - validateResponse: validateRawStreamResponse, - }) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/project.json b/benchmarks/ssr/scenarios/server-fn-transport/react/project.json deleted file mode 100644 index a3012549ca..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-fn-transport-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts deleted file mode 100644 index fa80cdb690..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnMultipartRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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 deleted file mode 100644 index fd535ee313..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-response.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnRawResponseRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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 deleted file mode 100644 index 8fbce405dd..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/speed.server-fn-raw-stream.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnRawStreamRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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/react/src/fns.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/src/fns.ts deleted file mode 100644 index 79ecb50e87..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/src/fns.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { RawStream, createServerFn } from '@tanstack/react-start' - -type FormEchoData = { - alpha: string - beta: string - gamma: string - upload: File -} - -const streamChunkCount = 8 -const streamChunkSize = 1024 - -function getStringField(formData: FormData, field: string) { - const value = formData.get(field) - - if (typeof value !== 'string') { - throw new Error(`Expected ${field} to be a string`) - } - - return value -} - -function validateFormData(input: unknown): FormEchoData { - if (!(input instanceof FormData)) { - throw new Error('Expected FormData input') - } - - const upload = input.get('upload') - if (!(upload instanceof File)) { - throw new Error('Expected upload to be a File') - } - - return { - alpha: getStringField(input, 'alpha'), - beta: getStringField(input, 'beta'), - gamma: getStringField(input, 'gamma'), - upload, - } -} - -function validateString(input: unknown) { - if (typeof input !== 'string' || input.length === 0) { - throw new Error('Expected non-empty string input') - } - - return input -} - -function createDeterministicStream(seed: string) { - return new ReadableStream({ - start(controller) { - for (let chunkIndex = 0; chunkIndex < streamChunkCount; chunkIndex++) { - const chunk = new Uint8Array(streamChunkSize) - - for (let byteIndex = 0; byteIndex < chunk.length; byteIndex++) { - chunk[byteIndex] = - (seed.charCodeAt(byteIndex % seed.length) + - byteIndex + - chunkIndex) & - 0xff - } - - controller.enqueue(chunk) - } - - controller.close() - }, - }) -} - -export const formEcho = createServerFn({ method: 'POST' }) - .validator(validateFormData) - .handler(async ({ data }) => { - const contents = await data.upload.text() - - return { - alpha: data.alpha, - beta: data.beta, - gamma: data.gamma, - fileName: data.upload.name, - fileSize: data.upload.size, - filePreview: contents.slice(0, 32), - } - }) - -export const rawResp = createServerFn({ method: 'GET' }) - .validator(validateString) - .handler(({ data }) => { - return new Response(`raw-${data}`, { - headers: { 'content-type': 'text/plain' }, - }) - }) - -export const streamOut = createServerFn({ method: 'GET' }) - .validator(validateString) - .handler(({ data }) => { - return { - label: `stream-${data}`, - data: new RawStream(createDeterministicStream(data)), - } - }) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/src/routeTree.gen.ts deleted file mode 100644 index 10e933da3d..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiFnUrlsRouteImport } from './routes/api.fn-urls' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' - id: '__root__' | '/' | '/api/fn-urls' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/src/router.tsx b/benchmarks/ssr/scenarios/server-fn-transport/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/api.fn-urls.ts deleted file mode 100644 index 02260e5098..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { formEcho, rawResp, streamOut } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - form: formEcho.url, - raw: rawResp.url, - stream: streamOut.url, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/index.tsx deleted file mode 100644 index baa0026378..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { formEcho, rawResp, streamOut } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- server-fn transport benchmark -
- ) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/tsconfig.json b/benchmarks/ssr/scenarios/server-fn-transport/react/tsconfig.json deleted file mode 100644 index 4f3cc314af..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/react/vite.config.ts b/benchmarks/ssr/scenarios/server-fn-transport/react/vite.config.ts deleted file mode 100644 index c37fde0c4b..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-fn-transport (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/project.json b/benchmarks/ssr/scenarios/server-fn-transport/solid/project.json deleted file mode 100644 index 16fc151b11..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-fn-transport-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts deleted file mode 100644 index adac07cb22..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnMultipartRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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 deleted file mode 100644 index 843a4c97ce..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-response.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnRawResponseRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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 deleted file mode 100644 index aa24d55e79..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/speed.server-fn-raw-stream.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnRawStreamRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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/solid/src/fns.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/src/fns.ts deleted file mode 100644 index 3c586fa2ee..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/fns.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { RawStream, createServerFn } from '@tanstack/solid-start' - -type FormEchoData = { - alpha: string - beta: string - gamma: string - upload: File -} - -const streamChunkCount = 8 -const streamChunkSize = 1024 - -function getStringField(formData: FormData, field: string) { - const value = formData.get(field) - - if (typeof value !== 'string') { - throw new Error(`Expected ${field} to be a string`) - } - - return value -} - -function validateFormData(input: unknown): FormEchoData { - if (!(input instanceof FormData)) { - throw new Error('Expected FormData input') - } - - const upload = input.get('upload') - if (!(upload instanceof File)) { - throw new Error('Expected upload to be a File') - } - - return { - alpha: getStringField(input, 'alpha'), - beta: getStringField(input, 'beta'), - gamma: getStringField(input, 'gamma'), - upload, - } -} - -function validateString(input: unknown) { - if (typeof input !== 'string' || input.length === 0) { - throw new Error('Expected non-empty string input') - } - - return input -} - -function createDeterministicStream(seed: string) { - return new ReadableStream({ - start(controller) { - for (let chunkIndex = 0; chunkIndex < streamChunkCount; chunkIndex++) { - const chunk = new Uint8Array(streamChunkSize) - - for (let byteIndex = 0; byteIndex < chunk.length; byteIndex++) { - chunk[byteIndex] = - (seed.charCodeAt(byteIndex % seed.length) + - byteIndex + - chunkIndex) & - 0xff - } - - controller.enqueue(chunk) - } - - controller.close() - }, - }) -} - -export const formEcho = createServerFn({ method: 'POST' }) - .validator(validateFormData) - .handler(async ({ data }) => { - const contents = await data.upload.text() - - return { - alpha: data.alpha, - beta: data.beta, - gamma: data.gamma, - fileName: data.upload.name, - fileSize: data.upload.size, - filePreview: contents.slice(0, 32), - } - }) - -export const rawResp = createServerFn({ method: 'GET' }) - .validator(validateString) - .handler(({ data }) => { - return new Response(`raw-${data}`, { - headers: { 'content-type': 'text/plain' }, - }) - }) - -export const streamOut = createServerFn({ method: 'GET' }) - .validator(validateString) - .handler(({ data }) => { - return { - label: `stream-${data}`, - data: new RawStream(createDeterministicStream(data)), - } - }) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routeTree.gen.ts deleted file mode 100644 index 298ac3168d..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiFnUrlsRouteImport } from './routes/api.fn-urls' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' - id: '__root__' | '/' | '/api/fn-urls' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/router.tsx b/benchmarks/ssr/scenarios/server-fn-transport/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/api.fn-urls.ts deleted file mode 100644 index 353a732637..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { formEcho, rawResp, streamOut } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - form: formEcho.url, - raw: rawResp.url, - stream: streamOut.url, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/index.tsx deleted file mode 100644 index 6e0e5d8d6b..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { formEcho, rawResp, streamOut } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- server-fn transport benchmark -
- ) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/tsconfig.json b/benchmarks/ssr/scenarios/server-fn-transport/solid/tsconfig.json deleted file mode 100644 index 0af78df33d..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/solid/vite.config.ts b/benchmarks/ssr/scenarios/server-fn-transport/solid/vite.config.ts deleted file mode 100644 index a8af4a6b50..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-fn-transport (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/project.json b/benchmarks/ssr/scenarios/server-fn-transport/vue/project.json deleted file mode 100644 index abdd85c6b7..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-fn-transport-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts deleted file mode 100644 index 24305cf1bc..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnMultipartRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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 deleted file mode 100644 index 2eeb9a4f6b..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-response.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnRawResponseRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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 deleted file mode 100644 index a73905004d..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/speed.server-fn-raw-stream.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnTransportScenario, - runServerFnRawStreamRequestLoop, - serverFnTransportBenchOptions, - setupServerFnTransportBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnTransportBench(handler) - -await assertServerFnTransportScenario(handler, context) - -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-fn-transport/vue/src/fns.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/src/fns.ts deleted file mode 100644 index f7e1a1217a..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/fns.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { RawStream, createServerFn } from '@tanstack/vue-start' - -type FormEchoData = { - alpha: string - beta: string - gamma: string - upload: File -} - -const streamChunkCount = 8 -const streamChunkSize = 1024 - -function getStringField(formData: FormData, field: string) { - const value = formData.get(field) - - if (typeof value !== 'string') { - throw new Error(`Expected ${field} to be a string`) - } - - return value -} - -function validateFormData(input: unknown): FormEchoData { - if (!(input instanceof FormData)) { - throw new Error('Expected FormData input') - } - - const upload = input.get('upload') - if (!(upload instanceof File)) { - throw new Error('Expected upload to be a File') - } - - return { - alpha: getStringField(input, 'alpha'), - beta: getStringField(input, 'beta'), - gamma: getStringField(input, 'gamma'), - upload, - } -} - -function validateString(input: unknown) { - if (typeof input !== 'string' || input.length === 0) { - throw new Error('Expected non-empty string input') - } - - return input -} - -function createDeterministicStream(seed: string) { - return new ReadableStream({ - start(controller) { - for (let chunkIndex = 0; chunkIndex < streamChunkCount; chunkIndex++) { - const chunk = new Uint8Array(streamChunkSize) - - for (let byteIndex = 0; byteIndex < chunk.length; byteIndex++) { - chunk[byteIndex] = - (seed.charCodeAt(byteIndex % seed.length) + - byteIndex + - chunkIndex) & - 0xff - } - - controller.enqueue(chunk) - } - - controller.close() - }, - }) -} - -export const formEcho = createServerFn({ method: 'POST' }) - .validator(validateFormData) - .handler(async ({ data }) => { - const contents = await data.upload.text() - - return { - alpha: data.alpha, - beta: data.beta, - gamma: data.gamma, - fileName: data.upload.name, - fileSize: data.upload.size, - filePreview: contents.slice(0, 32), - } - }) - -export const rawResp = createServerFn({ method: 'GET' }) - .validator(validateString) - .handler(({ data }) => { - return new Response(`raw-${data}`, { - headers: { 'content-type': 'text/plain' }, - }) - }) - -export const streamOut = createServerFn({ method: 'GET' }) - .validator(validateString) - .handler(({ data }) => { - return { - label: `stream-${data}`, - data: new RawStream(createDeterministicStream(data)), - } - }) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routeTree.gen.ts deleted file mode 100644 index b226f0a25a..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiFnUrlsRouteImport } from './routes/api.fn-urls' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiFnUrlsRoute = ApiFnUrlsRouteImport.update({ - id: '/api/fn-urls', - path: '/api/fn-urls', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' - id: '__root__' | '/' | '/api/fn-urls' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/router.tsx b/benchmarks/ssr/scenarios/server-fn-transport/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/api.fn-urls.ts deleted file mode 100644 index 2db00972bb..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { formEcho, rawResp, streamOut } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - form: formEcho.url, - raw: rawResp.url, - stream: streamOut.url, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/index.tsx deleted file mode 100644 index d53731eb23..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { formEcho, rawResp, streamOut } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- server-fn transport benchmark -
- ) -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/tsconfig.json b/benchmarks/ssr/scenarios/server-fn-transport/vue/tsconfig.json deleted file mode 100644 index 5b7742b414..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../bench.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-fn-transport/vue/vite.config.ts b/benchmarks/ssr/scenarios/server-fn-transport/vue/vite.config.ts deleted file mode 100644 index 0f3e2ce84d..0000000000 --- a/benchmarks/ssr/scenarios/server-fn-transport/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-fn-transport (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/bench.ts b/benchmarks/ssr/scenarios/server-fns/bench.ts deleted file mode 100644 index 1461ce2bfd..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/bench.ts +++ /dev/null @@ -1,533 +0,0 @@ -import { fromCrossJSON, toJSONAsync } from 'seroval' -import { - createDeterministicRandom, - randomSegment, - runRequestLoop, -} from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' -import type { SerovalNode } from 'seroval' - -export type { StartRequestHandler } - -type Payload = { - q: string - n: number - nested: { list: Array } -} - -type FnUrls = { - get: string - post: string - redirect: string - notFound: string - context: string -} - -export type ServerFnBenchContext = { - urls: FnUrls - bodies: Array - getQueries: Array - expectedMarker: string - contextBodies: Array - contextExpectedMarkers: Array - contextExpectedStamps: Array -} - -const benchmarkSeed = 0xdecafbad -const origin = 'http://localhost' -const tssContentTypeFramed = 'application/x-tss-framed' -const xTssSerialized = 'x-tss-serialized' -const acceptHeader = `${tssContentTypeFramed}, application/x-ndjson, application/json` -const commonHeaders = { - 'x-tsr-serverFn': 'true', - 'sec-fetch-site': 'same-origin', - accept: acceptHeader, -} satisfies HeadersInit -const postHeaders = { - ...commonHeaders, - 'content-type': 'application/json', -} satisfies HeadersInit -const documentRequestInit = { - method: 'GET', - headers: { - accept: 'text/html', - }, -} satisfies RequestInit -const serverFnGetLoopTotalRequests = 112 -const serverFnPostLoopTotalRequests = 160 -const serverFnRedirectLoopTotalRequests = 128 -const serverFnNotFoundLoopTotalRequests = 208 -const serverFnSendContextLoopTotalRequests = 176 -const serverFnDocumentSsrLoopTotalRequests = 48 - -export const serverFnBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} as const - -function createPayloads() { - const random = createDeterministicRandom(benchmarkSeed) - - return Array.from({ length: 10 }, (_, index): Payload => { - const queryParts = Array.from({ length: 6 }, () => randomSegment(random)) - - return { - q: `q-${index}-${queryParts.join('-')}`, - n: 100 + index, - nested: { - list: Array.from( - { length: 5 }, - () => `l-${index}-${randomSegment(random)}-${randomSegment(random)}`, - ), - }, - } - }) -} - -async function createBodies(payloads: Array) { - return await Promise.all( - payloads.map(async (payload) => - JSON.stringify(await toJSONAsync({ data: payload })), - ), - ) -} - -function createContextToken(payload: Payload) { - return `token-${payload.q}-${payload.nested.list[0]}` -} - -async function createContextFixtures(payloads: Array) { - return await Promise.all( - payloads.map(async (payload) => { - const token = createContextToken(payload) - - return { - body: JSON.stringify( - await toJSONAsync({ data: payload, context: { token } }), - ), - marker: `ctx-${token}-${payload.nested.list[0]}`, - stamp: `stamp-${token}`, - } - }), - ) -} - -function createGetQueries(bodies: Array) { - return bodies.map((body) => `?${new URLSearchParams({ payload: body })}`) -} - -async function discoverUrls(handler: StartRequestHandler) { - const response = await handler.fetch(new Request(`${origin}/api/fn-urls`)) - - if (response.status === 404) { - throw new Error('URL discovery route returned 404 for /api/fn-urls') - } - - if (response.status !== 200) { - throw new Error( - `URL discovery failed with status ${response.status}: ${await response.text()}`, - ) - } - - const urls = (await response.json()) as Partial - const requiredKeys = [ - 'get', - 'post', - 'redirect', - 'notFound', - 'context', - ] as const - - for (const key of requiredKeys) { - if (typeof urls[key] !== 'string') { - throw new Error( - `URL discovery returned invalid payload: ${JSON.stringify(urls)}`, - ) - } - } - - return urls as FnUrls -} - -function validateSerializedResponse(response: Response, label: string) { - if (response.status === 403) { - throw new Error( - `${label} sanity check failed with 403. Check CSRF headers.`, - ) - } - - if (response.status === 404) { - throw new Error( - `${label} sanity check failed with 404. The discovered server function URL is stale.`, - ) - } - - if (response.status !== 200) { - throw new Error(`${label} request failed with status ${response.status}`) - } - - if (!response.headers.get(xTssSerialized)) { - throw new Error(`${label} response missing ${xTssSerialized} header`) - } -} - -function validateRedirectResponse(response: Response) { - if (response.status !== 200) { - throw new Error(`redirect request failed with status ${response.status}`) - } - - const contentType = response.headers.get('content-type') - - if (!contentType?.includes('application/json')) { - throw new Error(`redirect response was not JSON: ${contentType}`) - } -} - -function validateDocumentResponse(response: Response) { - if (response.status !== 200) { - throw new Error(`document request failed with status ${response.status}`) - } - - const contentType = response.headers.get('content-type') - - if (!contentType?.includes('text/html')) { - throw new Error(`document response was not HTML: ${contentType}`) - } -} - -async function readSerializedServerFnResult(response: Response, label: string) { - const text = await response.text() - - validateSerializedResponse(response, label) - - let json: unknown - - try { - json = JSON.parse(text) - } catch (error) { - throw new Error(`${label} sanity check returned invalid JSON: ${text}`, { - cause: error, - }) - } - - return { text, decoded: fromCrossJSON(json as SerovalNode, {}) } -} - -async function assertServerFnResponse({ - response, - label, - expectedMarker, -}: { - response: Response - label: string - expectedMarker: string -}) { - const { text } = await readSerializedServerFnResult(response, label) - - if (!text.includes(expectedMarker)) { - throw new Error( - `${label} sanity check did not include expected marker ${expectedMarker}: ${text}`, - ) - } -} - -async function assertServerFnRedirectResponse(response: Response) { - const text = await response.text() - - if (response.status !== 200) { - throw new Error( - `redirect sanity check failed with status ${response.status}: ${text}`, - ) - } - - let payload: { - href?: string - isSerializedRedirect?: boolean - statusCode?: number - } - - try { - payload = JSON.parse(text) as typeof payload - } catch (error) { - throw new Error(`redirect sanity check returned invalid JSON: ${text}`, { - cause: error, - }) - } - - if ( - payload.href !== '/' || - payload.statusCode !== 307 || - payload.isSerializedRedirect !== true - ) { - throw new Error( - `redirect sanity check expected serialized redirect to /, got ${text}`, - ) - } -} - -async function assertServerFnNotFoundResponse(response: Response) { - const { decoded } = await readSerializedServerFnResult(response, 'not-found') - const payload = decoded as { error?: { isNotFound?: boolean } } - - if (payload.error?.isNotFound !== true) { - throw new Error( - `not-found sanity check did not include isNotFound error: ${JSON.stringify(decoded)}`, - ) - } -} - -async function assertServerFnContextResponse({ - response, - expectedMarker, - expectedStamp, -}: { - response: Response - expectedMarker: string - expectedStamp: string -}) { - const { decoded } = await readSerializedServerFnResult( - response, - 'send-context', - ) - const payload = decoded as { - result?: { marker?: string; token?: string } - context?: { stamp?: string } - } - - if (payload.result?.marker !== expectedMarker) { - throw new Error( - `send-context sanity check expected result marker ${expectedMarker}, got ${JSON.stringify(decoded)}`, - ) - } - - if (payload.context?.stamp !== expectedStamp) { - throw new Error( - `send-context sanity check expected response context ${expectedStamp}, got ${JSON.stringify(decoded)}`, - ) - } -} - -async function assertDocumentServerFnCallResponse(response: Response) { - const text = await response.text() - const expectedMarker = 'out-ssr-call-sanity-ssr' - - if (response.status !== 200) { - throw new Error( - `SSR-call sanity check failed with status ${response.status}: ${text}`, - ) - } - - const contentType = response.headers.get('content-type') - - if (!contentType?.includes('text/html')) { - throw new Error(`SSR-call sanity check was not HTML: ${contentType}`) - } - - if (response.headers.get(xTssSerialized)) { - throw new Error('SSR-call sanity check returned a server-fn RPC response') - } - - if (!text.includes('data-bench="server-fn-ssr-call"')) { - throw new Error('SSR-call sanity check missing document marker') - } - - if (!text.includes(expectedMarker)) { - throw new Error( - `SSR-call sanity check missing expected marker ${expectedMarker}`, - ) - } -} - -function buildGetRequest(urls: FnUrls, queries: Array, index: number) { - return new Request(`${origin}${urls.get}${queries[index % queries.length]}`, { - method: 'GET', - headers: commonHeaders, - }) -} - -function buildPostUrlRequest( - url: string, - bodies: Array, - index: number, -) { - return new Request(`${origin}${url}`, { - method: 'POST', - headers: postHeaders, - body: bodies[index % bodies.length], - }) -} - -function buildPostRequest(urls: FnUrls, bodies: Array, index: number) { - return buildPostUrlRequest(urls.post, bodies, index) -} - -function buildRedirectRequest( - urls: FnUrls, - bodies: Array, - index: number, -) { - return buildPostUrlRequest(urls.redirect, bodies, index) -} - -function buildNotFoundRequest( - urls: FnUrls, - bodies: Array, - index: number, -) { - return buildPostUrlRequest(urls.notFound, bodies, index) -} - -function buildContextRequest( - urls: FnUrls, - contextBodies: Array, - index: number, -) { - return buildPostUrlRequest(urls.context, contextBodies, index) -} - -function buildSsrCallRequest(random: () => number) { - return new Request( - `${origin}/ssr-call/${randomSegment(random)}`, - documentRequestInit, - ) -} - -export async function setupServerFnBench(handler: StartRequestHandler) { - const urls = await discoverUrls(handler) - const payloads = createPayloads() - const bodies = await createBodies(payloads) - const contextFixtures = await createContextFixtures(payloads) - const getQueries = createGetQueries(bodies) - const expectedMarker = `out-${payloads[0]!.nested.list[0]}` - - return { - urls, - bodies, - getQueries, - expectedMarker, - contextBodies: contextFixtures.map((fixture) => fixture.body), - contextExpectedMarkers: contextFixtures.map((fixture) => fixture.marker), - contextExpectedStamps: contextFixtures.map((fixture) => fixture.stamp), - } -} - -export async function assertServerFnScenario( - handler: StartRequestHandler, - context: ServerFnBenchContext, -) { - await assertServerFnResponse({ - response: await handler.fetch( - buildGetRequest(context.urls, context.getQueries, 0), - ), - label: 'GET', - expectedMarker: context.expectedMarker, - }) - await assertServerFnResponse({ - response: await handler.fetch( - buildPostRequest(context.urls, context.bodies, 0), - ), - label: 'POST', - expectedMarker: context.expectedMarker, - }) - await assertServerFnRedirectResponse( - await handler.fetch(buildRedirectRequest(context.urls, context.bodies, 0)), - ) - await assertServerFnNotFoundResponse( - await handler.fetch(buildNotFoundRequest(context.urls, context.bodies, 0)), - ) - await assertServerFnContextResponse({ - response: await handler.fetch( - buildContextRequest(context.urls, context.contextBodies, 0), - ), - expectedMarker: context.contextExpectedMarkers[0]!, - expectedStamp: context.contextExpectedStamps[0]!, - }) - await assertDocumentServerFnCallResponse( - await handler.fetch( - new Request(`${origin}/ssr-call/sanity-ssr`, documentRequestInit), - ), - ) -} - -export function runServerFnGetRequestLoop( - handler: StartRequestHandler, - context: ServerFnBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnGetLoopTotalRequests, - buildRequest: (_random, index) => - buildGetRequest(context.urls, context.getQueries, index), - }) -} - -export function runServerFnPostRequestLoop( - handler: StartRequestHandler, - context: ServerFnBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnPostLoopTotalRequests, - buildRequest: (_random, index) => - buildPostRequest(context.urls, context.bodies, index), - }) -} - -export function runServerFnRedirectRequestLoop( - handler: StartRequestHandler, - context: ServerFnBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnRedirectLoopTotalRequests, - buildRequest: (_random, index) => - buildRedirectRequest(context.urls, context.bodies, index), - validateResponse: validateRedirectResponse, - }) -} - -export function runServerFnNotFoundRequestLoop( - handler: StartRequestHandler, - context: ServerFnBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnNotFoundLoopTotalRequests, - buildRequest: (_random, index) => - buildNotFoundRequest(context.urls, context.bodies, index), - validateResponse: (response) => - validateSerializedResponse(response, 'not-found'), - }) -} - -export function runServerFnSendContextRequestLoop( - handler: StartRequestHandler, - context: ServerFnBenchContext, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnSendContextLoopTotalRequests, - buildRequest: (_random, index) => - buildContextRequest(context.urls, context.contextBodies, index), - validateResponse: (response) => - validateSerializedResponse(response, 'send-context'), - }) -} - -export function runServerFnDocumentSsrRequestLoop( - handler: StartRequestHandler, -) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: serverFnDocumentSsrLoopTotalRequests, - buildRequest: buildSsrCallRequest, - validateResponse: validateDocumentResponse, - }) -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/project.json b/benchmarks/ssr/scenarios/server-fns/react/project.json deleted file mode 100644 index 8858309f35..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-fns-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts deleted file mode 100644 index c876772ad1..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnGetRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 6a0cb55f78..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-during-document-ssr.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnDocumentSsrRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 96f1160078..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-not-found.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnNotFoundRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index e85d5debd3..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-post.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnPostRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 5dae598549..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-redirect.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnRedirectRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 40d6961206..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/speed.server-fn-send-context.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnSendContextRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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/react/src/fns.ts b/benchmarks/ssr/scenarios/server-fns/react/src/fns.ts deleted file mode 100644 index ce2ba48c5b..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/fns.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { createMiddleware, createServerFn } from '@tanstack/react-start' -import { notFound, redirect } from '@tanstack/react-router' - -const mwA = createMiddleware({ type: 'function' }).server(({ next }) => - next({ context: { a: 1 } }), -) -const mwB = createMiddleware({ type: 'function' }).server(({ next }) => - next({ context: { b: 2 } }), -) - -const sendContextMw = createMiddleware({ type: 'function' }) - .client(({ data, next }) => { - return next({ - sendContext: { token: createContextToken(data as unknown as Payload) }, - }) - }) - .server(({ context, next }) => { - const { token } = context as { token?: string } - - if (typeof token !== 'string') { - throw new Error('missing sendContext token') - } - - return next({ - context: { token }, - sendContext: { stamp: `stamp-${token}` }, - }) - }) - -type Payload = { q: string; n: number; nested: { list: Array } } - -function createContextToken(data: Payload) { - return `token-${data.q}-${data.nested.list[0]}` -} - -const validate = (input: unknown): Payload => { - const p = input as Payload - - if ( - typeof p?.q !== 'string' || - typeof p?.n !== 'number' || - !Array.isArray(p?.nested?.list) - ) { - throw new Error('invalid payload') - } - - return p -} - -function echo(data: Payload, context: { a: number; b: number }) { - return { - echoed: data, - sum: data.n + context.a + context.b, - list: data.nested.list.map((s) => `out-${s}`), - } -} - -export const echoGet = createServerFn({ method: 'GET' }) - .middleware([mwA, mwB]) - .validator(validate) - .handler(({ data, context }) => echo(data, context)) - -export const echoPost = createServerFn({ method: 'POST' }) - .middleware([mwA, mwB]) - .validator(validate) - .handler(({ data, context }) => echo(data, context)) - -export const redirector = createServerFn({ method: 'POST' }).handler(() => { - throw redirect({ to: '/', statusCode: 307 }) -}) - -export const notFounder = createServerFn({ method: 'POST' }).handler(() => { - throw notFound() -}) - -export const ctxEcho = createServerFn({ method: 'POST' }) - .middleware([sendContextMw]) - .validator(validate) - .handler(({ data, context }) => { - const { token } = context as { token: string } - - return { - marker: `ctx-${token}-${data.nested.list[0]}`, - q: data.q, - token, - } - }) diff --git a/benchmarks/ssr/scenarios/server-fns/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fns/react/src/routeTree.gen.ts deleted file mode 100644 index 4daa5f03b0..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/routeTree.gen.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* 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 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 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 - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' | '/ssr-call/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' | '/ssr-call/$id' - id: '__root__' | '/' | '/api/fn-urls' | '/ssr-call/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute - SsrCallIdRoute: typeof SsrCallIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - '/ssr-call/$id': { - id: '/ssr-call/$id' - path: '/ssr-call/$id' - fullPath: '/ssr-call/$id' - preLoaderRoute: typeof SsrCallIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, - SsrCallIdRoute: SsrCallIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/src/router.tsx b/benchmarks/ssr/scenarios/server-fns/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-fns/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/server-fns/react/src/routes/api.fn-urls.ts deleted file mode 100644 index ed3d9a9b7b..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { ctxEcho, echoGet, echoPost, notFounder, redirector } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - get: echoGet.url, - post: echoPost.url, - redirect: redirector.url, - notFound: notFounder.url, - context: ctxEcho.url, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/react/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-fns/react/src/routes/index.tsx deleted file mode 100644 index 45636ef30e..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { echoGet, echoPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- server-fns -
- ) -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/src/routes/ssr-call.$id.tsx b/benchmarks/ssr/scenarios/server-fns/react/src/routes/ssr-call.$id.tsx deleted file mode 100644 index 0f8a39f69d..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/src/routes/ssr-call.$id.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { echoGet } from '../fns' - -export const Route = createFileRoute('/ssr-call/$id')({ - loader: async ({ params }) => { - const result = await echoGet({ - data: { - q: `ssr-${params.id}`, - n: 300, - nested: { list: [`ssr-call-${params.id}`] }, - }, - }) - - return { marker: result.list[0] } - }, - component: SsrCallComponent, -}) - -function SsrCallComponent() { - const data = Route.useLoaderData() - - return
{data.marker}
-} diff --git a/benchmarks/ssr/scenarios/server-fns/react/tsconfig.json b/benchmarks/ssr/scenarios/server-fns/react/tsconfig.json deleted file mode 100644 index cf14e1d440..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-fns/react/vite.config.ts b/benchmarks/ssr/scenarios/server-fns/react/vite.config.ts deleted file mode 100644 index cd56edda95..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-fns (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/solid/project.json b/benchmarks/ssr/scenarios/server-fns/solid/project.json deleted file mode 100644 index f1e9581897..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-fns-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts deleted file mode 100644 index f6bbdc9e73..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnGetRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 933f61b59c..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-during-document-ssr.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnDocumentSsrRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 513b69f4ba..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-not-found.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnNotFoundRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index e2ce8ad9ee..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-post.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnPostRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 14353f1290..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-redirect.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnRedirectRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 76d3a554bd..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/speed.server-fn-send-context.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnSendContextRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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/fns.ts b/benchmarks/ssr/scenarios/server-fns/solid/src/fns.ts deleted file mode 100644 index e9a81ad06e..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/fns.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { createMiddleware, createServerFn } from '@tanstack/solid-start' -import { notFound, redirect } from '@tanstack/solid-router' - -const mwA = createMiddleware({ type: 'function' }).server(({ next }) => - next({ context: { a: 1 } }), -) -const mwB = createMiddleware({ type: 'function' }).server(({ next }) => - next({ context: { b: 2 } }), -) - -const sendContextMw = createMiddleware({ type: 'function' }) - .client(({ data, next }) => { - return next({ - sendContext: { token: createContextToken(data as unknown as Payload) }, - }) - }) - .server(({ context, next }) => { - const { token } = context as { token?: string } - - if (typeof token !== 'string') { - throw new Error('missing sendContext token') - } - - return next({ - context: { token }, - sendContext: { stamp: `stamp-${token}` }, - }) - }) - -type Payload = { q: string; n: number; nested: { list: Array } } - -function createContextToken(data: Payload) { - return `token-${data.q}-${data.nested.list[0]}` -} - -const validate = (input: unknown): Payload => { - const p = input as Payload - - if ( - typeof p?.q !== 'string' || - typeof p?.n !== 'number' || - !Array.isArray(p?.nested?.list) - ) { - throw new Error('invalid payload') - } - - return p -} - -function echo(data: Payload, context: { a: number; b: number }) { - return { - echoed: data, - sum: data.n + context.a + context.b, - list: data.nested.list.map((s) => `out-${s}`), - } -} - -export const echoGet = createServerFn({ method: 'GET' }) - .middleware([mwA, mwB]) - .validator(validate) - .handler(({ data, context }) => echo(data, context)) - -export const echoPost = createServerFn({ method: 'POST' }) - .middleware([mwA, mwB]) - .validator(validate) - .handler(({ data, context }) => echo(data, context)) - -export const redirector = createServerFn({ method: 'POST' }).handler(() => { - throw redirect({ to: '/', statusCode: 307 }) -}) - -export const notFounder = createServerFn({ method: 'POST' }).handler(() => { - throw notFound() -}) - -export const ctxEcho = createServerFn({ method: 'POST' }) - .middleware([sendContextMw]) - .validator(validate) - .handler(({ data, context }) => { - const { token } = context as { token: string } - - return { - marker: `ctx-${token}-${data.nested.list[0]}`, - q: data.q, - token, - } - }) diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts deleted file mode 100644 index 3d0bd34eaa..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* 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 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 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 - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' | '/ssr-call/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' | '/ssr-call/$id' - id: '__root__' | '/' | '/api/fn-urls' | '/ssr-call/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute - SsrCallIdRoute: typeof SsrCallIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - '/ssr-call/$id': { - id: '/ssr-call/$id' - path: '/ssr-call/$id' - fullPath: '/ssr-call/$id' - preLoaderRoute: typeof SsrCallIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, - SsrCallIdRoute: SsrCallIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/router.tsx b/benchmarks/ssr/scenarios/server-fns/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-fns/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/server-fns/solid/src/routes/api.fn-urls.ts deleted file mode 100644 index 7e18f6a03b..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ctxEcho, echoGet, echoPost, notFounder, redirector } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - get: echoGet.url, - post: echoPost.url, - redirect: redirector.url, - notFound: notFounder.url, - context: ctxEcho.url, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-fns/solid/src/routes/index.tsx deleted file mode 100644 index 83e7b22372..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { echoGet, echoPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- server-fns -
- ) -} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/ssr-call.$id.tsx b/benchmarks/ssr/scenarios/server-fns/solid/src/routes/ssr-call.$id.tsx deleted file mode 100644 index abc5571a59..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/src/routes/ssr-call.$id.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { echoGet } from '../fns' - -export const Route = createFileRoute('/ssr-call/$id')({ - loader: async ({ params }) => { - const result = await echoGet({ - data: { - q: `ssr-${params.id}`, - n: 300, - nested: { list: [`ssr-call-${params.id}`] }, - }, - }) - - return { marker: result.list[0] } - }, - component: SsrCallComponent, -}) - -function SsrCallComponent() { - const data = Route.useLoaderData() - - return
{data().marker}
-} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/tsconfig.json b/benchmarks/ssr/scenarios/server-fns/solid/tsconfig.json deleted file mode 100644 index 42c3a2160f..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-fns/solid/vite.config.ts b/benchmarks/ssr/scenarios/server-fns/solid/vite.config.ts deleted file mode 100644 index 2f2f78b75c..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-fns (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/vue/project.json b/benchmarks/ssr/scenarios/server-fns/vue/project.json deleted file mode 100644 index ad6f053838..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-fns-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts deleted file mode 100644 index 3f67c1a500..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnGetRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 56c9addca5..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-during-document-ssr.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnDocumentSsrRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index e9a6e31617..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-not-found.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnNotFoundRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index df9312ccd1..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-post.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnPostRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 67c4611644..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-redirect.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnRedirectRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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 deleted file mode 100644 index 6f51ef4bab..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/speed.server-fn-send-context.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerFnScenario, - runServerFnSendContextRequestLoop, - serverFnBenchOptions, - setupServerFnBench, -} from '../bench' -import type { StartRequestHandler } from '../bench' - -const { default: handler } = (await import( - /* @vite-ignore */ new URL('./dist/server/server.js', import.meta.url).href -)) as { - default: StartRequestHandler -} -const context = await setupServerFnBench(handler) - -await assertServerFnScenario(handler, context) - -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-fns/vue/src/fns.ts b/benchmarks/ssr/scenarios/server-fns/vue/src/fns.ts deleted file mode 100644 index fc08b2b9bf..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/fns.ts +++ /dev/null @@ -1,87 +0,0 @@ -import { createMiddleware, createServerFn } from '@tanstack/vue-start' -import { notFound, redirect } from '@tanstack/vue-router' - -const mwA = createMiddleware({ type: 'function' }).server(({ next }) => - next({ context: { a: 1 } }), -) -const mwB = createMiddleware({ type: 'function' }).server(({ next }) => - next({ context: { b: 2 } }), -) - -const sendContextMw = createMiddleware({ type: 'function' }) - .client(({ data, next }) => { - return next({ - sendContext: { token: createContextToken(data as unknown as Payload) }, - }) - }) - .server(({ context, next }) => { - const { token } = context as { token?: string } - - if (typeof token !== 'string') { - throw new Error('missing sendContext token') - } - - return next({ - context: { token }, - sendContext: { stamp: `stamp-${token}` }, - }) - }) - -type Payload = { q: string; n: number; nested: { list: Array } } - -function createContextToken(data: Payload) { - return `token-${data.q}-${data.nested.list[0]}` -} - -const validate = (input: unknown): Payload => { - const p = input as Payload - - if ( - typeof p?.q !== 'string' || - typeof p?.n !== 'number' || - !Array.isArray(p?.nested?.list) - ) { - throw new Error('invalid payload') - } - - return p -} - -function echo(data: Payload, context: { a: number; b: number }) { - return { - echoed: data, - sum: data.n + context.a + context.b, - list: data.nested.list.map((s) => `out-${s}`), - } -} - -export const echoGet = createServerFn({ method: 'GET' }) - .middleware([mwA, mwB]) - .validator(validate) - .handler(({ data, context }) => echo(data, context)) - -export const echoPost = createServerFn({ method: 'POST' }) - .middleware([mwA, mwB]) - .validator(validate) - .handler(({ data, context }) => echo(data, context)) - -export const redirector = createServerFn({ method: 'POST' }).handler(() => { - throw redirect({ to: '/', statusCode: 307 }) -}) - -export const notFounder = createServerFn({ method: 'POST' }).handler(() => { - throw notFound() -}) - -export const ctxEcho = createServerFn({ method: 'POST' }) - .middleware([sendContextMw]) - .validator(validate) - .handler(({ data, context }) => { - const { token } = context as { token: string } - - return { - marker: `ctx-${token}-${data.nested.list[0]}`, - q: data.q, - token, - } - }) diff --git a/benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts deleted file mode 100644 index 0e24cd9c15..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* 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 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 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 - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/fn-urls': typeof ApiFnUrlsRoute - '/ssr-call/$id': typeof SsrCallIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/fn-urls' | '/ssr-call/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/fn-urls' | '/ssr-call/$id' - id: '__root__' | '/' | '/api/fn-urls' | '/ssr-call/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiFnUrlsRoute: typeof ApiFnUrlsRoute - SsrCallIdRoute: typeof SsrCallIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/fn-urls': { - id: '/api/fn-urls' - path: '/api/fn-urls' - fullPath: '/api/fn-urls' - preLoaderRoute: typeof ApiFnUrlsRouteImport - parentRoute: typeof rootRouteImport - } - '/ssr-call/$id': { - id: '/ssr-call/$id' - path: '/ssr-call/$id' - fullPath: '/ssr-call/$id' - preLoaderRoute: typeof SsrCallIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiFnUrlsRoute: ApiFnUrlsRoute, - SsrCallIdRoute: SsrCallIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/vue/src/router.tsx b/benchmarks/ssr/scenarios/server-fns/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-fns/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/api.fn-urls.ts b/benchmarks/ssr/scenarios/server-fns/vue/src/routes/api.fn-urls.ts deleted file mode 100644 index 0199e7f1d3..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/api.fn-urls.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { ctxEcho, echoGet, echoPost, notFounder, redirector } from '../fns' - -export const Route = createFileRoute('/api/fn-urls')({ - server: { - handlers: { - GET: () => - Response.json({ - get: echoGet.url, - post: echoPost.url, - redirect: redirector.url, - notFound: notFounder.url, - context: ctxEcho.url, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-fns/vue/src/routes/index.tsx deleted file mode 100644 index e72e667bc5..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { echoGet, echoPost } from '../fns' - -export const Route = createFileRoute('/')({ - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
- server-fns -
- ) -} diff --git a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/ssr-call.$id.tsx b/benchmarks/ssr/scenarios/server-fns/vue/src/routes/ssr-call.$id.tsx deleted file mode 100644 index 45fad23dc0..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/src/routes/ssr-call.$id.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { defineComponent } from 'vue' -import { createFileRoute } from '@tanstack/vue-router' -import { echoGet } from '../fns' - -const SsrCallComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( -
{data.value.marker}
- ) - }, -}) - -export const Route = createFileRoute('/ssr-call/$id')({ - loader: async ({ params }) => { - const result = await echoGet({ - data: { - q: `ssr-${params.id}`, - n: 300, - nested: { list: [`ssr-call-${params.id}`] }, - }, - }) - - return { marker: result.list[0] } - }, - component: SsrCallComponent, -}) diff --git a/benchmarks/ssr/scenarios/server-fns/vue/tsconfig.json b/benchmarks/ssr/scenarios/server-fns/vue/tsconfig.json deleted file mode 100644 index 08c94853f4..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed*.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-fns/vue/vite.config.ts b/benchmarks/ssr/scenarios/server-fns/vue/vite.config.ts deleted file mode 100644 index 5f3e3ca4b5..0000000000 --- a/benchmarks/ssr/scenarios/server-fns/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-fns (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/project.json b/benchmarks/ssr/scenarios/server-routes-middleware/react/project.json deleted file mode 100644 index e5f11d0a57..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-routes-middleware-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts deleted file mode 100644 index 6331216522..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerRouteMiddlewareResponse, - runServerRouteMiddlewareLoop, - serverRouteMiddlewareBenchOptions, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertServerRouteMiddlewareResponse(handler) - -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/react/src/middleware.ts b/benchmarks/ssr/scenarios/server-routes-middleware/react/src/middleware.ts deleted file mode 100644 index 1e8c428696..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/middleware.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createMiddleware } from '@tanstack/react-start' - -const make = (key: TKey, value: number) => - createMiddleware({ type: 'request' }).server(({ next }) => - next({ context: { [key]: value } as Record }), - ) - -export const routeMws = [ - make('r1', 1), - make('r2', 2), - make('r3', 3), - make('r4', 4), - make('r5', 5), -] as const - -export const methodMws = [make('m1', 6), make('m2', 7)] as const diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routeTree.gen.ts deleted file mode 100644 index 7a63a799a1..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiChainIdRouteImport } from './routes/api.chain.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiChainIdRoute = ApiChainIdRouteImport.update({ - id: '/api/chain/$id', - path: '/api/chain/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/chain/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/chain/$id' - id: '__root__' | '/' | '/api/chain/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiChainIdRoute: typeof ApiChainIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/chain/$id': { - id: '/api/chain/$id' - path: '/api/chain/$id' - fullPath: '/api/chain/$id' - preLoaderRoute: typeof ApiChainIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiChainIdRoute: ApiChainIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/router.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/api.chain.$id.ts b/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/api.chain.$id.ts deleted file mode 100644 index 5a9f5d5035..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/api.chain.$id.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { methodMws, routeMws } from '../middleware' - -const allMws = [...routeMws, ...methodMws] as const - -export const Route = createFileRoute('/api/chain/$id')({ - server: { - middleware: allMws, - handlers: { - GET: ({ params, context }) => - Response.json({ - id: params.id, - total: - context.r1 + - context.r2 + - context.r3 + - context.r4 + - context.r5 + - context.m1 + - context.m2, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/index.tsx deleted file mode 100644 index 9fe98b6851..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return
server routes middleware
-} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/tsconfig.json b/benchmarks/ssr/scenarios/server-routes-middleware/react/tsconfig.json deleted file mode 100644 index 91027bfc88..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/react/vite.config.ts b/benchmarks/ssr/scenarios/server-routes-middleware/react/vite.config.ts deleted file mode 100644 index f6998c2ac8..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-routes-middleware (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/shared.ts b/benchmarks/ssr/scenarios/server-routes-middleware/shared.ts deleted file mode 100644 index 663ca09294..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/shared.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const loopTotalRequests = 160 - -const apiRequestInit = { - method: 'GET', - headers: { - accept: 'application/json', - }, -} satisfies RequestInit - -export const serverRouteMiddlewareBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runServerRouteMiddlewareLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: loopTotalRequests, - buildRequest: (random) => - new Request( - `http://localhost/api/chain/${randomSegment(random)}`, - apiRequestInit, - ), - }) -} - -export async function assertServerRouteMiddlewareResponse( - handler: StartRequestHandler, -) { - const id = 'sanity' - const response = await handler.fetch( - new Request(`http://localhost/api/chain/${id}`, apiRequestInit), - ) - - if (response.status !== 200) { - throw new Error(`Expected status 200, received ${response.status}`) - } - - const contentType = response.headers.get('content-type') - - if (!contentType?.includes('application/json')) { - throw new Error(`Expected JSON response, received ${contentType}`) - } - - const body = (await response.json()) as { total?: number } - - if (body.total !== 28) { - throw new Error(`Expected total 28, received ${body.total}`) - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json b/benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json deleted file mode 100644 index 0bde91f794..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-routes-middleware-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts deleted file mode 100644 index 77d58e7b19..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerRouteMiddlewareResponse, - runServerRouteMiddlewareLoop, - serverRouteMiddlewareBenchOptions, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertServerRouteMiddlewareResponse(handler) - -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/solid/src/middleware.ts b/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/middleware.ts deleted file mode 100644 index fcaf3d08f7..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/middleware.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createMiddleware } from '@tanstack/solid-start' - -const make = (key: TKey, value: number) => - createMiddleware({ type: 'request' }).server(({ next }) => - next({ context: { [key]: value } as Record }), - ) - -export const routeMws = [ - make('r1', 1), - make('r2', 2), - make('r3', 3), - make('r4', 4), - make('r5', 5), -] as const - -export const methodMws = [make('m1', 6), make('m2', 7)] as const diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routeTree.gen.ts deleted file mode 100644 index b8c91b9134..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiChainIdRouteImport } from './routes/api.chain.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiChainIdRoute = ApiChainIdRouteImport.update({ - id: '/api/chain/$id', - path: '/api/chain/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/chain/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/chain/$id' - id: '__root__' | '/' | '/api/chain/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiChainIdRoute: typeof ApiChainIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/chain/$id': { - id: '/api/chain/$id' - path: '/api/chain/$id' - fullPath: '/api/chain/$id' - preLoaderRoute: typeof ApiChainIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiChainIdRoute: ApiChainIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/router.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/api.chain.$id.ts b/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/api.chain.$id.ts deleted file mode 100644 index fabdb9de85..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/api.chain.$id.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { methodMws, routeMws } from '../middleware' - -const allMws = [...routeMws, ...methodMws] as const - -export const Route = createFileRoute('/api/chain/$id')({ - server: { - middleware: allMws, - handlers: { - GET: ({ params, context }) => - Response.json({ - id: params.id, - total: - context.r1 + - context.r2 + - context.r3 + - context.r4 + - context.r5 + - context.m1 + - context.m2, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/index.tsx deleted file mode 100644 index e2357b558d..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return
server routes middleware
-} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/tsconfig.json b/benchmarks/ssr/scenarios/server-routes-middleware/solid/tsconfig.json deleted file mode 100644 index b1806caa67..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/solid/vite.config.ts b/benchmarks/ssr/scenarios/server-routes-middleware/solid/vite.config.ts deleted file mode 100644 index 800cf9db9f..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-routes-middleware (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json b/benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json deleted file mode 100644 index 2a21b81bf9..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-routes-middleware-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts deleted file mode 100644 index 3d03b9c1fa..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerRouteMiddlewareResponse, - runServerRouteMiddlewareLoop, - serverRouteMiddlewareBenchOptions, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertServerRouteMiddlewareResponse(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr server-route middleware (vue)', async () => - runServerRouteMiddlewareLoop(handler), - ).run(serverRouteMiddlewareBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/middleware.ts b/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/middleware.ts deleted file mode 100644 index 05e7a86be9..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/middleware.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { createMiddleware } from '@tanstack/vue-start' - -const make = (key: TKey, value: number) => - createMiddleware({ type: 'request' }).server(({ next }) => - next({ context: { [key]: value } as Record }), - ) - -export const routeMws = [ - make('r1', 1), - make('r2', 2), - make('r3', 3), - make('r4', 4), - make('r5', 5), -] as const - -export const methodMws = [make('m1', 6), make('m2', 7)] as const diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routeTree.gen.ts deleted file mode 100644 index db4f072a69..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiChainIdRouteImport } from './routes/api.chain.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiChainIdRoute = ApiChainIdRouteImport.update({ - id: '/api/chain/$id', - path: '/api/chain/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/chain/$id': typeof ApiChainIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/chain/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/chain/$id' - id: '__root__' | '/' | '/api/chain/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiChainIdRoute: typeof ApiChainIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/chain/$id': { - id: '/api/chain/$id' - path: '/api/chain/$id' - fullPath: '/api/chain/$id' - preLoaderRoute: typeof ApiChainIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiChainIdRoute: ApiChainIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/router.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/api.chain.$id.ts b/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/api.chain.$id.ts deleted file mode 100644 index d643a339c5..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/api.chain.$id.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { methodMws, routeMws } from '../middleware' - -const allMws = [...routeMws, ...methodMws] as const - -export const Route = createFileRoute('/api/chain/$id')({ - server: { - middleware: allMws, - handlers: { - GET: ({ params, context }) => - Response.json({ - id: params.id, - total: - context.r1 + - context.r2 + - context.r3 + - context.r4 + - context.r5 + - context.m1 + - context.m2, - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/index.tsx deleted file mode 100644 index 60e9d08e6d..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return
server routes middleware
-} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/tsconfig.json b/benchmarks/ssr/scenarios/server-routes-middleware/vue/tsconfig.json deleted file mode 100644 index 4fe3ccecb1..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-routes-middleware/vue/vite.config.ts b/benchmarks/ssr/scenarios/server-routes-middleware/vue/vite.config.ts deleted file mode 100644 index 909b7cca50..0000000000 --- a/benchmarks/ssr/scenarios/server-routes-middleware/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-routes-middleware (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes/react/project.json b/benchmarks/ssr/scenarios/server-routes/react/project.json deleted file mode 100644 index a16cb3e537..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-routes-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts deleted file mode 100644 index 631314148a..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerRouteResponse, - runServerRouteLoop, - serverRouteBenchOptions, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertServerRouteResponse(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr server-route (react)', async () => - runServerRouteLoop(handler), - ).run(serverRouteBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/server-routes/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-routes/react/src/routeTree.gen.ts deleted file mode 100644 index 6615cc0611..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiUsersIdRouteImport } from './routes/api.users.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiUsersIdRoute = ApiUsersIdRouteImport.update({ - id: '/api/users/$id', - path: '/api/users/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/users/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/users/$id' - id: '__root__' | '/' | '/api/users/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiUsersIdRoute: typeof ApiUsersIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/users/$id': { - id: '/api/users/$id' - path: '/api/users/$id' - fullPath: '/api/users/$id' - preLoaderRoute: typeof ApiUsersIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiUsersIdRoute: ApiUsersIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/react/src/router.tsx b/benchmarks/ssr/scenarios/server-routes/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-routes/react/src/routes/__root.tsx deleted file mode 100644 index ff1da4c304..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-routes/react/src/routes/api.users.$id.ts b/benchmarks/ssr/scenarios/server-routes/react/src/routes/api.users.$id.ts deleted file mode 100644 index b43275a5c6..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/src/routes/api.users.$id.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/api/users/$id')({ - server: { - handlers: { - GET: ({ params }) => - Response.json({ - id: params.id, - name: `user-${params.id}`, - roles: ['a', 'b', 'c'], - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes/react/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-routes/react/src/routes/index.tsx deleted file mode 100644 index f5a19839f9..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return
server routes
-} diff --git a/benchmarks/ssr/scenarios/server-routes/react/tsconfig.json b/benchmarks/ssr/scenarios/server-routes/react/tsconfig.json deleted file mode 100644 index 91027bfc88..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-routes/react/vite.config.ts b/benchmarks/ssr/scenarios/server-routes/react/vite.config.ts deleted file mode 100644 index 2c723c749c..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-routes (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes/shared.ts b/benchmarks/ssr/scenarios/server-routes/shared.ts deleted file mode 100644 index ce33faaefe..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/shared.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad -const loopTotalRequests = 208 - -const apiRequestInit = { - method: 'GET', - headers: { - accept: 'application/json', - }, -} satisfies RequestInit - -export const serverRouteBenchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runServerRouteLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: loopTotalRequests, - buildRequest: (random) => - new Request( - `http://localhost/api/users/${randomSegment(random)}`, - apiRequestInit, - ), - }) -} - -export async function assertServerRouteResponse(handler: StartRequestHandler) { - const id = 'sanity' - const response = await handler.fetch( - new Request(`http://localhost/api/users/${id}`, apiRequestInit), - ) - - if (response.status !== 200) { - throw new Error(`Expected status 200, received ${response.status}`) - } - - const contentType = response.headers.get('content-type') - - if (!contentType?.includes('application/json')) { - throw new Error(`Expected JSON response, received ${contentType}`) - } - - const body = (await response.json()) as { name?: string } - - if (body.name !== `user-${id}`) { - throw new Error(`Expected user-${id}, received ${body.name}`) - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/project.json b/benchmarks/ssr/scenarios/server-routes/solid/project.json deleted file mode 100644 index 9c4bf7e230..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-routes-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts deleted file mode 100644 index 4788d31854..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerRouteResponse, - runServerRouteLoop, - serverRouteBenchOptions, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertServerRouteResponse(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr server-route (solid)', async () => - runServerRouteLoop(handler), - ).run(serverRouteBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/server-routes/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-routes/solid/src/routeTree.gen.ts deleted file mode 100644 index 1d7fee0d2b..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiUsersIdRouteImport } from './routes/api.users.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiUsersIdRoute = ApiUsersIdRouteImport.update({ - id: '/api/users/$id', - path: '/api/users/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/users/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/users/$id' - id: '__root__' | '/' | '/api/users/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiUsersIdRoute: typeof ApiUsersIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/users/$id': { - id: '/api/users/$id' - path: '/api/users/$id' - fullPath: '/api/users/$id' - preLoaderRoute: typeof ApiUsersIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiUsersIdRoute: ApiUsersIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/src/router.tsx b/benchmarks/ssr/scenarios/server-routes/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-routes/solid/src/routes/__root.tsx deleted file mode 100644 index e59de72236..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/src/routes/__root.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/src/routes/api.users.$id.ts b/benchmarks/ssr/scenarios/server-routes/solid/src/routes/api.users.$id.ts deleted file mode 100644 index 516af1cc15..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/src/routes/api.users.$id.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/api/users/$id')({ - server: { - handlers: { - GET: ({ params }) => - Response.json({ - id: params.id, - name: `user-${params.id}`, - roles: ['a', 'b', 'c'], - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes/solid/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-routes/solid/src/routes/index.tsx deleted file mode 100644 index 87eb6a178f..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return
server routes
-} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/tsconfig.json b/benchmarks/ssr/scenarios/server-routes/solid/tsconfig.json deleted file mode 100644 index b1806caa67..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-routes/solid/vite.config.ts b/benchmarks/ssr/scenarios/server-routes/solid/vite.config.ts deleted file mode 100644 index 994e04f1d6..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-routes (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes/vue/project.json b/benchmarks/ssr/scenarios/server-routes/vue/project.json deleted file mode 100644 index a92a9ad40e..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-server-routes-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts b/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts deleted file mode 100644 index 09c0bbe90b..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertServerRouteResponse, - runServerRouteLoop, - serverRouteBenchOptions, -} from '../shared' -import type { StartRequestHandler } from '../shared' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertServerRouteResponse(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr server-route (vue)', async () => - runServerRouteLoop(handler), - ).run(serverRouteBenchOptions) -}) diff --git a/benchmarks/ssr/scenarios/server-routes/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/server-routes/vue/src/routeTree.gen.ts deleted file mode 100644 index b12a446b9f..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* 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 ApiUsersIdRouteImport } from './routes/api.users.$id' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ApiUsersIdRoute = ApiUsersIdRouteImport.update({ - id: '/api/users/$id', - path: '/api/users/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/api/users/$id': typeof ApiUsersIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/api/users/$id' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/api/users/$id' - id: '__root__' | '/' | '/api/users/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ApiUsersIdRoute: typeof ApiUsersIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/api/users/$id': { - id: '/api/users/$id' - path: '/api/users/$id' - fullPath: '/api/users/$id' - preLoaderRoute: typeof ApiUsersIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ApiUsersIdRoute: ApiUsersIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/vue/src/router.tsx b/benchmarks/ssr/scenarios/server-routes/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/server-routes/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/server-routes/vue/src/routes/__root.tsx deleted file mode 100644 index 49422aac38..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/src/routes/__root.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/server-routes/vue/src/routes/api.users.$id.ts b/benchmarks/ssr/scenarios/server-routes/vue/src/routes/api.users.$id.ts deleted file mode 100644 index 7766b52acc..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/src/routes/api.users.$id.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/api/users/$id')({ - server: { - handlers: { - GET: ({ params }) => - Response.json({ - id: params.id, - name: `user-${params.id}`, - roles: ['a', 'b', 'c'], - }), - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/server-routes/vue/src/routes/index.tsx b/benchmarks/ssr/scenarios/server-routes/vue/src/routes/index.tsx deleted file mode 100644 index 39d1e2f935..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/src/routes/index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return
server routes
-} diff --git a/benchmarks/ssr/scenarios/server-routes/vue/tsconfig.json b/benchmarks/ssr/scenarios/server-routes/vue/tsconfig.json deleted file mode 100644 index 4fe3ccecb1..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/server-routes/vue/vite.config.ts b/benchmarks/ssr/scenarios/server-routes/vue/vite.config.ts deleted file mode 100644 index 0457453532..0000000000 --- a/benchmarks/ssr/scenarios/server-routes/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr server-routes (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/streaming/react/project.json b/benchmarks/ssr/scenarios/streaming/react/project.json deleted file mode 100644 index a905aa3474..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-streaming-react", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/react-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts b/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts deleted file mode 100644 index eb4c9dc1d6..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertStreamingSanity, - benchOptions, - runStreamingLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertStreamingSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr streaming deferred (react)', async () => - runStreamingLoop(handler), - ).run(benchOptions) -}) diff --git a/benchmarks/ssr/scenarios/streaming/react/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/streaming/react/src/routeTree.gen.ts deleted file mode 100644 index eb1af78a41..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/stream/$id' - id: '__root__' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/streaming/react/src/router.tsx b/benchmarks/ssr/scenarios/streaming/react/src/router.tsx deleted file mode 100644 index 7c4eb0babe..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/react-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/streaming/react/src/routes/__root.tsx b/benchmarks/ssr/scenarios/streaming/react/src/routes/__root.tsx deleted file mode 100644 index 1973ca20bb..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/streaming/react/src/routes/stream.$id.tsx b/benchmarks/ssr/scenarios/streaming/react/src/routes/stream.$id.tsx deleted file mode 100644 index 342f7ceb0c..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/src/routes/stream.$id.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/react-router' -import { Suspense } from 'react' -import { makeBigPayload, sleep0 } from '../../../shared-data' - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - fast: { label: `fast-${params.id}` }, - slowSmall: sleep0().then(() => ({ label: `slow-small-${params.id}` })), - slowBig: sleep0().then(() => makeBigPayload(params.id)), - }), - component: StreamComponent, -}) - -function StreamComponent() { - const data = Route.useLoaderData() - - return ( - <> -

{data.fast.label}

-

loading-small

- - {(d) =>

{d.label}

}
-
-

loading-big

- - - {(d) => ( -
-

{d.label}

- {d.chunks.map((chunk) => ( -

{chunk.value}

- ))} -
- )} -
-
- - ) -} diff --git a/benchmarks/ssr/scenarios/streaming/react/tsconfig.json b/benchmarks/ssr/scenarios/streaming/react/tsconfig.json deleted file mode 100644 index 8800818162..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "react-jsx", - "jsxImportSource": "react", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/streaming/react/vite.config.ts b/benchmarks/ssr/scenarios/streaming/react/vite.config.ts deleted file mode 100644 index e1cc5f534b..0000000000 --- a/benchmarks/ssr/scenarios/streaming/react/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import react from '@vitejs/plugin-react' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - react(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr streaming (react)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/scenarios/streaming/shared-bench.ts b/benchmarks/ssr/scenarios/streaming/shared-bench.ts deleted file mode 100644 index cc45062e1b..0000000000 --- a/benchmarks/ssr/scenarios/streaming/shared-bench.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { expect } from 'vitest' -import { streamChunkCount } from './shared-data' -import { randomSegment, runRequestLoop } from '../../bench-utils' -import type { StartRequestHandler } from '../../bench-utils' - -export type { StartRequestHandler } - -const benchmarkSeed = 0xdecafbad - -export const CHROME_UA = - 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36' - -const requestInit = { - method: 'GET', - headers: { - accept: 'text/html', - 'user-agent': CHROME_UA, - }, -} satisfies RequestInit - -function buildStreamingRequest(random: () => number) { - return new Request( - `http://localhost/stream/${randomSegment(random)}`, - requestInit, - ) -} - -function getMarkerIndexes(body: string, marker: string) { - const indexes: Array = [] - let index = body.indexOf(marker) - - while (index !== -1) { - indexes.push(index) - index = body.indexOf(marker, index + marker.length) - } - - return indexes -} - -export async function assertStreamingSanity(handler: StartRequestHandler) { - const id = 'sanity-stream' - const response = await handler.fetch( - new Request(`http://localhost/stream/${id}`, requestInit), - ) - const body = await response.text() - const loadingSmallIndexes = getMarkerIndexes(body, 'loading-small') - const loadingBigIndexes = getMarkerIndexes(body, 'loading-big') - const tsrIndex = body.indexOf('$_TSR') - - expect(response.status).toBe(200) - expect(loadingSmallIndexes).toHaveLength(1) - expect(loadingBigIndexes).toHaveLength(1) - expect(body).toContain(`slow-small-${id}`) - expect(body).toContain(`slow-big-${id}`) - expect(body).toContain(`${id}:0:`) - expect(body).toContain(`${id}:${streamChunkCount - 1}:`) - - const loadingSmallIndex = loadingSmallIndexes[0]! - const loadingBigIndex = loadingBigIndexes[0]! - - expect(loadingBigIndex).toBeGreaterThan(loadingSmallIndex) - expect(tsrIndex).toBeGreaterThan(loadingBigIndex) -} - -export const benchOptions = { - warmupIterations: 100, - time: 10_000, - throws: true, -} - -export function runStreamingLoop(handler: StartRequestHandler) { - return runRequestLoop(handler, { - seed: benchmarkSeed, - concurrency: 16, - totalRequests: 16, - buildRequest: buildStreamingRequest, - }) -} diff --git a/benchmarks/ssr/scenarios/streaming/shared-data.ts b/benchmarks/ssr/scenarios/streaming/shared-data.ts deleted file mode 100644 index 695ed107c6..0000000000 --- a/benchmarks/ssr/scenarios/streaming/shared-data.ts +++ /dev/null @@ -1,69 +0,0 @@ -export interface SmallPayload { - label: string -} - -export interface BigPayload { - label: string - chunks: Array<{ - index: number - value: string - }> -} - -const alphabet = 'abcdefghijklmnopqrstuvwxyz0123456789' -export const streamChunkCount = 96 -export const streamChunkLength = 192 - -export function sleep0() { - // Give SSR a render turn before resolving deferred values. Counted turns - // avoid grouping concurrent requests by wall-clock timer expiration. - return new Promise((resolve) => { - setImmediate(() => setImmediate(resolve)) - }) -} - -function hashId(id: string) { - let state = 2166136261 - - for (let index = 0; index < id.length; index++) { - state ^= id.charCodeAt(index) - state = Math.imul(state, 16777619) >>> 0 - } - - return state || 1 -} - -function nextState(state: number) { - return (state * 1664525 + 1013904223) >>> 0 -} - -function makeChunk(seed: number) { - let state = seed - let value = '' - - for (let index = 0; index < streamChunkLength; index++) { - state = nextState(state) - value += alphabet[state % alphabet.length] - } - - return { state, value } -} - -export function makeBigPayload(id: string): BigPayload { - let state = hashId(id) - const chunks: BigPayload['chunks'] = [] - - for (let index = 0; index < streamChunkCount; index++) { - const chunk = makeChunk(state + index) - state = chunk.state - chunks.push({ - index, - value: `${id}:${index}:${chunk.value}`, - }) - } - - return { - label: `slow-big-${id}`, - chunks, - } -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/project.json b/benchmarks/ssr/scenarios/streaming/solid/project.json deleted file mode 100644 index 15e5f21103..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-streaming-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts b/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts deleted file mode 100644 index 19d5817d32..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertStreamingSanity, - benchOptions, - runStreamingLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertStreamingSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr streaming deferred (solid)', async () => - runStreamingLoop(handler), - ).run(benchOptions) -}) diff --git a/benchmarks/ssr/scenarios/streaming/solid/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/streaming/solid/src/routeTree.gen.ts deleted file mode 100644 index e015aee737..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/stream/$id' - id: '__root__' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/src/router.tsx b/benchmarks/ssr/scenarios/streaming/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/src/routes/__root.tsx b/benchmarks/ssr/scenarios/streaming/solid/src/routes/__root.tsx deleted file mode 100644 index 15de858e78..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/src/routes/stream.$id.tsx b/benchmarks/ssr/scenarios/streaming/solid/src/routes/stream.$id.tsx deleted file mode 100644 index 1a65fff950..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/src/routes/stream.$id.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { Suspense } from 'solid-js' -import { makeBigPayload, sleep0 } from '../../../shared-data' - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - fast: { label: `fast-${params.id}` }, - slowSmall: sleep0().then(() => ({ label: `slow-small-${params.id}` })), - slowBig: sleep0().then(() => makeBigPayload(params.id)), - }), - component: StreamComponent, -}) - -function StreamComponent() { - const data = Route.useLoaderData() - - return ( - <> -

{data().fast.label}

-

loading-small

- - {(d) =>

{d.label}

}
-
-

loading-big

- - - {(d) => ( -
-

{d.label}

- {d.chunks.map((chunk) => ( -

{chunk.value}

- ))} -
- )} -
-
- - ) -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/tsconfig.json b/benchmarks/ssr/scenarios/streaming/solid/tsconfig.json deleted file mode 100644 index 47f264ba4f..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/streaming/solid/vite.config.ts b/benchmarks/ssr/scenarios/streaming/solid/vite.config.ts deleted file mode 100644 index 353c21f552..0000000000 --- a/benchmarks/ssr/scenarios/streaming/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr streaming (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/scenarios/streaming/vue/project.json b/benchmarks/ssr/scenarios/streaming/vue/project.json deleted file mode 100644 index acaa7c460c..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-streaming-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts b/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts deleted file mode 100644 index 42473fc694..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/speed.bench.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { test } from 'vitest' -import { - assertStreamingSanity, - benchOptions, - runStreamingLoop, - type StartRequestHandler, -} from '../shared-bench' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -await assertStreamingSanity(handler) - -test('ssr', async ({ bench }) => { - await bench('ssr streaming deferred (vue)', async () => - runStreamingLoop(handler), - ).run(benchOptions) -}) diff --git a/benchmarks/ssr/scenarios/streaming/vue/src/routeTree.gen.ts b/benchmarks/ssr/scenarios/streaming/vue/src/routeTree.gen.ts deleted file mode 100644 index 2ec10975f2..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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 StreamIdRouteImport } from './routes/stream.$id' - -const StreamIdRoute = StreamIdRouteImport.update({ - id: '/stream/$id', - path: '/stream/$id', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesByTo { - '/stream/$id': typeof StreamIdRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/stream/$id': typeof StreamIdRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/stream/$id' - fileRoutesByTo: FileRoutesByTo - to: '/stream/$id' - id: '__root__' | '/stream/$id' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - StreamIdRoute: typeof StreamIdRoute -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/stream/$id': { - id: '/stream/$id' - path: '/stream/$id' - fullPath: '/stream/$id' - preLoaderRoute: typeof StreamIdRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - StreamIdRoute: StreamIdRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/scenarios/streaming/vue/src/router.tsx b/benchmarks/ssr/scenarios/streaming/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/scenarios/streaming/vue/src/routes/__root.tsx b/benchmarks/ssr/scenarios/streaming/vue/src/routes/__root.tsx deleted file mode 100644 index 4b03519823..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/scenarios/streaming/vue/src/routes/stream.$id.tsx b/benchmarks/ssr/scenarios/streaming/vue/src/routes/stream.$id.tsx deleted file mode 100644 index d627fa56c9..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/src/routes/stream.$id.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/vue-router' -import { Suspense, defineComponent } from 'vue' -import { makeBigPayload, sleep0 } from '../../../shared-data' -import type { BigPayload, SmallPayload } from '../../../shared-data' - -const StreamComponent = defineComponent({ - setup() { - const data = Route.useLoaderData() - - return () => ( - <> -

{data.value.fast.label}

-

loading-small

- - {{ - default: () => ( -

{d.label}

} - /> - ), - fallback: () => null, - }} -
-

loading-big

- - {{ - default: () => ( - ( -
-

{d.label}

- {d.chunks.map((chunk) => ( -

{chunk.value}

- ))} -
- )} - /> - ), - fallback: () => null, - }} -
- - ) - }, -}) - -export const Route = createFileRoute('/stream/$id')({ - loader: ({ params }) => ({ - fast: { label: `fast-${params.id}` }, - slowSmall: sleep0().then(() => ({ label: `slow-small-${params.id}` })), - slowBig: sleep0().then(() => makeBigPayload(params.id)), - }), - component: StreamComponent, -}) diff --git a/benchmarks/ssr/scenarios/streaming/vue/tsconfig.json b/benchmarks/ssr/scenarios/streaming/vue/tsconfig.json deleted file mode 100644 index c302f63770..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "extends": "../../../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../../../bench-utils.ts", - "../shared-data.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/scenarios/streaming/vue/vite.config.ts b/benchmarks/ssr/scenarios/streaming/vue/vite.config.ts deleted file mode 100644 index a09a30076f..0000000000 --- a/benchmarks/ssr/scenarios/streaming/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr streaming (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/ssr/solid/project.json b/benchmarks/ssr/solid/project.json deleted file mode 100644 index 0f19144d3b..0000000000 --- a/benchmarks/ssr/solid/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-solid", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/solid-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/solid/speed.bench.ts b/benchmarks/ssr/solid/speed.bench.ts deleted file mode 100644 index 2f72977612..0000000000 --- a/benchmarks/ssr/solid/speed.bench.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test } from 'vitest' -import { runSsrRequestLoop } from '../bench-utils' -import type { StartRequestHandler } from '../bench-utils' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href -const benchmarkSeed = 0xcafebabe - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -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/solid/src/routeTree.gen.ts b/benchmarks/ssr/solid/src/routeTree.gen.ts deleted file mode 100644 index 27cbe59476..0000000000 --- a/benchmarks/ssr/solid/src/routeTree.gen.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' -import { Route as ABCDRouteImport } from './routes/$a.$b.$c.$d' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) -const ABCDRoute = ABCDRouteImport.update({ - id: '/$d', - path: '/$d', - getParentRoute: () => ABCRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - '/$a/$b/$c/$d': { - id: '/$a/$b/$c/$d' - path: '/$d' - fullPath: '/$a/$b/$c/$d' - preLoaderRoute: typeof ABCDRouteImport - parentRoute: typeof ABCRoute - } - } -} - -interface ABCRouteChildren { - ABCDRoute: typeof ABCDRoute -} - -const ABCRouteChildren: ABCRouteChildren = { - ABCDRoute: ABCDRoute, -} - -const ABCRouteWithChildren = ABCRoute._addFileChildren(ABCRouteChildren) - -interface ABRouteChildren { - ABCRoute: typeof ABCRouteWithChildren -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRouteWithChildren, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/solid/src/router.tsx b/benchmarks/ssr/solid/src/router.tsx deleted file mode 100644 index 038ec0ab5e..0000000000 --- a/benchmarks/ssr/solid/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/solid-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/solid/src/routes/$a.$b.$c.$d.tsx b/benchmarks/ssr/solid/src/routes/$a.$b.$c.$d.tsx deleted file mode 100644 index 9bab038f37..0000000000 --- a/benchmarks/ssr/solid/src/routes/$a.$b.$c.$d.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b/$c/$d')({ - component: LevelDComponent, -}) - -function LevelDComponent() { - return -} diff --git a/benchmarks/ssr/solid/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/solid/src/routes/$a.$b.$c.tsx deleted file mode 100644 index e10b9da6df..0000000000 --- a/benchmarks/ssr/solid/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b/$c')({ - component: LevelCComponent, -}) - -function LevelCComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/solid/src/routes/$a.$b.tsx b/benchmarks/ssr/solid/src/routes/$a.$b.tsx deleted file mode 100644 index cd2d0e9754..0000000000 --- a/benchmarks/ssr/solid/src/routes/$a.$b.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b')({ - component: LevelBComponent, -}) - -function LevelBComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/solid/src/routes/$a.tsx b/benchmarks/ssr/solid/src/routes/$a.tsx deleted file mode 100644 index a2f0200882..0000000000 --- a/benchmarks/ssr/solid/src/routes/$a.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a')({ - component: LevelAComponent, -}) - -function LevelAComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/solid/src/routes/__root.tsx b/benchmarks/ssr/solid/src/routes/__root.tsx deleted file mode 100644 index 15de858e78..0000000000 --- a/benchmarks/ssr/solid/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/solid/src/workload.tsx b/benchmarks/ssr/solid/src/workload.tsx deleted file mode 100644 index 76fcae555a..0000000000 --- a/benchmarks/ssr/solid/src/workload.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { For, createEffect } from 'solid-js' -import { Link, useParams, useSearch } from '@tanstack/solid-router' - -const probes = Array.from({ length: 10 }, (_, index) => index) - -function runSelectorWork(input: string, salt: number) { - let value = salt - - for (let index = 0; index < input.length; index++) { - value = (value * 33 + input.charCodeAt(index) + index) >>> 0 - } - - for (let index = 0; index < 16; index++) { - value = (value ^ (value << 13)) >>> 0 - value = (value ^ (value >> 17)) >>> 0 - value = (value ^ (value << 5)) >>> 0 - } - - return value -} - -function ParamsProbe(props: { salt: number }) { - const params = useParams({ - strict: false, - select: (nextParams) => - runSelectorWork( - `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`, - props.salt, - ), - }) - - createEffect(() => { - void params() - }) - - return null -} - -function SearchProbe(props: { salt: number }) { - const search = useSearch({ - strict: false, - select: (nextSearch) => - runSelectorWork(String(nextSearch.q ?? ''), props.salt), - }) - - createEffect(() => { - void search() - }) - - return null -} - -function LinkProbe(props: { salt: number }) { - const value = String((props.salt % 97) + 1) - - return ( - - Link - - ) -} - -export function RouteWorkload() { - return ( - <> - {(probe) => } - {(probe) => } - {(probe) => } - - ) -} diff --git a/benchmarks/ssr/solid/tsconfig.json b/benchmarks/ssr/solid/tsconfig.json deleted file mode 100644 index 6c87e995c7..0000000000 --- a/benchmarks/ssr/solid/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "solid-js", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/solid/vite.config.ts b/benchmarks/ssr/solid/vite.config.ts deleted file mode 100644 index dfd82d9192..0000000000 --- a/benchmarks/ssr/solid/vite.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import { cpuSimulationExecArgv } from '../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - solid({ ssr: true, hot: false, dev: false }), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr (solid)', - watch: false, - environment: 'node', - server: { - deps: { - inline: [/@solidjs/, /@tanstack\/solid-store/], - }, - }, - }, -}) diff --git a/benchmarks/ssr/tsconfig.json b/benchmarks/ssr/tsconfig.json deleted file mode 100644 index 7279177023..0000000000 --- a/benchmarks/ssr/tsconfig.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "extends": "../../tsconfig.json", - "compilerOptions": { - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "bench-utils.ts", - "bench-utils.test.ts", - "scenarios/streaming/shared-data.ts", - "vitest.unit.config.ts" - ] -} diff --git a/benchmarks/ssr/vitest.config.ts b/benchmarks/ssr/vitest.config.ts deleted file mode 100644 index a91eae4967..0000000000 --- a/benchmarks/ssr/vitest.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: [ - './react/vite.config.ts', - './solid/vite.config.ts', - './vue/vite.config.ts', - './scenarios/*/*/vite.config.ts', - ], - }, -}) diff --git a/benchmarks/ssr/vitest.react.config.ts b/benchmarks/ssr/vitest.react.config.ts deleted file mode 100644 index a397ad929e..0000000000 --- a/benchmarks/ssr/vitest.react.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: ['./react/vite.config.ts', './scenarios/*/react/vite.config.ts'], - }, -}) diff --git a/benchmarks/ssr/vitest.solid.config.ts b/benchmarks/ssr/vitest.solid.config.ts deleted file mode 100644 index b8827b86aa..0000000000 --- a/benchmarks/ssr/vitest.solid.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: ['./solid/vite.config.ts', './scenarios/*/solid/vite.config.ts'], - }, -}) diff --git a/benchmarks/ssr/vitest.unit.config.ts b/benchmarks/ssr/vitest.unit.config.ts deleted file mode 100644 index cbba6db9ef..0000000000 --- a/benchmarks/ssr/vitest.unit.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - name: '@benchmarks/ssr unit', - environment: 'node', - include: ['bench-utils.test.ts'], - }, -}) diff --git a/benchmarks/ssr/vitest.vue.config.ts b/benchmarks/ssr/vitest.vue.config.ts deleted file mode 100644 index 17960d7569..0000000000 --- a/benchmarks/ssr/vitest.vue.config.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vitest/config' - -export default defineConfig({ - test: { - watch: false, - projects: ['./vue/vite.config.ts', './scenarios/*/vue/vite.config.ts'], - }, -}) diff --git a/benchmarks/ssr/vue/project.json b/benchmarks/ssr/vue/project.json deleted file mode 100644 index 930d6c2e22..0000000000 --- a/benchmarks/ssr/vue/project.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "@benchmarks/ssr-vue", - "projectType": "application", - "targets": { - "build:ssr": { - "executor": "nx:run-commands", - "cache": false, - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "NODE_ENV=production vite build --config {projectRoot}/vite.config.ts" - } - }, - "test:types:ssr": { - "executor": "nx:run-commands", - "dependsOn": [ - { - "projects": ["@tanstack/vue-start"], - "target": "build" - } - ], - "options": { - "command": "tsc -p {projectRoot}/tsconfig.json --noEmit" - } - } - } -} diff --git a/benchmarks/ssr/vue/speed.bench.ts b/benchmarks/ssr/vue/speed.bench.ts deleted file mode 100644 index 57b59e0504..0000000000 --- a/benchmarks/ssr/vue/speed.bench.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { test } from 'vitest' -import { runSsrRequestLoop } from '../bench-utils' -import type { StartRequestHandler } from '../bench-utils' - -const appModuleUrl = new URL('./dist/server/server.js', import.meta.url).href -const benchmarkSeed = 0xdeadbeef - -const { default: handler } = (await import( - /* @vite-ignore */ appModuleUrl -)) as { - default: StartRequestHandler -} - -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/benchmarks/ssr/vue/src/routeTree.gen.ts b/benchmarks/ssr/vue/src/routeTree.gen.ts deleted file mode 100644 index a6dfb5853e..0000000000 --- a/benchmarks/ssr/vue/src/routeTree.gen.ts +++ /dev/null @@ -1,146 +0,0 @@ -/* 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 ARouteImport } from './routes/$a' -import { Route as ABRouteImport } from './routes/$a.$b' -import { Route as ABCRouteImport } from './routes/$a.$b.$c' -import { Route as ABCDRouteImport } from './routes/$a.$b.$c.$d' - -const ARoute = ARouteImport.update({ - id: '/$a', - path: '/$a', - getParentRoute: () => rootRouteImport, -} as any) -const ABRoute = ABRouteImport.update({ - id: '/$b', - path: '/$b', - getParentRoute: () => ARoute, -} as any) -const ABCRoute = ABCRouteImport.update({ - id: '/$c', - path: '/$c', - getParentRoute: () => ABRoute, -} as any) -const ABCDRoute = ABCDRouteImport.update({ - id: '/$d', - path: '/$d', - getParentRoute: () => ABCRoute, -} as any) - -export interface FileRoutesByFullPath { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRoutesByTo { - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/$a': typeof ARouteWithChildren - '/$a/$b': typeof ABRouteWithChildren - '/$a/$b/$c': typeof ABCRouteWithChildren - '/$a/$b/$c/$d': typeof ABCDRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - fileRoutesByTo: FileRoutesByTo - to: '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - id: '__root__' | '/$a' | '/$a/$b' | '/$a/$b/$c' | '/$a/$b/$c/$d' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - ARoute: typeof ARouteWithChildren -} - -declare module '@tanstack/vue-router' { - interface FileRoutesByPath { - '/$a': { - id: '/$a' - path: '/$a' - fullPath: '/$a' - preLoaderRoute: typeof ARouteImport - parentRoute: typeof rootRouteImport - } - '/$a/$b': { - id: '/$a/$b' - path: '/$b' - fullPath: '/$a/$b' - preLoaderRoute: typeof ABRouteImport - parentRoute: typeof ARoute - } - '/$a/$b/$c': { - id: '/$a/$b/$c' - path: '/$c' - fullPath: '/$a/$b/$c' - preLoaderRoute: typeof ABCRouteImport - parentRoute: typeof ABRoute - } - '/$a/$b/$c/$d': { - id: '/$a/$b/$c/$d' - path: '/$d' - fullPath: '/$a/$b/$c/$d' - preLoaderRoute: typeof ABCDRouteImport - parentRoute: typeof ABCRoute - } - } -} - -interface ABCRouteChildren { - ABCDRoute: typeof ABCDRoute -} - -const ABCRouteChildren: ABCRouteChildren = { - ABCDRoute: ABCDRoute, -} - -const ABCRouteWithChildren = ABCRoute._addFileChildren(ABCRouteChildren) - -interface ABRouteChildren { - ABCRoute: typeof ABCRouteWithChildren -} - -const ABRouteChildren: ABRouteChildren = { - ABCRoute: ABCRouteWithChildren, -} - -const ABRouteWithChildren = ABRoute._addFileChildren(ABRouteChildren) - -interface ARouteChildren { - ABRoute: typeof ABRouteWithChildren -} - -const ARouteChildren: ARouteChildren = { - ABRoute: ABRouteWithChildren, -} - -const ARouteWithChildren = ARoute._addFileChildren(ARouteChildren) - -const rootRouteChildren: RootRouteChildren = { - ARoute: ARouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/vue-start' -declare module '@tanstack/vue-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/benchmarks/ssr/vue/src/router.tsx b/benchmarks/ssr/vue/src/router.tsx deleted file mode 100644 index 4290e7cdd3..0000000000 --- a/benchmarks/ssr/vue/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/vue-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - defaultPreload: false, - scrollRestoration: false, - }) -} - -declare module '@tanstack/vue-router' { - interface Register { - router: ReturnType - } -} diff --git a/benchmarks/ssr/vue/src/routes/$a.$b.$c.$d.tsx b/benchmarks/ssr/vue/src/routes/$a.$b.$c.$d.tsx deleted file mode 100644 index 36c2896840..0000000000 --- a/benchmarks/ssr/vue/src/routes/$a.$b.$c.$d.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/vue-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b/$c/$d')({ - component: LevelDComponent, -}) - -function LevelDComponent() { - return -} diff --git a/benchmarks/ssr/vue/src/routes/$a.$b.$c.tsx b/benchmarks/ssr/vue/src/routes/$a.$b.$c.tsx deleted file mode 100644 index 3249876970..0000000000 --- a/benchmarks/ssr/vue/src/routes/$a.$b.$c.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b/$c')({ - component: LevelCComponent, -}) - -function LevelCComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/vue/src/routes/$a.$b.tsx b/benchmarks/ssr/vue/src/routes/$a.$b.tsx deleted file mode 100644 index fe50f88736..0000000000 --- a/benchmarks/ssr/vue/src/routes/$a.$b.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a/$b')({ - component: LevelBComponent, -}) - -function LevelBComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/vue/src/routes/$a.tsx b/benchmarks/ssr/vue/src/routes/$a.tsx deleted file mode 100644 index 51310ce063..0000000000 --- a/benchmarks/ssr/vue/src/routes/$a.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/vue-router' -import { RouteWorkload } from '../workload' - -export const Route = createFileRoute('/$a')({ - component: LevelAComponent, -}) - -function LevelAComponent() { - return ( - <> - - - - ) -} diff --git a/benchmarks/ssr/vue/src/routes/__root.tsx b/benchmarks/ssr/vue/src/routes/__root.tsx deleted file mode 100644 index 4b03519823..0000000000 --- a/benchmarks/ssr/vue/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - Body, - HeadContent, - Html, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/vue-router' - -export const Route = createRootRoute({ - component: RootComponent, - validateSearch: (s) => s as { q?: string }, -}) - -function RootComponent() { - return ( - - - - - - - - - - ) -} diff --git a/benchmarks/ssr/vue/src/workload.tsx b/benchmarks/ssr/vue/src/workload.tsx deleted file mode 100644 index 3266aff694..0000000000 --- a/benchmarks/ssr/vue/src/workload.tsx +++ /dev/null @@ -1,111 +0,0 @@ -import * as Vue from 'vue' -import { Link, useParams, useSearch } from '@tanstack/vue-router' - -const probes = Array.from({ length: 10 }, (_, index) => index) - -function runSelectorWork(input: string, salt: number) { - let value = salt - - for (let index = 0; index < input.length; index++) { - value = (value * 33 + input.charCodeAt(index) + index) >>> 0 - } - - for (let index = 0; index < 16; index++) { - value = (value ^ (value << 13)) >>> 0 - value = (value ^ (value >> 17)) >>> 0 - value = (value ^ (value << 5)) >>> 0 - } - - return value -} - -const ParamsProbe = Vue.defineComponent({ - props: { - salt: { - type: Number, - required: true, - }, - }, - setup(props) { - const params = useParams({ - strict: false, - select: (nextParams) => - runSelectorWork( - `${nextParams.a ?? ''}/${nextParams.b ?? ''}/${nextParams.c ?? ''}/${nextParams.d ?? ''}`, - props.salt, - ), - }) - - return () => { - void params.value - return null - } - }, -}) - -const SearchProbe = Vue.defineComponent({ - props: { - salt: { - type: Number, - required: true, - }, - }, - setup(props) { - const search = useSearch({ - strict: false, - select: (nextSearch) => - runSelectorWork(String(nextSearch.q ?? ''), props.salt), - }) - - return () => { - void search.value - return null - } - }, -}) - -const LinkProbe = Vue.defineComponent({ - props: { - salt: { - type: Number, - required: true, - }, - }, - setup(props) { - const value = String((props.salt % 97) + 1) - - return () => ( - - Link - - ) - }, -}) - -export const RouteWorkload = Vue.defineComponent({ - setup() { - return () => ( - <> - {probes.map((probe) => ( - - ))} - {probes.map((probe) => ( - - ))} - {probes.map((probe) => ( - - ))} - - ) - }, -}) diff --git a/benchmarks/ssr/vue/tsconfig.json b/benchmarks/ssr/vue/tsconfig.json deleted file mode 100644 index 1895164239..0000000000 --- a/benchmarks/ssr/vue/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "extends": "../../../tsconfig.json", - "compilerOptions": { - "jsx": "preserve", - "jsxImportSource": "vue", - "types": ["node", "vite/client", "vitest/globals"] - }, - "include": [ - "speed.bench.ts", - "vite.config.ts", - "../bench-utils.ts", - "./src/**/*" - ] -} diff --git a/benchmarks/ssr/vue/vite.config.ts b/benchmarks/ssr/vue/vite.config.ts deleted file mode 100644 index b2b9fc8a09..0000000000 --- a/benchmarks/ssr/vue/vite.config.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { fileURLToPath } from 'node:url' -import { defineConfig } from 'vitest/config' -import codspeedPlugin from '@codspeed/vitest-plugin' -import { tanstackStart } from '@tanstack/vue-start/plugin/vite' -import vueJsx from '@vitejs/plugin-vue-jsx' -import { cpuSimulationExecArgv } from '../../cpu-simulation' - -const rootDir = fileURLToPath(new URL('.', import.meta.url)) - -export default defineConfig({ - root: rootDir, - plugins: [ - !!(process.env.VITEST && process.env.WITH_INSTRUMENTATION) && - codspeedPlugin(), - tanstackStart({ - srcDirectory: 'src', - }), - vueJsx(), - ], - build: { - outDir: './dist', - emptyOutDir: true, - minify: false, - }, - test: { - execArgv: cpuSimulationExecArgv(), - isolate: true, - name: '@benchmarks/ssr (vue)', - watch: false, - environment: 'node', - }, -}) diff --git a/benchmarks/tsconfig.json b/benchmarks/tsconfig.json deleted file mode 100644 index 5e9ff9a8e1..0000000000 --- a/benchmarks/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "../tsconfig.json", - "compilerOptions": { - "types": ["node"] - }, - "include": ["cpu-simulation.ts"] -} diff --git a/docs/AGENTS.md b/docs/AGENTS.md deleted file mode 100644 index ab2d4117e2..0000000000 --- a/docs/AGENTS.md +++ /dev/null @@ -1,4 +0,0 @@ -# Documentation - -- Register new published pages in `router/config.json` or `start/config.json`; drafts need not be registered. -- Run `pnpm test:docs` from the repository root for Markdown link validation. It checks `docs/**/*.md`, not Markdown elsewhere. Relative links resolve from the containing file. diff --git a/docs/router/assets/search-serialization-deserialization-idempotency.jpg b/docs/assets/search-serialization-deserialization-idempotency.jpg similarity index 100% rename from docs/router/assets/search-serialization-deserialization-idempotency.jpg rename to docs/assets/search-serialization-deserialization-idempotency.jpg diff --git a/docs/config.json b/docs/config.json new file mode 100644 index 0000000000..5fb9e57916 --- /dev/null +++ b/docs/config.json @@ -0,0 +1,344 @@ +{ + "$schema": "https://raw.githubusercontent.com/TanStack/tanstack.com/main/tanstack-docs-config.schema.json", + "docSearch": { + "appId": "FQ0DQ6MA3C", + "apiKey": "8264730bab8a9b7fa6a0c85761d7a3fe", + "indexName": "tanstack" + }, + "sections": [ + { + "label": "Getting Started", + "children": [], + "frameworks": [ + { + "label": "react", + "children": [ + { + "label": "Overview", + "to": "framework/react/overview" + }, + { + "label": "Installation", + "to": "framework/react/installation" + }, + { + "label": "Quick Start", + "to": "framework/react/quick-start" + }, + { + "label": "Devtools", + "to": "framework/react/devtools" + }, + { + "label": "Comparison", + "to": "framework/react/comparison" + }, + { + "label": "Migrate from React Router", + "to": "framework/react/migrate-from-react-router" + }, + { + "label": "Migrate from React Location", + "to": "framework/react/migrate-from-react-location" + }, + { + "label": "Decisions on DX", + "to": "framework/react/decisions-on-dx" + } + ] + } + ] + }, + { + "label": "Guide", + "children": [], + "frameworks": [ + { + "label": "react", + "children": [ + { + "label": "Route Trees & Nesting", + "to": "framework/react/guide/route-trees" + }, + { + "label": "Routing Concepts", + "to": "framework/react/guide/routing-concepts" + }, + { + "label": "Code Splitting", + "to": "framework/react/guide/code-splitting" + }, + { + "label": "File-Based Routing", + "to": "framework/react/guide/file-based-routing" + }, + { + "label": "Code Based Routing", + "to": "framework/react/guide/code-based-routing" + }, + { + "label": "Creating a Router", + "to": "framework/react/guide/creating-a-router" + }, + { + "label": "Route Matching", + "to": "framework/react/guide/route-matching" + }, + { + "label": "Outlets", + "to": "framework/react/guide/outlets" + }, + { + "label": "Navigation", + "to": "framework/react/guide/navigation" + }, + { + "label": "Path Params", + "to": "framework/react/guide/path-params" + }, + { + "label": "Search Params", + "to": "framework/react/guide/search-params" + }, + { + "label": "Data Loading", + "to": "framework/react/guide/data-loading" + }, + { + "label": "Deferred Data Loading", + "to": "framework/react/guide/deferred-data-loading" + }, + { + "label": "External Data Loading", + "to": "framework/react/guide/external-data-loading" + }, + { + "label": "Data Mutations", + "to": "framework/react/guide/data-mutations" + }, + { + "label": "Type Safety", + "to": "framework/react/guide/type-safety" + }, + { + "label": "Preloading", + "to": "framework/react/guide/preloading" + }, + { + "label": "Route Masking", + "to": "framework/react/guide/route-masking" + }, + { + "label": "Navigation Blocking", + "to": "framework/react/guide/navigation-blocking" + }, + { + "label": "Custom Search Param Serialization", + "to": "framework/react/guide/custom-search-param-serialization" + }, + { + "label": "History Types", + "to": "framework/react/guide/history-types" + }, + { + "label": "Router Context", + "to": "framework/react/guide/router-context" + }, + { + "label": "Not Found Errors", + "to": "framework/react/guide/not-found-errors" + }, + { + "label": "Authenticated Routes", + "to": "framework/react/guide/authenticated-routes" + }, + { + "label": "Scroll Restoration", + "to": "framework/react/guide/scroll-restoration" + }, + { + "label": "Static Route Data", + "to": "framework/react/guide/static-route-data" + }, + { + "label": "SSR", + "to": "framework/react/guide/ssr" + } + ] + } + ] + }, + { + "label": "Start", + "children": [], + "frameworks": [ + { + "label": "react", + "children": [ + { + "label": "Overview", + "to": "framework/react/start/overview" + }, + { + "label": "Getting Started", + "to": "framework/react/start/getting-started" + }, + { + "label": "Hosting", + "to": "framework/react/start/hosting" + }, + { + "label": "Authentication", + "to": "framework/react/start/authentication" + }, + { + "label": "Databases", + "to": "framework/react/start/databases" + }, + { + "label": "Observability", + "to": "framework/react/start/observability" + } + ] + } + ] + }, + { + "label": "API", + "children": [], + "frameworks": [ + { + "label": "react", + "children": [ + { + "label": "Reference", + "to": "framework/react/api/router" + } + ] + } + ] + }, + { + "label": "Router Examples", + "children": [], + "frameworks": [ + { + "label": "react", + "children": [ + { + "label": "Quickstart (file-based)", + "to": "framework/react/examples/quickstart-file-based" + }, + { + "label": "Quickstart (code-based)", + "to": "framework/react/examples/quickstart" + }, + { + "label": "Basic (file-based)", + "to": "framework/react/examples/basic-file-based" + }, + { + "label": "Basic (code-based)", + "to": "framework/react/examples/basic" + }, + { + "label": "Basic + React Query (file-based)", + "to": "framework/react/examples/basic-react-query-file-based" + }, + { + "label": "Basic + React Query (code-based)", + "to": "framework/react/examples/basic-react-query" + }, + { + "label": "Basic + SSR (file-based)", + "to": "framework/react/examples/basic-ssr-file-based" + }, + { + "label": "Basic + SSR Streaming (file-based)", + "to": "framework/react/examples/basic-ssr-streaming-file-based" + }, + { + "label": "Kitchen Sink (file-based)", + "to": "framework/react/examples/kitchen-sink-file-based" + }, + { + "label": "Kitchen Sink (code-based)", + "to": "framework/react/examples/kitchen-sink" + }, + { + "label": "Kitchen Sink + React Query (file-based)", + "to": "framework/react/examples/kitchen-sink-react-query-file-based" + }, + { + "label": "Kitchen Sink + React Query (code-based)", + "to": "framework/react/examples/kitchen-sink-react-query" + }, + { + "label": "Location Masking", + "to": "framework/react/examples/location-masking" + }, + { + "label": "Authenticated Routes", + "to": "framework/react/examples/authenticated-routes" + }, + { + "label": "Scroll Restoration", + "to": "framework/react/examples/scroll-restoration" + }, + { + "label": "Deferred Data", + "to": "framework/react/examples/deferred-data" + }, + { + "label": "Navigation Blocking", + "to": "framework/react/examples/navigation-blocking" + }, + { + "label": "With tRPC", + "to": "framework/react/examples/with-trpc" + }, + { + "label": "With tRPC + React Query", + "to": "framework/react/examples/with-trpc-react-query" + } + ] + } + ] + }, + { + "label": "Start Examples", + "children": [], + "frameworks": [ + { + "label": "react", + "children": [ + { + "label": "Basic", + "to": "framework/react/examples/start-basic" + }, + { + "label": "Basic + React Query", + "to": "framework/react/examples/start-basic-react-query" + }, + { + "label": "Basic + Clerk Auth", + "to": "framework/react/examples/start-clerk-basic" + }, + { + "label": "Basic + DIY Auth", + "to": "framework/react/examples/start-basic-auth" + }, + { + "label": "Trellaux + Convex", + "to": "framework/react/examples/start-convex-trellaux" + }, + { + "label": "Trellaux", + "to": "framework/react/examples/start-trellaux" + } + ] + } + ] + } + ] +} diff --git a/docs/router/api/router.md b/docs/framework/react/api/router.md similarity index 89% rename from docs/router/api/router.md rename to docs/framework/react/api/router.md index 2c5ede186c..c2a55bad18 100644 --- a/docs/router/api/router.md +++ b/docs/framework/react/api/router.md @@ -17,27 +17,21 @@ title: Router API - [`isNotFound`](./router/isNotFoundFunction.md) - [`isRedirect`](./router/isRedirectFunction.md) - [`lazyRouteComponent`](./router/lazyRouteComponentFunction.md) - - [`linkOptions`](./router/linkOptions.md) - [`notFound`](./router/notFoundFunction.md) - [`redirect`](./router/redirectFunction.md) - - [`retainSearchParams`](./router/retainSearchParamsFunction.md) - - [`stripSearchParams`](./router/stripSearchParamsFunction.md) - Components - [``](./router/awaitComponent.md) - [``](./router/catchBoundaryComponent.md) - [``](./router/catchNotFoundComponent.md) - - [``](./router/clientOnlyComponent.md) - [``](./router/defaultGlobalNotFoundComponent.md) - [``](./router/errorComponentComponent.md) - [``](./router/linkComponent.md) - [``](./router/matchRouteComponent.md) - [``](./router/navigateComponent.md) - - [``](./router/notFoundComponentComponent.md) - [``](./router/outletComponent.md) - Hooks - [`useAwaited`](./router/useAwaitedHook.md) - [`useBlocker`](./router/useBlockerHook.md) - - [`useCanGoBack`](./router/useCanGoBack.md) - [`useChildMatches`](./router/useChildMatchesHook.md) - [`useLinkProps`](./router/useLinkPropsHook.md) - [`useLoaderData`](./router/useLoaderDataHook.md) @@ -56,13 +50,13 @@ title: Router API - Types - [`ActiveLinkOptions Type`](./router/ActiveLinkOptionsType.md) - [`AsyncRouteComponent Type`](./router/AsyncRouteComponentType.md) + - [`DeferredPromise Type`](./router/DeferredPromiseType.md) - [`HistoryState Interface`](./router/historyStateInterface.md) - [`LinkOptions Type`](./router/LinkOptionsType.md) - [`LinkProps Type`](./router/LinkPropsType.md) - [`MatchRouteOptions Type`](./router/MatchRouteOptionsType.md) - [`NavigateOptions Type`](./router/NavigateOptionsType.md) - [`NotFoundError Type`](./router/NotFoundErrorType.md) - - [`ParsedHistoryState Type`](./router/ParsedHistoryStateType.md) - [`ParsedLocation Type`](./router/ParsedLocationType.md) - [`Redirect Type`](./router/RedirectType.md) - [`Register Type`](./router/RegisterType.md) @@ -78,7 +72,6 @@ title: Router API - [`ToMaskOptions Type`](./router/ToMaskOptionsType.md) - [`ToOptions Type`](./router/ToOptionsType.md) - [`UseMatchRouteOptions Type`](./router/UseMatchRouteOptionsType.md) - - [`ViewTransitionOptions Type`](./router/ViewTransitionOptionsType.md) - ⚠️ Deprecated - [`FileRoute Class`](./router/FileRouteClass.md) - [`Route Class`](./router/RouteClass.md) diff --git a/docs/router/api/router/ActiveLinkOptionsType.md b/docs/framework/react/api/router/ActiveLinkOptionsType.md similarity index 100% rename from docs/router/api/router/ActiveLinkOptionsType.md rename to docs/framework/react/api/router/ActiveLinkOptionsType.md diff --git a/docs/router/api/router/AsyncRouteComponentType.md b/docs/framework/react/api/router/AsyncRouteComponentType.md similarity index 100% rename from docs/router/api/router/AsyncRouteComponentType.md rename to docs/framework/react/api/router/AsyncRouteComponentType.md diff --git a/docs/framework/react/api/router/DeferredPromiseType.md b/docs/framework/react/api/router/DeferredPromiseType.md new file mode 100644 index 0000000000..ef9bfb33ca --- /dev/null +++ b/docs/framework/react/api/router/DeferredPromiseType.md @@ -0,0 +1,29 @@ +--- +id: DeferredPromiseType +title: DeferredPromise type +--- + +The `DeferredPromise` type is used to describe a promise that can be resolved or rejected after it has been created. + +```tsx +type DeferredPromise = Promise & { + __deferredState: DeferredPromiseState +} + +type DeferredPromiseState = { uid: string } & ( + | { + status: 'pending' + data?: T + error?: unknown + } + | { + status: 'success' + data: T + } + | { + status: 'error' + data?: T + error: unknown + } +) +``` diff --git a/docs/router/api/router/FileRouteClass.md b/docs/framework/react/api/router/FileRouteClass.md similarity index 100% rename from docs/router/api/router/FileRouteClass.md rename to docs/framework/react/api/router/FileRouteClass.md diff --git a/docs/router/api/router/LinkOptionsType.md b/docs/framework/react/api/router/LinkOptionsType.md similarity index 77% rename from docs/router/api/router/LinkOptionsType.md rename to docs/framework/react/api/router/LinkOptionsType.md index 9d3d3fe8d8..eb34eca806 100644 --- a/docs/router/api/router/LinkOptionsType.md +++ b/docs/framework/react/api/router/LinkOptionsType.md @@ -9,7 +9,7 @@ The `LinkOptions` type extends the [`NavigateOptions`](./NavigateOptionsType.md) type LinkOptions = NavigateOptions & { target?: HTMLAnchorElement['target'] activeOptions?: ActiveOptions - preload?: false | 'intent' | 'viewport' | 'render' + preload?: false | 'intent' preloadDelay?: number disabled?: boolean } @@ -33,7 +33,7 @@ The `LinkOptions` object accepts/contains the following properties: ### `preload` -- Type: `false | 'intent' | 'viewport' | 'render'` +- Type: `false | 'intent' | 'viewport'` - Optional - If set, the link's preloading strategy will be set to this value. - See the [Preloading guide](../../guide/preloading.md) for more information. @@ -42,7 +42,7 @@ The `LinkOptions` object accepts/contains the following properties: - Type: `number` - Optional -- Delay focus, hover, and viewport preloading by this many milliseconds. Touch intent preloads immediately. If focus or hover ends, or the link leaves the viewport before the delay, the preload will be cancelled. +- Delay intent preloading by this many milliseconds. If the intent exits before this delay, the preload will be cancelled. ### `disabled` diff --git a/docs/router/api/router/LinkPropsType.md b/docs/framework/react/api/router/LinkPropsType.md similarity index 100% rename from docs/router/api/router/LinkPropsType.md rename to docs/framework/react/api/router/LinkPropsType.md diff --git a/docs/router/api/router/MatchRouteOptionsType.md b/docs/framework/react/api/router/MatchRouteOptionsType.md similarity index 82% rename from docs/router/api/router/MatchRouteOptionsType.md rename to docs/framework/react/api/router/MatchRouteOptionsType.md index 3ec757d420..579c8d427c 100644 --- a/docs/router/api/router/MatchRouteOptionsType.md +++ b/docs/framework/react/api/router/MatchRouteOptionsType.md @@ -8,7 +8,7 @@ The `MatchRouteOptions` type is used to describe the options that can be used wh ```tsx interface MatchRouteOptions { pending?: boolean - caseSensitive?: boolean /* @deprecated */ + caseSensitive?: boolean includeSearch?: boolean fuzzy?: boolean } @@ -24,12 +24,11 @@ The `MatchRouteOptions` type has the following properties: - Optional - If `true`, will match against pending location instead of the current location -### ~~`caseSensitive`~~ property (deprecated) +### `caseSensitive` property - Type: `boolean` - Optional - If `true`, will match against the current location with case sensitivity -- Declare case sensitivity in the route definition instead, or globally for all routes using the `caseSensitive` option on the router ### `includeSearch` property diff --git a/docs/framework/react/api/router/NavigateOptionsType.md b/docs/framework/react/api/router/NavigateOptionsType.md new file mode 100644 index 0000000000..f832d650b6 --- /dev/null +++ b/docs/framework/react/api/router/NavigateOptionsType.md @@ -0,0 +1,16 @@ +--- +id: NavigateOptionsType +title: NavigateOptions type +--- + +The `NavigateOptions` type is used to describe the options that can be used when describing a navigation action in TanStack Router. + +```tsx +type NavigateOptions = ToOptions & { + replace?: boolean + resetScroll?: boolean + ignoreBlocker?: boolean +} +``` + +- [`ToOptions`](./ToOptionsType.md) diff --git a/docs/router/api/router/NotFoundErrorType.md b/docs/framework/react/api/router/NotFoundErrorType.md similarity index 79% rename from docs/router/api/router/NotFoundErrorType.md rename to docs/framework/react/api/router/NotFoundErrorType.md index 1f4fbe4c74..54a1904eee 100644 --- a/docs/router/api/router/NotFoundErrorType.md +++ b/docs/framework/react/api/router/NotFoundErrorType.md @@ -11,7 +11,6 @@ export type NotFoundError = { data?: any throw?: boolean routeId?: string - headers?: HeadersInit } ``` @@ -19,32 +18,26 @@ export type NotFoundError = { The `NotFoundError` object accepts/contains the following properties: -### `global` property (⚠️ deprecated, use `routeId: rootRouteId` instead) +### `data` property + +- Type: `any` +- Optional +- Custom data that is passed into to `notFoundComponent` when the not-found error is handled + +### `global` property - Type: `boolean` - Optional - `default: false` - If true, the not-found error will be handled by the `notFoundComponent` of the root route instead of bubbling up from the route that threw it. This has the same behavior as importing the root route and calling `RootRoute.notFound()`. -### `data` property +### `route` property -- Type: `any` +- Type: `string` - Optional -- Custom data that is passed into `notFoundComponent` when the not-found error is handled +- The ID of the route that will attempt to handle the not-found error. If the route does not have a `notFoundComponent`, the error will bubble up to the parent route (and be handled by the root route if necessary). By default, TanStack Router will attempt to handle the not-found error with the route that threw it. ### `throw` property - Type: `boolean` - Optional - `default: false` - If provided, will throw the not-found object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `notFound({ throw: true })` to throw the not-found object instead of returning it. - -### `routeId` property - -- Type: `string` -- Optional -- The ID of the route that will attempt to handle the not-found error. If the route does not have a `notFoundComponent`, the error will bubble up to the parent route (and be handled by the root route if necessary). By default, TanStack Router will attempt to handle the not-found error with the route that threw it. - -### `headers` property - -- Type: `HeadersInit` -- Optional -- HTTP headers to be included when the not-found error is handled on the server side. diff --git a/docs/router/api/router/NotFoundRouteClass.md b/docs/framework/react/api/router/NotFoundRouteClass.md similarity index 100% rename from docs/router/api/router/NotFoundRouteClass.md rename to docs/framework/react/api/router/NotFoundRouteClass.md diff --git a/docs/router/api/router/ParsedLocationType.md b/docs/framework/react/api/router/ParsedLocationType.md similarity index 94% rename from docs/router/api/router/ParsedLocationType.md rename to docs/framework/react/api/router/ParsedLocationType.md index 321aa97a7f..43f7c46ea3 100644 --- a/docs/router/api/router/ParsedLocationType.md +++ b/docs/framework/react/api/router/ParsedLocationType.md @@ -11,7 +11,7 @@ interface ParsedLocation { pathname: string search: TFullSearchSchema searchStr: string - state: ParsedHistoryState + state: HistoryState hash: string maskedLocation?: ParsedLocation unmaskOnReload?: boolean diff --git a/docs/framework/react/api/router/RedirectType.md b/docs/framework/react/api/router/RedirectType.md new file mode 100644 index 0000000000..b8570dd2b3 --- /dev/null +++ b/docs/framework/react/api/router/RedirectType.md @@ -0,0 +1,31 @@ +--- +id: RedirectType +title: Redirect type +--- + +The `Redirect` type is used to represent a redirect action in TanStack Router. + +```tsx +export type Redirect = { + code?: number + throw?: any +} & NavigateOptions +``` + +- [`NavigateOptions`](./NavigateOptionsType.md) + +## Redirect properties + +The `Redirect` object accepts/contains the following properties: + +### `code` property + +- Type: `number` +- Optional +- The HTTP status code to use when redirecting + +### `throw` property + +- Type: `any` +- Optional +- If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it. diff --git a/docs/router/api/router/RegisterType.md b/docs/framework/react/api/router/RegisterType.md similarity index 100% rename from docs/router/api/router/RegisterType.md rename to docs/framework/react/api/router/RegisterType.md diff --git a/docs/router/api/router/RootRouteClass.md b/docs/framework/react/api/router/RootRouteClass.md similarity index 100% rename from docs/router/api/router/RootRouteClass.md rename to docs/framework/react/api/router/RootRouteClass.md diff --git a/docs/router/api/router/RouteApiClass.md b/docs/framework/react/api/router/RouteApiClass.md similarity index 100% rename from docs/router/api/router/RouteApiClass.md rename to docs/framework/react/api/router/RouteApiClass.md diff --git a/docs/framework/react/api/router/RouteApiType.md b/docs/framework/react/api/router/RouteApiType.md new file mode 100644 index 0000000000..1204cbd056 --- /dev/null +++ b/docs/framework/react/api/router/RouteApiType.md @@ -0,0 +1,126 @@ +--- +id: RouteApiType +title: RouteApi Type +--- + +The `RouteApi` describes an instance that provides type-safe versions of common hooks like `useParams`, `useSearch`, `useRouteContext`, `useNavigate`, `useLoaderData`, and `useLoaderDeps` that are pre-bound to a specific route ID and corresponding registered route types. + +## `RouteApi` properties and methods + +The `RouteApi` has the following properties and methods: + +### `useMatch` method + +```tsx + useMatch(opts?: { + select?: (match: TAllContext) => TSelected + }): TSelected +``` + +- A type-safe version of the [`useMatch`](./useMatchHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. +- Options + - `opts.select` + - Optional + - `(match: RouteMatch) => TSelected` + - If supplied, this function will be called with the route match and the return value will be returned from `useMatch`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. +- Returns + - If a `select` function is provided, the return value of the `select` function. + - If no `select` function is provided, the `RouteMatch` object or a loosened version of the `RouteMatch` object if `opts.strict` is `false`. + +### `useRouteContext` method + +```tsx + useRouteContext(opts?: { + select?: (search: TAllContext) => TSelected + }): TSelected +``` + +- A type-safe version of the [`useRouteContext`](./useRouteContextHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. +- Options + - `opts.select` + - Optional + - `(match: RouteContext) => TSelected` + - If supplied, this function will be called with the route match and the return value will be returned from `useRouteContext`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. +- Returns + - If a `select` function is provided, the return value of the `select` function. + - If no `select` function is provided, the `RouteContext` object or a loosened version of the `RouteContext` object if `opts.strict` is `false`. + +### `useSearch` method + +```tsx + useSearch(opts?: { + select?: (search: TFullSearchSchema) => TSelected + }): TSelected +``` + +- A type-safe version of the [`useSearch`](./useSearchHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. +- Options + - `opts.select` + - Optional + - `(match: TFullSearchSchema) => TSelected` + - If supplied, this function will be called with the route match and the return value will be returned from `useSearch`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. +- Returns + - If a `select` function is provided, the return value of the `select` function. + - If no `select` function is provided, the `TFullSearchSchema` object or a loosened version of the `TFullSearchSchema` object if `opts.strict` is `false`. + +### `useParams` method + +```tsx + useParams(opts?: { + select?: (params: TAllParams) => TSelected + }): TSelected +``` + +- A type-safe version of the [`useParams`](./useParamsHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. +- Options + - `opts.select` + - Optional + - `(match: TAllParams) => TSelected` + - If supplied, this function will be called with the route match and the return value will be returned from `useParams`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. +- Returns + - If a `select` function is provided, the return value of the `select` function. + - If no `select` function is provided, the `TAllParams` object or a loosened version of the `TAllParams` object if `opts.strict` is `false`. + +### `useLoaderData` method + +```tsx + useLoaderData(opts?: { + select?: (search: TLoaderData) => TSelected + }): TSelected +``` + +- A type-safe version of the [`useLoaderData`](./useLoaderDataHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. +- Options + - `opts.select` + - Optional + - `(match: TLoaderData) => TSelected` + - If supplied, this function will be called with the route match and the return value will be returned from `useLoaderData`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. +- Returns + - If a `select` function is provided, the return value of the `select` function. + - If no `select` function is provided, the `TLoaderData` object or a loosened version of the `TLoaderData` object if `opts.strict` is `false`. + +### `useLoaderDeps` method + +```tsx + useLoaderDeps(opts?: { + select?: (search: TLoaderDeps) => TSelected + }): TSelected +``` + +- A type-safe version of the [`useLoaderDeps`](./useLoaderDepsHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. +- Options + - `opts.select` + - Optional + - `(match: TLoaderDeps) => TSelected` + - If supplied, this function will be called with the route match and the return value will be returned from `useLoaderDeps`. +- Returns + - If a `select` function is provided, the return value of the `select` function. + - If no `select` function is provided, the `TLoaderDeps` object. + +### `useNavigate` method + +```tsx + useNavigate(): // navigate function +``` + +- A type-safe version of [`useNavigate`](./useNavigateHook.md) that is pre-bound to the route ID that the `RouteApi` instance was created with. diff --git a/docs/router/api/router/RouteClass.md b/docs/framework/react/api/router/RouteClass.md similarity index 100% rename from docs/router/api/router/RouteClass.md rename to docs/framework/react/api/router/RouteClass.md diff --git a/docs/router/api/router/RouteMaskType.md b/docs/framework/react/api/router/RouteMaskType.md similarity index 100% rename from docs/router/api/router/RouteMaskType.md rename to docs/framework/react/api/router/RouteMaskType.md diff --git a/docs/framework/react/api/router/RouteMatchType.md b/docs/framework/react/api/router/RouteMatchType.md new file mode 100644 index 0000000000..12d69cca74 --- /dev/null +++ b/docs/framework/react/api/router/RouteMatchType.md @@ -0,0 +1,29 @@ +--- +id: RouteMatchType +title: RouteMatch type +--- + +The `RouteMatch` type represents a route match in TanStack Router. + +```tsx +interface RouteMatch { + id: string + routeId: string + pathname: string + params: Route['allParams'] + status: 'pending' | 'success' | 'error' + isFetching: boolean + showPending: boolean + error: unknown + paramsError: unknown + searchError: unknown + updatedAt: number + loadPromise?: Promise + loaderData?: Route['loaderData'] + context: Route['allContext'] + search: Route['fullSearchSchema'] + fetchedAt: number + abortController: AbortController + cause: 'enter' | 'stay' +} +``` diff --git a/docs/framework/react/api/router/RouteOptionsType.md b/docs/framework/react/api/router/RouteOptionsType.md new file mode 100644 index 0000000000..ec40bedf36 --- /dev/null +++ b/docs/framework/react/api/router/RouteOptionsType.md @@ -0,0 +1,261 @@ +--- +id: RouteOptionsType +title: RouteOptions type +--- + +The `RouteOptions` type is used to describe the options that can be used when creating a route. + +## RouteOptions properties + +The `RouteOptions` type accepts an object with the following properties: + +### `getParentRoute` method + +- Type: `() => TParentRoute` +- Required +- A function that returns the parent route of the route being created. This is required to provide full type safety to child route configurations and to ensure that the route tree is built correctly. + +### `path` property + +- Type: `string` +- Required, unless an `id` is provided to configure the route as a layout route +- The path segment that will be used to match the route. + +### `id` property + +- Type: `string` +- Optional, but required if a `path` is not provided +- The unique identifier for the route if it is to be configured as a layout route. If provided, the, the route will not match against the location pathname and its routes will be flattened into its parent route for matching. + +### `component` property + +- Type: `RouteComponent` or `LazyRouteComponent` +- Optional - Defaults to `` +- The content to be rendered when the route is matched. + +### `errorComponent` property + +- Type: `RouteComponent` or `LazyRouteComponent` +- Optional - Defaults to `routerOptions.defaultErrorComponent` +- The content to be rendered when the route encounters an error. + +### `pendingComponent` property + +- Type: `RouteComponent` or `LazyRouteComponent` +- Optional - Defaults to `routerOptions.defaultPendingComponent` +- The content to be rendered if and when the route is pending and has reached its pendingMs threshold. + +### `notFoundComponent` property + +- Type: `NotFoundRouteComponent` or `LazyRouteComponent` +- Optional - Defaults to `routerOptions.defaultNotFoundComponent` +- The content to be rendered when the route is not found. + +### `validateSearch` method + +- Type: `(rawSearchParams: unknown) => TSearchSchema` +- Optional +- A function that will be called when this route is matched and passed the raw search params from the current location and return valid parsed search params. If this function throws, the route will be put into an error state and the error will be thrown during render. If this function does not throw, its return value will be used as the route's search params and the return type will be inferred into the rest of the router. +- Optionally, the parameter type can be tagged with the `SearchSchemaInput` type like this: `(searchParams: TSearchSchemaInput & SearchSchemaInput) => TSearchSchema`. If this tag is present, `TSearchSchemaInput` will be used to type the `search` property of `` and `navigate()` **instead of** `TSearchSchema`. The difference between `TSearchSchemaInput` and `TSearchSchema` can be useful, for example, to express optional search parameters. + +### `parseParams` method (⚠️ deprecated) + +- Type: `(rawParams: Record) => TParams` +- Optional +- A function that will be called when this route is matched and passed the raw params from the current location and return valid parsed params. If this function throws, the route will be put into an error state and the error will be thrown during render. If this function does not throw, its return value will be used as the route's params and the return type will be inferred into the rest of the router. + +### `stringifyParams` method (⚠️ deprecated) + +- Type: `(params: TParams) => Record` +- Required if `parseParams` is provided +- A function that will be called when this routes parsed params are being used to build a location. This function should return a valid object of `Record` mapping. + +### `params.parse` method + +- Type: `(rawParams: Record) => TParams` +- Optional +- A function that will be called when this route is matched and passed the raw params from the current location and return valid parsed params. If this function throws, the route will be put into an error state and the error will be thrown during render. If this function does not throw, its return value will be used as the route's params and the return type will be inferred into the rest of the router. + +### `params.stringify` method + +- Type: `(params: TParams) => Record` +- A function that will be called when this routes parsed params are being used to build a location. This function should return a valid object of `Record` mapping. + +### `beforeLoad` method + +- Type: + +```tsx +type beforeLoad = ( + opts: RouteMatch & { + search: TFullSearchSchema + abortController: AbortController + preload: boolean + params: TAllParams + context: TParentContext + location: ParsedLocation + navigate: NavigateFn // @deprecated + buildLocation: BuildLocationFn + cause: 'enter' | 'stay' + }, +) => Promise | TRouteContext | void +``` + +- Optional +- [`ParsedLocation`](./ParsedLocationType.md) +- This async function is called before a route is loaded. If an error is thrown here, the route's loader will not be called and the route will not render. If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function. If thrown during a preload event, the error will be logged to the console and the preload will fail. +- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this routes pendingMs threshold is reached, the `pendingComponent` will be shown until it resolved. If the promise rejects, the route will be put into an error state and the error will be thrown during render. +- If this function returns a `TRouteContext` object, that object will be merged into the route's context and be made available in the `loader` and other related route components/methods. +- It's common to use this function to check if a user is authenticated and redirect them to a login page if they are not. To do this, you can either return or throw a `redirect` object from this function. + +> 🚧 `opts.navigate` has been deprecated and will be removed in the next major release. Use `throw redirect({ to: '/somewhere' })` instead. Read more about the `redirect` function [here](./redirectFunction.md). + +### `loader` method + +- Type: + +```tsx +type loader = ( + opts: RouteMatch & { + search: TFullSearchSchema + abortController: AbortController + preload: boolean + params: TAllParams + context: TAllContext + location: ParsedLocation + navigate: NavigateFn // @deprecated + buildLocation: BuildLocationFn + cause: 'enter' | 'stay' + }, +) => Promise | TLoaderData | void +``` + +- Optional +- [`ParsedLocation`](./ParsedLocationType.md) +- This async function is called when a route is matched and passed the route's match object. If an error is thrown here, the route will be put into an error state and the error will be thrown during render. If thrown during a navigation, the navigation will be cancelled and the error will be passed to the `onError` function. If thrown during a preload event, the error will be logged to the console and the preload will fail. +- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this routes pendingMs threshold is reached, the `pendingComponent` will be shown until it resolved. If the promise rejects, the route will be put into an error state and the error will be thrown during render. +- If this function returns a `TLoaderData` object, that object will be stored on the route match until the route match is no longer active. It can be accessed using the `useLoaderData` hook in any component that is a child of the route match before another `` is rendered. + +> 🚧 `opts.navigate` has been deprecated and will be removed in the next major release. Use `throw redirect({ to: '/somewhere' })` instead. Read more about the `redirect` function [here](./redirectFunction.md). + +### `loaderDeps` method + +- Type: + +```tsx +type loaderDeps = (opts: { search: TFullSearchSchema }) => Record +``` + +- Optional +- A function that will be called before this route is matched to provide additional unique identification to the route match and serve as a dependency tracker for when the match should be reloaded. It should return any serializable value that can uniquely identify the route match from navigation to navigation. +- By default, path params are already used to uniquely identify a route match, so it's unnecessary to return these here. +- If your route match relies on search params for unique identification, it's required that you return them here so they can be made available in the `loader`'s `deps` argument. + +### `staleTime` property + +- Type: `number` +- Optional +- Defaults to `routerOptions.defaultStaleTime`, which defaults to `0` +- The amount of time in milliseconds that a route match's loader data will be considered fresh. If a route match is matched again within this time frame, its loader data will not be reloaded. + +### `preloadStaleTime` property + +- Type: `number` +- Optional +- Defaults to `routerOptions.defaultPreloadStaleTime`, which defaults to `30_000` ms (30 seconds) +- The amount of time in milliseconds that a route match's loader data will be considered fresh when preloading. If a route match is preloaded again within this time frame, its loader data will not be reloaded. If a route match is loaded (for navigation) within this time frame, the normal `staleTime` is used instead. + +### `gcTime` property + +- Type: `number` +- Optional +- Defaults to `routerOptions.defaultGcTime`, which defaults to 30 minutes. +- The amount of time in milliseconds that a route match's loader data will be kept in memory after a preload or it is no longer in use. + +### `shouldReload` property + +- Type: `boolean | ((args: LoaderArgs) => boolean)` +- Optional +- If `false` or returns `false`, the route match's loader data will not be reloaded on subsequent matches. +- If `true` or returns `true`, the route match's loader data will be reloaded on subsequent matches. +- If `undefined` or returns `undefined`, the route match's loader data will adhere to the default stale-while-revalidate behavior. + +### `caseSensitive` property + +- Type: `boolean` +- Optional +- If `true`, this route will be matched as case-sensitive + +### `wrapInSuspense` property + +- Type: `boolean` +- Optional +- If `true`, this route will be forcefully wrapped in a suspense boundary, regardless if a reason is found to do so from inspecting its provided components. + +### `pendingMs` property + +- Type: `number` +- Optional +- Defaults to `routerOptions.defaultPendingMs`, which defaults to `1000` +- The threshold in milliseconds that a route must be pending before its `pendingComponent` is shown. + +### `pendingMinMs` property + +- Type: `number` +- Optional +- Defaults to `routerOptions.defaultPendingMinMs` which defaults to `500` +- The minimum amount of time in milliseconds that the pending component will be shown for if it is shown. This is useful to prevent the pending component from flashing on the screen for a split second. + +### `preloadMaxAge` property + +- Type: `number` +- Optional +- Defaults to `30_000` ms (30 seconds) +- The maximum amount of time in milliseconds that a route's preloaded route data will be cached for. If a route is not matched within this time frame, its loader data will be discarded. + +### `preSearchFilters` property + +- Type: `((search: TFullSearchSchema) => TFullSearchSchema)[]` +- Optional +- An array of functions that will be called when generating any new links to this route or its grandchildren. +- Each function will be called with the current search params and should return a new search params object that will be used to generate the link. +- It has a `pre` prefix because it is called before the user-provided function that is passed to `navigate`/`Link` etc has a chance to modify the search params. + +### `postSearchFilters` property + +- Type: `((search: TFullSearchSchema) => TFullSearchSchema)[]` +- Optional +- An array of functions that will be called when generating any new links to this route or its grandchildren. +- Each function will be called with the current search params and should return a new search params object that will be used to generate the link. +- It has a `post` prefix because it is called after the user-provided function that is passed to `navigate`/`Link` etc has modified the search params. + +### `onError` property + +- Type: `(error: any) => void` +- Optional +- A function that will be called when an error is thrown during a navigation or preload event. +- If this function throws a [`redirect`](./redirectFunction.md), then the router will process and apply the redirect immediately. + +### `onEnter` property + +- Type: `(match: RouteMatch) => void` +- Optional +- A function that will be called when a route is matched and loaded after not being matched in the previous location. + +### `onStay` property + +- Type: `(match: RouteMatch) => void` +- Optional +- A function that will be called when a route is matched and loaded after being matched in the previous location. + +### `onLeave` property + +- Type: `(match: RouteMatch) => void` +- Optional +- A function that will be called when a route is no longer matched after being matched in the previous location. + +### `onCatch` property + +- Type: `(error: Error, errorInfo: ErrorInfo) => void` +- Optional - Defaults to `routerOptions.defaultOnCatch` +- A function that will be called when errors are caught when the route encounters an error. diff --git a/docs/framework/react/api/router/RouteType.md b/docs/framework/react/api/router/RouteType.md new file mode 100644 index 0000000000..57e23ecc8b --- /dev/null +++ b/docs/framework/react/api/router/RouteType.md @@ -0,0 +1,31 @@ +--- +id: RouteType +title: Route type +--- + +The `Route` type is used to describe a route instance. + +## `Route` properties and methods + +An instance of the `Route` has the following properties and methods: + +### `.addChildren` method + +- Type: `(children: Route[]) => this` +- Adds child routes to the route instance and returns the route instance (but with updated types to reflect the new children). + +### `.update` method + +- Type: `(options: Partial) => this` +- Updates the route instance with new options and returns the route instance (but with updated types to reflect the new options). +- In some circumstances, it can be useful to update a route instance's options after it has been created to avoid circular type references. +- ...`RouteApi` methods + +### `.lazy` method + +- Type: `(lazyImporter: () => Promise>) => this` +- Updates the route instance with a new lazy importer which will be resolved lazily when loading the route. This can be useful for code splitting. + +### ...`RouteApi` methods + +- All of the methods from [`RouteApi`](./RouteApiType.md) are available. diff --git a/docs/router/api/router/RouterClass.md b/docs/framework/react/api/router/RouterClass.md similarity index 100% rename from docs/router/api/router/RouterClass.md rename to docs/framework/react/api/router/RouterClass.md diff --git a/docs/framework/react/api/router/RouterEventsType.md b/docs/framework/react/api/router/RouterEventsType.md new file mode 100644 index 0000000000..c4dd6e3293 --- /dev/null +++ b/docs/framework/react/api/router/RouterEventsType.md @@ -0,0 +1,67 @@ +--- +id: RouterEventsType +title: RouterEvents type +--- + +The `RouterEvents` type contains all of the events that the router can emit. Each top-level key of this type, represents the name of an event that the router can emit. The values of the keys are the event payloads. + +```tsx +type RouterEvents = { + onBeforeLoad: { + type: 'onBeforeLoad' + fromLocation: ParsedLocation + toLocation: ParsedLocation + pathChanged: boolean + } + onLoad: { + type: 'onLoad' + fromLocation: ParsedLocation + toLocation: ParsedLocation + pathChanged: boolean + } + onResolved: { + type: 'onResolved' + fromLocation: ParsedLocation + toLocation: ParsedLocation + pathChanged: boolean + } +} +``` + +## RouterEvents properties + +Once an event is emitted, the following properties will be present on the event payload. + +### `type` property + +- Type: `onBeforeLoad | onLoad | onResolved` +- The type of the event +- This is useful for discriminating between events in a listener function. + +### `fromLocation` property + +- Type: [`ParsedLocation`](./ParsedLocationType.md) +- The location that the router is transitioning from. + +### `toLocation` property + +- Type: [`ParsedLocation`](./ParsedLocationType.md) +- The location that the router is transitioning to. + +### `pathChanged` property + +- Type: `boolean` +- `true` if the path has changed between the `fromLocation` and `toLocation`. + +## Example + +```tsx +import { createRouter } from '@tanstack/react-router' +import { routeTree } from './routeTree.gen' + +const router = createRouter({ routeTree }) + +const unsub = router.subscribe('onResolved', (evt) => { + // ... +}) +``` diff --git a/docs/framework/react/api/router/RouterOptionsType.md b/docs/framework/react/api/router/RouterOptionsType.md new file mode 100644 index 0000000000..2625db731b --- /dev/null +++ b/docs/framework/react/api/router/RouterOptionsType.md @@ -0,0 +1,278 @@ +--- +id: RouterOptions +title: RouterOptions +--- + +The `RouterOptions` type contains all of the options that can be used to configure a router instance. + +## RouterOptions properties + +The `RouterOptions` type accepts an object with the following properties and methods: + +### `routeTree` property + +- Type: `AnyRoute` +- Required +- The route tree that will be used to configure the router instance. + +### `history` property + +- Type: `RouterHistory` +- Optional +- The history object that will be used to manage the browser history. If not provided, a new `createBrowserHistory` instance will be created and used. + +### `stringifySearch` method + +- Type: `(search: Record) => string` +- Optional +- A function that will be used to stringify search params when generating links. +- Defaults to `defaultStringifySearch`. + +### `parseSearch` method + +- Type: `(search: string) => Record` +- Optional +- A function that will be used to parse search params when parsing the current location. +- Defaults to `defaultParseSearch`. + +### `defaultPreload` property + +- Type: `undefined | false | 'intent' | 'viewport'` +- Optional +- Defaults to `false` +- If `false`, routes will not be preloaded by default in any way. +- If `'intent'`, routes will be preloaded by default when the user hovers over a link or a `touchstart` event is detected on a ``. +- If `'viewport'`, routes will be preloaded by default when they are within the viewport of the browser. + +### `defaultPreloadDelay` property + +- Type: `number` +- Optional +- Defaults to `50` +- The delay in milliseconds that a route must be hovered over or touched before it is preloaded. + +### `defaultComponent` property + +- Type: `RouteComponent` +- Optional +- Defaults to `Outlet` +- The default `component` a route should use if no component is provided. + +### `defaultErrorComponent` property + +- Type: `RouteComponent` +- Optional +- Defaults to `ErrorComponent` +- The default `errorComponent` a route should use if no error component is provided. + +### `defaultNotFoundComponent` property + +- Type: `NotFoundRouteComponent` +- Optional +- Defaults to `NotFound` +- The default `notFoundComponent` a route should use if no notFound component is provided. + +### `defaultPendingComponent` property + +- Type: `RouteComponent` +- Optional +- The default `pendingComponent` a route should use if no pending component is provided. + +### `defaultPendingMs` property + +- Type: `number` +- Optional +- Defaults to `1000` +- The default `pendingMs` a route should use if no pendingMs is provided. + +### `defaultPendingMinMs` property + +- Type: `number` +- Optional +- Defaults to `500` +- The default `pendingMinMs` a route should use if no pendingMinMs is provided. + +### `defaultStaleTime` property + +- Type: `number` +- Optional +- Defaults to `0` +- The default `staleTime` a route should use if no staleTime is provided. + +### `defaultPreloadStaleTime` property + +- Type: `number` +- Optional +- Defaults to `30_000` ms (30 seconds) +- The default `preloadStaleTime` a route should use if no preloadStaleTime is provided. + +### `defaultPreloadGcTime` property + +- Type: `number` +- Optional +- Defaults to `routerOptions.defaultGcTime`, which defaults to 30 minutes. +- The default `preloadGcTime` a route should use if no preloadGcTime is provided. + +### `defaultGcTime` property + +- Type: `number` +- Optional +- Defaults to 30 minutes. +- The default `gcTime` a route should use if no gcTime is provided. + +### `defaultOnCatch` property + +- Type: `(error: Error, errorInfo: ErrorInfo) => void` +- Optional +- The default `onCatch` handler for errors caught by the Router ErrorBoundary + +### `defaultViewTransition` property + +- Type: `boolean` +- Optional +- If `true`, route navigations will called using `document.startViewTransition()`. +- If the browser does not support this api, this option will be ignored. +- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works. + +### `caseSensitive` property + +- Type: `boolean` +- Optional +- Defaults to `false` +- If `true`, all routes will be matched as case-sensitive. + +### `basepath` property + +- Type: `string` +- Optional +- Defaults to `/` +- The basepath for then entire router. This is useful for mounting a router instance at a subpath. + +### `context` property + +- Type: `any` +- Optional or required if the root route was created with [`createRootRouteWithContext()`](./createRootRouteWithContextFunction.md). +- The root context that will be provided to all routes in the route tree. This can be used to provide a context to all routes in the tree without having to provide it to each route individually. + +### `dehydrate` method + +- Type: `() => TDehydrated` +- Optional +- A function that will be called when the router is dehydrated. The return value of this function will be serialized and stored in the router's dehydrated state. + +### `hydrate` method + +- Type: `(dehydrated: TDehydrated) => void` +- Optional +- A function that will be called when the router is hydrated. The return value of this function will be serialized and stored in the router's dehydrated state. + +### `routeMasks` property + +- Type: `RouteMask[]` +- Optional +- An array of route masks that will be used to mask routes in the route tree. Route masking is when you display a route at a different path than the one it is configured to match, like a modal popup that when shared will unmask to the modal's content instead of the modal's context. + +### `unmaskOnReload` property + +- Type: `boolean` +- Optional +- Defaults to `false` +- If `true`, route masks will, by default, be removed when the page is reloaded. This can be overridden on a per-mask basis by setting the `unmaskOnReload` option on the mask, or on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options. + +### `Wrap` property + +- Type: `React.Component` +- Optional +- A component that will be used to wrap the entire router. This is useful for providing a context to the entire router. Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error. + +**Example** + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... + Wrap: ({ children }) => { + return {children} + }, +}) +``` + +### `InnerWrap` property + +- Type: `React.Component` +- Optional +- A component that will be used to wrap the inner contents of the router. This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks. Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error. + +**Example** + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... + InnerWrap: ({ children }) => { + const routerState = useRouterState() + + return ( + + {children} + + ) + }, +}) +``` + +### `notFoundMode` property + +- Type: `'root' | 'fuzzy'` +- Optional +- Defaults to `'fuzzy'` +- This property controls how TanStack Router will handle scenarios where it cannot find a route to match the current location. See the [Not Found Errors guide](../../guide/not-found-errors.md) for more information. + +### `notFoundRoute` property + +- **Deprecated** +- Type: `NotFoundRoute` +- Optional +- A route that will be used as the default not found route for every branch of the route tree. This can be overridden on a per-branch basis by providing a not found route to the `NotFoundRoute` option on the root route of the branch. + +### `errorSerializer` property + +- Type: [`RouterErrorSerializer`] +- Optional +- The serializer object that will be used to determine how errors are serialized and deserialized between the server and the client. + +#### `errorSerializer.serialize` method + +- Type: `(err: unknown) => TSerializedError` +- This method is called to define how errors are serialized when they are stored in the router's dehydrated state. + +#### `errorSerializer.deserialize` method + +- Type: `(err: TSerializedError) => unknown` +- This method is called to define how errors are deserialized from the router's dehydrated state. + +### `transformer` property + +- Type: `RouterTransformer` +- Optional +- The transformer that will be used when sending data between the server and the client during SSR. +- Defaults to a very lightweight transformer that supports a few basic types. See the [SSR guide](../../guide/ssr.md) for more information. + +#### `transformer.stringify` method + +- Type: `(obj: unknown) => string` +- This method is called when stringifying data to be sent to the client. + +#### `transformer.parse` method + +- Type: `(str: string) => unknown` +- This method is called when parsing the string encoded by the server. + +### `trailingSlash` property + +- Type: `'always' | 'never' | 'preserve'` +- Optional +- Defaults to `never` +- Configures how trailing slashes are treated. `'always'` will add a trailing slash if not present, `'never'` will remove the trailing slash if present and `'preserve'` will not modify the trailing slash. diff --git a/docs/framework/react/api/router/RouterStateType.md b/docs/framework/react/api/router/RouterStateType.md new file mode 100644 index 0000000000..6c4d2aca93 --- /dev/null +++ b/docs/framework/react/api/router/RouterStateType.md @@ -0,0 +1,57 @@ +--- +id: RouterStateType +title: RouterState type +--- + +The `RouterState` type represents shape of the internal state of the router. The Router's internal state is useful, if you need to access certain internals of the router, such as any pending matches, is the router in its loading state, etc. + +```tsx +type RouterState = { + status: 'pending' | 'idle' + isLoading: boolean + isTransitioning: boolean + matches: Array + pendingMatches: Array + location: ParsedLocation + resolvedLocation: ParsedLocation +} +``` + +## RouterState properties + +The `RouterState` type contains all of the properties that are available on the router state. + +### `status` property + +- Type: `'pending' | 'idle'` +- The current status of the router. If the router is pending, it means that it is currently loading a route or the router is still transitioning to the new route. + +### `isLoading` property + +- Type: `boolean` +- `true` if the router is currently loading a route or waiting for a route to finish loading. + +### `isTransitioning` property + +- Type: `boolean` +- `true` if the router is currently transitioning to a new route. + +### `matches` property + +- Type: [`Array`](./RouteMatchType.md) +- An array of all of the route matches that have been resolved and are currently active. + +### `pendingMatches` property + +- Type: [`Array`](./RouteMatchType.md) +- An array of all of the route matches that are currently pending. + +### `location` property + +- Type: [`ParsedLocation`](./ParsedLocationType.md) +- The latest location that the router has parsed from the browser history. This location may not be resolved and loaded yet. + +### `resolvedLocation` property + +- Type: [`ParsedLocation`](./ParsedLocationType.md) +- The location that the router has resolved and loaded. diff --git a/docs/framework/react/api/router/RouterType.md b/docs/framework/react/api/router/RouterType.md new file mode 100644 index 0000000000..7b79451c6b --- /dev/null +++ b/docs/framework/react/api/router/RouterType.md @@ -0,0 +1,197 @@ +--- +id: RouterType +title: Router type +--- + +The `Router` type is used to describe a router instance. + +## `Router` properties and methods + +An instance of the `Router` has the following properties and methods: + +### `.update` method + +- Type: `(newOptions: RouterOptions) => void` +- Updates the router instance with new options. + +### `state` property + +- Type: [`RouterState`](./RouterStateType.md) +- The current state of the router. + +> ⚠️⚠️⚠️ **`router.state` is always up to date, but NOT REACTIVE. If you use `router.state` in a component, the component will not re-render when the router state changes. To get a reactive version of the router state, use the [`useRouterState`](./useRouterStateHook.md) hook.** + +### `.subscribe` method + +- Type: `(eventType: TType, fn: ListenerFn) => (event: RouterEvent) => void` +- Subscribes to a [`RouterEvent`](./RouterEventsType.md). +- Returns a function that can be used to unsubscribe from the event. +- The callback provided to the returned function will be called with the event that was emitted. + +### `.matchRoutes` method + +- Type: `(pathname: string, locationSearch: Record, opts?: { throwOnError?: boolean; }) => RouteMatch[]` +- Matches a pathname and search params against the router's route tree and returns an array of route matches. +- If `opts.throwOnError` is `true`, any errors that occur during the matching process will be thrown (in addition to being returned in the route match's `error` property). + +### `.cancelMatch` method + +- Type: `(matchId: string) => void` +- Cancels a route match that is currently pending by calling `match.abortController.abort()`. + +### `.cancelMatches` method + +- Type: `() => void` +- Cancels all route matches that are currently pending by calling `match.abortController.abort()` on each one. + +### `.buildLocation` method + +Builds a new parsed location object that can be used later to navigate to a new location. + +- Type: `(opts: BuildNextOptions) => ParsedLocation` +- Properties + - `from` + - Type: `string` + - Optional + - The path to navigate from. If not provided, the current path will be used. + - `to` + - Type: `string | number | null` + - Optional + - The path to navigate to. If `null`, the current path will be used. + - `params` + - Type: `true | Updater` + - Optional + - If `true`, the current params will be used. If a function is provided, it will be called with the current params and the return value will be used. + - `search` + - Type: `true | Updater` + - Optional + - If `true`, the current search params will be used. If a function is provided, it will be called with the current search params and the return value will be used. + - `hash` + - Type: `true | Updater` + - Optional + - If `true`, the current hash will be used. If a function is provided, it will be called with the current hash and the return value will be used. + - `state` + - Type: `true | NonNullableUpdater` + - Optional + - If `true`, the current state will be used. If a function is provided, it will be called with the current state and the return value will be used. + - `mask` + - Type: `object` + - Optional + - Contains all of the same BuildNextOptions, with the addition of `unmaskOnReload`. + - `unmaskOnReload` + - Type: `boolean` + - Optional + - If `true`, the route mask will be removed when the page is reloaded. This can be overridden on a per-navigation basis by setting the `unmaskOnReload` option in the `Navigate` options. + +### `.commitLocation` method + +Commits a new location object to the browser history. + +- Type + ```tsx + type commitLocation = ( + location: ParsedLocation & { + replace?: boolean + resetScroll?: boolean + ignoreBlocker?: boolean + }, + ) => Promise + ``` +- Properties + - `location` + - Type: [`ParsedLocation`](./ParsedLocationType.md) + - Required + - The location to commit to the browser history. + - `replace` + - Type: `boolean` + - Optional + - Defaults to `false`. + - If `true`, the location will be committed to the browser history using `history.replace` instead of `history.push`. + - `resetScroll` + - Type: `boolean` + - Optional + - Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history. + - If `false`, the scroll position will not be reset to 0,0 after the location is committed to history. + - `ignoreBlocker` + - Type: `boolean` + - Optional + - Defaults to `false`. + - If `true`, navigation will ignore any blockers that might prevent it. + +### `.navigate` method + +Navigates to a new location. + +- Type + ```tsx + type navigate = (options: NavigateOptions) => Promise + ``` + +### `.invalidate` method + +Invalidates all route matches by forcing their `beforeLoad` and `load` functions to be called again. + +- Type: `() => Promise` +- This is useful any time your loader data might be out of date or stale. For example, if you have a route that displays a list of posts, and you have a loader function that fetches the list of posts from an API, you might want to invalidate the route matches for that route any time a new post is created so that the list of posts is always up-to-date. +- You might also want to invalidate the Router if you imperatively `reset` the router's `CatchBoundary` to trigger loaders again. + +### `.load` method + +Loads all of the currently matched route matches and resolves when they are all loaded and ready to be rendered. + +> ⚠️⚠️⚠️ **`router.load()` respects `route.staleTime` and will not forcefully reload a route match if it is still fresh. If you need to forcefully reload a route match, use `router.invalidate()` instead.** + +- Type: `() => Promise` +- The most common use case for this method is to call it when doing SSR to ensure that all of the critical data for the current route is loaded before attempting to stream or render the application to the client. + +### `.preloadRoute` method + +Preloads all of the matches that match the provided `NavigateOptions`. + +> ⚠️⚠️⚠️ **Preloaded route matches are not stored long-term in the router state. They are only stored until the next attempted navigation action.** + +- Type: `(opts?: NavigateOptions) => Promise` +- Properties + - `opts` + - Type: `NavigateOptions` + - Optional, defaults to the current location. + - The options that will be used to determine which route matches to preload. +- Returns + - A promise that resolves with an array of all of the route matches that were preloaded. + +### `.matchRoute` method + +Matches a pathname and search params against the router's route tree and returns a route match's params or false if no match was found. + +- Type: `(dest: ToOptions, matchOpts?: MatchRouteOptions) => RouteMatch | false` +- Properties + - `dest` + - Type: `ToOptions` + - Required + - The destination to match against. + - `matchOpts` + - Type: `MatchRouteOptions` + - Optional + - Options that will be used to match the destination. +- Returns + - A route match object if a match was found. + - `false` if no match was found. + +### `.dehydrate` method + +Dehydrates the router's critical state into a serializable object that can be sent to the client in an initial request. + +- Type: `() => DehydratedRouter` +- Returns + - A serializable object that contains the router's critical state. + +### `.hydrate` method + +Hydrates the router's critical state from a serializable object that was sent from the server in an initial request. + +- Type: `(dehydrated: DehydratedRouter) => void` +- Properties + - `dehydrated` + - Type: `DehydratedRouter` + - Required + - The dehydrated router state that was sent from the server. diff --git a/docs/framework/react/api/router/ToMaskOptionsType.md b/docs/framework/react/api/router/ToMaskOptionsType.md new file mode 100644 index 0000000000..fa0140fec2 --- /dev/null +++ b/docs/framework/react/api/router/ToMaskOptionsType.md @@ -0,0 +1,14 @@ +--- +id: ToMaskOptionsType +title: ToMaskOptions type +--- + +The `ToMaskOptions` type extends the [`ToOptions`](./ToOptionsType.md) type and describes additional options available when using route masks. + +```tsx +type ToMaskOptions = ToOptions & { + unmaskOnReload?: boolean +} +``` + +- [`ToOptions`](./ToOptionsType.md) diff --git a/docs/framework/react/api/router/ToOptionsType.md b/docs/framework/react/api/router/ToOptionsType.md new file mode 100644 index 0000000000..6c368dd037 --- /dev/null +++ b/docs/framework/react/api/router/ToOptionsType.md @@ -0,0 +1,24 @@ +--- +id: ToOptionsType +title: ToOptions type +--- + +The `ToOptions` type contains several properties that can be used to describe a router destination. + +```tsx +type ToOptions = { + from?: ValidRoutePath | string + to?: ValidRoutePath | string + hash?: true | string | ((prev?: string) => string) + state?: true | HistoryState | ((prev: HistoryState) => HistoryState) +} & SearchParamOptions & + PathParamOptions + +type SearchParamOptions = { + search?: true | TToSearch | ((prev: TFromSearch) => TToSearch) +} + +type PathParamOptions = { + path?: true | Record | ((prev: TFromParams) => TToParams) +} +``` diff --git a/docs/router/api/router/UseMatchRouteOptionsType.md b/docs/framework/react/api/router/UseMatchRouteOptionsType.md similarity index 100% rename from docs/router/api/router/UseMatchRouteOptionsType.md rename to docs/framework/react/api/router/UseMatchRouteOptionsType.md diff --git a/docs/router/api/router/awaitComponent.md b/docs/framework/react/api/router/awaitComponent.md similarity index 86% rename from docs/router/api/router/awaitComponent.md rename to docs/framework/react/api/router/awaitComponent.md index ed1d67e1ee..14f797494e 100644 --- a/docs/router/api/router/awaitComponent.md +++ b/docs/framework/react/api/router/awaitComponent.md @@ -4,8 +4,6 @@ title: Await component --- The `Await` component is a component that suspends until the provided promise is resolved or rejected. -This is only necessary for React 18. -If you are using React 19, you can use the `use()` hook instead. ## Await props @@ -13,9 +11,9 @@ The `Await` component accepts the following props: ### `props.promise` prop -- Type: `Promise` +- Type: [`DeferredPromise`](./DeferredPromiseType.md) - Required -- The promise to await. +- The deferred promise to await. ### `props.children` prop diff --git a/docs/router/api/router/catchBoundaryComponent.md b/docs/framework/react/api/router/catchBoundaryComponent.md similarity index 91% rename from docs/router/api/router/catchBoundaryComponent.md rename to docs/framework/react/api/router/catchBoundaryComponent.md index aa2f6eb7ce..deef0ffa22 100644 --- a/docs/router/api/router/catchBoundaryComponent.md +++ b/docs/framework/react/api/router/catchBoundaryComponent.md @@ -29,7 +29,7 @@ The `CatchBoundary` component accepts the following props: ### `props.onCatch` prop -- Type: `(error: unknown, errorInfo: ErrorInfo) => void` in React; `(error: unknown) => void` in Vue; `(error: Error) => void` in Solid +- Type: `(error: any) => void` - Optional - A callback that will be called with the error that was thrown by the component's children. diff --git a/docs/router/api/router/catchNotFoundComponent.md b/docs/framework/react/api/router/catchNotFoundComponent.md similarity index 100% rename from docs/router/api/router/catchNotFoundComponent.md rename to docs/framework/react/api/router/catchNotFoundComponent.md diff --git a/docs/router/api/router/createFileRouteFunction.md b/docs/framework/react/api/router/createFileRouteFunction.md similarity index 100% rename from docs/router/api/router/createFileRouteFunction.md rename to docs/framework/react/api/router/createFileRouteFunction.md diff --git a/docs/router/api/router/createLazyFileRouteFunction.md b/docs/framework/react/api/router/createLazyFileRouteFunction.md similarity index 80% rename from docs/router/api/router/createLazyFileRouteFunction.md rename to docs/framework/react/api/router/createLazyFileRouteFunction.md index 750e38dd24..87e1743ed1 100644 --- a/docs/router/api/router/createLazyFileRouteFunction.md +++ b/docs/framework/react/api/router/createLazyFileRouteFunction.md @@ -3,7 +3,7 @@ id: createLazyFileRouteFunction title: createLazyFileRoute function --- -The `createLazyFileRoute` function is used for creating a partial file-based route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](../../guide/code-splitting.md#how-does-tanstack-router-split-code) of the route, such as `component`, `pendingComponent`, `errorComponent`, and the `notFoundComponent`. +The `createLazyFileRoute` function is used for creating a partial file-based route route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](../../guide/code-splitting.md#how-does-tanstack-router-split-code) of the route, such as `component`, `pendingComponent`, `errorComponent`, and the `notFoundComponent`. ## createLazyFileRoute options diff --git a/docs/router/api/router/createLazyRouteFunction.md b/docs/framework/react/api/router/createLazyRouteFunction.md similarity index 83% rename from docs/router/api/router/createLazyRouteFunction.md rename to docs/framework/react/api/router/createLazyRouteFunction.md index 553e2f36a2..48c100c352 100644 --- a/docs/router/api/router/createLazyRouteFunction.md +++ b/docs/framework/react/api/router/createLazyRouteFunction.md @@ -3,7 +3,7 @@ id: createLazyRouteFunction title: createLazyRoute function --- -The `createLazyRoute` function is used for creating a partial code-based route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](../../guide/code-splitting.md#how-does-tanstack-router-split-code) of the route, such as `component`, `pendingComponent`, `errorComponent`, and the `notFoundComponent`. +The `createLazyRoute` function is used for creating a partial code-based route route instance that is lazily loaded when matched. This route instance can only be used to configure the [non-critical properties](../../guide/code-splitting.md#how-does-tanstack-router-split-code) of the route, such as `component`, `pendingComponent`, `errorComponent`, and the `notFoundComponent`. ## createLazyRoute options diff --git a/docs/router/api/router/createRootRouteFunction.md b/docs/framework/react/api/router/createRootRouteFunction.md similarity index 100% rename from docs/router/api/router/createRootRouteFunction.md rename to docs/framework/react/api/router/createRootRouteFunction.md diff --git a/docs/router/api/router/createRootRouteWithContextFunction.md b/docs/framework/react/api/router/createRootRouteWithContextFunction.md similarity index 100% rename from docs/router/api/router/createRootRouteWithContextFunction.md rename to docs/framework/react/api/router/createRootRouteWithContextFunction.md diff --git a/docs/router/api/router/createRouteFunction.md b/docs/framework/react/api/router/createRouteFunction.md similarity index 100% rename from docs/router/api/router/createRouteFunction.md rename to docs/framework/react/api/router/createRouteFunction.md diff --git a/docs/router/api/router/createRouteMaskFunction.md b/docs/framework/react/api/router/createRouteMaskFunction.md similarity index 100% rename from docs/router/api/router/createRouteMaskFunction.md rename to docs/framework/react/api/router/createRouteMaskFunction.md diff --git a/docs/router/api/router/createRouterFunction.md b/docs/framework/react/api/router/createRouterFunction.md similarity index 100% rename from docs/router/api/router/createRouterFunction.md rename to docs/framework/react/api/router/createRouterFunction.md diff --git a/docs/router/api/router/defaultGlobalNotFoundComponent.md b/docs/framework/react/api/router/defaultGlobalNotFoundComponent.md similarity index 100% rename from docs/router/api/router/defaultGlobalNotFoundComponent.md rename to docs/framework/react/api/router/defaultGlobalNotFoundComponent.md diff --git a/docs/router/api/router/deferFunction.md b/docs/framework/react/api/router/deferFunction.md similarity index 82% rename from docs/router/api/router/deferFunction.md rename to docs/framework/react/api/router/deferFunction.md index 929b9d7c63..8a8a7876ef 100644 --- a/docs/router/api/router/deferFunction.md +++ b/docs/framework/react/api/router/deferFunction.md @@ -3,9 +3,6 @@ id: deferFunction title: defer function --- -> [!CAUTION] -> You don't need to call `defer` manually anymore, Promises are handled automatically now. - The `defer` function wraps a promise with a deferred state object that can be used to inspect the promise's state. This deferred promise can then be passed to the [`useAwaited`](./useAwaitedHook.md) hook or the [``](./awaitComponent.md) component for suspending until the promise is resolved or rejected. The `defer` function accepts a single argument, the `promise` to wrap with a deferred state object. @@ -18,7 +15,7 @@ The `defer` function accepts a single argument, the `promise` to wrap with a def ## defer returns -- A promise that can be passed to the [`useAwaited`](./useAwaitedHook.md) hook or the [``](./awaitComponent.md) component. +- A [`DeferredPromise`](./DeferredPromiseType.md) that can be passed to the [`useAwaited`](./useAwaitedHook.md) hook or the [``](./awaitComponent.md) component. ## Examples diff --git a/docs/framework/react/api/router/errorComponentComponent.md b/docs/framework/react/api/router/errorComponentComponent.md new file mode 100644 index 0000000000..d94e0559ed --- /dev/null +++ b/docs/framework/react/api/router/errorComponentComponent.md @@ -0,0 +1,26 @@ +--- +id: errorComponentComponent +title: ErrorComponent component +--- + +The `ErrorComponent` component is a component that renders an error message and optionally the error's message. + +## ErrorComponent props + +The `ErrorComponent` component accepts the following props: + +### `props.error` prop + +- Type: `any` +- The error that was thrown by the component's children + +### `props.reset` prop + +- Type: `() => void` +- A function to programmatically reset the error state + +## ErrorComponent returns + +- Returns a formatted error message with the error's message if it exists. +- The error message can be toggled by clicking the "Show Error" button. +- By default, the error message will be shown in development. diff --git a/docs/router/api/router/getRouteApiFunction.md b/docs/framework/react/api/router/getRouteApiFunction.md similarity index 100% rename from docs/router/api/router/getRouteApiFunction.md rename to docs/framework/react/api/router/getRouteApiFunction.md diff --git a/docs/framework/react/api/router/historyStateInterface.md b/docs/framework/react/api/router/historyStateInterface.md new file mode 100644 index 0000000000..9c1f48c0fd --- /dev/null +++ b/docs/framework/react/api/router/historyStateInterface.md @@ -0,0 +1,14 @@ +--- +id: historyStateInterface +title: HistoryState interface +--- + +The `HistoryState` interface is an interface exported by the `history` package that describes the shape of the state object that can be used in conjunction with the `history` package and the `window.location` API. + +You can extend this interface to add additional properties to the state object across your application. + +```tsx +interface HistoryState { + key: string // This is the unique ID for any given history entry +} +``` diff --git a/docs/router/api/router/isNotFoundFunction.md b/docs/framework/react/api/router/isNotFoundFunction.md similarity index 100% rename from docs/router/api/router/isNotFoundFunction.md rename to docs/framework/react/api/router/isNotFoundFunction.md diff --git a/docs/router/api/router/isRedirectFunction.md b/docs/framework/react/api/router/isRedirectFunction.md similarity index 100% rename from docs/router/api/router/isRedirectFunction.md rename to docs/framework/react/api/router/isRedirectFunction.md diff --git a/docs/router/api/router/lazyRouteComponentFunction.md b/docs/framework/react/api/router/lazyRouteComponentFunction.md similarity index 100% rename from docs/router/api/router/lazyRouteComponentFunction.md rename to docs/framework/react/api/router/lazyRouteComponentFunction.md diff --git a/docs/framework/react/api/router/linkComponent.md b/docs/framework/react/api/router/linkComponent.md new file mode 100644 index 0000000000..6c973d80df --- /dev/null +++ b/docs/framework/react/api/router/linkComponent.md @@ -0,0 +1,37 @@ +--- +id: linkComponent +title: Link component +--- + +The `Link` component is a component that can be used to create a link that can be used to navigate to a new location. This includes changes to the pathname, search params, hash, and location state. + +## Link props + +The `Link` component accepts the following props: + +### `...props` + +- Type: `LinkProps & React.RefAttributes` +- [`LinkProps`](./LinkPropsType.md) + +## Link returns + +An anchor element that can be used to navigate to a new location. + +## Examples + +```tsx +import { Link } from '@tanstack/react-router' + +function Component() { + return ( + ({ ...prev, foo: 'bar' })} + > + Click me + + ) +} +``` diff --git a/docs/router/api/router/matchRouteComponent.md b/docs/framework/react/api/router/matchRouteComponent.md similarity index 100% rename from docs/router/api/router/matchRouteComponent.md rename to docs/framework/react/api/router/matchRouteComponent.md diff --git a/docs/router/api/router/navigateComponent.md b/docs/framework/react/api/router/navigateComponent.md similarity index 100% rename from docs/router/api/router/navigateComponent.md rename to docs/framework/react/api/router/navigateComponent.md diff --git a/docs/router/api/router/notFoundFunction.md b/docs/framework/react/api/router/notFoundFunction.md similarity index 89% rename from docs/router/api/router/notFoundFunction.md rename to docs/framework/react/api/router/notFoundFunction.md index 02bb26bfbc..26ee2c74cd 100644 --- a/docs/router/api/router/notFoundFunction.md +++ b/docs/framework/react/api/router/notFoundFunction.md @@ -20,7 +20,7 @@ The `notFound` function accepts a single optional argument, the `options` to cre ## Examples ```tsx -import { notFound, createFileRoute, rootRouteId } from '@tanstack/react-router' +import { notFound, createFileRoute } from '@tanstack/react-router' const Route = new createFileRoute('/posts/$postId')({ // throwing a not-found object @@ -32,7 +32,7 @@ const Route = new createFileRoute('/posts/$postId')({ // or if you want to show a not-found on the whole page loader: ({ context: { team } }) => { if (!team) { - throw notFound({ routeId: rootRouteId }) + throw notFound({ global: true }) } }, // ... other route options diff --git a/docs/router/api/router/outletComponent.md b/docs/framework/react/api/router/outletComponent.md similarity index 100% rename from docs/router/api/router/outletComponent.md rename to docs/framework/react/api/router/outletComponent.md diff --git a/docs/framework/react/api/router/redirectFunction.md b/docs/framework/react/api/router/redirectFunction.md new file mode 100644 index 0000000000..1e1c83dfb3 --- /dev/null +++ b/docs/framework/react/api/router/redirectFunction.md @@ -0,0 +1,45 @@ +--- +id: redirectFunction +title: redirect function +--- + +The `redirect` function returns a new `Redirect` object that can be either returned or thrown from places like a Route's `beforeLoad` or `loader` callbacks to trigger _redirect_ to a new location. + +## redirect options + +The `redirect` function accepts a single argument, the `options` to determine the redirect behavior. + +- Type: [`Redirect`](./RedirectType.md) +- Required + +## redirect returns + +- If the `throw` property is `true` in the `options` object, the `Redirect` object will be thrown from within the function call. +- If the `throw` property is `false | undefined` in the `options` object, the `Redirect` object will be returned. + +## Examples + +```tsx +import { redirect } from '@tanstack/react-router' + +const route = createRoute({ + // throwing a redirect object + loader: () => { + if (!user) { + throw redirect({ + to: '/login', + }) + } + }, + // or forcing `redirect` to throw itself + loader: () => { + if (!user) { + redirect({ + to: '/login', + throw: true, + }) + } + }, + // ... other route options +}) +``` diff --git a/docs/router/api/router/rootRouteWithContextFunction.md b/docs/framework/react/api/router/rootRouteWithContextFunction.md similarity index 100% rename from docs/router/api/router/rootRouteWithContextFunction.md rename to docs/framework/react/api/router/rootRouteWithContextFunction.md diff --git a/docs/router/api/router/useAwaitedHook.md b/docs/framework/react/api/router/useAwaitedHook.md similarity index 92% rename from docs/router/api/router/useAwaitedHook.md rename to docs/framework/react/api/router/useAwaitedHook.md index 0641de8662..fb0ebd72e7 100644 --- a/docs/router/api/router/useAwaitedHook.md +++ b/docs/framework/react/api/router/useAwaitedHook.md @@ -11,7 +11,7 @@ The `useAwaited` hook accepts a single argument, an `options` object. ### `options.promise` option -- Type: `Promise` +- Type: [`DeferredPromise`](./DeferredPromiseType.md) - Required - The deferred promise to await. diff --git a/docs/framework/react/api/router/useBlockerHook.md b/docs/framework/react/api/router/useBlockerHook.md new file mode 100644 index 0000000000..699dff7d2a --- /dev/null +++ b/docs/framework/react/api/router/useBlockerHook.md @@ -0,0 +1,79 @@ +--- +id: useBlockerHook +title: useBlocker hook +--- + +The `useBlocker` method is a hook that [blocks navigation](../../guide/navigation-blocking.md) when a condition is met. + +## useBlocker options + +The `useBlocker` hook accepts a single _optional_ argument, an option object: + +### `options.blockerFn` option + +- Optional +- Type: `BlockerFn` +- The function that returns a `boolean` or `Promise` indicating whether to allow navigation. + +### `options.condition` option + +- Optional - defaults to `true` +- Type: `boolean` +- A navigation attempt is blocked when this condition is `true`. + +## useBlocker returns + +An object with the controls to allow manual blocking and unblocking of navigation. + +- `status` - A string literal that can be either `'blocked'` or `'idle'` +- `proceed` - A function that allows navigation to continue +- `reset` - A function that cancels navigation (`status` will be be reset to `'idle'`) + +## Examples + +Two common use cases for the `useBlocker` hook are: + +### Basic usage + +```tsx +import { useBlocker } from '@tanstack/react-router' + +function MyComponent() { + const [formIsDirty, setFormIsDirty] = useState(false) + + useBlocker({ + blockerFn: () => window.confirm('Are you sure you want to leave?'), + condition: formIsDirty, + }) + + // ... +} +``` + +### Custom UI + +```tsx +import { useBlocker } from '@tanstack/react-router' + +function MyComponent() { + const [formIsDirty, setFormIsDirty] = useState(false) + + const { proceed, reset, status } = useBlocker({ + condition: formIsDirty, + }) + + // ... + + return ( + <> + {/* ... */} + {status === 'blocked' && ( +
+

Are you sure you want to leave?

+ + +
+ )} + +} +``` diff --git a/docs/framework/react/api/router/useChildMatchesHook.md b/docs/framework/react/api/router/useChildMatchesHook.md new file mode 100644 index 0000000000..0d6e0f942d --- /dev/null +++ b/docs/framework/react/api/router/useChildMatchesHook.md @@ -0,0 +1,35 @@ +--- +id: useChildMatchesHook +title: useChildMatches hook +--- + +The `useChildMatches` hook returns all of the child [`RouteMatch`](./RouteMatchType.md) objects from the closest match down to the leaf-most match. **It does not include the current match, which can be obtained using the `useMatch` hook.** + +> [!IMPORTANT] +> If the router has pending matches and they are showing their pending component fallbacks, `router.state.pendingMatches` will used instead of `router.state.matches`. + +## useChildMatches options + +The `useChildMatches` hook accepts a single _optional_ argument, an `options` object. + +### `opts.select` option + +- Optional +- `(matches: RouteMatch[]) => TSelected` +- If supplied, this function will be called with the route matches and the return value will be returned from `useChildMatches`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. + +## useChildMatches returns + +- If a `select` function is provided, the return value of the `select` function. +- If no `select` function is provided, an array of [`RouteMatch`](./RouteMatchType.md) objects. + +## Examples + +```tsx +import { useChildMatches } from '@tanstack/react-router' + +function Component() { + const childMatches = useChildMatches() + // ... +} +``` diff --git a/docs/router/api/router/useLinkPropsHook.md b/docs/framework/react/api/router/useLinkPropsHook.md similarity index 100% rename from docs/router/api/router/useLinkPropsHook.md rename to docs/framework/react/api/router/useLinkPropsHook.md diff --git a/docs/router/api/router/useLoaderDataHook.md b/docs/framework/react/api/router/useLoaderDataHook.md similarity index 76% rename from docs/router/api/router/useLoaderDataHook.md rename to docs/framework/react/api/router/useLoaderDataHook.md index b551d613fc..d6de4b8ea7 100644 --- a/docs/router/api/router/useLoaderDataHook.md +++ b/docs/framework/react/api/router/useLoaderDataHook.md @@ -15,13 +15,13 @@ The `useLoaderData` hook accepts an `options` object. - The route id of the closest parent match - Optional, but recommended for full type safety. - If `opts.strict` is `true`, TypeScript will warn for this option if it is not provided. -- If `opts.strict` is `false`, TypeScript will provide loosened types for the returned loader data. +- If `opts.strict` is `false`, TypeScript will provided loosened types for the returned loader data. ### `opts.strict` option - Type: `boolean` - Optional - `default: true` -- If `false`, the `opts.from` option will be ignored and types will be loosened to reflect the shared types of all possible loader data. +- If `false`, the `opts.from` option will be ignored and types will be loosened to to reflect the shared types of all possible loader data. ### `opts.select` option @@ -29,13 +29,6 @@ The `useLoaderData` hook accepts an `options` object. - `(loaderData: TLoaderData) => TSelected` - If supplied, this function will be called with the loader data and the return value will be returned from `useLoaderData`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. -### `opts.structuralSharing` option - -- Type: `boolean` -- Optional -- Configures whether structural sharing is enabled for the value returned by `select`. -- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. - ## useLoaderData returns - If a `select` function is provided, the return value of the `select` function. diff --git a/docs/router/api/router/useLoaderDepsHook.md b/docs/framework/react/api/router/useLoaderDepsHook.md similarity index 81% rename from docs/router/api/router/useLoaderDepsHook.md rename to docs/framework/react/api/router/useLoaderDepsHook.md index bf9a3a35ec..bcd6536658 100644 --- a/docs/router/api/router/useLoaderDepsHook.md +++ b/docs/framework/react/api/router/useLoaderDepsHook.md @@ -21,13 +21,6 @@ The `useLoaderDepsHook` hook accepts an `options` object. - Optional - If supplied, this function will be called with the loader dependencies object and the return value will be returned from `useLoaderDeps`. -### `opts.structuralSharing` option - -- Type: `boolean` -- Optional -- Configures whether structural sharing is enabled for the value returned by `select`. -- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. - ## useLoaderDeps returns - An object of the loader dependencies or `TSelected` if a `select` function is provided. diff --git a/docs/router/api/router/useLocationHook.md b/docs/framework/react/api/router/useLocationHook.md similarity index 100% rename from docs/router/api/router/useLocationHook.md rename to docs/framework/react/api/router/useLocationHook.md diff --git a/docs/router/api/router/useMatchHook.md b/docs/framework/react/api/router/useMatchHook.md similarity index 91% rename from docs/router/api/router/useMatchHook.md rename to docs/framework/react/api/router/useMatchHook.md index 966fd1d7c1..1ce050486a 100644 --- a/docs/router/api/router/useMatchHook.md +++ b/docs/framework/react/api/router/useMatchHook.md @@ -30,13 +30,6 @@ The `useMatch` hook accepts a single argument, an `options` object. - `(match: RouteMatch) => TSelected` - If supplied, this function will be called with the route match and the return value will be returned from `useMatch`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. -### `opts.structuralSharing` option - -- Type: `boolean` -- Optional -- Configures whether structural sharing is enabled for the value returned by `select`. -- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. - ### `opts.shouldThrow` option - Type: `boolean` diff --git a/docs/framework/react/api/router/useMatchRouteHook.md b/docs/framework/react/api/router/useMatchRouteHook.md new file mode 100644 index 0000000000..01c26d07c6 --- /dev/null +++ b/docs/framework/react/api/router/useMatchRouteHook.md @@ -0,0 +1,116 @@ +--- +id: useMatchRouteHook +title: useMatchRoute hook +--- + +The `useMatchRoute` hook is a hook that returns a `matchRoute` function that can be used to match a route against either the current or pending location. + +## useMatchRoute returns + +- A `matchRoute` function that can be used to match a route against either the current or pending location. + +## matchRoute function + +The `matchRoute` function is a function that can be used to match a route against either the current or pending location. + +### matchRoute function options + +The `matchRoute` function accepts a single argument, an `options` object. + +- Type: [`UseMatchRouteOptions`](./UseMatchRouteOptionsType.md) + +### matchRoute function returns + +- The matched route's params or `false` if no route was matched + +## Examples + +```tsx +import { useMatchRoute } from '@tanstack/react-router' + +// Current location: /posts/123 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ to: '/posts/$postId' }) + // ^ { postId: '123' } +} + +// Current location: /posts/123 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ to: '/posts' }) + // ^ false +} + +// Current location: /posts/123 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ to: '/posts', fuzzy: true }) + // ^ {} +} + +// Current location: /posts +// Pending location: /posts/123 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ to: '/posts/$postId', pending: true }) + // ^ { postId: '123' } +} + +// Current location: /posts/123/foo/456 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ to: '/posts/$postId/foo/$fooId' }) + // ^ { postId: '123', fooId: '456' } +} + +// Current location: /posts/123/foo/456 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ + to: '/posts/$postId/foo/$fooId', + params: { postId: '123' }, + }) + // ^ { postId: '123', fooId: '456' } +} + +// Current location: /posts/123/foo/456 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ + to: '/posts/$postId/foo/$fooId', + params: { postId: '789' }, + }) + // ^ false +} + +// Current location: /posts/123/foo/456 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ + to: '/posts/$postId/foo/$fooId', + params: { fooId: '456' }, + }) + // ^ { postId: '123', fooId: '456' } +} + +// Current location: /posts/123/foo/456 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ + to: '/posts/$postId/foo/$fooId', + params: { postId: '123', fooId: '456' }, + }) + // ^ { postId: '123', fooId: '456' } +} + +// Current location: /posts/123/foo/456 +function Component() { + const matchRoute = useMatchRoute() + const params = matchRoute({ + to: '/posts/$postId/foo/$fooId', + params: { postId: '789', fooId: '456' }, + }) + // ^ false +} +``` diff --git a/docs/framework/react/api/router/useMatchesHook.md b/docs/framework/react/api/router/useMatchesHook.md new file mode 100644 index 0000000000..74a554dfd5 --- /dev/null +++ b/docs/framework/react/api/router/useMatchesHook.md @@ -0,0 +1,36 @@ +--- +id: useMatchesHook +title: useMatches hook +--- + +The `useMatches` hook returns all of the [`RouteMatch`](./RouteMatchType.md) objects from the router **regardless of its callers position in the React component tree**. + +> [!TIP] +> If you only want the parent or child matches, then you can use the [`useParentMatches`](./useParentMatchesHook.md) or the [`useChildMatches`](./useChildMatchesHook.md) based on the selection you need. + +## useMatches options + +The `useMatches` hook accepts a single _optional_ argument, an `options` object. + +### `opts.select` option + +- Optional +- `(matches: RouteMatch[]) => TSelected` +- If supplied, this function will be called with the route matches and the return value will be returned from `useMatches`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. + +## useMatches returns + +- If a `select` function is provided, the return value of the `select` function. +- If no `select` function is provided, an array of [`RouteMatch`](./RouteMatchType.md) objects. + +## Examples + +```tsx +import { useMatches } from '@tanstack/react-router' + +function Component() { + const matches = useMatches() + // ^? [RouteMatch, RouteMatch, ...] + // ... +} +``` diff --git a/docs/router/api/router/useNavigateHook.md b/docs/framework/react/api/router/useNavigateHook.md similarity index 100% rename from docs/router/api/router/useNavigateHook.md rename to docs/framework/react/api/router/useNavigateHook.md diff --git a/docs/framework/react/api/router/useParamsHook.md b/docs/framework/react/api/router/useParamsHook.md new file mode 100644 index 0000000000..41ad2da508 --- /dev/null +++ b/docs/framework/react/api/router/useParamsHook.md @@ -0,0 +1,55 @@ +--- +id: useParamsHook +title: useParams hook +--- + +The `useParams` method returns all of the path parameters that were parsed for the closest match and all of its parent matches. + +## useParams options + +The `useParams` hook accepts an optional `options` object. + +### `opts.strict` option + +- Type: `boolean` +- Optional - `default: true` +- If `false`, the `opts.from` option will be ignored and types will be loosened to `Partial` to reflect the shared types of all params. + +### `opts.select` option + +- Optional +- `(params: AllParams) => TSelected` +- If supplied, this function will be called with the params object and the return value will be returned from `useParams`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. + +## useParams returns + +- An object of of the match's and parent match path params or `TSelected` if a `select` function is provided. + +## Examples + +```tsx +import { useParams } from '@tanstack/react-router' + +const routeApi = getRouteApi('/posts/$postId') + +function Component() { + const params = useParams({ from: '/posts/$postId' }) + + // OR + + const routeParams = routeApi.useParams() + + // OR + + const postId = useParams({ + from: '/posts/$postId', + select: (params) => params.postId, + }) + + // OR + + const looseParams = useParams({ strict: false }) + + // ... +} +``` diff --git a/docs/framework/react/api/router/useParentMatchesHook.md b/docs/framework/react/api/router/useParentMatchesHook.md new file mode 100644 index 0000000000..bc50c3cd5e --- /dev/null +++ b/docs/framework/react/api/router/useParentMatchesHook.md @@ -0,0 +1,35 @@ +--- +id: useParentMatchesHook +title: useParentMatches hook +--- + +The `useParentMatches` hook returns all of the parent [`RouteMatch`](./RouteMatchType.md) objects from the root down to the immediate parent of the current match in context. **It does not include the current match, which can be obtained using the `useMatch` hook.** + +> [!IMPORTANT] +> If the router has pending matches and they are showing their pending component fallbacks, `router.state.pendingMatches` will used instead of `router.state.matches`. + +## useParentMatches options + +The `useParentMatches` hook accepts an optional `options` object. + +### `opts.select` option + +- Optional +- `(matches: RouteMatch[]) => TSelected` +- If supplied, this function will be called with the route matches and the return value will be returned from `useParentMatches`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. + +## useParentMatches returns + +- If a `select` function is provided, the return value of the `select` function. +- If no `select` function is provided, an array of [`RouteMatch`](./RouteMatchType.md) objects. + +## Examples + +```tsx +import { useParentMatches } from '@tanstack/react-router' + +function Component() { + const parentMatches = useParentMatches() + // ^ [RouteMatch, RouteMatch, ...] +} +``` diff --git a/docs/router/api/router/useRouteContextHook.md b/docs/framework/react/api/router/useRouteContextHook.md similarity index 100% rename from docs/router/api/router/useRouteContextHook.md rename to docs/framework/react/api/router/useRouteContextHook.md diff --git a/docs/router/api/router/useRouterHook.md b/docs/framework/react/api/router/useRouterHook.md similarity index 100% rename from docs/router/api/router/useRouterHook.md rename to docs/framework/react/api/router/useRouterHook.md diff --git a/docs/router/api/router/useRouterStateHook.md b/docs/framework/react/api/router/useRouterStateHook.md similarity index 76% rename from docs/router/api/router/useRouterStateHook.md rename to docs/framework/react/api/router/useRouterStateHook.md index 24fd8f94b2..dbcb37613b 100644 --- a/docs/router/api/router/useRouterStateHook.md +++ b/docs/framework/react/api/router/useRouterStateHook.md @@ -6,7 +6,7 @@ title: useRouterState hook The `useRouterState` method is a hook that returns the current internal state of the router. This hook is useful for accessing the current state of the router in a component. > [!TIP] -> If you want to access the current location or the current matches, you should try out the [`useLocation`](./useLocationHook.md) and [`useMatches`](./useMatchesHook.md) hooks first. These hooks are designed to be more performant, more ergonomic and easier to use than accessing the router state directly. +> If you want to access the current location or the current matches, you should try out the [`useLocation`](./useLocationHook.md) and [`useMatches`](./useMatchesHook.md) hooks first. These hooks are designed to be more ergonomic and easier to use than accessing the router state directly. ## useRouterState options @@ -18,13 +18,6 @@ The `useRouterState` hook accepts an optional `options` object. - Optional - If supplied, this function will be called with the [`RouterState`](./RouterStateType.md) object and the return value will be returned from `useRouterState`. -### `opts.structuralSharing` option - -- Type: `boolean` -- Optional -- Configures whether structural sharing is enabled for the value returned by `select`. -- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. - ## useRouterState returns - The current [`RouterState`](./RouterStateType.md) object or `TSelected` if a `select` function is provided. diff --git a/docs/router/api/router/useSearchHook.md b/docs/framework/react/api/router/useSearchHook.md similarity index 76% rename from docs/router/api/router/useSearchHook.md rename to docs/framework/react/api/router/useSearchHook.md index 39c8ed5d9e..586ce2e4d2 100644 --- a/docs/router/api/router/useSearchHook.md +++ b/docs/framework/react/api/router/useSearchHook.md @@ -15,26 +15,12 @@ The `useSearch` hook accepts an `options` object. - Required - The RouteID to match the search query parameters from. -### `opts.shouldThrow` option - -- Type: `boolean` -- Optional -- `default: true` -- If `false`,`useSearch` will not throw an invariant exception in case a match was not found in the currently rendered matches; in this case, it will return `undefined`. - ### `opts.select` option - Type: `(search: SelectedSearchSchema) => TSelected` - Optional - If supplied, this function will be called with the search object and the return value will be returned from `useSearch`. -### `opts.structuralSharing` option - -- Type: `boolean` -- Optional -- Configures whether structural sharing is enabled for the value returned by `select`. -- See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. - ### `opts.strict` option - Type: `boolean` diff --git a/docs/framework/react/comparison.md b/docs/framework/react/comparison.md new file mode 100644 index 0000000000..e7cce153b3 --- /dev/null +++ b/docs/framework/react/comparison.md @@ -0,0 +1,81 @@ +--- +title: Comparison | TanStack Router vs React Router +toc: false +--- + +Before you commit to a new tool, it's always nice to know how it stacks up against the competition! + +> This comparison table strives to be as accurate and as unbiased as possible. If you use any of these libraries and feel the information could be improved, feel free to suggest changes (with notes or evidence of claims) using the "Edit this page on GitHub" link at the bottom of this page. + +Feature/Capability Key: + +- ✅ 1st-class, built-in, and ready to use with no added configuration or code +- 🔵 Supported via addon package +- 🟡 Partial Support +- 🔶 Possible, but requires custom code/implementation/casting +- 🛑 Not officially supported + +| | TanStack Router | React Router DOM [_(Website)_][router] | Next.JS [_(Website)_][nextjs] | +| ---------------------------------------------- | ------------------------------------------------ | ----------------------------------------------------- | ----------------------------------------------------- | +| Github Repo / Stars | [![][stars-tanstack-router]][gh-tanstack-router] | [![][stars-router]][gh-router] | [![][stars-nextjs]][gh-nextjs] | +| Bundle Size | [![][bp-tanstack-router]][bpl-tanstack-router] | [![][bp-router]][bpl-router] | ❓ | +| History, Memory & Hash Routers | ✅ | ✅ | 🛑 | +| Nested / Layout Routes | ✅ | ✅ | ✅ | +| Suspense-like Route Transitions | ✅ | ✅ | ✅ | +| Typesafe Routes | ✅ | 🛑 | 🟡 | +| Code-based Routes | ✅ | ✅ | 🛑 | +| File-based Routes | ✅ | ✅ | ✅ | +| Router Loaders | ✅ | ✅ | ✅ | +| SWR Loader Caching | ✅ | 🛑 | ✅ | +| Route Prefetching | ✅ | ✅ | ✅ | +| Auto Route Prefetching | ✅ | 🔵 (via Remix) | ✅ | +| Route Prefetching Delay | ✅ | 🔶 | 🛑 | +| Path Params | ✅ | ✅ | ✅ | +| Typesafe Path Params | ✅ | 🛑 | 🛑 | +| Path Param Validation | ✅ | 🛑 | 🛑 | +| Custom Path Param Parsing/Serialization | ✅ | 🛑 | 🛑 | +| Ranked Routes | ✅ | ✅ | ✅ | +| Active Link Customization | ✅ | ✅ | ✅ | +| Optimistic UI | ✅ | ✅ | 🔶 | +| Typesafe Absolute + Relative Navigation | ✅ | 🛑 | 🛑 | +| Route Mount/Transition/Unmount Events | ✅ | 🛑 | 🛑 | +| Devtools | ✅ | 🛑 | 🛑 | +| Basic Search Params | ✅ | ✅ | ✅ | +| Search Param Hooks | ✅ | ✅ | ✅ | +| ``/`useNavigate` Search Param API | ✅ | 🟡 (search-string only via the `to`/`search` options) | 🟡 (search-string only via the `to`/`search` options) | +| JSON Search Params | ✅ | 🔶 | 🔶 | +| TypeSafe Search Params | ✅ | 🛑 | 🛑 | +| Search Param Schema Validation | ✅ | 🛑 | 🛑 | +| Search Param Immutability + Structural Sharing | ✅ | 🔶 | 🛑 | +| Custom Search Param parsing/serialization | ✅ | 🔶 | 🛑 | +| Search Param Middleware | ✅ | 🛑 | 🛑 | +| Suspense Route Elements | ✅ | ✅ | ✅ | +| Route Error Elements | ✅ | ✅ | ✅ | +| Route Pending Elements | ✅ | ✅ | ✅ | +| ``/`useBlocker` | ✅ | 🔶 | ❓ | +| SSR | ✅ | ✅ | ✅ | +| Streaming SSR | ✅ | ✅ | ✅ | +| Deferred Primitives | ✅ | ✅ | ✅ | +| Navigation Scroll Restoration | ✅ | ✅ | ❓ | +| Loader Caching (SWR + Invalidation) | 🔶 (TanStack Query is recommended) | 🛑 | ✅ | +| Actions | 🔶 (TanStack Query is recommended) | ✅ | ✅ | +| `
` API | 🛑 | ✅ | ✅ | +| Full-Stack APIs | 🛑 | ✅ | ✅ | + +[bp-tanstack-router]: https://badgen.net/bundlephobia/minzip/@tanstack/react-router +[bpl-tanstack-router]: https://bundlephobia.com/result?p=@tanstack/react-router +[gh-tanstack-router]: https://github.com/tanstack/router +[stars-tanstack-router]: https://img.shields.io/github/stars/tanstack/router?label=%F0%9F%8C%9F +[_]: _ +[router]: https://github.com/remix-run/react-router +[bp-router]: https://badgen.net/bundlephobia/minzip/react-router-dom +[gh-router]: https://github.com/remix-run/react-router +[stars-router]: https://img.shields.io/github/stars/remix-run/react-router?label=%F0%9F%8C%9F +[bpl-router]: https://bundlephobia.com/result?p=react-router-dom +[bpl-history]: https://bundlephobia.com/result?p=history +[_]: _ +[nextjs]: https://nextjs.org/docs/routing/introduction +[bp-nextjs]: https://badgen.net/bundlephobia/minzip/next.js?label=All +[gh-nextjs]: https://github.com/vercel/next.js +[stars-nextjs]: https://img.shields.io/github/stars/vercel/next.js?label=%F0%9F%8C%9F +[bpl-nextjs]: https://bundlephobia.com/result?p=next diff --git a/docs/router/decisions-on-dx.md b/docs/framework/react/decisions-on-dx.md similarity index 77% rename from docs/router/decisions-on-dx.md rename to docs/framework/react/decisions-on-dx.md index a06ec4b331..8a4596b8aa 100644 --- a/docs/router/decisions-on-dx.md +++ b/docs/framework/react/decisions-on-dx.md @@ -14,12 +14,9 @@ And they are all valid questions. For the most part, people are used to using ro But TanStack Router is different. It's not your average routing library. It's not your average state management library. It's not your average anything. -> [!TIP] -> The examples in this guide use React for components and code snippets, but the same principles apply to Solid. The only difference is in the syntax and API of the framework, but the underlying concepts and design decisions are the same. - ## TanStack Router's origin story -It's important to remember that TanStack Router's origins stem from [Nozzle.io](https://nozzle.io?utm_source=tanstack)'s need for a client-side routing solution that offered a first-in-class _URL Search Parameters_ experience without compromising on the **_type-safety_** that was required to power its complex dashboards. +It's important to remember that TanStack Router's origins stem from [Nozzle.io](https://nozzle.io)'s need for a client-side routing solution that offered a first-in-class _URL Search Parameters_ experience without compromising on the **_type-safety_** that was required to power its complex dashboards. And so, from TanStack Router's very inception, every facet of its design was meticulously thought out to ensure that its type-safety and developer experience were second to none. @@ -31,15 +28,15 @@ Every aspect of TanStack Router is designed to be as type-safe as possible, and But to achieve this, we had to make some decisions that deviate from the norms in the routing world. -1. [**Route configuration boilerplate?**](#why-is-the-routers-configuration-done-this-way): You have to define your routes in a way that allows TypeScript to infer the types of your routes as much as possible. -2. [**TypeScript module declaration for the router?**](#declaring-the-router-instance-for-type-inference): You have to pass the `Router` instance to the rest of your application using TypeScript's module declaration. -3. [**Why push for file-based routing over code-based?**](#why-is-file-based-routing-the-preferred-way-to-define-routes): We push for file-based routing as the preferred way to define your routes. +1. [**Route configuration boilerplate?**](#1-why-is-the-routers-configuration-done-this-way): You have to define your routes in a way that allows TypeScript to infer the types of your routes as much as possible. +2. [**TypeScript module declaration for the router?**](#2-declaring-the-router-instance-for-type-inference): You have to pass the `Router` instance to the rest of your application using TypeScript's module declaration. +3. [**Why push for file-based routing over code-based?**](#3-why-is-file-based-routing-the-preferred-way-to-define-routes): We push for file-based routing as the preferred way to define your routes. > TLDR; All the design decisions in the developer experience of using TanStack Router are made so that you can have a best-in-class type-safety experience without compromising on the control, flexibility, and maintainability of your route configurations. -## Why is the Router's configuration done this way? +## 1. Why is the Router's configuration done this way? -When you want to leverage TypeScript's inference features to its fullest, you'll quickly realize that _Generics_ are your best friend. And so, TanStack Router uses Generics everywhere to ensure that the types of your routes are inferred as much as possible. +When you want to leverage the TypeScript's inference features to its fullest, you'll quickly realize that _Generics_ are your best friend. And so, TanStack Router uses Generics everywhere to ensure that the types of your routes are inferred as much as possible. This means that you have to define your routes in a way that allows TypeScript to infer the types of your routes as much as possible. @@ -93,12 +90,12 @@ This only gets worse as you begin to use more features of the router, such as ne What we found to be the best way to define your routes is to abstract the definition of the route configuration outside of the route-tree. Then stitch together your route configurations into a single cohesive route-tree that is then passed into the `createRouter` function. -You can read more about [code-based routing](./routing/code-based-routing.md) to see how to define your routes in this way. +You can read more about [code-based routing](./guide/code-based-routing.md) to see how to define your routes in this way. > [!TIP] -> Finding Code-based routing to be a bit too cumbersome? See why [file-based routing](#why-is-file-based-routing-the-preferred-way-to-define-routes) is the preferred way to define your routes. +> Finding Code-based routing to be a bit too cumbersome? See why [file-based routing](#3-why-is-file-based-routing-the-preferred-way-to-define-routes) is the preferred way to define your routes. -## Declaring the Router instance for type inference +## 2. Declaring the Router instance for type inference > Why do I have to declare the `Router`? @@ -154,7 +151,7 @@ export const PostsIdLink = () => { We went with **module declaration**, as it is what we found to be the most scalable and maintainable approach with the least amount of overhead and boilerplate. -## Why is file-based routing the preferred way to define routes? +## 3. Why is file-based routing the preferred way to define routes? > Why are the docs pushing for file-based routing? @@ -163,7 +160,7 @@ We went with **module declaration**, as it is what we found to be the most scala Something you'll notice (quite soon) in the TanStack Router documentation is that we push for **file-based routing** as the preferred method for defining your routes. This is because we've found that file-based routing is the most scalable and maintainable way to define your routes. > [!TIP] -> Before you continue, it's important you have a good understanding of [code-based routing](./routing/code-based-routing.md) and [file-based routing](./routing/file-based-routing.md). +> Before you continue, it's important you have a good understanding of [code-based routing](./guide/code-based-routing.md) and [file-based routing](./guide/file-based-routing.md). As mentioned in the beginning, TanStack Router was designed for complex applications that require a high degree of type-safety and maintainability. And to achieve this, the configuration of the router has been done in a precise way that allows TypeScript to infer the types of your routes as much as possible. @@ -216,25 +213,25 @@ All of this boilerplate, no matter how essential for providing a best-in-class t TanStack Router's file-based routing is designed to solve all of these issues. It allows you to define your routes in a predictable way that is easy to manage and maintain, and is scalable as your application grows. -The file-based routing approach is powered by the TanStack Router Bundler Plugin. It performs 3 essential tasks that solve the pain points in route configuration when using code-based routing: +The file-based routing approach is powered by the TanStack Router CLI. It performs 3 essential tasks that solve the pain points in route configuration when using code-based routing: 1. **Route configuration boilerplate**: It generates the boilerplate for your route configurations. -2. **Route tree stitching**: It stitches together your route configurations into a single cohesive route-tree. Also in the background, it correctly updates the route configurations to define the `getParentRoute` function and so matches the routes with their parent routes. -3. **Code-splitting**: It automatically code-splits your route content components and updates the route configurations with the correct component. Additionally, at runtime, it ensures that the correct component is loaded when the route is visited. +2. **Route tree stitching**: It stitches together your route configurations into a single cohesive route-tree. Also in the background, it correctly updates the route configurations to define the `getParentRoute` function match the routes with their parent routes. +3. **Code-splitting**: It automatically code-splits your components and handles updating your route configurations with the correct lazy imports. Let's take a look at how the route configuration for the previous example would look like with file-based routing. ```tsx -// src/routes/posts/index.ts -import { createFileRoute } from '@tanstack/react-router' +// src/routes/posts/index.lazy.ts +import { createLazyFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/posts/')({ +export const Route = createLazyFileRoute('/posts/')({ component: () => 'Posts index component goes here!!!', }) ``` -That's it! No need to worry about defining the `getParentRoute` function, stitching together the route-tree, or code-splitting your components. The TanStack Router Bundler Plugin handles all of this for you. +That's it! No need to worry about defining the `getParentRoute` function, stitching together the route-tree, or code-splitting your components. The CLI handles all of this for you. -At no point does the TanStack Router Bundler Plugin take away your control over your route configurations. It's designed to be as flexible as possible, allowing you to define your routes in a way that suits your application whilst reducing the boilerplate and complexity of the route configuration. +At no point does the TanStack Router CLI take away your control over your route configurations. It's designed to be as flexible as possible, allowing you to define your routes in a way that suits your application whilst reducing the boilerplate and complexity of the route configuration. -Check out the guides for [file-based routing](./routing/file-based-routing.md) and [code-splitting](./guide/code-splitting.md) for a more in-depth explanation of how they work in TanStack Router. +Check out the guides for [file-based routing](./guide/file-based-routing.md) and [code-splitting](./guide/code-splitting.md) for a more in-depth explanation of how they work in TanStack Router. diff --git a/docs/framework/react/devtools.md b/docs/framework/react/devtools.md new file mode 100644 index 0000000000..df3435a053 --- /dev/null +++ b/docs/framework/react/devtools.md @@ -0,0 +1,159 @@ +--- +title: Devtools +--- + +> Link, take this sword... I mean Devtools!... to help you on your way! + +Wave your hands in the air and shout hooray because TanStack Router comes with dedicated devtools! 🥳 + +When you begin your TanStack Router journey, you'll want these devtools by your side. They help visualize all of the inner workings of TanStack Router and will likely save you hours of debugging if you find yourself in a pinch! + +> Please note that for now, the devtools **are only supported in React**. If you would like to help us make the devtools platform-agnostic, please let us know! + +## Installation + +```sh +npm install @tanstack/router-devtools --save +``` + +## Import the Devtools + +```js +import { TanStackRouterDevtools } from '@tanstack/router-devtools' +``` + +## Only importing and using Devtools in Development + +To do this, simply use `React.lazy` and the env variable of your choice to optionally return a dummy component: + +```tsx +const TanStackRouterDevtools = + process.env.NODE_ENV === 'production' + ? () => null // Render nothing in production + : React.lazy(() => + // Lazy load in development + import('@tanstack/router-devtools').then((res) => ({ + default: res.TanStackRouterDevtools, + // For Embedded Mode + // default: res.TanStackRouterDevtoolsPanel + })), + ) +``` + +Then wrap the `TanStackRouterDevtools` component in suspense. + +```tsx + + + +``` + +## Using inside of the `RouterProvider` + +The easiest way for the devtools to work is to render them inside of your root route (or any other route). This will automatically connect the devtools to the router instance. + +```tsx +const rootRoute = createRootRoute({ + component: () => ( + <> + + + + ), +}) + +const routeTree = rootRoute.addChildren([ + // ... other routes +]) + +const router = createRouter({ + routeTree, +}) + +function App() { + return +} +``` + +## Manually passing the Router Instance + +If rendering the devtools inside of the `RouterProvider` isn't your cup of tea, a `router` prop for the devtools accepts the same `router` instance you pass to the `Router` component. This makes it possible to place the devtools anywhere on the page, not just inside the provider: + +```tsx +function App() { + return ( + <> + + + + ) +} +``` + +## Floating Mode + +Floating Mode will mount the devtools as a fixed, floating element in your app and provide a toggle in the corner of the screen to show and hide the devtools. This toggle state will be stored and remembered in localStorage across reloads. + +Place the following code as high in your React app as you can. The closer it is to the root of the page, the better it will work! + +```js +import { TanStackRouterDevtools } from '@tanstack/router-devtools' + +function App() { + return ( + <> + + + + ) +} +``` + +### Options + +- `router: Router` + - The router instance to connect to +- `initialIsOpen: Boolean` + - Set this `true` if you want the devtools to default to being open +- `panelProps: PropsObject` + - Use this to add props to the panel. For example, you can add `className`, `style` (merge and override default style), etc. +- `closeButtonProps: PropsObject` + - Use this to add props to the close button. For example, you can add `className`, `style` (merge and override default style), `onClick` (extend default handler), etc. +- `toggleButtonProps: PropsObject` + - Use this to add props to the toggle button. For example, you can add `className`, `style` (merge and override default style), `onClick` (extend default handler), etc. +- `position?: "top-left" | "top-right" | "bottom-left" | "bottom-right"` + - Defaults to `bottom-left` + - The position of the TanStack Router logo to open and close the devtools panel +- `shadowDOMTarget?: ShadowRoot` + - Specifies a Shadow DOM target for the devtools. + - By default, devtool styles are applied to the `` tag of the main document (light DOM). When a `shadowDOMTarget` is provided, styles will be applied within this Shadow DOM instead. + +## Embedded Mode + +Embedded Mode will embed the devtools as a regular component in your application. You can style it however you'd like after that! + +```js +import { TanStackRouterDevtoolsPanel } from '@tanstack/router-devtools' + +function App() { + return ( + <> + + + + ) +} +``` + +### Options + +Use these options to style the devtools. + +- `style: StyleObject` + - The standard React style object used to style a component with inline styles +- `className: string` + - The standard React className property used to style a component with classes diff --git a/docs/framework/react/guide/authenticated-routes.md b/docs/framework/react/guide/authenticated-routes.md new file mode 100644 index 0000000000..5677748633 --- /dev/null +++ b/docs/framework/react/guide/authenticated-routes.md @@ -0,0 +1,166 @@ +--- +id: authenticated-routes +title: Authenticated Routes +--- + +Authentication is an extremely common requirement for web applications. In this guide, we'll walk through how to use TanStack Router to build protected routes, and how to redirect users to login if they try to access them. + +## The `route.beforeLoad` Option + +The `route.beforeLoad` option allows you to specify a function that will be called before a route is loaded. It receives all of the same arguments that the `route.loader` function does. This is a great place to check if a user is authenticated, and redirect them to a login page if they are not. + +The `beforeLoad` function runs in relative order to these other route loading functions: + +- Route Matching (Top-Down) + - `route.params.parse` + - `route.validateSearch` +- Route Loading (including Preloading) + - **`route.beforeLoad`** + - `route.onError` +- Route Loading (Parallel) + - `route.component.preload?` + - `route.load` + +**It's important to know that the `beforeLoad` function for a route is called _before any of its child routes' `beforeLoad` functions_.** It is essentially a middleware function for the route and all of its children. + +**If you throw an error in `beforeLoad`, none of its children will attempt to load**. + +## Redirecting + +While not required, some authentication flows require redirecting to a login page. To do this, you can **throw a `redirect()`** from `beforeLoad`: + +```tsx +// src/routes/_authenticated.tsx +export const Route = createFileRoute('/_authenticated')({ + beforeLoad: async ({ location }) => { + if (!isAuthenticated()) { + throw redirect({ + to: '/login', + search: { + // Use the current location to power a redirect after login + // (Do not use `router.state.resolvedLocation` as it can + // potentially lag behind the actual current location) + redirect: location.href, + }, + }) + } + }, +}) +``` + +> [!TIP] +> The `redirect()` function takes all of the same options as the `navigate` function, so you can pass options like `replace: true` if you want to replace the current history entry instead of adding a new one. + +Once you have authenticated a user, it's also common practice to redirect them back to the page they were trying to access. To do this, you can utilize the `redirect` search param that we added in our original redirect. Since we'll be replacing the entire URL with what it was, `router.history.push` is better suited for this than `router.navigate`: + +```tsx +router.history.push(search.redirect) +``` + +## Non-Redirected Authentication + +Some applications choose to not redirect users to a login page, and instead keep the user on the same page and show a login form that either replaces the main content or hides it via a modal. This is also possible with TanStack Router by simply short circuiting rendering the `` that would normally render the child routes: + +```tsx +// src/routes/_authenticated.tsx +export const Route = createFileRoute('/_authenticated')({ + component: () => { + if (!isAuthenticated()) { + return + } + + return + }, +}) +``` + +This keeps the user on the same page, but still allows you to render a login form. Once the user is authenticated, you can simply render the `` and the child routes will be rendered. + +## Authentication using React context/hooks + +If your authentication flow relies on interactions with React context and/or hooks, you'll need to pass down your authentication state to TanStack Router using `router.context` option. + +> [!IMPORTANT] +> React hooks are not meant to be consumed outside of React components. If you need to use a hook outside of a React component, you need to extract the returned state from the hook in a component that wraps your `` and then pass the returned value down to TanStack Router. + +We'll cover the `router.context` options in-detail in the [Router Context](./router-context.md) section. + +Here's an example that uses React context and hooks for protecting authenticated routes in TanStack Router. See the entire working setup in the [Authenticated Routes example](../../examples/authenticated-routes). + +- `src/routes/__root.tsx` + +```tsx +import { createRootRouteWithContext } from '@tanstack/react-router' + +interface MyRouterContext { + // The ReturnType of your useAuth hook or the value of your AuthContext + auth: AuthState +} + +export const Route = createRootRouteWithContext()({ + component: () => , +}) +``` + +- `src/router.tsx` + +```tsx +import { createRouter } from '@tanstack/react-router' + +import { routeTree } from './routeTree.gen' + +export const router = createRouter({ + routeTree, + context: { + // auth will initially be undefined + // We'll be passing down the auth state from within a React component + auth: undefined!, + }, +}) +``` + +- `src/App.tsx` + +```tsx +import { RouterProvider } from '@tanstack/react-router' + +import { router } from './router' + +function InnerApp() { + const auth = useAuth() + return +} + +function App() { + return ( + + + + ) +} +``` + +Then in the authenticated route, you can check the auth state using the `beforeLoad` function, and **throw a `redirect()`** to your **Login route** if the user is not signed-in. + +- `src/routes/dashboard.route.tsx` + +```tsx +import { createFileRoute, redirect } from '@tanstack/react-router' + +export const Route = createFileRoute('/dashboard')({ + beforeLoad: ({ context, location }) => { + if (!context.auth.isAuthenticated) { + throw redirect({ + to: '/login', + search: { + redirect: location.href, + }, + }) + } + }, +}) +``` + +You can _optionally_, also use the [Non-Redirected Authentication](#non-redirected-authentication) approach to show a login form instead of calling a **redirect**. + +This approach can also be used in conjunction with Layout or Parent Routes to protect all routes under a specific layout. diff --git a/docs/framework/react/guide/code-based-routing.md b/docs/framework/react/guide/code-based-routing.md new file mode 100644 index 0000000000..05aeeb53b6 --- /dev/null +++ b/docs/framework/react/guide/code-based-routing.md @@ -0,0 +1,280 @@ +--- +title: Code-Based Routing +--- + +## ⚠️ Before You Start + +- If you're using [File-Based Routing](./file-based-routing.md), **skip this guide**. +- If you are new to TanStack Router, please be aware that **file-based routing is the recommended way to configure TanStack Router**. If you're not sure which to use, please read the [File-Based Routing](./file-based-routing.md) guide first. +- If you still insist on using code-based routing, you must read the [File-Based Routing](./file-based-routing.md) guide first as it also covers core concepts of the router that are not repeated here. + +## Route Trees + +Code-based routing is no different from file-based routing in that it uses the same route tree concept to organize, match and compose matching routes into a component tree. The only difference is that instead of using the filesystem to organize your routes, you use code. + +Let's consider the same route tree from the [Route Trees & Nesting](./route-trees.md#route-trees) guide, but from a code-based perspective: + +- _Root_ + - `/` + - `about` + - `posts` + - `/` + - `$postId` + - `posts/$postId/edit` + - `settings` + - `profile` + - `notifications` + - `layout` + - `layout-a` + - `layout-b` + - `files` + - `$` +- _Not-Found Route_ + +## File-Based vs Code-Based Routing + +Notice how the route tree is exactly the same as the file-based route tree? Believe it or not, file-based routing is really a superset of code-based routing and at the end of the day, file-based routing is just code-based routing with a filesystem and code-generation abstraction on top of it. + +We're going to assume you've read the [File-Based Routing](./file-based-routing.md) guide and are familiar with each of these main concepts: + +- The Root Route +- Static Routes +- Index Routes +- Dynamic Route Segments +- Splat / Catch-All Routes +- Pathless Routes +- Non-Nested Routes +- Not-Found Routes + +**Now, let's take a look at how to create each of these route types in code.** + +## The Root Route + +Creating a root route in code-based routing is thankfully the same as doing so in file-based routing. Call the `createRootRoute()` function. + +Unlike file-based routing however, you do not need to export the root route if you don't want to. It's certainly not recommended to build an entire route tree and application in a single file (although you can and we do this in the examples to demonstrate routing concepts in brevity). + +```tsx +import { createRootRoute } from '@tanstack/react-router' + +const rootRoute = createRootRoute() +``` + +> 🧠 You can also create a root route via the `createRootRouteWithContext()` function, which is a type-safe way of doing dependency injection for the entire router. Read more about this in the [Context Section](./router-context.md) --> + +## Anatomy of a Route + +All other routes other than the root route are configured using the `createRoute` function: + +```tsx +const route = createRoute({ + getParentRoute: () => rootRoute, + path: '/posts', + component: PostsComponent, +}) +``` + +### The `getParentRoute` option + +The `getParentRoute` option is a function that returns the parent route of the route you're creating. + +**❓❓❓ "Wait, you're making me pass the parent route for every route I make?"** + +Absolutely! The reason for passing the parent route has **everything to do with the magical type safety** of TanStack Router. Without the parent route, TypeScript would have no idea what types to supply your route with! + +### The `path` option + +For every route that **is not the root route or a pathless route**, a `path` option is required. This is the path that will be matched against the URL pathname to determine if the route is a match. + +#### Leading/Trailing Slashes + +When configuring routes via code, route paths ignore leading and trailing slashes (this does not include "index" route paths `/`). You can include them if you want, but they will be normalized internally by TanStack Router. Here is a table of valid paths and what they will be normalized to: + +| Path | Normalized Path | +| -------- | --------------- | +| `/` | `/` | +| `/about` | `about` | +| `about/` | `about` | +| `about` | `about` | +| `$` | `$` | +| `/$` | `$` | +| `/$/` | `$` | + +## Manually building the route tree + +When building a route tree in code, it's not enough to define the parent route of each route. You must also construct the final route tree by adding each route to its parent route's `children` array. This is because the route tree is not built automatically for you like it is in file-based routing. + +```tsx +/* prettier-ignore */ +const routeTree = rootRoute.addChildren([ + indexRoute, + aboutRoute, + postsRoute.addChildren([ + postsIndexRoute, + postRoute, + ]), + postEditorRoute, + settingsRoute.addChildren([ + profileRoute, + notificationsRoute, + ]), + layoutRoute.addChildren([ + layoutARoute, + layoutBRoute, + ]), + filesRoute.addChildren([ + fileRoute, + ]), +]) +/* prettier-ignore-end */ +``` + +## Static Routes + +To create a static route, simply provide a normal `path` string to the `createRoute` function: + +```tsx +const aboutRoute = createRoute({ + getParentRoute: () => rootRoute, + path: 'about', +}) +``` + +## Index Routes + +Unlike file-based routing, which uses the `index` filename to denote an index route, code-based routing uses a single slash `/` to denote an index route. For example, the `posts.index.tsx` file from our example route tree above would be represented in code-based routing like this: + +```tsx +const postsRoute = createRoute({ + getParentRoute: () => rootRoute, + path: 'posts', +}) + +const postsIndexRoute = createRoute({ + getParentRoute: () => postsRoute, + // Notice the single slash `/` here + path: '/', +}) +``` + +## Dynamic Route Segments + +Dynamic route segments work exactly the same in code-based routing as they do in file-based routing. Simply prefix a segment of the path with a `$` and it will be captured into the `params` object of the route's `loader` or `component`: + +```tsx +const postIdRoute = createRoute({ + getParentRoute: () => postsRoute, + path: '$postId', + // In a loader + loader: ({ params }) => fetchPost(params.postId), + // Or in a component + component: PostComponent, +}) + +function PostComponent() { + const { postId } = postIdRoute.useParams() + return
Post ID: {postId}
+} +``` + +> [!TIP] +> If your component is code-split, you can use the [getRouteApi function](./code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-routeapi-class) to avoid having to import the `postIdRoute` configuration to get access to the typed `useParams()` hook. + +## Splat / Catch-All Routes + +As expected, splat/catch-all routes also work the same in code-based routing as they do in file-based routing. Simply prefix a segment of the path with a `$` and it will be captured into the `params` object under the `_splat` key: + +```tsx +const filesRoute = createRoute({ + getParentRoute: () => rootRoute, + path: 'files', +}) + +const fileRoute = createRoute({ + getParentRoute: () => filesRoute, + path: '$', +}) +``` + +For the URL `/documents/hello-world`, the `params` object will look like this: + +```js +{ + '_splat': 'documents/hello-world' +} +``` + +## Pathless Routes + +In file-based routing a pathless route is prefixed with a `_`, but in code-based routing, a pathless route is simply a route with an `id` instead of a `path` option. This is because code-based routing does not use the filesystem to organize routes, so there is no need to prefix a route with a `_` to denote that it has no path. + +```tsx +const layoutRoute = createRoute({ + getParentRoute: () => rootRoute, + id: 'layout', + component: LayoutComponent, +}) + +const layoutARoute = createRoute({ + getParentRoute: () => layoutRoute, + path: 'layout-a', +}) + +const layoutBRoute = createRoute({ + getParentRoute: () => layoutRoute, + path: 'layout-b', +}) +``` + +Now both `/layout-a` and `/layout-b` will render the their contents inside of the `LayoutComponent`: + +```tsx +// URL: /layout-a + + + + +// URL: /layout-b + + + +``` + +## Non-Nested Routes + +Building non-nested routes in code-based routing does not require using a trailing `_` in the path, but does require you to build your route and route tree with the right paths and nesting. Let's consider the route tree where we want the post editor to **not** be nested under the posts route: + +- `/posts_/$postId/edit` +- `/posts` + - `$postId` + +To do this we need to build a separate route for the post editor an include the entire path in the `path` option from the root of where we want the route to be nested (in this case, the root): + +```tsx +// The posts editor route is nested under the root route +const postEditorRoute = createRoute({ + getParentRoute: () => rootRoute, + // The path includes the entire path we need to match + path: 'posts/$postId/edit', +}) + +const postsRoute = createRoute({ + getParentRoute: () => rootRoute, + path: 'posts', +}) + +const postRoute = createRoute({ + getParentRoute: () => postsRoute, + path: '$postId', +}) + +const routeTree = rootRoute.addChildren([ + // The post editor route is nested under the root route + postEditorRoute, + postsRoute.addChildren([postRoute]), +]) +``` + +## 404 / `NotFoundRoute`s + +We'll cover how to configure a `NotFoundRoute` in the [Not Found Errors](./not-found-errors.md) guide. diff --git a/docs/framework/react/guide/code-splitting.md b/docs/framework/react/guide/code-splitting.md new file mode 100644 index 0000000000..ff2085f5b5 --- /dev/null +++ b/docs/framework/react/guide/code-splitting.md @@ -0,0 +1,395 @@ +--- +title: Code Splitting +--- + +Code splitting and lazy loading is a powerful technique for improving the bundle size and load performance of an application. + +- Reduces the amount of code that needs to be loaded on initial page load +- Code is loaded on-demand when it is needed +- Results in more chunks that are smaller in size that can be cached more easily by the browser. + +## How does TanStack Router split code? + +TanStack Router separates code into two categories: + +- **Critical Route Configuration** - The code that is required to render the current route and kick off the data loading process as early as possible. + + - Path Parsing/Serialization + - Search Param Validation + - Loaders, Before Load + - Route Context + - Static Data + - Links + - Scripts + - Styles + - All other route configuration not listed below + +- **Non-Critical/Lazy Route Configuration** - The code that is not required to match the route, and can be loaded on-demand. + - Route Component + - Error Component + - Pending Component + - Not-found Component + +> 🧠 **Why is the loader not split?** +> +> - The loader is already an asynchronous boundary, so you pay double to both get the chunk _and_ wait for the loader to execute. +> - Categorically, it is less likely to contribute to a large bundle size than a component. +> - The loader is one of the most important preloadable assets for a route, especially if you're using a default preload intent, like hovering over a link, so it's important for the loader to be available without any additional async overhead. +> +> Knowing the disadvantages of splitting the loader, if you still want to go ahead with it, head over to the [Data Loader Splitting](#data-loader-splitting) section. + +## Approaches to code splitting + +TanStack Router supports multiple approaches to code splitting. If you are using code-based routing, skip to the [Code-Based Splitting](#code-based-splitting) section. + +When you are using file-based routing, you can use the following approaches to code splitting: + +- [Using the `.lazy.tsx` suffix](#using-the-lazytsx-suffix) +- [Using Virtual Routes](#using-virtual-routes) +- [Using automatic code-splitting ✨](#using-automatic-code-splitting) + +## Encapsulating a route's files into a directory + +Since TanStack Router's file-based routing system is designed to support both flat and nested file structures, it's possible to encapsulate a route's files into a single directory without any additional configuration. + +To encapsulate a route's files into a directory, move the route file itself into a `.route` file within a directory with the same name as the route file. + +For example, if you have a route file named `posts.tsx`, you would create a new directory named `posts` and move the `posts.tsx` file into that directory, renaming it to `route.tsx`. + +**Before** + +- `posts.tsx` +- `posts.lazy.tsx` + +**After** + +- `posts` + - `route.tsx` + - `route.lazy.tsx` + +## Using the `.lazy.tsx` suffix + +If you're using the recommended [File-Based Routing](./route-trees.md) approach, code splitting is **as easy as moving your code into a separate file with a `.lazy.tsx` suffix** and use the `createLazyFileRoute` function instead of the `FileRoute` class or `createFileRoute` function. + +Here are the options currently supported by the `createLazyFileRoute` function: + +| Export Name | Description | +| ------------------- | --------------------------------------------------------------------- | +| `component` | The component to render for the route. | +| `errorComponent` | The component to render when an error occurs while loading the route. | +| `pendingComponent` | The component to render while the route is loading. | +| `notFoundComponent` | The component to render if a not-found error gets thrown. | + +### Exceptions to the `.lazy.tsx` rule + +- The `__root.tsx` route file does not support code splitting, since it's always rendered regardless of the current route. + +> ❓ Why can't I keep all of my route code in a single file? Can't you just code split that file? +> +> It's true, most popular frameworks support automatic code-extraction, but for now, TanStack Router is going to keep things simple by not getting into the business of parsing and extracting code from files. This also allows you to use any bundler you want, via the CLI, without having to worry about whether or not it supports our code extraction approach. +> +> In practice, we've found that **_splitting_ a file into 2 parts (critical and lazy) is the easy part**. The **harder part by far is wiring it all back together properly using lower-level lazy-loading APIs (not to mention doing that in a type-safe way)**. +> +> By keeping the splitting process manual and adhering to a simple set of conventions, there's less room for error and less cognitive overhead when working with code splitting. + +### Example code splitting with `.lazy.tsx` + +When you are using `.lazy.tsx` you can split your route into two files to enable code splitting: + +**Before (Single File)** + +```tsx +// src/routes/posts.tsx +import { createFileRoute } from '@tanstack/react-router' +import { fetchPosts } from './api' + +export const Route = createFileRoute('/posts')({ + loader: fetchPosts, + component: Posts, +}) + +function Posts() { + // ... +} +``` + +**After (Split into two files)** + +This file would contain the critical route configuration: + +```tsx +// src/routes/posts.tsx + +import { createFileRoute } from '@tanstack/react-router' +import { fetchPosts } from './api' + +export const Route = createFileRoute('/posts')({ + loader: fetchPosts, +}) +``` + +With the non-critical route configuration going into the file with the `.lazy.tsx` suffix: + +```tsx +// src/routes/posts.lazy.tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/posts')({ + component: Posts, +}) + +function Posts() { + // ... +} +``` + +## Using Virtual Routes + +You might run into a situation where you end up splitting out everything from a route file, leaving it empty! In this case, simply **delete the route file entirely**! A virtual route will automatically be generated for you to serve as an anchor for your code split files. This virtual route will live directly in the generated route tree file. + +**Before (Virtual Routes)** + +```tsx +// src/routes/posts.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + // Hello? +}) +``` + +```tsx +// src/routes/posts.lazy.tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/posts')({ + component: Posts, +}) + +function Posts() { + // ... +} +``` + +**After (Virtual Routes)** + +```tsx +// src/routes/posts.lazy.tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/posts')({ + component: Posts, +}) + +function Posts() { + // ... +} +``` + +Tada! 🎉 + +## Using automatic code-splitting + +When using the `autoCodeSplitting` feature, TanStack Router will automatically code split your route files based on the non-critical route configuration mentioned above. + +> [!IMPORTANT] +> The automatic code-splitting feature is **ONLY** available when you are using file-based routing with one of our [supported bundlers](./file-based-routing.md#prerequisites). +> This will **NOT** work if you are **only** using the CLI (`@tanstack/router-cli`). + +If this is your first time using TanStack Router, then you can skip the following steps and head over to [Enabling automatic code-splitting](#enabling-automatic-code-splitting). If you've already been using TanStack Router, then you might need to make some changes to your route files to enable automatic code-splitting. + +### Preparing your route files for automatic code-splitting + +When using automatic code-splitting, you should **not** use the `.lazy.tsx` suffix. Instead, any routes that are split into two using the `.lazy.tsx` suffix should be merged back into a single file. + +**Before using the `.lazy` suffix** + +```tsx +// src/routes/posts.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + loader: fetchPosts, +}) +``` + +```tsx +// src/routes/posts.lazy.tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/posts')({ + component: Posts, +}) + +function Posts() { + // ... +} +``` + +**After removing the `.lazy` suffix** + +```tsx +// src/routes/posts.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + loader: fetchPosts, + component: Posts, +}) + +function Posts() { + // ... +} +``` + +Also, if you were previously using virtual routes, you should then have their `.lazy.tsx` suffixes removed. + +**Before using Virtual Routes** + +```tsx +// src/routes/posts.lazy.tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/posts')({ + /* ... */ +}) +``` + +**After without Virtual Routes** + +```tsx +// src/routes/posts.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + /* ... */ +}) +``` + +Once you've done this, your route files are ready for automatic code-splitting. + +### Enabling automatic code-splitting + +> [!IMPORTANT] +> At this time, when using automatic code-splitting, ALL of your route files will be code-split. This means that you should only use this feature if you are sure that you want to code-split all of your route files. + +To enable automatic code-splitting, you can add the following to your `tsr.config.json`: + +```jsonc +{ + // ... + "autoCodeSplitting": true, +} +``` + +That's it! TanStack Router will automatically code-split all your route files by their critical and non-critical route configurations. + +## Code-Based Splitting + +### Manually Splitting Using `route.lazy()` and `createLazyRoute` + +If you're not using the file-based routing system, you can still manually split your code using the `route.lazy()` method and the `createLazyRoute` function. You'd need to: + +Create a lazy route using the `createLazyRoute` function. + +```tsx +// src/posts.tsx +export const Route = createLazyRoute('/posts')({ + component: MyComponent, +}) + +function MyComponent() { + return
My Component
+} +``` + +Then, call the `.lazy` method on the route definition in your `app.tsx` to import the lazy/code-split route with the non-critical route configuration. + +```tsx +// src/app.tsx +const postsRoute = createRoute({ + getParent: () => rootRoute, + path: '/posts', +}).lazy(() => import('./posts.lazy').then((d) => d.Route)) +``` + +## Data Loader Splitting + +> ⚠️ Splitting a data loader will incur 2 round trips to the server to retrieve the loader data. One round trip to load the loader code bundle itself and another to execute the loader code and retrieve the data. Do not proceed unless you are VERY sure that your loader is contributing to the bundle size enough to warrant these round trips. + +You can code split your data loading logic using the Route's `loader` option. While this process makes it difficult to maintain type-safety with the parameters passed to your loader, you can always use the generic `LoaderContext` type to get most of the way there: + +```tsx +import { LoaderContext } from '@tanstack/react-router' + +const route = createRoute({ + path: '/my-route', + component: MyComponent, + loader: (...args) => import('./loader').then((d) => d.loader(...args)), +}) + +// In another file... +export const loader = async (context: LoaderContext) => { + /// ... +} +``` + +This process can feel heavy-handed, so TanStack Router exports a utility called `lazyFn` which is very similar to `lazyRouteComponent` that can help simplify this process: + +```tsx +import { lazyFn } from '@tanstack/react-router' + +const route = createRoute({ + path: '/my-route', + component: MyComponent, + loader: lazyFn(() => import('./loader'), 'loader'), +}) + +// In another file...a +export const loader = async (context: LoaderContext) => { + /// ... +} +``` + +## Manually accessing Route APIs in other files with the `getRouteApi` helper + +As you might have guessed, placing your component code in a separate file than your route can make it difficult to consume the route itself. To help with this, TanStack Router exports a handy `getRouteApi` function that you can use to access a route's type-safe APIs in a file without importing the route itself. + +- `my-route.tsx` + +```tsx +import { createRoute } from '@tanstack/react-router' +import { MyComponent } from './MyComponent' + +const route = createRoute({ + path: '/my-route', + loader: () => ({ + foo: 'bar', + }), + component: MyComponent, +}) +``` + +- `MyComponent.tsx` + +```tsx +import { getRouteApi } from '@tanstack/react-router' + +const route = getRouteApi('/my-route') + +export function MyComponent() { + const loaderData = route.useLoaderData() + // ^? { foo: string } + + return
...
+} +``` + +The `getRouteApi` function is useful for accessing other type-safe APIs: + +- `useLoaderData` +- `useLoaderDeps` +- `useMatch` +- `useParams` +- `useRouteContext` +- `useSearch` diff --git a/docs/framework/react/guide/creating-a-router.md b/docs/framework/react/guide/creating-a-router.md new file mode 100644 index 0000000000..74140d1d74 --- /dev/null +++ b/docs/framework/react/guide/creating-a-router.md @@ -0,0 +1,106 @@ +--- +title: Creating a Router +--- + +## The `Router` Class + +When you're ready to start using your router, you'll need to create a new `Router` instance. The router instance is the core brains of TanStack Router and is responsible for managing the route tree, matching routes, and coordinating navigations and route transitions. It also serves as a place to configure router-wide settings. + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... +}) +``` + +## Route Tree + +You'll probably notice quickly that the `Router` constructor requires a `routeTree` option. This is the route tree that the router will use to match routes and render components. + +Whether you used [file-based routing](./route-trees.md) or [code-based routing](./code-based-routing.md), you'll need to pass your route tree to the `createRouter` function: + +### Filesystem Route Tree + +If you used our recommended file-based routing, then it's likely your generated route tree file was created at the default `src/routeTree.gen.ts` location. If you used a custom location, then you'll need to import your route tree from that location. + +```tsx +import { routeTree } from './routeTree.gen' +``` + +### Code-Based Route Tree + +If you used code-based routing, then you likely created your route tree manually using the root route's `addChildren` method: + +```tsx +const routeTree = rootRoute.addChildren([ + // ... +]) +``` + +## Router Type Safety + +> [!IMPORTANT] +> DO NOT SKIP THIS SECTION! ⚠️ + +TanStack Router provides amazing support for TypeScript, even for things you wouldn't expect like bare imports straight from the library! To make this possible, you must register your router's types using TypeScripts' [Declaration Merging](https://www.typescriptlang.org/docs/handbook/declaration-merging.html) feature. This is done by extending the `Register` interface on `@tanstack/react-router` with a `router` property that has the type of your `router` instance: + +```tsx +declare module '@tanstack/react-router' { + interface Register { + // This infers the type of our router and registers it across your entire project + router: typeof router + } +} +``` + +With your router registered, you'll now get type-safety across your entire project for anything related to routing. + +## Not-Found Route + +As promised in earlier guides, we'll now cover the `notFoundRoute` option. This option is used to configure a route that will render when no other suitable match is found. This is useful for rendering a 404 page or redirecting to a default route. + +### File-Based Routing + +If you used file-based routing, then you'll need to import your root route from it's location and then use the `notFoundRoute` method to create a `NotFoundRoute` instance: + +```tsx +import { NotFoundRoute } from '@tanstack/react-router' +import { Route as rootRoute } from './routes/__root.tsx' + +const notFoundRoute = new NotFoundRoute({ + getParentRoute: () => rootRoute, + component: () => '404 Not Found', +}) + +const router = createRouter({ + routeTree, + notFoundRoute, +}) +``` + +### Code-Based Routing + +If You used code-based routing, then you'll need to create a `NotFoundRoute` with a reference to your root route, then pass it to your router's `notFoundRoute` option: + +```tsx +import { NotFoundRoute } from '@tanstack/react-router' + +const rootRoute = createRootRoute() + +// ... + +const notFoundRoute = new NotFoundRoute({ + getParentRoute: () => rootRoute, + component: () => '404 Not Found', +}) + +const router = createRouter({ + routeTree, + notFoundRoute, +}) +``` + +## Other Options + +There are many other options that can be passed to the `Router` constructor. You can find a full list of them in the [API Reference](../api/router/RouterOptionsType.md). diff --git a/docs/framework/react/guide/custom-search-param-serialization.md b/docs/framework/react/guide/custom-search-param-serialization.md new file mode 100644 index 0000000000..4d6255a11c --- /dev/null +++ b/docs/framework/react/guide/custom-search-param-serialization.md @@ -0,0 +1,225 @@ +--- +title: Custom Search Param Serialization +--- + +By default, TanStack Router parses and serializes your URL Search Params automatically using `JSON.stringify` and `JSON.parse`. This process involves escaping and unescaping the search string, which is a common practice for URL search params, in addition to the serialization and deserialization of the search object. + +For instance, using the default configuration, if you have the following search object: + +```tsx +const search = { + page: 1, + sort: 'asc', + filters: { author: 'tanner', min_words: 800 }, +} +``` + +It would be serialized and escaped into the following search string: + +```txt +?page=1&sort=asc&filters=%7B%22author%22%3A%22tanner%22%2C%22min_words%22%3A800%7D +``` + +We can implement the default behavior with the following code: + +```tsx +import { + createRouter, + parseSearchWith, + stringifySearchWith, +} from '@tanstack/react-router' + +const router = createRouter({ + // ... + parseSearch: parseSearchWith(JSON.parse), + stringifySearch: stringifySearchWith(JSON.stringify), +}) +``` + +However, this default behavior may not be suitable for all use cases. For example, you may want to use a different serialization format, such as base64 encoding, or you may want to use a purpose-built serialization/deserialization library, like [query-string](https://github.com/sindresorhus/query-string), [JSURL2](https://github.com/wmertens/jsurl2), or [Zipson](https://jgranstrom.github.io/zipson/). + +This can be achieved by providing your own serialization and deserialization functions to the `parseSearch` and `stringifySearch` options in the [`Router`](../api/router/RouterOptionsType.md#stringifysearch-method) configuration. When doing this, you can utilize TanStack Router's built-in helper functions, `parseSearchWith` and `stringifySearchWith`, to simplify the process. + +> [!TIP] +> An important aspect of serialization and deserialization, is that you are able to get the same object back after deserialization. This is important because if the serialization and deserialization process is not done correctly, you may lose some information. For example, if you are using a library that does not support nested objects, you may lose the nested object when deserializing the search string. + +![Diagram showing idempotent nature of URL search param serialization and deserialization](https://raw.githubusercontent.com/TanStack/router/main/docs/assets/search-serialization-deserialization-idempotency.jpg) + +Here are some examples of how you can customize the search param serialization in TanStack Router: + +## Using Base64 + +It's common to base64 encode your search params to achieve maximum compatibility across browsers and URL unfurlers, etc. This can be done with the following code: + +```tsx +import { + Router, + parseSearchWith, + stringifySearchWith, +} from '@tanstack/react-router' + +const router = createRouter({ + parseSearch: parseSearchWith((value) => JSON.parse(decodeFromBinary(value))), + stringifySearch: stringifySearchWith((value) => + encodeToBinary(JSON.stringify(value)), + ), +}) + +function decodeFromBinary(str: string): string { + return decodeURIComponent( + Array.prototype.map + .call(atob(str), function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) + }) + .join(''), + ) +} + +function encodeToBinary(str: string): string { + return btoa( + encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + return String.fromCharCode(parseInt(p1, 16)) + }), + ) +} +``` + +> [⚠️ Why does this snippet not use atob/btoa?](#safe-binary-encodingdecoding) + +So, if we were to turn the previous object into a search string using this configuration, it would look like this: + +```txt +?page=1&sort=asc&filters=eyJhdXRob3IiOiJ0YW5uZXIiLCJtaW5fd29yZHMiOjgwMH0%3D +``` + +## Using the query-string library + +The [query-string](https://github.com/sindresorhus/query-string) library is a popular for being able to reliably parse and stringify query strings. You can use it to customize the serialization format of your search params. This can be done with the following code: + +```tsx +import { createRouter } from '@tanstack/react-router' +import qs from 'query-string' + +const router = createRouter({ + // ... + stringifySearch: stringifySearchWith((value) => + qs.stringify(value, { + // ...options + }), + ), + parseSearch: parseSearchWith((value) => + qs.parse(value, { + // ...options + }), + ), +}) +``` + +So, if we were to turn the previous object into a search string using this configuration, it would look like this: + +```txt +?page=1&sort=asc&filters=author%3Dtanner%26min_words%3D800 +``` + +## Using the JSURL2 library + +[JSURL2](https://github.com/wmertens/jsurl2) is a non-standard library that can compress URLs while still maintaining readability. This can be done with the following code: + +```tsx +import { + Router, + parseSearchWith, + stringifySearchWith, +} from '@tanstack/react-router' +import { parse, stringify } from 'jsurl2' + +const router = createRouter({ + // ... + parseSearch: parseSearchWith(parse), + stringifySearch: stringifySearchWith(stringify), +}) +``` + +So, if we were to turn the previous object into a search string using this configuration, it would look like this: + +```txt +?page=1&sort=asc&filters=(author~tanner~min*_words~800)~ +``` + +## Using the Zipson library + +[Zipson](https://jgranstrom.github.io/zipson/) is a very user-friendly and performant JSON compression library (both in runtime performance and the resulting compression performance). To compress your search params with it (which requires escaping/unescaping and base64 encoding/decoding them as well), you can use the following code: + +```tsx +import { + Router, + parseSearchWith, + stringifySearchWith, +} from '@tanstack/react-router' +import { stringify, parse } from 'zipson' + +const router = createRouter({ + parseSearch: parseSearchWith((value) => parse(decodeFromBinary(value))), + stringifySearch: stringifySearchWith((value) => + encodeToBinary(stringify(value)), + ), +}) + +function decodeFromBinary(str: string): string { + return decodeURIComponent( + Array.prototype.map + .call(atob(str), function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) + }) + .join(''), + ) +} + +function encodeToBinary(str: string): string { + return btoa( + encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + return String.fromCharCode(parseInt(p1, 16)) + }), + ) +} +``` + +> [⚠️ Why does this snippet not use atob/btoa?](#safe-binary-encodingdecoding) + +So, if we were to turn the previous object into a search string using this configuration, it would look like this: + +```txt +?page=1&sort=asc&filters=JTdCJUMyJUE4YXV0aG9yJUMyJUE4JUMyJUE4dGFubmVyJUMyJUE4JUMyJUE4bWluX3dvcmRzJUMyJUE4JUMyJUEyQ3UlN0Q%3D +``` + +
+ +### Safe Binary Encoding/Decoding + +In the browser, the `atob` and `btoa` functions are not guaranteed to work properly with non-UTF8 characters. We recommend using these encoding/decoding utilities instead: + +To encode from a string to a binary string: + +```typescript +export function encodeToBinary(str: string): string { + return btoa( + encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function (match, p1) { + return String.fromCharCode(parseInt(p1, 16)) + }), + ) +} +``` + +To decode from a binary string to a string: + +```typescript +export function decodeFromBinary(str: string): string { + return decodeURIComponent( + Array.prototype.map + .call(atob(str), function (c) { + return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2) + }) + .join(''), + ) +} +``` diff --git a/docs/framework/react/guide/data-loading.md b/docs/framework/react/guide/data-loading.md new file mode 100644 index 0000000000..24748a7e97 --- /dev/null +++ b/docs/framework/react/guide/data-loading.md @@ -0,0 +1,527 @@ +--- +id: data-loading +title: Data Loading +--- + +Data loading is a common concern for web applications and is related to routing. When loading a page for your app, it's ideal if all of the page's async requirements are fetched and fulfilled as early as possible, in parallel. The router is the best place to coordinate these async dependencies as it's usually the only place in your app that knows where users are headed before content is rendered. + +You may be familiar with `getServerSideProps` from Next.js or `loader`s from Remix/React-Router. TanStack Router has similar functionality to preload/load assets on a per-route basis in parallel allowing React to render as quickly as possible as it fetches via suspense. + +Beyond these normal expectations of a router, TanStack Router goes above and beyond and provides **built-in SWR Caching**, a long-term in-memory caching layer for route loaders. This means that you can use TanStack Router to both preload data for your routes so they load instantaneously or temporarily cache route data for previously visited routes to use again later. + +## The route loading lifecycle + +Every time a URL/history update is detected, the router executes the following sequence: + +- Route Matching (Top-Down) + - `route.params.parse` + - `route.validateSearch` +- Route Pre-Loading (Serial) + - `route.beforeLoad` + - `route.onError` + - `route.errorComponent` / `parentRoute.errorComponent` / `router.defaultErrorComponent` +- Route Loading (Parallel) + - `route.component.preload?` + - `route.loader` + - `route.pendingComponent` (Optional) + - `route.component` + - `route.onError` + - `route.errorComponent` / `parentRoute.errorComponent` / `router.defaultErrorComponent` + +## To Router Cache or not to Router Cache? + +There is a high possibility that TanStack's router cache will be a good fit for most smaller to medium size applications, but it's important to understand the tradeoffs of using it vs a more robust caching solution like TanStack Query: + +TanStack Router Cache Pros: + +- Built-in, easy to use, no extra dependencies +- Handles deduping, preloading, loading, stale-while-revalidate, background refetching on a per-route basis +- Coarse invalidation (invalidate all routes and cache at once) +- Automatic garbage collection +- Works great for apps that share little data between routes +- "Just works" for SSR + +TanStack Router Cache Cons: + +- No persistence adapters/model +- No shared caching/deduping between routes +- No built-in mutation APIs (a basic `useMutation` hook is provided in many examples that may be sufficient for many use cases) +- No built-in cache-level optimistic update APIs (you can still use ephemeral state from something like a `useMutation` hook to achieve this at the component level) + +> [!TIP] +> If you know right away that you'd like to or need to use something more robust like TanStack Query, skip to the [External Data Loading](./external-data-loading.md) guide. + +## Using the Router Cache + +The router cache is built-in and is as easy as returning data from any route's `loader` function. Let's learn how! + +## Route `loader`s + +Route `loader` functions are called when a route match is loaded. They are called with a single parameter which is an object containing many helpful properties. We'll go over those in a bit, but first, let's look at an example of a route `loader` function: + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), +}) +``` + +## `loader` Parameters + +The `loader` function receives a single object with the following properties: + +- `abortController` - The route's abortController. Its signal is cancelled when the route is unloaded or when the Route is no longer relevant and the current invocation of the `loader` function becomes outdated. +- `cause` - The cause of the current route match, either `enter` or `stay`. +- `context` - The route's context object, which is a merged union of: + - Parent route context + - This route's context as provided by the `beforeLoad` option +- `deps` - The object value returned from the `Route.loaderDeps` function. If `Route.loaderDeps` is not defined, an empty object will be provided instead. +- `location` - The current location +- `params` - The route's path params +- `parentMatchPromise` - `Promise` or `undefined` +- `preload` - Boolean which is `true` when the route is being preloaded instead of loaded +- `route` - The route itself + +Using these parameters, we can do a lot of cool things, but first, let's take a look at how we can control it and when the `loader` function is called. + +## Dependency-based Stale-While-Revalidate Caching + +TanStack Router provides a built-in Stale-While-Revalidate caching layer for route loaders that is keyed on the dependencies of a route: + +- The route's fully parsed pathname + - e.g. `/posts/1` vs `/posts/2` +- Any additional dependencies provided by the `loaderDeps` option + - e.g. `loaderDeps: ({ search: { pageIndex, pageSize } }) => ({ pageIndex, pageSize })` + +Using these dependencies as keys, TanStack Router will cache the data returned from a route's `loader` function and use it to fulfill subsequent requests for the same route match. This means that if a route's data is already in the cache, it will be returned immediately, then **potentially** be refetched in the background depending on the "freshness" of the data. + +### Key options + +To control router dependencies and "freshness", TanStack Router provides a plethora of options to control the keying and caching behavior of your route loaders. Let's take a look at them in the order that you are most likely to use them: + +- `routeOptions.loaderDeps` + - A function that supplies you the search params for a router and returns an object of dependencies for use in your `loader` function. When these deps changed from navigation to navigation, it will cause the route to reload regardless of `staleTime`s. The deps are compared using a deep equality check. +- `routeOptions.staleTime` +- `routerOptions.defaultStaleTime` + - The number of milliseconds that a route's data should be considered fresh when attempting to load. +- `routeOptions.preloadStaleTime` +- `routerOptions.defaultPreloadStaleTime` + - The number of milliseconds that a route's data should be considered fresh attempting to preload. +- `routeOptions.gcTime` +- `routerOptions.defaultGcTime` + - The number of milliseconds that a route's data should be kept in the cache before being garbage collected. +- `routeOptions.shouldReload` + - A function that receives the same `beforeLoad` and `loaderContext` parameters and returns a boolean indicating if the route should reload. This offers one more level of control over when a route should reload beyond `staleTime` and `loaderDeps` and can be used to implement patterns similar to Remix's `shouldLoad` option. + +### ⚠️ Some Important Defaults + +- By default, the `staleTime` is set to `0`, meaning that the route's data will always be considered stale and will always be reloaded in the background when the route is rematched. +- By default, a previously preloaded route is considered fresh for **30 seconds**. This means if a route is preloaded, then preloaded again within 30 seconds, the second preload will be ignored. This prevents unnecessary preloads from happening too frequently. **When a route is loaded normally, the standard `staleTime` is used.** +- By default, the `gcTime` is set to **30 minutes**, meaning that any route data that has not been accessed in 30 minutes will be garbage collected and removed from the cache. +- `router.invalidate()` will force all active routes to reload their loaders immediately and mark every cached route's data as stale. + +### Using `loaderDeps` to access search params + +Imagine a `/posts` route supports some pagination via search params `offset` and `limit`. For the cache to uniquely store this data, we need to access these search params via the `loaderDeps` function. By explicitly identifying them, each route match for `/posts` with different `offset` and `limit` won't get mixed up! + +Once we have these deps in place, the route will always reload when the deps change. + +```tsx +// /routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loaderDeps: ({ search: { offset, limit } }) => ({ offset, limit }), + loader: ({ deps: { offset, limit } }) => + fetchPosts({ + offset, + limit, + }), +}) +``` + +### Using `staleTime` to control how long data is considered fresh + +By default, `staleTime` for navigations is set to `0`ms (and 30 seconds for preloads) which means that the route's data will always be considered stale and will always be reloaded in the background when the route is matched and navigated to. + +**This is a good default for most use cases, but you may find that some route data is more static or potentially expensive to load.** In these cases, you can use the `staleTime` option to control how long the route's data is considered fresh for navigations. Let's take a look at an example: + +```tsx +// /routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + // Consider the route's data fresh for 10 seconds + staleTime: 10_000, +}) +``` + +By passing `10_000` to the `staleTime` option, we are telling the router to consider the route's data fresh for 10 seconds. This means that if the user navigates to `/posts` from `/about` within 10 seconds of the last loader result, the route's data will not be reloaded. If the user then navigates to `/posts` from `/about` after 10 seconds, the route's data will be reloaded **in the background**. + +## Turning off stale-while-revalidate caching + +To disable stale-while-revalidate caching for a route, set the `staleTime` option to `Infinity`: + +```tsx +// /routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + staleTime: Infinity, +}) +``` + +You can even turn this off for all routes by setting the `defaultStaleTime` option on the router: + +```tsx +const router = createRouter({ + routeTree, + defaultStaleTime: Infinity, +}) +``` + +## Using `shouldReload` and `gcTime` to opt-out of caching + +Similar to Remix's default functionality, you may want to configure a route to only load on entry or when critical loader deps change. You can do this by using the `gcTime` option combined with the `shouldReload` option, which accepts either a `boolean` or a function that receives the same `beforeLoad` and `loaderContext` parameters and returns a boolean indicating if the route should reload. + +```tsx +// /routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loaderDeps: ({ search: { offset, limit } }) => ({ offset, limit }), + loader: ({ deps }) => fetchPosts(deps), + // Do not cache this route's data after it's unloaded + gcTime: 0, + // Only reload the route when the user navigates to it or when deps change + shouldReload: false, +}) +``` + +### Opting out of caching while still preloading + +Even though you may opt-out of short-term caching for your route data, you can still get the benefits of preloading! With the above configuration, preloading will still "just work" with the default `preloadGcTime`. This means that if a route is preloaded, then navigated to, the route's data will be considered fresh and will not be reloaded. + +To opt out of preloading, don't turn it on via the `routerOptions.defaultPreload` or `routeOptions.preload` options. + +## Passing all loader events to an external cache + +We break down this use case in the [External Data Loading](./external-data-loading.md) page, but if you'd like to use an external cache like TanStack Query, you can do so by passing all loader events to your external cache. As long as you are using the defaults, the only change you'll need to make is to set the `defaultPreloadStaleTime` option on the router to `0`: + +```tsx +const router = createRouter({ + routeTree, + defaultPreloadStaleTime: 0, +}) +``` + +This will ensure that every preload, load, and reload event will trigger your `loader` functions, which can then be handled and deduped by your external cache. + +## Using Router Context + +The `context` argument passed to the `loader` function is an object containing a merged union of: + +- Parent route context +- This route's context as provided by the `beforeLoad` option + +Starting at the very top of the router, you can pass an initial context to the router via the `context` option. This context will be available to all routes in the router and get copied and extended by each route as they are matched. This happens by passing a context to a route via the `beforeLoad` option. This context will be available to all the route's child routes. The resulting context will be available to the route's `loader` function. + +In this example, we'll create a function in our route context to fetch posts, then use it in our `loader` function. + +> 🧠 Context is a powerful tool for dependency injection. You can use it to inject services, hooks, and other objects into your router and routes. You can also additively pass data down the route tree at every route using a route's `beforeLoad` option. + +- `/utils/fetchPosts.tsx` + +```tsx +export const fetchPosts = async () => { + const res = await fetch(`/api/posts?page=${pageIndex}`) + if (!res.ok) throw new Error('Failed to fetch posts') + return res.json() +} +``` + +- `/routes/__root.tsx` + +```tsx +import { createRootRouteWithContext } from '@tanstack/react-router' + +// Create a root route using the createRootRouteWithContext<{...}>() function and pass it whatever types you would like to be available in your router context. +export const Route = createRootRouteWithContext<{ + fetchPosts: typeof fetchPosts +}>()() // NOTE: the double call is on purpose, since createRootRouteWithContext is a factory ;) +``` + +- `/routes/posts.tsx` + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +// Notice how our postsRoute references context to get our fetchPosts function +// This can be a powerful tool for dependency injection across your router +// and routes. +export const Route = createFileRoute('/posts')({ + loader: ({ context: { fetchPosts } }) => fetchPosts(), +}) +``` + +- `/router.tsx` + +```tsx +import { routeTree } from './routeTree.gen' + +// Use your routerContext to create a new router +// This will require that you fullfil the type requirements of the routerContext +const router = createRouter({ + routeTree, + context: { + // Supply the fetchPosts function to the router context + fetchPosts, + }, +}) +``` + +## Using Path Params + +To use path params in your `loader` function, access them via the `params` property on the function's parameters. Here's an example: + +```tsx +// routes/posts.$postId.tsx +export const Route = createFileRoute('/posts/$postId')({ + loader: ({ params: { postId } }) => fetchPostById(postId), +}) +``` + +## Using Route Context + +Passing down global context to your router is great, but what if you want to provide context that is specific to a route? This is where the `beforeLoad` option comes in. The `beforeLoad` option is a function that runs right before attempting to load a route and receives the same parameters as `loader`. Beyond its ability to redirect potential matches, block loader requests, etc, it can also return an object that will be merged into the route's context. Let's take a look at an example where we inject some data into our route context via the `beforeLoad` option: + +```tsx +// /routes/posts.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + // Pass the fetchPosts function to the route context + beforeLoad: () => ({ + fetchPosts: () => console.info('foo'), + }), + loader: ({ context: { fetchPosts } }) => { + console.info(fetchPosts()) // 'foo' + + // ... + }, +}) +``` + +## Using Search Params in Loaders + +> ❓ But wait Tanner... where the heck are my search params?! + +You might be here wondering why `search` isn't directly available in the `loader` function's parameters. We've purposefully designed it this way to help you succeed. Let's take a look at why: + +- Search Parameters being used in a loader function are a very good indicator that those search params should also be used to uniquely identify the data being loaded. For example, you may have a route that uses a search param like `pageIndex` that uniquely identifies the data held inside of the route match. Or, imagine a `/users/user` route that uses the search param `userId` to identify a specific user in your application, you might model your url like this: `/users/user?userId=123`. This means that your `user` route would need some extra help to identify a specific user. +- Directly accessing search params in a loader function can lead to bugs in caching and preloading where the data being loaded is not unique to the current URL pathname and search params. For example, you might ask your `/posts` route to preload page 2's results, but without the distinction of pages in your route configuration, you will end up fetching, storing and displaying page 2's data on your `/posts` or `?page=1` screen instead of it preloading in the background! +- Placing a threshold between search parameters and the loader function allows the router to understand your dependencies and reactivity. + +```tsx +// /routes/users.user.tsx +export const Route = createFileRoute('/users/user')({ + validateSearch: (search) => + search as { + userId: string + }, + loaderDeps: ({ search: { userId } }) => ({ + userId, + }), + loader: async ({ deps: { userId } }) => getUser(userId), +}) +``` + +### Accessing Search Params via `routeOptions.loaderDeps` + +```tsx +// /routes/posts.tsx +export const Route = createFileRoute('/posts')({ + // Use zod to validate and parse the search params + validateSearch: z.object({ + offset: z.number().int().nonnegative().catch(0), + }), + // Pass the offset to your loader deps via the loaderDeps function + loaderDeps: ({ search: { offset } }) => ({ offset }), + // Use the offset from context in the loader function + loader: async ({ deps: { offset } }) => + fetchPosts({ + offset, + }), +}) +``` + +## Using the Abort Signal + +The `abortController` property of the `loader` function is an [AbortController](https://developer.mozilla.org/en-US/docs/Web/API/AbortController). Its signal is cancelled when the route is unloaded or when the `loader` call becomes outdated. This is useful for cancelling network requests when the route is unloaded or when the route's params change. Here is an example using it with a fetch call: + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: ({ abortController }) => + fetchPosts({ + // Pass this to an underlying fetch call or anything that supports signals + signal: abortController.signal, + }), +}) +``` + +## Using the `preload` flag + +The `preload` property of the `loader` function is a boolean which is `true` when the route is being preloaded instead of loaded. Some data loading libraries may handle preloading differently than a standard fetch, so you may want to pass `preload` to your data loading library, or use it to execute the appropriate data loading logic: + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: async ({ preload }) => + fetchPosts({ + maxAge: preload ? 10_000 : 0, // Preloads should hang around a bit longer + }), +}) +``` + +## Handling Slow Loaders + +Ideally most route loaders can resolve their data within a short moment, removing the need to render a placeholder spinner and simply rely on suspense to render the next route when it's completely ready. When critical data that is required to render a route's component is slow though, you have 2 options: + +- Split up your fast and slow data into separate promises and `defer` the slow data until after the fast data is loaded (see the [Deferred Data Loading](./deferred-data-loading.md) guide). +- Show a pending component after an optimistic suspense threshold until all of the data is ready (See below). + +## Showing a pending component + +**By default, TanStack Router will show a pending component for loaders that take longer than 1 second to resolve.** This is an optimistic threshold that can be configured via: + +- `routeOptions.pendingMs` or +- `routerOptions.defaultPendingMs` + +When the pending time threshold is exceeded, the router will render the `pendingComponent` option of the route, if configured. + +## Avoiding Pending Component Flash + +If you're using a pending component, the last thing you want is for your pending time threshold to be met, then have your data resolve immediately after, resulting in a jarring flash of your pending component. To avoid this, **TanStack Router by default will show your pending component for at least 500ms**. This is an optimistic threshold that can be configured via: + +- `routeOptions.pendingMinMs` or +- `routerOptions.defaultPendingMinMs` + +## Handling Errors + +TanStack Router provides a few ways to handle errors that occur during the route loading lifecycle. Let's take a look at them. + +### Handling Errors with `routeOptions.onError` + +The `routeOptions.onError` option is a function that is called when an error occurs during the route loading. + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + onError: ({ error }) => { + // Log the error + console.error(error) + }, +}) +``` + +### Handling Errors with `routeOptions.onCatch` + +The `routeOptions.onCatch` option is a function that is called whenever an error was caught by the router's CatchBoundary. + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + onCatch: ({ error, errorInfo }) => { + // Log the error + console.error(error) + }, +}) +``` + +### Handling Errors with `routeOptions.errorComponent` + +The `routeOptions.errorComponent` option is a component that is rendered when an error occurs during the route loading or rendering lifecycle. It is rendered with the following props: + +- `error` - The error that occurred +- `reset` - A function to reset the internal `CatchBoundary` + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + errorComponent: ({ error }) => { + // Render an error message + return
{error.message}
+ }, +}) +``` + +The `reset` function can be used to allow the user to retry rendering the error boundaries normal children: + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + errorComponent: ({ error, reset }) => { + const router = useRouter() + + return ( +
+ {error.message} + +
+ ) + }, +}) +``` + +If the error was the result of a route load, you should instead call `router.invalidate()`, which will coordinate both a router reload and an error boundary reset: + +```tsx +// routes/posts.tsx +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + errorComponent: ({ error, reset }) => { + const router = useRouter() + + return ( +
+ {error.message} + +
+ ) + }, +}) +``` + +### Using the default `ErrorComponent` + +TanStack Router provides a default `ErrorComponent` that is rendered when an error occurs during the route loading or rendering lifecycle. If you choose to override your routes' error components, it's still wise to always fall back to rendering any uncaught errors with the default `ErrorComponent`: + +```tsx +// routes/posts.tsx +import { createFileRoute, ErrorComponent } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + loader: () => fetchPosts(), + errorComponent: ({ error }) => { + if (error instanceof MyCustomError) { + // Render a custom error message + return
{error.message}
+ } + + // Fallback to the default ErrorComponent + return + }, +}) +``` diff --git a/docs/router/guide/data-mutations.md b/docs/framework/react/guide/data-mutations.md similarity index 76% rename from docs/router/guide/data-mutations.md rename to docs/framework/react/guide/data-mutations.md index 5fddfffdea..7277cff882 100644 --- a/docs/router/guide/data-mutations.md +++ b/docs/framework/react/guide/data-mutations.md @@ -2,11 +2,7 @@ title: Data Mutations --- -TanStack Router caches route loader data, but it does not manage mutation or -submission state. Its role in mutation workflows is primarily invalidating -loader data and reacting to potential URL side effects from external mutation -events. That said, we've compiled a list of mutation-related features you might -find useful and libraries that implement them. +Since TanStack router does not store or cache data, it's role in data mutation is slim to none outside of reacting to potential URL side-effects from external mutation events. That said, we've compiled a list of mutation-related features you might find useful and libraries that implement them. Look for and use mutation utilities that support: @@ -17,8 +13,6 @@ Look for and use mutation utilities that support: - Organizing mutation state as a globally accessible resource - Submission state history and garbage collection -Some suggested libraries: - - [TanStack Query](https://tanstack.com/query/latest/docs/react/guides/mutations) - [SWR](https://swr.vercel.app/) - [RTK Query](https://redux-toolkit.js.org/rtk-query/overview) @@ -39,14 +33,9 @@ Similar to data fetching, mutation state isn't a one-size-fits-all solution, so ## Invalidating TanStack Router after a mutation -TanStack Router comes with short-term caching built in. Loader data can remain -cached after a route match is unmounted, so a mutation can make both active and -cached route data stale. +TanStack Router comes with short-term caching built-in. So even though we're not storing any data after a route match is unmounted, there is a high probability that if any mutations are made related to the data stored in the Router, the current route matches' data could become stale. -When mutations related to loader data are made, we can use `router.invalidate` -to invalidate committed, cached, and in-flight loader generations. Matching -active preload lanes are retired, and selected current active matches reload -through the normal loading protocol: +When mutations related to loader data are made, we can use `router.invalidate` to force the router to reload all of the current route matches: ```tsx const router = useRouter() @@ -61,24 +50,7 @@ const addTodo = async (todo: Todo) => { } ``` -By default, stale successful loader data revalidates in the background, so -existing data remains visible until the new data is ready. Cached inactive -matches remain marked stale and reload when they are reused. - -If you want to await the invalidation until all loaders have finished, pass `{sync: true}` into `router.invalidate`: - -```tsx -const router = useRouter() - -const addTodo = async (todo: Todo) => { - try { - await api.addTodo() - await router.invalidate({ sync: true }) - } catch { - // - } -} -``` +Invalidating all of the current route matches happens in the background, so existing data will continue to be served until the new data is ready, just as if you were navigating to a new route. ## Long-term mutation State @@ -98,9 +70,9 @@ Without notifying your mutation management library about the route change, it's Hopefully and hypothetically, the easiest way is for your mutation library to support a keying mechanism that will allow your mutations's state to be reset when the key changes: ```tsx -const routeApi = getRouteApi('/room/$roomId/chat') +const routeApi = getRouteApi('/posts/$postId/edit') -function ChatRoom() { +function EditPost() { const { roomId } = routeApi.useParams() const sendMessageMutation = useCoolMutation({ @@ -134,8 +106,6 @@ function ChatRoom() { ## Using the `router.subscribe` method -See the [Router Events guide](./router-events.md) for a more complete walkthrough of the available events and when to use them. - For libraries that don't have a keying mechanism, we'll likely need to manually reset the mutation state when the user navigates away from the screen. To solve this, we can use TanStack Router's `invalidate` and `subscribe` method to clear mutation states when the user is no longer in need of them. The `router.subscribe` method is a function that subscribes a callback to various router events. The event in particular that we'll use here is the `onResolved` event. It's important to understand that this event is fired when the location path is _changed (not just reloaded) and has finally resolved_. diff --git a/docs/framework/react/guide/deferred-data-loading.md b/docs/framework/react/guide/deferred-data-loading.md new file mode 100644 index 0000000000..3fefc2d7a1 --- /dev/null +++ b/docs/framework/react/guide/deferred-data-loading.md @@ -0,0 +1,100 @@ +--- +id: deferred-data-loading +title: Deferred Data Loading +--- + +TanStack Router is designed to run loaders in parallel and wait for all of them to resolve before rendering the next route. This is great most of the time, but occasionally, you may want to show the user something sooner while the rest of the data loads in the background. + +Deferred data loading is a pattern that allows the router to render the next location's critical data/markup while slower, non-critical route data is resolved in the background. This process works on both the client and server (via streaming) and is a great way to improve the perceived performance of your application. + +## Deferred Data Loading with `defer` and `Await` + +To defer slow or non-critical data, wrap an **unawaited/unresolved** promise in the `defer` function and return it anywhere in your loader response: + +```tsx +// src/routes/posts.$postId.tsx + +import * as React from 'react' +import { createFileRoute, defer } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/$postId')({ + loader: async () => { + // Fetch some slower data, but do not await it + const slowDataPromise = fetchSlowData() + + // Fetch and await some data that resolves quickly + const fastData = await fetchFastData() + + return { + fastData, + // Wrap the slow promise in `defer()` + deferredSlowData: defer(slowDataPromise), + } + }, +}) +``` + +As soon as any awaited promises are resolved, the next route will begin rendering while the deferred promises continue to resolve. + +In the component, deferred promises can be resolved and utilized using the `Await` component: + +```tsx +// src/routes/posts.$postId.tsx + +import * as React from 'react' +import { createFileRoute, Await } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/$postId')({ + // ... + component: PostIdComponent, +}) + +function PostIdComponent() { + const { deferredSlowData } = Route.useLoaderData() + + return ( + Loading...}> + + {(data) => { + return
{data}
+ }} +
+
+ ) +} +``` + +> [!TIP] +> If your component is code-split, you can use the [getRouteApi function](./code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-routeapi-class) to avoid having to import the `Route` configuration to get access to the typed `useLoaderData()` hook. + +The `Await` component resolves the promise by triggering the nearest suspense boundary until it is resolved, after which it renders the component's `children` as a function with the resolved data. + +If the promise is rejected, the `Await` component will throw the serialized error, which can be caught by the nearest error boundary. + +## Caching and Invalidation + +Streamed promises follow the same lifecycle as the loader data they are associated with. They can even be preloaded! + +## SSR & Streaming Deferred Data + +**Streaming requires a server that supports it and for TanStack Router to be configured to use it properly.** + +Please read the entire [SSR Guide](/docs/guide/server-streaming) for step by step instructions on how to set up your server for streaming. + +## SSR Streaming Lifecycle + +The following is a high-level overview of how deferred data streaming works with TanStack Router: + +- Server + - Promises wrapped in `defer()` are marked and tracked as they are returned from route loaders + - All loaders resolve and any deferred promises are serialized and embedded into the html + - The route begins to render + - Deferred promises rendered with the `` component trigger suspense boundaries, allowing the server to stream html up to that point +- Client + - The client receives the initial html from the server + - `` components suspend with placeholder promises while they wait for their data to resolve on the server +- Server + - As deferred promises resolve, their results (or errors) are serialized and streamed to the client via an inline script tag + - The resolved `` components and their suspense boundaries are resolved and their resulting HTML is streamed to the client along with their dehydrated data +- Client + - The suspended placeholder promises within `` are resolved with the streamed data/error responses and either render the result or throw the error to the nearest error boundary diff --git a/docs/router/guide/external-data-loading.md b/docs/framework/react/guide/external-data-loading.md similarity index 79% rename from docs/router/guide/external-data-loading.md rename to docs/framework/react/guide/external-data-loading.md index 4ffb318686..4f29532248 100644 --- a/docs/router/guide/external-data-loading.md +++ b/docs/framework/react/guide/external-data-loading.md @@ -6,8 +6,6 @@ title: External Data Loading > [!IMPORTANT] > This guide is geared towards external state management libraries and their integration with TanStack Router for data fetching, ssr, hydration/dehydration and streaming. If you haven't read the standard [Data Loading](./data-loading.md) guide, please do so first. -Router can coordinate loaders and an existing API without Start. If you also want an integrated server runtime and typed server functions for your React application, follow [TanStack Query with Start](/start/latest/docs/framework/react/guide/tanstack-query) for request-scoped SSR, hydration, and mutation invalidation with a tested example. - ## To **Store** or to **Coordinate**? While Router is very capable of storing and managing most data needs out of the box, sometimes you just might want something more robust! @@ -36,18 +34,19 @@ Literally any library that **can return a promise and read/write data** can be i ## Using Loaders to ensure data is loaded -The easiest way to integrate external caching/data library into Router is to use `route.loader`s to ensure that the data required inside of a route has been loaded and is ready to be displayed. +The easiest way to use integrate and external caching/data library into Router is to use `route.loader`s to ensure that the data required inside of a route has been loaded and is ready to be displayed. > ⚠️ BUT WHY? It's very important to preload your critical render data in the loader for a few reasons: > > - No "flash of loading" states > - No waterfall data fetching, caused by component based fetching -> - Better for SEO. If your data is available at render time, it will be indexed by search engines. +> - Better for SEO. If you data is available at render time, it will be indexed by search engines. Here is a naive illustration (don't do this) of using a Route's `loader` option to seed the cache for some data: ```tsx // src/routes/posts.tsx + let postsCache = [] export const Route = createFileRoute('/posts')({ @@ -77,6 +76,7 @@ Let's take a look at a more realistic example using TanStack Query. ```tsx // src/routes/posts.tsx + const postsQueryOptions = queryOptions({ queryKey: ['posts'], queryFn: () => fetchPosts(), @@ -84,8 +84,7 @@ const postsQueryOptions = queryOptions({ export const Route = createFileRoute('/posts')({ // Use the `loader` option to ensure that the data is loaded - loader: () => - queryClient.query({ ...postsQueryOptions, staleTime: 'static' }), + loader: () => queryClient.ensureQueryData(postsQueryOptions), component: () => { // Read the data from the cache and subscribe to updates const { @@ -105,24 +104,23 @@ export const Route = createFileRoute('/posts')({ ### Error handling with TanStack Query -When an error occurs while using `suspense` with `TanStack Query`, you need to let queries know that you want to try again when re-rendering. This can be done by using the `reset` function provided by the `useQueryErrorResetBoundary` hook. You can invoke this function in an effect as soon as the error component mounts. This will make sure that the query is reset and will try to fetch data again when the route component is rendered again. This will also cover cases where users navigate away from the route instead of clicking the `retry` button. +When an error occurs while using `suspense` with `Tanstack Query`, you'll need to let queries know that you want to try again when re-rendering. This can be done by using the `reset` function provided by the `useQueryErrorResetBoundary` hook. We can invoke this function in an effect as soon as the error component mounts. This will make sure that the query is reset and will try to fetch data again when the route component is rendered again. This will also cover cases where users navigate away from our route instead of clicking the `retry` button. ```tsx -export const Route = createFileRoute('/')({ - loader: () => - queryClient.query({ ...postsQueryOptions, staleTime: 'static' }), +export const Route = createFileRoute('/posts')({ + loader: () => queryClient.ensureQueryData(postsQueryOptions), errorComponent: ({ error, reset }) => { const router = useRouter() const queryErrorResetBoundary = useQueryErrorResetBoundary() - useEffect(() => { + React.useEffect(() => { // Reset the query error boundary queryErrorResetBoundary.reset() }, [queryErrorResetBoundary]) return (
- {error instanceof Error ? error.message : String(error)} + {error.message} + +
+ )} + +} +``` + +### Component-based custom UI + +Similarly to the hook, the `Block` component returns the same state and functions as render props: + +```tsx +import { Block } from '@tanstack/react-router' + +function MyComponent() { + const [formIsDirty, setFormIsDirty] = useState(false) + + return ( + + {({ status, proceed, reset }) => ( + <> + {/* ... */} + {status === 'blocked' && ( +
+

Are you sure you want to leave?

+ + +
+ )} + + )} +
+ ) +} +``` diff --git a/docs/framework/react/guide/navigation.md b/docs/framework/react/guide/navigation.md new file mode 100644 index 0000000000..a493604ccf --- /dev/null +++ b/docs/framework/react/guide/navigation.md @@ -0,0 +1,486 @@ +--- +title: Navigation +--- + +## Everything is Relative + +Believe it or not, every navigation within an app is **relative**, even if you aren't using explicit relative path syntax (`../../somewhere`). Any time a link is clicked or an imperative navigation call is made, you will always have an **origin** path and a **destination** path which means you are navigating **from** one route **to** another route. + +TanStack Router keeps this constant concept of relative navigation in mind for every navigation, so you'll constantly see two properties in the API: + +- `from` - The origin route ID +- `to` - The destination route ID + +> ⚠️ If a `from` route ID isn't provided the router will assume you are navigating from the root `/` route and only auto-complete absolute paths. After all, you need to know where you are from in order to know where you're going 😉. + +## Shared Navigation API + +Every navigation and route matching API in TanStack Router uses the same core interface with minor differences depending on the API. This means that you can learn navigation and route matching once and use the same syntax and concepts across the library. + +### `ToOptions` Interface + +This is the core `ToOptions` interface that is used in every navigation and route matching API: + +```ts +type ToOptions< + TRouteTree extends AnyRoute = AnyRoute, + TFrom extends RoutePaths | string = string, + TTo extends string = '', +> = { + // `from` is an optional route ID or path. If it is not supplied, only absolute paths will be auto-completed and type-safe. It's common to supply the route.fullPath of the origin route you are rendering from for convenience. If you don't know the origin route, leave this empty and work with absolute paths or unsafe relative paths. + from: string + // `to` can be an absolute route path or a relative path from the `from` option to a valid route path. ⚠️ Do not interpolate path params, hash or search params into the `to` options. Use the `params`, `search`, and `hash` options instead. + to: string + // `params` is either an object of path params to interpolate into the `to` option or a function that supplies the previous params and allows you to return new ones. This is the only way to interpolate dynamic parameters into the final URL. Depending on the `from` and `to` route, you may need to supply none, some or all of the path params. TypeScript will notify you of the required params if there are any. + params: + | Record + | ((prevParams: Record) => Record) + // `search` is either an object of query params or a function that supplies the previous search and allows you to return new ones. Depending on the `from` and `to` route, you may need to supply none, some or all of the query params. TypeScript will notify you of the required search params if there are any. + search: + | Record + | ((prevSearch: Record) => Record) + // `hash` is either a string or a function that supplies the previous hash and allows you to return a new one. + hash?: string | ((prevHash: string) => string) + // `state` is either an object of state or a function that supplies the previous state and allows you to return a new one. State is stored in the history API and can be useful for passing data between routes that you do not want to permanently store in URL search params. + state?: + | Record + | ((prevState: Record) => Record) +} +``` + +> 🧠 Every route object has a `to` property, which can be used as the `to` for any navigation or route matching API. Where possible, this will allow you to avoid plain strings and use type-safe route references instead: + +```tsx +function Comp() { + return About +} +``` + +### `NavigateOptions` Interface + +This is the core `NavigateOptions` interface that extends `ToOptions`. Any API that is actually performing a navigation will use this interface: + +```ts +export type NavigateOptions< + TRouteTree extends AnyRoute = AnyRoute, + TFrom extends RoutePaths | string = string, + TTo extends string = '', +> = ToOptions & { + // `replace` is a boolean that determines whether the navigation should replace the current history entry or push a new one. + replace?: boolean +} +``` + +### `LinkOptions` Interface + +Anywhere an actual `
` tag the `LinkOptions` interface which extends `NavigateOptions` will be available: + +```tsx +export type LinkOptions< + TRouteTree extends AnyRoute = AnyRoute, + TFrom extends RoutePaths | string = string, + TTo extends string = '', +> = NavigateOptions & { + // The standard anchor tag target attribute + target?: HTMLAnchorElement['target'] + // Defaults to `{ exact: false, includeHash: false }` + activeOptions?: { + exact?: boolean + includeHash?: boolean + includeSearch?: boolean + } + // If set, will preload the linked route on hover and cache it for this many milliseconds in hopes that the user will eventually navigate there. + preload?: false | 'intent' + // Delay intent preloading by this many milliseconds. If the intent exits before this delay, the preload will be cancelled. + preloadDelay?: number + // If true, will render the link without the href attribute + disabled?: boolean +} +``` + +## Navigation API + +With relative navigation and all of the interfaces in mind now, let's talk about the different flavors of navigation API at your disposal: + +- The `` component + - Generates an actual `` tag with a valid `href` which can be click or even cmd/ctrl + clicked to open in a new tab +- The `useNavigate()` hook + - When possible, `Link` component should be used for navigation, but sometimes you need to navigate imperatively as a result of a side-effect. `useNavigate` returns a function that can be called to perform an immediate client-side navigation. +- The `` component + - Renders nothing and performs an immediate client-side navigation. +- The `Router.navigate()` method + - This is the most powerful navigation API in TanStack Router. Similar to `useNavigate`, it imperatively navigates, but is available everywhere you have access to your router. + +⚠️ None of these APIs are a replacement for server-side redirects. If you need to redirect a user immediately from one route to another before mounting your application, use a server-side redirect instead of a client-side navigation. + +## `` Component + +The `Link` component is the most common way to navigate within an app. It renders an actual `` tag with a valid `href` attribute which can be clicked or even cmd/ctrl + clicked to open in a new tab. It also supports any normal `` attributes including `target` to open links in new windows, etc. + +In addition to the [`LinkOptions`](#linkoptions-interface) interface, the `Link` component also supports the following props: + +```tsx +export type LinkProps< + TFrom extends RoutePaths | string = string, + TTo extends string = '', +> = LinkOptions & { + // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated) + activeProps?: + | React.AnchorHTMLAttributes + | (() => React.AnchorHTMLAttributes) + // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated) + inactiveProps?: + | React.AnchorHTMLAttributes + | (() => React.AnchorHTMLAttributes) +} +``` + +### Absolute Links + +Let's make a simple static link! + +```tsx +import { Link } from '@tanstack/react-router' + +const link = About +``` + +### Dynamic Links + +Dynamic links are links that have dynamic segments in them. For example, a link to a blog post might look like this: + +```tsx +const link = ( + + Blog Post + +) +``` + +Keep in mind that normally dynamic segment params are `string` values, but they can also be any other type that you parse them to in your route options. Either way, the type will be checked at compile time to ensure that you are passing the correct type. + +### Relative Links + +By default, all links are absolute unless a `from` route path is provided. This means that the above link will always navigate to the `/about` route regardless of what route you are currently on. + +If you want to make a link that is relative to the current route, you can provide a `from` route path: + +```tsx +const postIdRoute = createRoute({ + path: '/blog/post/$postId', +}) + +const link = ( + + Categories + +) +``` + +As seen above, it's common to provide the `route.fullPath` as the `from` route path. This is because the `route.fullPath` is a reference that will update if you refactor your application. However, sometimes it's not possible to import the route directly, in which case it's fine to provide the route path directly as a string. It will still get type-checked as per usual! + +### Search Param Links + +Search params are a great way to provide additional context to a route. For example, you might want to provide a search query to a search page: + +```tsx +const link = ( + + Search + +) +``` + +It's also common to want to update a single search param without supplying any other information about the existing route. For example, you might want to update the page number of a search result: + +```tsx +const link = ( + ({ + ...prev, + page: prev.page + 1, + })} + > + Next Page + +) +``` + +> 🧠 Did you notice that how we didn't even need to supply a `to` prop? By default, all navigations are relative to the current route, so if you don't supply a `to` prop, it will just update the current route's search params. + +### Search Param Type Safety + +Search params are a highly dynamic state management mechanism, so it's important to ensure that you are passing the correct types to your search params. We'll see in a later section in detail how to validate and ensure search params typesafety, among other great features! + +### Hash Links + +Hash links are a great way to link to a specific section of a page. For example, you might want to link to a specific section of a blog post: + +```tsx +const link = ( + + Section 1 + +) +``` + +### Active & Inactive Props + +The `Link` component supports two additional props: `activeProps` and `inactiveProps`. These props are functions that return additional props for the `active` and `inactive` states of the link. All props other than styles and classes passed here will override the original props passed to `Link`. Any styles or classes passed are merged together. + +Here's an example: + +```tsx +const link = ( + + Section 1 + +) +``` + +### The `data-status` attribute + +In addition to the `activeProps` and `inactiveProps` props, the `Link` component also adds a `data-status` attribute to the rendered element when it is in an active state. This attribute will be `active` or `undefined` depending on the current state of the link. This can come in handy if you prefer to use data-attributes to style your links instead of props. + +### Active Options + +The `Link` component comes with an `activeOptions` property that offers a few options of determining if a link is active or not. The following interface describes those options: + +```tsx +export interface ActiveOptions { + // If true, the link will be active if the current route matches the `to` route path exactly (no children routes) + // Defaults to `false` + exact?: boolean + // If true, the link will only be active if the current URL hash matches the `hash` prop + // Defaults to `false` + includeHash?: boolean // Defaults to false + // If true, the link will only be active if the current URL search params inclusively match the `search` prop + // Defaults to `true` + includeSearch?: boolean +} +``` + +By default, it will check if the resulting **pathname** is a prefix of the current route. If any search params are provided, it will check that they _inclusively_ match those in the current location. Hashes are not checked by default. + +For example, if you are on the `/blog/post/my-first-blog-post` route, the following links will be active: + +```tsx +const link1 = ( + + Blog Post + +) +const link2 = Blog Post +const link3 = Blog Post +``` + +However, the following links will not be active: + +```tsx +const link4 = ( + + Blog Post + +) +``` + +It's common for some links to only be active if they are an exact match. A good example of this would be a link to the home page. In scenarios like these, you can pass the `exact: true` option: + +```tsx +const link = ( + + Home + +) +``` + +This will ensure that the link is not active when you are a child route. + +A few more options to be aware of: + +- If you want to include the hash in your matching, you can pass the `includeHash: true` option +- If you do **not** want to include the search params in your matching, you can pass the `includeSearch: false` option + +### Passing `isActive` to children + +The `Link` component accepts a function for its children, allowing you to propagate its `isActive` property to children. For example, you could style a child component based on whether the parent link is active: + +```tsx +const link = ( + + {({ isActive }) => { + return ( + <> + My Blog Post + + + ) + }} + +) +``` + +### Link Preloading + +The `Link` component supports automatically preloading routes on intent (hovering or touchstart for now). This can be configured as a default in the router options (which we'll talk more about soon) or by passing a `preload='intent'` prop to the `Link` component. Here's an example: + +```tsx +const link = ( + + Blog Post + +) +``` + +With preloading enabled and relatively quick asynchronous route dependencies (if any), this simple trick can increase the perceived performance of your application with very little effort. + +What's even better is that by using a cache-first library like `@tanstack/query`, preloaded routes will stick around and be ready for a stale-while-revalidate experience if the user decides to navigate to the route later on. + +### Link Preloading Timeout + +Along with preloading is a configurable timeout which determines how long a user must hover over a link to trigger the intent-based preloading. The default timeout is 50 milliseconds, but you can change this by passing a `preloadTimeout` prop to the `Link` component with the number of milliseconds you'd like to wait: + +```tsx +const link = ( + + Blog Post + +) +``` + +## `useNavigate` + +> ⚠️ Because of the `Link` component's built-in affordances around `href`, cmd/ctrl + click-ability, and active/inactive capabilities, it's recommended to use the `Link` component instead of `useNavigate` for anything the user can interact with (e.g. links, buttons). However, there are some cases where `useNavigate` is necessary to handle side-effect navigations (e.g. a successful async action that results in a navigation). + +The `useNavigate` hook returns a `navigate` function that can be called to imperatively navigate. It's a great way to navigate to a route from a side-effect (e.g. a successful async action). Here's an example: + +```tsx +function Component() { + const navigate = useNavigate({ from: '/posts/$postId' }) + + const handleSubmit = async (e: React.FormEvent) => { + e.preventDefault() + + const response = await fetch('/posts', { + method: 'POST', + body: JSON.stringify({ title: 'My First Post' }), + }) + + const { id: postId } = await response.json() + + if (response.ok) { + navigate({ to: '/posts/$postId', params: { postId } }) + } + } +} +``` + +> 🧠 As shown above, you can pass the `from` option to specify the route to navigate from in the hook call. While this is also possible to pass in the resulting `navigate` function each time you call it, it's recommended to pass it here to reduce on potential error and also not type as much! + +### `navigate` Options + +The `navigate` function returned by `useNavigate` accepts the [`NavigateOptions` interface](#navigateoptions-interface) + +## `Navigate` Component + +Occasionally, you may find yourself needing to navigate immediately when a component mounts. Your first instinct might be to reach for `useNavigate` and an immediate side-effect (e.g. React.useEffect), but this is unnecessary. Instead, you can render the `Navigate` component to achieve the same result: + +```tsx +function Component() { + return +} +``` + +Think of the `Navigate` component as a way to navigate to a route immediately when a component mounts. It's a great way to handle client-only redirects. It is _definitely not_ a substitute for handling server-aware redirects responsibly on the server. + +## `router.navigate` + +The `router.navigate` method is the same as the `navigate` function returned by `useNavigate` and accepts the same [`NavigateOptions` interface](#navigateoptions-interface). Unlike the `useNavigate` hook, it is available anywhere your `router` instance is available and is thus a great way to navigate imperatively from anywhere in your application, including outside of your framework. + +## `useMatchRoute` and `` + +The `useMatchRoute` hook and `` component are the same thing, but the hook is a bit more flexible. They both accept the standard navigation `ToOptions` interface either as options or props and return `true/false` if that route is currently matched. It also has a handy `pending` option that will return `true` if the route is currently pending (e.g. a route is currently transitioning to that route). This can be extremely useful for showing optimistic UI around where a user is navigating: + +```tsx +function Component() { + return ( +
+ + Users + + + + +
+ ) +} +``` + +The component version `` can also be used with a function as children to render something when the route is matched: + +```tsx +function Component() { + return ( +
+ + Users + + {(match) => { + return + }} + + +
+ ) +} +``` + +The hook version `useMatchRoute` returns a function that can be called programmatically to check if a route is matched: + +```tsx +function Component() { + const matchRoute = useMatchRoute() + + useEffect(() => { + if (matchRoute({ to: '/users', pending: true })) { + console.info('The /users route is matched and pending') + } + }) + + return ( +
+ Users +
+ ) +} +``` + +--- + +Phew! That's a lot of navigating! That said, hopefully you're feeling pretty good about getting around your application now. Let's move on! diff --git a/docs/router/guide/not-found-errors.md b/docs/framework/react/guide/not-found-errors.md similarity index 78% rename from docs/router/guide/not-found-errors.md rename to docs/framework/react/guide/not-found-errors.md index 88b8767a00..0061b3d0f9 100644 --- a/docs/router/guide/not-found-errors.md +++ b/docs/framework/react/guide/not-found-errors.md @@ -10,13 +10,13 @@ There are 2 uses for not-found errors in TanStack Router: - **Non-matching route paths**: When a path does not match any known route matching pattern **OR** when it partially matches a route, but with extra path segments - The **router** will automatically throw a not-found error when a path does not match any known route matching pattern - - If the router's `notFoundMode` is set to `fuzzy`, the nearest matching route with a `notFoundComponent` will handle the error. If the router's `notFoundMode` is set to `root`, the root route will handle the error. + - If the router's `notFoundMode` is set to `fuzzy`, the nearest parent route with a `notFoundComponent` will handle the error. If the router's `notFoundMode` is set to `root`, the root route will handle the error. - Examples: - Attempting to access `/users` when there is no `/users` route - Attempting to access `/posts/1/edit` when the route tree only handles `/posts/$postId` - **Missing resources**: When a resource cannot be found, such as a post with a given ID or any asynchronous data that is not available or does not exist - **You, the developer** must throw a not-found error when a resource cannot be found. This can be done in the `beforeLoad` or `loader` functions using the `notFound` utility. - - Will be handled by the nearest matching route with a `notFoundComponent` (when `notFound` is called within `loader`) or the root route. + - Will be handled by the nearest parent route with a `notFoundComponent` or the root route - Examples: - Attempting to access `/posts/1` when the post with ID 1 does not exist - Attempting to access `/docs/path/to/document` when the document does not exist @@ -27,19 +27,20 @@ Under the hood, both of these cases are implemented using the same `notFound` fu When TanStack Router encounters a **pathname** that doesn't match any known route pattern **OR** partially matches a route pattern but with extra trailing pathname segments, it will automatically throw a not-found error. -Depending on the `notFoundMode` option, the router will handle these automatic errors differently: +Depending on the `notFoundMode` option, the router will handle these automatic errors differently:: - ["fuzzy" mode](#notfoundmode-fuzzy) (default): The router will intelligently find the closest matching suitable route and display the `notFoundComponent`. - ["root" mode](#notfoundmode-root): All not-found errors will be handled by the root route's `notFoundComponent`, regardless of the nearest matching route. ### `notFoundMode: 'fuzzy'` -By default, the router's `notFoundMode` is set to `fuzzy`, which indicates that if a pathname doesn't match any known route, the router will attempt to use the closest matching route with a configured `notFoundComponent`. +By default, the router's `notFoundMode` is set to `fuzzy`, which indicates that if a pathname doesn't match any known route, the router will attempt to use the closest matching route with children/(an outlet) and a configured not found component. > **❓ Why is this the default?** Fuzzy matching to preserve as much parent layout as possible for the user gives them more context to navigate to a useful location based on where they thought they would arrive. The nearest suitable route is found using the following criteria: +- The route must have children and therefore an `Outlet` to render the `notFoundComponent` - The route must have a `notFoundComponent` configured or the router must have a `defaultNotFoundComponent` configured For example, consider the following route tree: @@ -52,10 +53,9 @@ If provided the path of `/posts/1/edit`, the following component structure will - `` - `` - - `` - - `` + - `` -The `notFoundComponent` of the `$postId` route will be rendered because it is the **nearest matching route with a `notFoundComponent` configured**. +The `notFoundComponent` of the `posts` route will be rendered because it is the **nearest suitable parent route with children (and therefore an outlet) and a `notFoundComponent` configured**. ### `notFoundMode: 'root'` @@ -164,47 +164,39 @@ export const Route = createFileRoute('/posts/$postId')({ The not-found error above will be handled by the same route or nearest parent route that has either a `notFoundComponent` route option or the `defaultNotFoundComponent` router option configured. -If neither the route nor any suitable parent route is found to handle the error, the root route will handle it using TanStack Router's **extremely basic (and purposefully undesirable)** default not-found component that simply renders `

Not Found

`. It's highly recommended to either attach at least one `notFoundComponent` to the root route or configure a router-wide `defaultNotFoundComponent` to handle not-found errors. - -> ⚠️ When you throw `notFound()` in `beforeLoad`, TanStack Router resolves it the same way as other not-found errors: -> -> - If you pass `routeId`, that route (or the nearest valid ancestor boundary) handles it. -> - If you don't pass `routeId`, the nearest route/ancestor with a `notFoundComponent` handles it (based on the router's mode and matching rules). -> - If no suitable boundary is found, handling falls back to the root/default not-found behavior. -> -> For `beforeLoad`-thrown not-found errors, TanStack Router still runs required parent loaders so the selected not-found boundary can render with the loader data it depends on. +If neither the route nor any suitable parent route is found to handle the error, the root route will handle it using TanStack Router's **extremely basic (and purposefully undesirable)** default not-found component that simply renders `
Not Found
`. It's highly recommended to either attach at least one `notFoundComponent` to the root route or configure a router-wide `defaultNotFoundComponent` to handle not-found errors. ## Specifying Which Routes Handle Not Found Errors Sometimes you may want to trigger a not-found on a specific parent route and bypass the normal not-found component propagation. To do this, pass in a route id to the `route` option in the `notFound` function. ```tsx -// _pathlessLayout.tsx -export const Route = createFileRoute('/_pathlessLayout')({ +// _layout.tsx +export const Route = createFileRoute('/_layout')({ // This will render notFoundComponent: () => { - return

Not found (in _pathlessLayout)

+ return

Not found (in _layout)

}, component: () => { return (
-

This is a pathless layout route!

+

This is a layout!

) }, }) -// _pathlessLayout/route-a.tsx -export const Route = createFileRoute('/_pathless/route-a')({ +// _layout/a.tsx +export const Route = createFileRoute('/_layout/a')({ loader: async () => { // This will make LayoutRoute handle the not-found error - throw notFound({ routeId: '/_pathlessLayout' }) + throw notFound({ routeId: '/_layout' }) // ^^^^^^^^^ This will autocomplete from the registered router }, // This WILL NOT render notFoundComponent: () => { - return

Not found (in _pathlessLayout/route-a)

+ return

Not found (in _layout/a)

}, }) ``` @@ -214,6 +206,8 @@ export const Route = createFileRoute('/_pathless/route-a')({ You can also target the root route by passing the exported `rootRouteId` variable to the `notFound` function's `route` property: ```tsx +import { rootRouteId } from '@tanstack/react-router' + export const Route = createFileRoute('/posts/$postId')({ loader: async ({ params: { postId } }) => { const post = await getPost(postId) @@ -276,31 +270,7 @@ The main differences are: - When using `NotFoundRoute`, you can't use layouts. `notFoundComponent` can be used with layouts. - When using `notFoundComponent`, path matching is strict. This means that if you have a route at `/post/$postId`, a not-found error will be thrown if you try to access `/post/1/2/3`. With `NotFoundRoute`, `/post/1/2/3` would match the `NotFoundRoute` and only render it if there is an ``. -To migrate from `NotFoundRoute` to `notFoundComponent`, you'll just need to make a few changes: +To migrate from `NotFoundRoute` to `notFoundComponent`, follow these steps: -```tsx title='src/router.tsx' -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen.' -- import { notFoundRoute } from './notFoundRoute' // [!code --] - -export const router = createRouter({ - routeTree, -- notFoundRoute // [!code --] -}) - -// routes/__root.tsx -import { createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - // ... -+ notFoundComponent: () => { // [!code ++] -+ return

Not found!

// [!code ++] -+ } // [!code ++] -}) -``` - -Important changes: - -- A `notFoundComponent` is added to the root route for global not-found handling. - - You can also add a `notFoundComponent` to any other route in your route tree to handle not-found errors for that specific route. -- The `notFoundComponent` does not support rendering an ``. +- Replace `NotFoundRoute` with `notFoundComponent`s on the routes that need to handle not-found errors. For "global" not-found errors, attach a `notFoundComponent` to the root route. +- Remove ``s from the routes that used `NotFoundRoute`. diff --git a/docs/framework/react/guide/outlets.md b/docs/framework/react/guide/outlets.md new file mode 100644 index 0000000000..5f0b3cfe5c --- /dev/null +++ b/docs/framework/react/guide/outlets.md @@ -0,0 +1,31 @@ +--- +title: Outlets +--- + +Nested routing means that routes can be nested within other routes, including the way they render. So how do we tell our routes where to render this nested content? + +## The `Outlet` Component + +The `Outlet` component is used to render the next potentially matching child route. `` doesn't take any props and can be rendered anywhere within a route's component tree. If there is no matching child route, `` will render `null`. + +> [!TIP] +> If a route's `component` is left undefined, it will render an `` automatically. + +A great example is configuring the root route of your application. Let's give our root route a component that renders a title, then an `` for our top-level routes to render. + +```tsx +import { createRootRoute } from '@tanstack/react-router' + +export const Route = createRootRoute({ + component: RootComponent, +}) + +function RootComponent() { + return ( +
+

My App

+ {/* This is where child routes will render */} +
+ ) +} +``` diff --git a/docs/framework/react/guide/parallel-routes.md b/docs/framework/react/guide/parallel-routes.md new file mode 100644 index 0000000000..b127cb75d1 --- /dev/null +++ b/docs/framework/react/guide/parallel-routes.md @@ -0,0 +1,5 @@ +--- +title: Parallel Routes +--- + +TODO: Write this guide diff --git a/docs/framework/react/guide/path-params.md b/docs/framework/react/guide/path-params.md new file mode 100644 index 0000000000..eaa66d5158 --- /dev/null +++ b/docs/framework/react/guide/path-params.md @@ -0,0 +1,112 @@ +--- +title: Path Params +--- + +Path params are used to match a single segment (the text until the next `/`) and provide its value back to you as a **named** variable. They are defined by using the `$` character prefix in the path, followed by the key variable to assign it to. The following are valid path param paths: + +- `$postId` +- `$name` +- `$teamId` +- `about/$name` +- `team/$teamId` +- `blog/$postId` + +Because path param routes only match to the next `/`, child routes can be created to continue expressing hierarchy: + +Let's create a post route file that uses a path param to match the post ID: + +- `posts.$postId.tsx` + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/$postId')({ + loader: async ({ params }) => { + return fetchPost(params.postId) + }, +}) +``` + +## Path Params can be used by child routes + +Once a path param has been parsed, it is available to all child routes. This means that if we define a child route to our `postRoute`, we can use the `postId` variable from the URL in the child route's path! + +## Path Params in Loaders + +Path params are passed to the loader as a `params` object. The keys of this object are the names of the path params, and the values are the values that were parsed out of the actual URL path. For example, if we were to visit the `/blog/123` URL, the `params` object would be `{ postId: '123' }`: + +```tsx +export const Route = createFileRoute('/posts/$postId')({ + loader: async ({ params }) => { + return fetchPost(params.postId) + }, +}) +``` + +The `params` object is also passed to the `beforeLoad` option: + +```tsx +export const Route = createFileRoute('/posts/$postId')({ + beforeLoad: async ({ params }) => { + // do something with params.postId + }, +}) +``` + +## Path Params in Components + +If we add a component to our `postRoute`, we can access the `postId` variable from the URL by using the route's `useParams` hook: + +```tsx +export const Route = createFileRoute('/posts/$postId')({ + component: PostComponent, +}) + +function PostComponent() { + const { postId } = Route.useParams() + return
Post {postId}
+} +``` + +> 🧠 Quick tip: If your component is code-split, you can use the [getRouteApi function](./code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-routeapi-class) to avoid having to import the `Route` configuration to get access to the typed `useParams()` hook. + +## Path Params outside of Routes + +You can also use the globally exported `useParams` hook to access any parsed path params from any component in your app. You'll need to pass the `strict: false` option to `useParams`, denoting that you want to access the params from an ambiguous location: + +```tsx +function PostComponent() { + const { postId } = useParams({ strict: false }) + return
Post {postId}
+} +``` + +## Navigating with Path Params + +When navigating to a route with path params, TypeScript will require you to pass the params either as an object or as a function that returns an object of params. + +Let's see what an object style looks like: + +```tsx +function Component() { + return ( + + Post 123 + + ) +} +``` + +And here's what a function style looks like: + +```tsx +function Component() { + return ( + ({ ...prev, postId: '123' })}> + Post 123 + + ) +} +``` + +Notice that the function style is useful when you need to persist params that are already in the URL for other routes. This is because the function style will receive the current params as an argument, allowing you to modify them as needed and return the final params object. diff --git a/docs/framework/react/guide/preloading.md b/docs/framework/react/guide/preloading.md new file mode 100644 index 0000000000..bd773d508e --- /dev/null +++ b/docs/framework/react/guide/preloading.md @@ -0,0 +1,121 @@ +--- +title: Preloading +--- + +Preloading in TanStack Router is a way to load a route before the user actually navigates to it. This is useful for routes that are likely to be visited by the user next. For example, if you have a list of posts and the user is likely to click on one of them, you can preload the post route so that it's ready to go when the user clicks on it. + +## Supported Preloading Strategies + +- Intent + - Preloading by **"intent"** works by using hover and touch start events on `` components to preload the dependencies for the destination route. + - This strategy is useful for preloading routes that the user is likely to visit next. +- Viewport Visibility + - Preloading by **"viewport**" works by using the Intersection Observer API to preload the dependencies for the destination route when the `` component is in the viewport. + - This strategy is useful for preloading routes that are below the fold or off-screen. +- Render + - **Coming soon!** + +## How long does preloaded data stay in memory? + +Preloaded route matches are temporarily cached in memory with a few important caveats: + +- **Unused preloaded data is removed after 30 seconds by default.** This can be configured by setting the `defaultPreloadMaxAge` option on your router. +- **Obviously, when a a route is loaded, its preloaded version is promoted to the router's normal pending matches state.** + +If you need more control over preloading, caching and/or garbage collection of preloaded data, you should use an external caching library like [TanStack Query](https://react-query.tanstack.com) + +The simplest way to preload routes for your application is to set the `defaultPreload` option to `intent` for your entire router: + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... + defaultPreload: 'intent', +}) +``` + +This will turn on `intent` preloading by default for all `` components in your application. You can also set the `preload` prop on individual `` components to override the default behavior. + +## Preload Delay + +By default, preloading will start after **50ms** of the user hovering or touching a `` component. You can change this delay by setting the `defaultPreloadDelay` option on your router: + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... + defaultPreloadDelay: 100, +}) +``` + +You can also set the `preloadDelay` prop on individual `` components to override the default behavior on a per-link basis. + +## Built-in Preloading & `preloadStaleTime` + +If you're using the built-in loaders, you can control how long preloaded data is considered fresh until another preload is triggered by setting either `routerOptions.defaultPreloadStaleTime` or `routeOptions.preloadStaleTime` to a number of milliseconds. **By default, preloaded data is considered fresh for 30 seconds.**. + +To change this, you can set the `defaultPreloadStaleTime` option on your router: + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... + defaultPreloadStaleTime: 10_000, +}) +``` + +Or, you can use the `routeOptions.preloadStaleTime` option on individual routes: + +```tsx +// src/routes/posts.$postId.tsx +export const Route = createFileRoute('/posts/$postId')({ + loader: async ({ params }) => fetchPost(params.postId), + // Preload the route again if the preload cache is older than 10 seconds + preloadStaleTime: 10_000, +}) +``` + +## Preloading with External Libraries + +When integrating external caching libraries like React Query, which have their own mechanisms for determining stale data, you may want to override the default preloading and stale-while-revalidate logic of TanStack Router. These libraries often use options like staleTime to control the freshness of data. + +To customize the preloading behavior in TanStack Router and fully leverage your external library's caching strategy, you can bypass the built-in caching by setting routerOptions.defaultPreloadStaleTime or routeOptions.preloadStaleTime to 0. This ensures that all preloads are marked as stale internally, and loaders are always invoked, allowing your external library, such as React Query, to manage data loading and caching. + +For example: + +```tsx +import { createRouter } from '@tanstack/react-router' + +const router = createRouter({ + // ... + defaultPreloadStaleTime: 0, +}) +``` + +This would then allow you, for instance, to use an option like React Query's `staleTime` to control the freshness of your preloads. + +## Preloading Manually + +If you need to manually preload a route, you can use the router's `preloadRoute` method. It accepts a standard TanStack `NavigateOptions` object and returns a promise that resolves when the route is preloaded. + +```tsx +function Component() { + const router = useRouter() + + useEffect(() => { + try { + const matches = await router.preloadRoute({ + to: postRoute, + params: { id: 1 }, + }) + } catch (err) { + // Failed to preload route + } + }, []) + + return
+} +``` diff --git a/docs/router/guide/route-masking.md b/docs/framework/react/guide/route-masking.md similarity index 89% rename from docs/router/guide/route-masking.md rename to docs/framework/react/guide/route-masking.md index a734b75e17..8173c18d1a 100644 --- a/docs/router/guide/route-masking.md +++ b/docs/framework/react/guide/route-masking.md @@ -56,16 +56,7 @@ When using either route masking APIs, the `mask` option accepts the same navigat The `` and `navigate()` APIs both accept a `mask` option that can be used to mask the URL of the route being navigated to. Here's an example of using it with the `` component: ```tsx - + Open Photo ``` @@ -76,16 +67,7 @@ And here's an example of using it with the `navigate()` API: const navigate = useNavigate() function onOpenPhoto() { - navigate({ - to: '/photos/$photoId/modal', - params: { photoId: 5 }, - mask: { - to: '/photos/$photoId', - params: { - photoId: 5, - }, - }, - }) + navigate('/photos/5/modal', { mask: { to: '/photo/5' } }) } ``` @@ -93,9 +75,7 @@ function onOpenPhoto() { In addition to the imperative API, you can also use the Router's `routeMasks` option to declaratively mask routes. Instead of needing to pass the `mask` option to every `` or `navigate()` call, you can instead create a route mask on the Router to mask routes that match a certain pattern. Here's an example of the same route mask from above, but using the `routeMasks` option instead: - - -# React +// Use the following for the example below ```tsx import { createRouteMask } from '@tanstack/react-router' @@ -115,28 +95,6 @@ const router = createRouter({ }) ``` -# Solid - -```tsx -import { createRouteMask } from '@tanstack/solid-router' - -const photoModalToPhotoMask = createRouteMask({ - routeTree, - from: '/photos/$photoId/modal', - to: '/photos/$photoId', - params: (prev) => ({ - photoId: prev.photoId, - }), -}) - -const router = createRouter({ - routeTree, - routeMasks: [photoModalToPhotoMask], -}) -``` - - - When creating a route mask, you'll need to pass 1 argument with at least: - `routeTree` - The route tree that the route mask will be applied to diff --git a/docs/framework/react/guide/route-matching.md b/docs/framework/react/guide/route-matching.md new file mode 100644 index 0000000000..80fa031802 --- /dev/null +++ b/docs/framework/react/guide/route-matching.md @@ -0,0 +1,103 @@ +--- +title: Route Matching +--- + +Route matching follows a consistent and predictable pattern. This guide will explain how route trees are matched. + +When TanStack Router processes your route tree, all of your routes are automatically sorted to match the most specific routes first. This means that regardless of the order your route tree is defined, routes will always be sorted in this order: + +- Index Route +- Static Routes (most specific to least specific) +- Dynamic Routes (longest to shortest) +- Splat/Wildcard Routes + +Consider the following pseudo route tree: + +``` +Root + - blog + - $postId + - / + - new + - / + - * + - about + - about/us +``` + +After sorting, this route tree will become: + +``` +Root + - / + - about/us + - about + - blog + - / + - new + - $postId + - * +``` + +This final order represents the order in which routes will be matched based on specificity. + +Using that route tree, let's follow the matching process for a few different URLs: + +- `/blog` + ``` + Root + ❌ / + ❌ about/us + ❌ about + ⏩ blog + ✅ / + - new + - $postId + - * + ``` +- `/blog/my-post` + ``` + Root + ❌ / + ❌ about/us + ❌ about + ⏩ blog + ❌ / + ❌ new + ✅ $postId + - * + ``` +- `/` + ``` + Root + ✅ / + - about/us + - about + - blog + - / + - new + - $postId + - * + ``` +- `/not-a-route` + ``` + Root + ❌ / + ❌ about/us + ❌ about + ❌ blog + - / + - new + - $postId + ✅ * + ``` + +## Pathless / Layout Route Matching + +During matching, [pathless / layout routes](./routing-concepts.md#pathless--layout-routes) are treated as if they are flat. If a route is not found in a pathless route's children, matching will continue out of the pathless route's children and on through the rest of the parent subtree like normal. + +## `NotFoundRoute`s and Matching + +If you choose to configure a `NotFoundRoute` for your router, it should be passed to the `notFoundRoute` option and not as part of your `routeTree`. This is because `NotFoundRoute`s are not considered during matching and only render as a fallback when no other suitable match is found. + +You can read more about `NotFoundRoute`s in the [Not Found Errors](./not-found-errors.md) guide. diff --git a/docs/framework/react/guide/route-trees.md b/docs/framework/react/guide/route-trees.md new file mode 100644 index 0000000000..c5c855e9d1 --- /dev/null +++ b/docs/framework/react/guide/route-trees.md @@ -0,0 +1,124 @@ +--- +title: Route Trees & Nesting +--- + +Like most other routers, TanStack Router uses a nested route tree to match up the URL with the correct component tree to render. + +To build a route tree, TanStack Router supports both: + +- File-Based Routing +- Code-Based Routing + +Both methods support the exact same core features and functionality, but **file-based routing requires less code for the same or better results**. For this reasons, **file-based routing is the preferred and recommended way to configure TanStack Router and most of the documentation is written from the perspective of file-based routing** + +For code-based routing documentation, please see +the [Code-Based Routing](./code-based-routing.md) guide. + +## Route Trees + +Nested routing is a powerful concept that allows you to use a URL to render a nested component tree. For example, given the URL of `/blog/posts/123`, you could match a path hierarchy that looks like this: + +- /blog + - /posts + - /$postId + +And render a component tree that looks like this: + +```tsx + + + + + +``` + +To configure nested routing TanStack Router uses a route hierarchy called a **route tree** to organize, match and compose matching routes into a component tree. + +Consider the following route tree: + +- _Root_ + - `/` + - `about` + - `posts` + - `/` + - `$postId` + - `posts/$postId/edit` + - `settings` + - `profile` + - `notifications` + - `layout` + - `layout-a` + - `layout-b` + - `files` + - `$` +- _Not-Found Route_ + +Route trees are represented using a number of different ways: + +- [Flat Routes](./route-trees.md#flat-routes) +- [Directory Routes](./route-trees.md#directory-routes) +- [Mixed Flat and Directory Routes](./route-trees.md#mixed-flat-and-directory-routes) +- [Code-Based Routes](./route-trees.md#code-based-routes) +- [Case-Sensitivity](./route-trees.md#case-sensitivity) + +The route tree examples below showcase the [Routing Concepts](./routing-concepts.md) that are available in TanStack Router. + +## Flat Routes + +Flat routing uses same level of nesting. They make it easy to see and find routes in your project: + +| Filename | Route Path | Component Output | +| ---------------------------- | ------------------------- | --------------------------------- | +| `__root.tsx` | | `` | +| `index.tsx` | `/` (exact) | `` | +| `about.tsx` | `/about` | `` | +| `posts.tsx` | `/posts` | `` | +| `posts.index.tsx` | `/posts` (exact) | `` | +| `posts.$postId.tsx` | `/posts/$postId` | `` | +| `posts_.$postId.edit.tsx` | `/posts/$postId/edit` | `` | +| `settings.tsx` | `/settings` | `` | +| `settings.profile.tsx` | `/settings/profile` | `` | +| `settings.notifications.tsx` | `/settings/notifications` | `` | +| `_layout.tsx` | | `` | +| `_layout.layout-a.tsx` | `/layout-a` | `` | +| `_layout.layout-b.tsx` | `/layout-b` | `` | +| `files.$.tsx` | `/files/$` | `` | + +## Directory Routes + +Directory routes are routes that are nested within a directory, which can be useful for organizing routes into logical groups and also cutting down on the filename length for routes that get deeply nested: + +| Filename | Route Path | Component Output | +| --------------------- | ------------------------- | --------------------------------- | +| `__root.tsx` | | `` | +| `index.tsx` | `/` (exact) | `` | +| `about.tsx` | `/about` | `` | +| `posts.tsx` | `/posts` | `` | +| `posts` (dir) | | | +| - `index.tsx` | `/posts` (exact) | `` | +| - `$postId.tsx` | `/posts/$postId` | `` | +| `posts_` (dir) | | | +| - `$postId` (dir) | | | +| - - `edit.tsx` | `/posts/$postId/edit` | `` | +| `settings.tsx` | `/settings` | `` | +| `settings` (dir) | | `` | +| - `profile.tsx` | `/settings/profile` | `` | +| - `notifications.tsx` | `/settings/notifications` | `` | +| `_layout.tsx` | | `` | +| `_layout` (dir) | | | +| - `layout-a.tsx` | `/layout-a` | `` | +| - `layout-b.tsx` | `/layout-b` | `` | +| `files` (dir) | | | +| - `$.tsx` | `/files/$` | `` | + +## Mixed Flat and Directory Routes + +Both flat and directory routes can be mixed together to create a route tree that uses the best of both worlds where it makes sense. + +## Code-Based Routes + +Code-based routes are routes that are configured using the `RootRoute` and `Route` classes directly. You may want to do this simply for taste, or you may find a use-case where file-based routing doesn't work for you (if you do, please let us know!). For code-based routing documentation, please see the [Code-Based Routing](./code-based-routing.md) guide. + +## Case-Sensitivity + +Route paths are **not case-sensitive** _by default_. This means that `about.tsx` and `AbOuT.tsx` are considered the same path out-of-the box. This is a good thing, since this is the way most of the web works anyway! That said, if you truly want to be weird and match a path with a different case, you can set a route's `caseSensitive` option to `true`. diff --git a/docs/framework/react/guide/router-context.md b/docs/framework/react/guide/router-context.md new file mode 100644 index 0000000000..f143961cd9 --- /dev/null +++ b/docs/framework/react/guide/router-context.md @@ -0,0 +1,346 @@ +--- +title: Router Context +--- + +TanStack Router's router context is a very powerful tool that can be used for dependency injection among many other things. Aptly named, the router context is passed through the router and down through each matching route. At each route in the hierarchy, the context can be modified or added to. Here's a few ways you might use the router context practically: + +- Dependency Injection + - You can supply dependencies (e.g. a loader function, a data fetching client, a mutation service) which the route and all child routes can access and use without importing or creating directly. +- Breadcrumbs + - While the main context object for each route is merged as it descends, each route's unique context is also stored making it possible to attach breadcrumbs or methods to each route's context. +- Dynamic meta tag management + - You can attach meta tags to each route's context and then use a meta tag manager to dynamically update the meta tags on the page as the user navigates the site. + +These are just suggested uses of the router context. You can use it for whatever you want! + +## Typed Router Context + +Like everything else, the root router context is strictly typed. This type can be augmented via any route's `beforeLoad` option as it is merged down the route match tree. To constrain the type of the root router context, you must use the `createRootRouteWithContext()(routeOptions)` function to create a new router context instead of the `createRootRoute()` function to create your root route. Here's an example: + +```tsx +import { + createRootRouteWithContext, + createRouter, +} from '@tanstack/react-router' + +interface MyRouterContext { + user: User +} + +// Use the routerContext to create your root route +const rootRoute = createRootRouteWithContext()({ + component: App, +}) + +const routeTree = rootRoute.addChildren([ + // ... +]) + +// Use the routerContext to create your router +const router = createRouter({ + routeTree, +}) +``` + +## Passing the initial Router Context + +The router context is passed to the router at instantiation time. You can pass the initial router context to the router via the `context` option: + +> [!TIP] +> If your context has any required properties, you will see a TypeScript error if you don't pass them in the initial router context. If all of your context properties are optional, you will not see a TypeScript error and passing the context will be optional. If you don't pass a router context, it defaults to `{}`. + +```tsx +import { createRouter } from '@tanstack/react-router' + +// Use the routerContext you created to create your router +const router = createRouter({ + routeTree, + context: { + user: { + id: '123', + name: 'John Doe', + }, + }, +}) +``` + +### Invalidating the Router Context + +If you need to invalidate the context state you are passing into the router, you can call the `invalidate` method to tell the router to recompute the context. This is useful when you need to update the context state and have the router recompute the context for all routes. + +```tsx +function useAuth() { + const [user, setUser] = useState(null) + + useEffect(() => { + const unsubscribe = auth.onAuthStateChanged((user) => { + setUser(user) + router.invalidate() + }) + + return unsubscribe + }, []) + + return user +} +``` + +## Using the Router Context + +Once you have defined the router context type, you can use it in your route definitions: + +```tsx +// src/routes/todos.tsx +export const Route = createFileRoute('/todos')({ + component: Todos, + loader: ({ context }) => fetchTodosByUserId(context.user.id), +}) +``` + +You can even inject data fetching and mutation implementations themselves! In fact, this is highly recommended 😜 + +Let's try this with a simple function to fetch some todos: + +```tsx +const fetchTodosByUserId = async ({ userId }) => { + const response = await fetch(`/api/todos?userId=${userId}`) + const data = await response.json() + return data +} + +const router = createRouter({ + routeTree: rootRoute, + context: { + userId: '123', + fetchTodosByUserId, + }, +}) +``` + +Then, in your route: + +```tsx +// src/routes/todos.tsx +export const Route = createFileRoute('/todos')({ + component: Todos, + loader: ({ context }) => context.fetchTodosByUserId(context.userId), +}) +``` + +### How about an external data fetching library? + +```tsx +import { + createRootRouteWithContext, + createRouter, +} from '@tanstack/react-router' + +interface MyRouterContext { + queryClient: QueryClient +} + +const rootRoute = createRootRouteWithContext()({ + component: App, +}) + +const queryClient = new QueryClient() + +const router = createRouter({ + routeTree: rootRoute, + context: { + queryClient, + }, +}) +``` + +Then, in your route: + +```tsx +// src/routes/todos.tsx +export const Route = createFileRoute('/todos')({ + component: Todos, + loader: async ({ context }) => { + await context.queryClient.ensureQueryData({ + queryKey: ['todos', { userId: user.id }], + queryFn: fetchTodos, + }) + }, +}) +``` + +## How about using React Context/Hooks? + +When trying to use React Context or Hooks in your route's `beforeLoad` or `loader` functions, it's important to remember React's [Rules of Hooks](https://react.dev/reference/rules/rules-of-hooks). You can't use hooks in a non-React function, so you can't use hooks in your `beforeLoad` or `loader` functions. + +So, how do we use React Context or Hooks in our route's `beforeLoad` or `loader` functions? We can use the router context to pass down the React Context or Hooks to our route's `beforeLoad` or `loader` functions. + +Let's look at the setup for an example, where we pass down a `useNetworkStrength` hook to our route's `loader` function: + +- `src/routes/__root.tsx` + +```tsx +// First, make sure the context for the root route is typed +import { createRootRouteWithContext } from '@tanstack/react-router' +import { useNetworkStrength } from '@/hooks/useNetworkStrength' + +interface MyRouterContext { + networkStrength: ReturnType +} + +export const Route = createRootRouteWithContext()({ + component: App, +}) +``` + +In this example, we'd instantiate the hook before rendering the router using the ``. This way, the hook would be called in React-land, therefore adhering to the Rules of Hooks. + +- `src/router.tsx` + +```tsx +import { createRouter } from '@tanstack/react-router' + +import { routeTree } from './routeTree.gen' + +export const router = createRouter({ + routeTree, + context: { + networkStrength: undefined!, // We'll set this in React-land + }, +}) +``` + +- `src/main.tsx` + +```tsx +import { RouterProvider } from '@tanstack/react-router' +import { router } from './router' + +import { useNetworkStrength } from '@/hooks/useNetworkStrength' + +function App() { + const networkStrength = useNetworkStrength() + // Inject the returned value from the hook into the router context + return +} + +// ... +``` + +So, now in our route's `loader` function, we can access the `networkStrength` hook from the router context: + +- `src/routes/posts.tsx` + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + component: Posts, + loader: ({ context }) => { + if (context.networkStrength === 'STRONG') { + // Do something + } + }, +}) +``` + +## Modifying the Router Context + +The router context is passed down the route tree and is merged at each route. This means that you can modify the context at each route and the modifications will be available to all child routes. Here's an example: + +- `src/routes/__root.tsx` + +```tsx +import { createRootRouteWithContext } from '@tanstack/react-router' + +interface MyRouterContext { + foo: boolean +} + +export const Route = createRootRouteWithContext()({ + component: App, +}) +``` + +- `src/router.tsx` + +```tsx +import { createRouter } from '@tanstack/react-router' + +import { routeTree } from './routeTree.gen' + +const router = createRouter({ + routeTree, + context: { + foo: true, + }, +}) +``` + +- `src/routes/todos.tsx` + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/todos')({ + component: Todos, + beforeLoad: () => { + return { + bar: true, + } + }, + loader: ({ context }) => { + context.foo // true + context.bar // true + }, +}) +``` + +## Processing Accumulated Route Context + +Context, especially the isolated route `context` objects, make it trivial to accumulate and process the route context objects for all matched routes. Here's an example where we use all of the matched route contexts to generate a breadcrumb trail: + +```tsx +// src/routes/__root.tsx +export const Route = createRootRoute({ + component: () => { + const matches = useRouterState({ select: (s) => s.matches }) + + const breadcrumbs = matches + .filter((match) => match.context.getTitle) + .map(({ pathname, context }) => { + return { + title: context.getTitle(), + path: pathname, + } + }) + + // ... + }, +}) +``` + +Using that same route context, we could also generate a title tag for our page's ``: + +```tsx +// src/routes/__root.tsx +export const Route = createRootRoute({ + component: () => { + const matches = useRouterState({ select: (s) => s.matches }) + + const matchWithTitle = [...matches] + .reverse() + .find((d) => d.context.getTitle) + + const title = matchWithTitle?.context.getTitle() || 'My App' + + return ( + + + {title} + + {/* ... */} + + ) + }, +}) +``` diff --git a/docs/framework/react/guide/routing-concepts.md b/docs/framework/react/guide/routing-concepts.md new file mode 100644 index 0000000000..9172023ab9 --- /dev/null +++ b/docs/framework/react/guide/routing-concepts.md @@ -0,0 +1,236 @@ +--- +title: Routing Concepts +--- + +TanStack Router supports a number of powerful routing concepts that allow you to build complex and dynamic routing systems with ease. + +- [The Root Route](./routing-concepts.md#the-root-route) +- [Static Routes](./routing-concepts.md#static-routes) +- [Index Routes](./routing-concepts.md#index-routes) +- [Dynamic Route Segments](./routing-concepts.md#dynamic-route-segments) +- [Splat / Catch-All Routes](./routing-concept.md#splat--catch-all-routes) +- [Pathless / Layout Routes](./routing-concepts.md#pathless--layout-routes) +- [Non-Nested Routes](./routing-concepts.md#non-nested-routes) +- [Not-Found Routes](./routing-concepts.md#404--notfoundroutes) + +Each of these concepts is useful and powerful, and we'll dive into each of them in the following sections. + +## The Root Route + +The root route is the top-most route in the entire tree and encapsulates all other routes as children. + +- It has no path +- It is always matched +- Its `component` is always rendered + +Even though it doesn't have a path, the root route has access to all of the same functionality as other routes including: + +- components +- loaders +- search param validation +- etc. + +To create a root route, call the `createRootRoute()` constructor and export it as the `Route` variable in your route file: + +```tsx +import { createRootRoute } from '@tanstack/react-router' + +export const Route = createRootRoute() +``` + +> 🧠 You can also create a root route via the `createRootRouteWithContext()` function, which is a type-safe way of doing dependency injection for the entire router. Read more about this in the [Context Section](./router-context.md) --> + +## Anatomy of a Route + +All other routes other than the root route are configured using the `FileRoute` class. The `FileRoute` class is a wrapper around the `Route` class that provides type safety when using file-based routing: + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + component: PostsComponent, +}) +``` + +### The `createFileRoute` Path Argument + +The `createFileRoute` function takes a single argument, the file-route's path as a string. + +**❓❓❓ "Wait, you're making me pass the path of the route file to `createFileRoute`?"** + +Yes! But don't worry, this path is **automatically written and managed by the router for you via the TanStack Router plugin or Router CLI.** So, as you create new routes, move routes around or rename routes, the path will be updated for you automatically. + +> 🧠 The reason for this pathname has everything to do with the magical type safety of TanStack Router. Without this pathname, TypeScript would have no idea what file we're in! (We wish TypeScript had a built-in for this, but they don't yet 🤷‍♂️) + +## Static Routes + +Static routes simply match a specific path. In our example route tree above, the `/about`, `/settings`, `/settings/profile` and `/settings/notifications` routes are all static routes. + +Let's take a look at the `/about` route: + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/about')({ + component: AboutComponent, +}) + +function AboutComponent() { + return
About
+} +``` + +Static routes are simple and straightforward. They match the path exactly and render the provided component. + +## Index Routes + +Index routes specifically target their parent route when it is matched exactly and no child route is matched. We can see this in the above route tree with both the root index route (`index.tsx`) and the posts index route (`posts.index.tsx`). + +Let's take a look at the posts index route (`posts.index.tsx`): + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/')({ + component: PostsIndexComponent, +}) + +function PostsIndexComponent() { + return
Please select a post!
+} +``` + +In this example, the `posts.index.tsx` file is nested under the `posts` directory, so it will be matched when the URL is `/posts` exactly. When this happens, the `PostsIndexComponent` will be rendered. + +## Dynamic Route Segments + +Route path segments that start with a `$` followed by a label are dynamic and capture that section of the URL into the `params` object for use in your application. For example, a pathname of `/posts/123` would match the `/posts/$postId` route, and the `params` object would be `{ postId: '123' }`. + +These params are then usable in your route's configuration and components! Let's look at the `posts.$postId.tsx` route from our example route tree above: + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/$postId')({ + // In a loader + loader: ({ params }) => fetchPost(params.postId), + // Or in a component + component: PostComponent, +}) + +function PostComponent() { + const { postId } = Route.useParams() + return
Post ID: {postId}
+} +``` + +> 🧠 Dynamic segments work at **each** segment of the path. For example, you could have a route with the path of `/posts/$postId/$revisionId` and each `$` segment would be captured into the `params` object. + +## Splat / Catch-All Routes + +A route with a path of only `$` is called a "splat" route because it _always_ captures _any_ remaining section of the URL pathname from the `$` to the end. The captured pathname is then available in the `params` object under the special `_splat` property. + +For example, our route tree above has a `files/$` splat route. If the URL pathname is `/files/documents/hello-world`, the `params` object would contain `documents/hello-world` under the special `_splat` property: + +```js +{ + '_splat': 'documents/hello-world' +} +``` + +> ⚠️ In v1 of the router, splat routes are also denoted with a `*` instead of a `_splat` key for backwards compatibility. This will be removed in v2. + +> 🧠 Why use `$`? Thanks to tools like Remix, we know that despite `*`s being the most common character to represent a wildcard, they do not play nice with filenames or CLI tools, so just like them, we decided to use `$` instead. + +## Pathless / Layout Routes + +File routes that are prefixed with an underscore (`_`) are considered "pathless" / a "layout". Pathless/Layout routes can be used to wrap child routes with additional components and logic, without requiring a matching `path` in the URL + +- Wrap child routes with a layout component +- Enforce a `loader` requirement before displaying any child routes +- Validate and provide search params to child routes +- Provide fallbacks for error components or pending elements to child routes +- Provide shared context to all child routes + +> 🧠 The part of the path after the `_` prefix is used as the route's ID and is required because every route must be uniquely identifiable, especially when using TypeScript so as to avoid type errors and accomplish autocomplete effectively. + +In our example route tree above, the `_layout` route is a pathless route that wraps the `layout-a` and `layout-b` routes with a layout component. This means that when the URL is `/layout-a`, the `/_layout/layout-a` route will be matched and the component tree will look like this: + +```tsx + + + +``` + +Let's take a look at the `_layout.tsx` route: + +```tsx +import { Outlet, createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/_layout')({ + component: LayoutComponent, +}) + +function LayoutComponent() { + return ( +
+

Layout

+ +
+ ) +} +``` + +## Non-Nested Routes + +Non-nested routes can be created by suffixing a parent file route segment with a `_`. Non-nested routes are valuable because you don't always want a route to be nested, but instead you need it to "break out" of the parent route's path and render its own completely different component tree. + +During path matching, the trailing `_` is ignored, so `/posts` and `/posts_` are considered the same path. However, when constructing the component tree, the `_` is used to denote a non-nested route, so `/posts` and `/posts_` are considered different routes. + +In our example route tree above, `/posts` and `/posts_/$postId/edit` routes are siblings, not parent/child. To make this easier to understand, here's their section of the route tree and a pseudo-code component representation comparison between `/posts/$postId` and `/posts/$postId/edit`: + +- `/posts_/$postId/edit` +- `/posts` + - `$postId` + +```tsx +// `posts_.$postId.edit.tsx` + + +// `posts.$postId.tsx` + + + +``` + +Notice how the post editor route is considered a sibling of the post route, not a child and would get matched by specificity before the post route. Likewise, the post editor component's parent is the root route, not the posts route, so it is not wrapped in the `` component. + +## 404 / `NotFoundRoute`s + +404 / Not-Found routes, while not an explicit part of the route tree, are a useful abstraction on the concept. + +Sure, you could technically (and monotonously) place a splat / catch-all route under every route branch you create. But even at a small scale, this is cumbersome and prone to error. Instead, you can create a special `NotFoundRoute` and provide it to your router's `notFoundRoute` option. + +> ⚠️ Never include a `NotFoundRoute` in your route tree. Doing so will not allow it to work at every branch of your route tree. + +`NotFoundRoutes` are rendered when: + +- excess path segments are found in the URL beyond all possible route matches +- there is no dynamic segment or splat route to capture the excess path segments +- there is no index route to render when the parent route is matched +- a `notFoundRoute` is provided to the router + +`NotFoundRoute`s are special versions of a `Route` that: + +- Have no `path` +- Have no `id` +- Cannot parse or validate path params + +They do however still have the ability to: + +- Render `component`, `pendingComponent` and `errorComponent`s +- Validate and receive `search` params +- Configure `loader`s and `beforeLoad` hooks +- Receive `data` and search params from the root route + +We'll cover how to configure a `NotFoundRoute` in the [Route Matching - Not-Found Routes](./route-matching.md#not-found-routes) guide. diff --git a/docs/framework/react/guide/scroll-restoration.md b/docs/framework/react/guide/scroll-restoration.md new file mode 100644 index 0000000000..2f53c0519e --- /dev/null +++ b/docs/framework/react/guide/scroll-restoration.md @@ -0,0 +1,139 @@ +--- +id: scroll-restoration +title: Scroll Restoration +--- + +Scroll restoration is the process of restoring the scroll position of a page when the user navigates back to it. This is normally a built-in feature for standard HTML based websites, but can be difficult to replicate for SPA applications because: + +- SPAs typically use the `history.pushState` API for navigation, so the browser doesn't know to restore the scroll position natively +- SPAs sometimes render content asynchronously, so the browser doesn't know the height of the page until after it's rendered +- SPAs can sometimes use nested scrollable containers to force specific layouts and features. + +Not only that, but it's very common for applications to have multiple scrollable areas within an app, not just the body. For example, a chat application might have a scrollable sidebar and a scrollable chat area. In this case, you would want to restore the scroll position of both areas independently. + +To alleviate this problem, TanStack Router provides a scroll restoration component and hook that handle the process of monitoring, caching and restoring scroll positions for you. + +It does this by: + +- Monitoring the DOM for scroll events +- Registering scrollable areas with the scroll restoration cache +- Listening to the proper router events to know when to cache and restore scroll positions +- Storing scroll positions for each scrollable area in the cache (including `window` and `body`) +- Restoring scroll positions after successful navigations before DOM paint + +That may sound like a lot, but for you, it's as simple as this: + +```tsx +import { ScrollRestoration } from '@tanstack/react-router' + +function Root() { + return ( + <> + + + + ) +} +``` + +Just render the `ScrollRestoration` component (or use the `useScrollRestoration` hook) at the root of your application and it will handle everything automatically! + +## Custom Cache Keys + +Falling in behind Remix's own Scroll Restoration APIs, you can also customize the key used to cache scroll positions for a given scrollable area using the `getKey` option. This could be used, for example, to force the same scroll position to be used regardless of the users browser history. + +The `getKey` option receives the relevant `Location` state from TanStack Router and expects you to return a string to uniquely identify the scrollable measurements for that state. + +The default `getKey` is `(location) => location.state.key!`, where `key` is the unique key generated for each entry in the history. + +## Examples + +You could sync scrolling to the pathname: + +```tsx +import { ScrollRestoration } from '@tanstack/react-router' + +function Root() { + return ( + <> + location.pathname} /> + + + ) +} +``` + +You can conditionally sync only some paths, then use the key for the rest: + +```tsx +import { ScrollRestoration } from '@tanstack/react-router' + +function Root() { + return ( + <> + { + const paths = ['/', '/chat'] + return paths.includes(location.pathname) + ? location.pathname + : location.state.key! + }} + /> + + + ) +} +``` + +## Preventing Scroll Restoration + +Sometimes you may want to prevent scroll restoration from happening. To do this you can utilize the `resetScroll` option available on the following APIs: + +- `` +- `navigate({ resetScroll: false })` +- `redirect({ resetScroll: false })` + +When `resetScroll` is set to `false`, the scroll position for the next navigation will not be restored (if navigating to an existing history event in the stack) or reset to the top (if it's a new history event in the stack). + +## Manual Scroll Restoration + +Most of the time, you won't need to do anything special to get scroll restoration to work. However, there are some cases where you may need to manually control scroll restoration. The most common example is **virtualized lists**. + +To manually control scroll restoration, you can use the `useElementScrollRestoration` hook and the `data-scroll-restoration-id` DOM attribute: + +```tsx +function Component() { + // We need a unique ID for manual scroll restoration on a specific element + // It should be as unique as possible for this element across your app + const scrollRestorationId = 'myVirtualizedContent' + + // We use that ID to get the scroll entry for this element + const scrollEntry = useElementScrollRestoration({ + id: scrollRestorationId, + }) + + // Let's use TanStack Virtual to virtualize some content! + const virtualizerParentRef = React.useRef(null) + const virtualizer = useVirtualizer({ + count: 10000, + getScrollElement: () => virtualizerParentRef.current, + estimateSize: () => 100, + // We pass the scrollY from the scroll restoration entry to the virtualizer + // as the initial offset + initialOffset: scrollEntry?.scrollY, + }) + + return ( +
+ ... +
+ ) +} +``` diff --git a/docs/framework/react/guide/search-params.md b/docs/framework/react/guide/search-params.md new file mode 100644 index 0000000000..abd516038a --- /dev/null +++ b/docs/framework/react/guide/search-params.md @@ -0,0 +1,487 @@ +--- +title: Search Params +--- + +Similar to how TanStack Query made handling server-state in your React applications a breeze, TanStack Router aims to unlock the power of URL search params in your applications. + +## Why not just use `URLSearchParams`? + +We get it, you've been hearing a lot of "use the platform" lately and for the most part, we agree. However, we also believe it's important to recognize where the platform falls short for more advanced use-cases and we believe `URLSearchParams` is one of these circumstances. + +Traditional Search Param APIs usually assume a few things: + +- Search params are always strings +- They are _mostly_ flat +- Serializing and deserializing using `URLSearchParams` is good enough (Spoiler alert: it's not.) +- Search params modifications are tightly coupled with the URL's pathname and must be updated together, even if the pathname is not changing. + +Reality is very different from these assumptions though. + +- Search params represent application state, so inevitably, we will expect them to have the same DX associated with other state managers. This means having the capability of distinguishing between primitive value types and efficiently storing and manipulating complex data structures like nested arrays and objects. +- There are many ways to serialize and deserialize state with different tradeoffs. You should be able to choose the best one for your application or at the very least get a better default than `URLSearchParams`. +- Immutability & Structural Sharing. Every time you stringify and parse url search params, referential integrity and object identity is lost because each new parse creates a brand new data structure with a unique memory reference. If not properly managed over its lifetime, this constant serialization and parsing can result in unexpected and undesirable performance issues, especially in frameworks like React that choose to track reactivity via immutability or in Solid that normally relies on reconciliation to detect changes from deserialized data sources. +- Search params, while an important part of the URL, do frequently change independently of the URL's pathname. For example, a user may want to change the page number of a paginated list without touching the URL's pathname. + +## Search Params, the "OG" State Manager + +You've probably seen search params like `?page=3` or `?filter-name=tanner` in the URL. There is no question that this is truly **a form of global state** living inside of the URL. It's valuable to store specific pieces of state in the URL because: + +- Users should be able to: + - Cmd/Ctrl + Click to open a link in a new tab and reliably see the state they expected + - Bookmark and share links from your application with others with assurances that they will see exactly the state as when the link was copied. + - Refresh your app or navigate back and forth between pages without losing their state +- Developers should be able to easily: + - Add, remove or modify state in the URL with the same great DX as other state managers + - Easily validate search params coming from the URL in a format and type that is safe for their application to consume + - Read and write to search params without having to worry about the underlying serialization format + +## JSON-first Search Params + +To achieve the above, the first step built in to TanStack Router is a powerful search param parser that automatically converts the search string of your URL to structured JSON. This means that you can store any JSON-serializable data structure in your search params and it will be parsed and serialized as JSON. This is a huge improvement over `URLSearchParams` which has limited support for array-like structures and nested data. + +For example, navigating to the following route: + +```tsx +const link = ( + +) +``` + +Will result in the following URL: + +``` +/shop?pageIndex=3&includeCategories=%5B%22electronics%22%2C%22gifts%22%5D&sortBy=price&desc=true +``` + +When this URL is parsed, the search params will be accurately converted back to the following JSON: + +```json +{ + "pageIndex": 3, + "includeCategories": ["electronics", "gifts"], + "sortBy": "price", + "desc": true +} +``` + +If you noticed, there are a few things going on here: + +- The first level of the search params is flat and string based, just like `URLSearchParams`. +- First level values that are not strings are accurately preserved as actual numbers and booleans. +- Nested data structures are automatically converted to URL-safe JSON strings + +> 🧠 It's common for other tools to assume that search params are always flat and string-based which is why we've chosen to keep things URLSearchParam compliant at the first level. This ultimately means that even though TanStack Router is managing your nested search params as JSON, other tools will still be able to write to the URL and read first-level params normally. + +## Validating and Typing Search Params + +Despite TanStack Router being able to parse search params into reliable JSON, they ultimately still came from **a user-facing raw-text input**. Similar to other serialization boundaries, this means that before you consume search params, they should be validated into a format that your application can trust and rely on. + +### Enter Validation + TypeScript! + +TanStack Router provides convenient APIs for validating and typing search params. This all starts with the `Route`'s `validateSearch` option: + +```tsx +// /routes/shop.products.tsx + +type ProductSearchSortOptions = 'newest' | 'oldest' | 'price' + +type ProductSearch = { + page: number + filter: string + sort: ProductSearchSortOptions +} + +export const Route = createFileRoute('/shop/products')({ + validateSearch: (search: Record): ProductSearch => { + // validate and parse the search params into a typed state + return { + page: Number(search?.page ?? 1), + filter: (search.filter as string) || '', + sort: (search.sort as ProductSearchSortOptions) || 'newest', + } + }, +}) +``` + +In the above example, we're validating the search params of the `allProductsRoute` and returning a typed `ProductSearch` object. This typed object is then made available to this route's other options **and any child routes, too!** + +### Validating Search Params + +The `validateSearch` option is a function that is provided the JSON parsed (but non-validated) search params as a `Record` and returns a typed object of your choice. It's usually best to provide sensible fallbacks for malformed or unexpected search params so your users' experience stays non-interrupted. + +Here's an example: + +```tsx +// /routes/shop.products.tsx + +type ProductSearchSortOptions = 'newest' | 'oldest' | 'price' + +type ProductSearch = { + page: number + filter: string + sort: ProductSearchSortOptions +} + +export const Route = createFileRoute('/shop/products')({ + validateSearch: (search: Record): ProductSearch => { + // validate and parse the search params into a typed state + return { + page: Number(search?.page ?? 1), + filter: (search.filter as string) || '', + sort: (search.sort as ProductSearchSortOptions) || 'newest', + } + }, +}) +``` + +Here's an example using the [Zod](https://zod.dev/) library (but feel free to use any validation library you want) to both validate and type the search params in a single step: + +```tsx +// /routes/shop.products.tsx + +import { z } from 'zod' + +const productSearchSchema = z.object({ + page: z.number().catch(1), + filter: z.string().catch(''), + sort: z.enum(['newest', 'oldest', 'price']).catch('newest'), +}) + +type ProductSearch = z.infer + +export const Route = createFileRoute('/shop/products')({ + validateSearch: (search) => productSearchSchema.parse(search), +}) +``` + +Because `validateSearch` also accepts an object with the `parse` property, this can be shortened to: + +```tsx +validateSearch: productSearchSchema +``` + +In the above example, we used Zod's `.catch()` modifier instead of `.default()` to avoid showing an error to the user because we firmly believe that if a search parameter is malformed, you probably don't want to halt the user's experience through the app to show a big fat error message. That said, there may be times that you **do want to show an error message**. In that case, you can use `.default()` instead of `.catch()`. + +The underlying mechanics why this works relies on the `validateSearch` function throwing an error. If an error is thrown, the route's `onError` option will be triggered (and `error.routerCode` will be set to `VALIDATE_SEARCH` and the `errorComponent` will be rendered instead of the route's `component` where you can handle the search param error however you'd like. + +#### Adapters + +When using a library like [Zod](https://zod.dev/) to validate search params you might want to `transform` search params before committing the search params to the URL. A common `zod` `transform` is `default` for example. + +```tsx +import { createFileRoute } from '@tanstack/react-router' +import { z } from 'zod' + +const productSearchSchema = z.object({ + page: z.number().default(1), + filter: z.string().default(''), + sort: z.enum(['newest', 'oldest', 'price']).default('newest'), +}) + +export const Route = createFileRoute('/shop/products/')({ + validateSearch: productSearchSchema, +}) +``` + +It might be surprising that when you try to navigate to this route, `search` is required. The following `Link` will type error as `search` is missing. + +```tsx + +``` + +For validation libraries we recommend using adapters which infer the correct `input` and `output` types. + +### Zod Adapter + +An adapter is provided for [Zod](https://zod.dev/) which will pipe through the correct `input` type and `output` type + +```tsx +import { createFileRoute } from '@tanstack/react-router' +import { zodSearchValidator } from '@tanstack/router-zod-adapter' +import { z } from 'zod' + +const productSearchSchema = z.object({ + page: z.number().default(1), + filter: z.string().default(''), + sort: z.enum(['newest', 'oldest', 'price']).default('newest'), +}) + +export const Route = createFileRoute('/shop/products/')({ + validateSearch: zodSearchValidator(productSearchSchema), +}) +``` + +The important part here is the following use of `Link` no longer requires `search` params + +```tsx + +``` + +However the use of `catch` here overrides the types and makes `page`, `filter` and `sort` `unknown` causing type loss. We have handled this case by providing a `fallback` generic function which retains the types but provides a `fallback` value when validation fails + +```tsx +import { createFileRoute } from '@tanstack/react-router' +import { fallback, zodSearchValidator } from '@tanstack/router-zod-adapter' +import { z } from 'zod' + +const productSearchSchema = z.object({ + page: fallback(z.number(), 1).default(1), + filter: fallback(z.string(), '').default(''), + sort: fallback(z.enum(['newest', 'oldest', 'price']), 'newest').default( + 'newest', + ), +}) + +export const Route = createFileRoute('/shop/products/')({ + validateSearch: zodSearchValidator(productSearchSchema), +}) +``` + +Therefore when navigating to this route, `search` is optional and retains the correct types. + +While not recommended, it is also possible to configure `input` and `output` type in case the `output` type is more accurate than the `input` type + +```tsx +const productSearchSchema = z.object({ + page: fallback(z.number(), 1).default(1), + filter: fallback(z.string(), '').default(''), + sort: fallback(z.enum(['newest', 'oldest', 'price']), 'newest').default( + 'newest', + ), +}) + +export const Route = createFileRoute('/shop/products/')({ + validateSearch: zodSearchValidator({ + schema: productSearchSchema, + input: 'output', + output: 'input', + }), +}) +``` + +This provides flexibility in which type you want to infer for navigation and which types you want to infer for reading search params. + +### Valibot Adapter + +When using [Valibot](https://valibot.dev/) we recommend using the adapter. This ensures the correct `input` and `output` types are used for navigation and reading search params + +```tsx +import { valibotSearchValidator } from '@tanstack/router-valibot-adapter' +import { createFileRoute } from '@tanstack/react-router' +import * as v from 'valibot' + +const productSearchSchema = v.object({ + page: v.optional(v.fallback(v.number(), 1), 1), + filter: v.optional(v.fallback(v.string(), ''), ''), + sort: v.optional( + v.fallback(v.picklist(['newest', 'oldest', 'price']), 'newest'), + 'newest', + ), +}) + +export const Route = createFileRoute('/shop/products/')({ + validateSearch: valibotSearchValidator(productSearchSchema), +}) +``` + +### Arktype Adapter + +[!WARNING] +This adapter expects the arktype beta + +When using [ArkType](https://arktype.io/) we recommend using the adapter. This ensures the correct `input` and `output` types are used for navigation and reading search params + +```tsx +import { arkTypeSearchValidator } from '@tanstack/router-arktype-adapter' +import { createFileRoute } from '@tanstack/react-router' +import * as v from 'valibot' +import { type } from 'arktype' + +const productSearchSchema = type({ + page: 'number = 1', + filter: 'string = ""', + sort: '"newest" | "oldest" | "price" = "newest"', +}) + +export const Route = createFileRoute('/shop/products/')({ + validateSearch: arkTypeSearchValidator(productSearchSchema), +}) +``` + +## Reading Search Params + +Once your search params have been validated and typed, you're finally ready to start reading and writing to them. There are a few ways to do this in TanStack Router, so let's check them out. + +### Using Search Params in Loaders + +Please read the [Search Params in Loaders](./data-loading.md#using-loaderdeps-to-access-search-params) section for more information about how to read search params in loaders with the `loaderDeps` option. + +### Search Params are inherited from Parent Routes + +The search parameters and types of parents are merged as you go down the route tree, so child routes also have access to their parent's search params: + +- `shop.products.tsx` + +```tsx +const productSearchSchema = z.object({ + page: z.number().catch(1), + filter: z.string().catch(''), + sort: z.enum(['newest', 'oldest', 'price']).catch('newest'), +}) + +type ProductSearch = z.infer + +export const Route = createFileRoute('/shop/products')({ + validateSearch: productSearchSchema, +}) +``` + +- `shop.products.$productId.tsx` + +```tsx +export const Route = createFileRoute('/shop/products/$productId')({ + beforeLoad: ({ search }) => { + search + // ^? ProductSearch ✅ + }, +}) +``` + +### Search Params in Components + +You can access your route's validated search params in your route's `component` via the `useSearch` hook. + +```tsx +// /routes/shop.products.tsx + +export const Route = createFileRoute('/shop/products')({ + validateSearch: productSearchSchema, +}) + +const ProductList = () => { + const { page, filter, sort } = Route.useSearch() + + return
...
+} +``` + +> [!TIP] +> If your component is code-split, you can use the [getRouteApi function](./code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-routeapi-class) to avoid having to import the `Route` configuration to get access to the typed `useSearch()` hook. + +### Search Params outside of Route Components + +You can access your route's validated search params anywhere in your app using the `useSearch` hook. By passing the `from` id/path of your origin route, you'll get even better type safety: + +```tsx +const allProductsRoute = createRoute({ + getParentRoute: () => shopRoute, + path: 'products', + validateSearch: productSearchSchema, +}) + +// Somewhere else... + +const routeApi = getRouteApi('/shop/products') + +const ProductList = () => { + const routeSearch = routeApi.useSearch() + + // OR + + const { page, filter, sort } = useSearch({ + from: allProductsRoute.fullPath, + }) + + return
...
+} +``` + +Or, you can loosen up the type-safety and get an optional `search` object by passing `strict: false`: + +```tsx +function ProductList() { + const search = useSearch({ + strict: false, + }) + // { + // page: number | undefined + // filter: string | undefined + // sort: 'newest' | 'oldest' | 'price' | undefined + // } + + return
...
+} +``` + +## Writing Search Params + +Now that you've learned how to read your route's search params, you'll be happy to know that you've already seen the primary APIs to modify and update them. Let's remind ourselves a bit + +### `` + +The best way to update search params is to use the `search` prop on the `` component. Remember, if a `to` prop is omitted, will update the search for the current page. Here's an example: + +```tsx +// /routes/shop.products.tsx +export const Route = createFileRoute('/shop/products')({ + validateSearch: productSearchSchema, +}) + +const ProductList = () => { + return ( +
+ ({ page: prev.page + 1 })} + > + Next Page + +
+ ) +} +``` + +### `useNavigate(), navigate({ search })` + +The `navigate` function also accepts a `search` option that works the same way as the `search` prop on ``: + +```tsx +// /routes/shop.products.tsx +export const Route = createFileRoute('/shop/products/$productId')({ + validateSearch: productSearchSchema, +}) + +const ProductList = () => { + const navigate = useNavigate({ from: Route.fullPath }) + + return ( +
+ +
+ ) +} +``` + +### `router.navigate({ search })` + +The `router.navigate` function works exactly the same way as the `useNavigate`/`navigate` hook/function above. + +### `` + +The `` component works exactly the same way as the `useNavigate`/`navigate` hook/function above, but accepts its options as props instead of a function argument. diff --git a/docs/framework/react/guide/server-functions.md b/docs/framework/react/guide/server-functions.md new file mode 100644 index 0000000000..8628fc2ef5 --- /dev/null +++ b/docs/framework/react/guide/server-functions.md @@ -0,0 +1,259 @@ +--- +id: server-functions +title: Server Functions +--- + +As [TanStack Start](./tanstack-start.md) is a full-stack framework, we need a way to call a function on the client which then executes some code on the server. + +This is where Server Functions come in. + +## What are Server Functions? + +> [!TIP] +> You can think of Server Functions like mini-portals that let your users trigger a pre-defined action on the server (like a built-in RPC solution 🤯). + +Server Functions are actions that can be executed on the server from the client or from other server functions. + +When a server function is called, it will execute the server-side code and return the result to the caller (regardless of whether the caller is a client or another server function). + +Server Functions are more than just a way to send and receive data. They're like a bridge that lets you connect your backend code (the behind-the-scenes magic) directly to your frontend code (what the user sees), making it easier to build a seamless user experience. + +## How to use Server Functions in TanStack Start + +While some frameworks use special pragmas to denote a function that will execute on the server, Start uses a utility to +create an instance of a server function. + +```typescript +const yourFn = createServerFn('POST', async () => { + // Server-side code lives here +}) +``` + +This function can then be called from the client: + +```tsx +function Component() { + // Just to demonstrate that this is a client-side function + const buttonRef = (el: HTMLButtonElement) => { + if (!el) return + el.addEventListener('click', async () => { + const result = await yourFn() + console.info(result) + }) + } + + return +} + +// Or, even just: +function Component() { + return +} +``` + +Or from another server function: + +```typescript +const yourFn2 = createServerFn('POST', async () => { + const result = await yourFn() + console.info(result) +}) +``` + +Or even from other server-side code: + +```typescript +async function someServerFunction() { + const result = await yourFn() + console(result) +} +``` + +When this function is called from the client, it will make a request to the server, execute the server-side code, and +return the serialized result to the client. + +## Server Function Arguments + +Like any function, server functions can take arguments: + +```typescript +const yourFn = createServerFn('POST', async (val: number) => { + // Server-side code lives here +}) + +// Call it like this: +yourFn(123) +``` + +Only one argument is supported, but you can pass an object if you need to pass multiple values: + +```typescript +const yourFn = createServerFn('POST', async (obj: { a: number; b: number }) => { + // Server-side code lives here +}) +``` + +Any serializable value can be passed as an argument to a server function. + +## Serialization + +Anything that can be serialized via `JSON.stringify` and `JSON.parse` can be used as an argument to or returned from a +server function. + +This includes: + +- `string` +- `number` +- `boolean` +- `null` +- `Array` +- `Object` + +In addition, we support serializing the following: + +- [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)s of other serializable types +- [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise)s of other + serializable types + +## No-JS Server Functions + +Without JavaScript enabled, there's only one way to execute server functions: by submitting a form. + +This is done by adding a `form` element to the page +with [the HTML attribute `action`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/action). + +> Notice that we mentioned the **HTML** attribute `action`. This attribute only accepts a string in HTML, just like all +> other attributes. +> +> While React +> 19 [added support for passing a function to `action`](https://react.dev/reference/react-dom/components/form#form), +> it's +> a React-specific feature and not part of the HTML standard. + +The `action` attribute tells the browser where to send the form data when the form is submitted. In this case, we want +to send the form data to the server function. + +To do this, we can utilize the `url` property of the server function: + +```typescript +const yourFn = createServerFn('POST', async () => { + // Server-side code lives here +}) + +console.info(yourFn.url) +``` + +And pass this to the `action` attribute of the form: + +```tsx +function Component() { + return ( + + + + ) +} +``` + +When the form is submitted, the server function will be executed. + +### No-JS Server Function Arguments + +To pass arguments to a server function when submitting a form, you can use the `input` element with the `name` attribute +to attach the argument to the [`FormData`](https://developer.mozilla.org/en-US/docs/Web/API/FormData) passed to your +server function: + +```tsx +const yourFn = createServerFn('POST', async (formData: FormData) => { + // `val` will be '123' + const val = formData.get('val') + // ... +}) + +function Component() { + return ( + // We need to tell the server that our data type is `multipart/form-data` by setting the `encType` attribute on the form. +
+ + +
+ ) +} +``` + +When the form is submitted, the server function will be executed with the form's data as an argument. + +### No-JS Server Function Return Value + +Regardless of whether JavaScript is enabled, the server function will return a response to the HTTP request made from +the client. + +When JavaScript is enabled, this response can be accessed as the return value of the server function in the client's +JavaScript code. + +```typescript +const yourFn = createServerFn('POST', async () => { + return 'Hello, world!' +}) + +// `.then` is not available when JavaScript is disabled +yourFn().then(console.log) +``` + +However, when JavaScript is disabled, there is no way to access the return value of the server function in the client's +JavaScript code. + +Instead, the server function can provide a response to the client, telling the browser to navigate in a certain way. + +When combined with a `loader`, we're able to provide an experience similar to a single-page application, even when +JavaScript is disabled; +all by telling the browser to reload the current page with new data piped through the `loader`: + +```tsx +import * as fs from 'fs' +import { createFileRoute } from '@tanstack/react-router' +import { createServerFn } from '@tanstack/start' + +const filePath = 'count.txt' + +async function readCount() { + return parseInt( + await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'), + ) +} + +const getCount = createServerFn('GET', () => { + return readCount() +}) + +const updateCount = createServerFn('POST', async (formData: FormData) => { + const count = await readCount() + const addBy = Number(formData.get('addBy')) + await fs.promises.writeFile(filePath, `${count + addBy}`) + // Reload the page to trigger the loader again + return new Response('ok', { status: 301, headers: { Location: '/' } }) +}) + +export const Route = createFileRoute('/')({ + component: Home, + loader: async () => await getCount(), +}) + +function Home() { + const state = Route.useLoaderData() + + return ( +
+
+ + +
+
{state}
+
+ ) +} +``` diff --git a/docs/framework/react/guide/ssr.md b/docs/framework/react/guide/ssr.md new file mode 100644 index 0000000000..a166415230 --- /dev/null +++ b/docs/framework/react/guide/ssr.md @@ -0,0 +1,229 @@ +--- +id: ssr +title: SSR +--- + +Server Side Rendering (SSR) is the process of rendering a component on the server and sending the HTML markup to the client. The client then hydrates the markup into a fully interactive component. + +There are usually two different flavors of SSR to be considered: + +- Non-streaming SSR + - The entire page is rendered on the server and sent to the client in one single HTML request, including the serialized data the application needs to hydrate on the client. +- Streaming SSR + - The critical first paint of the page is rendered on the server and sent to the client in one single HTML request, including the serialized data the application needs to hydrate on the client + - The rest of the page is then streamed to the client as it is rendered on the server. + +This guide will explain how to implement both flavors of SSR with TanStack Router! + +## Non-Streaming SSR + +Non-Streaming server-side rendering is the classic process of rendering the markup for your entire application page on the server and sending the completed HTML markup (and data) to the client. The client then hydrates the markup into a fully interactive application again. + +To implement non-streaming SSR with TanStack Router, you will need the following utilities: + +- `StartServer` from `@tanstack/start` + - e.g. `` + - Rendering this component in your server entry will render your application and also automatically handle application-level hydration/dehydration and implement the `Wrap` component option on `Router` +- `StartClient` from `@tanstack/start` + - e.g. `` + - Rendering this component in your client entry will render your application and also automatically implement the `Wrap` component option on `Router` + +### Router Creation + +Since your router will exist both on the server and the client, it's important that you create your router in a way that is consistent between both of these environments. The easiest way to do this is to expose a `createRouter` function in a shared file that can be imported and called by both your server and client entry files. + +- `src/router.tsx` + +```tsx +import * as React from 'react' +import { createRouter as createTanstackRouter } from '@tanstack/react-router' +import { routeTree } from './routeTree.gen' + +export function createRouter() { + return createTanstackRouter({ routeTree }) +} + +declare module '@tanstack/react-router' { + interface Register { + router: ReturnType + } +} +``` + +Now you can import this function in both your server and client entry files and create your router. + +- `src/entry-server.tsx` + +```tsx +import { createRouter } from './router' + +export async function render(req, res) { + const router = createRouter() +} +``` + +- `src/entry-client.tsx` + +```tsx +import { createRouter } from './router' + +const router = createRouter() +``` + +### Server History + +On the client, Router defaults to using an instance of `createBrowserHistory`, which is the preferred type of history to use on the client. On the server, however, you will want to use an instance of `createMemoryHistory` instead. This is because `createBrowserHistory` uses the `window` object, which does not exist on the server. + +> 🧠 Make sure you initialize your memory history with the server URL that is being rendered. + +- `src/entry-server.tsx` + +```tsx +const router = createRouter() + +const memoryHistory = createMemoryHistory({ + initialEntries: [opts.url], +}) +``` + +After creating the memory history instance, you can update the router to use it. + +- `src/entry-server.tsx` + +```tsx +router.update({ + history: memoryHistory, +}) +``` + +### Loading Critical Router Data on the Server + +In order to render your application on the server, you will need to ensure that the router has loaded any critical data via it's route loaders. To do this, you can `await router.load()` before rendering your application. This will quite literally wait for each of the matching route matches found for this url to run their route's `loader` functions in parallel. + +- `src/entry-server.tsx` + +```tsx +await router.load() +``` + +## Automatic Loader Dehydration/Hydration + +Resolved loader data fetched by routes is automatically dehydrated and rehydrated by TanStack Router so long as you complete the standard SSR steps outlined in this guide. + +⚠️ If you are using deferred data streaming, you will also need to ensure that you have implemented the [SSR Streaming & Stream Transform](#streaming-ssr) pattern near the end of this guide. + +For more information on how to utilize data loading and data streaming, see the [Data Loading](./data-loading.md) and [Data Streaming](../data-streaming) guides. + +### Rendering the Application on the Server + +Now that you have a router instance that has loaded all of the critical data for the current URL, you can render your application on the server: + +```tsx +// src/entry-server.tsx + +const html = ReactDOMServer.renderToString() +``` + +### Handling Not Found Errors + +`router` has a method `hasNotFoundMatch` to check if a not-found error has occurred during the rendering process. Use this method to check if a not-found error has occurred and set the response status code accordingly: + +```tsx +// src/entry-server.tsx +if (router.hasNotFoundMatch()) statusCode = 404 +``` + +### All Together Now! + +Here is a complete example of a server entry file that uses all of the concepts discussed above. + +```tsx +// src/entry-server.tsx +import * as React from 'react' +import ReactDOMServer from 'react-dom/server' +import { createMemoryHistory } from '@tanstack/react-router' +import { StartServer } from '@tanstack/start' +import { createRouter } from './router' + +export async function render(url, response) { + const router = createRouter() + + const memoryHistory = createMemoryHistory({ + initialEntries: [url], + }) + + router.update({ + history: memoryHistory, + }) + + await router.load() + + const appHtml = ReactDOMServer.renderToString() + + response.statusCode = router.hasNotFoundMatch() ? 404 : 200 + response.setHeader('Content-Type', 'text/html') + response.end(`${appHtml}`) +} +``` + +## Rendering the Application on the Client + +On the client, things are much simpler. + +- Create your router instance +- Render your application using the `` component + +```tsx +// src/entry-client.tsx + +import * as React from 'react' +import ReactDOM from 'react-dom/client' + +import { StartClient } from '@tanstack/start' +import { createRouter } from './router' + +const router = createRouter() + +ReactDOM.hydrateRoot(document, ) +``` + +With this setup, your application will be rendered on the server and then hydrated on the client! + +## Streaming SSR + +Streaming SSR is the most modern flavor of SSR and is the process of continuously and incrementally sending HTML markup to the client as it is rendered on the server. This is slightly different from traditional SSR in concept because beyond being able to dehydrate and rehydrate a critical first paint, markup and data with less priority or slower response times can be streamed to the client after the initial render, but in the same request. + +This pattern can be useful for pages that have slow or high-latency data fetching requirements. For example, if you have a page that needs to fetch data from a third-party API, you can stream the critical initial markup and data to the client and then stream the less-critical third-party data to the client as it is resolved. + +**This streaming pattern is all automatic as long as you are using `renderToPipeableStream`**. + +## Streaming Dehydration/Hydration + +Streaming dehydration/hydration is an advanced pattern that goes beyond markup and allows you to dehydrate and stream any supporting data from the server to the client and rehydrate it on arrival. This is useful for applications that may need to further use/manage the underlying data that was used to render the initial markup on the server. + +## Data Transformers + +When using SSR, data passed between the server and the client must be serialized before it is sent across network-boundaries. By default, TanStack Router will serialize data using a very lightweight serializer that supports a few basic types beyond JSON.stringify/JSON.parse. + +Out of the box, the following types are supported: + +- `Date` +- `undefined` + +If you feel that there are other types that should be supported by default, please open an issue on the TanStack Router repository. + +If you are using more complex data types like `Map`, `Set`, `BigInt`, etc, you may need to use a custom serializer to ensure that your type-definitions are accurate and your data is correctly serialized and deserialized. This is where the `transformer` option on `createRouter` comes in. + +The Data Transformer API allows the usage of a custom serializer that can allow us to transparently use these data types when communicating across the network. + +The following example shows usage with [SuperJSON](https://github.com/blitz-js/superjson), however, anything that implements [`Router Transformer`](../api/router/RouterOptionsType.md#transformer-property) can be used. + +```tsx +import { SuperJSON } from 'superjson' + +const router = createRouter({ + transformer: SuperJSON, +}) +``` + +Just like that, TanStack Router will now appropriately use SuperJSON to serialize data across the network. diff --git a/docs/framework/react/guide/static-route-data.md b/docs/framework/react/guide/static-route-data.md new file mode 100644 index 0000000000..913c1fa4dc --- /dev/null +++ b/docs/framework/react/guide/static-route-data.md @@ -0,0 +1,81 @@ +--- +title: Static Route Data +--- + +When creating routes, you can optionally specify a `staticData` property in the route's options. This object can literally contain anything you want as long as it's synchronously available when you create your route. + +In addition to being able to access this data from the route itself, you can also access it from any match under the `match.staticData` property. + +## Example + +- `posts.tsx` + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + staticData: { + customData: 'Hello!', + }, +}) +``` + +You can then access this data anywhere you have access to your routes, including matches that can be mapped back to their routes. + +- `__root.tsx` + +```tsx +import { createRootRoute } from '@tanstack/react-router' + +export const Route = createRootRoute({ + component: () => { + const matches = useMatches() + + return ( +
+ {matches.map((match) => { + return
{match.staticData.customData}
+ })} +
+ ) + }, +}) +``` + +## Enforcing Static Data + +If you want to enforce that a route has static data, you can use declaration merging to add a type to the route's static option: + +```tsx +declare module '@tanstack/react-router' { + interface StaticDataRouteOption { + customData: string + } +} +``` + +Now, if you try to create a route without the `customData` property, you'll get a type error: + +```tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + staticData: { + // Property 'customData' is missing in type '{ customData: number; }' but required in type 'StaticDataRouteOption'.ts(2741) + }, +}) +``` + +## Optional Static Data + +If you want to make static data optional, simply add a `?` to the property: + +```tsx +declare module '@tanstack/react-router' { + interface StaticDataRouteOption { + customData?: string + } +} +``` + +As long as there are any required properties on the `StaticDataRouteOption`, you'll be required to pass in an object. diff --git a/docs/framework/react/guide/tanstack-start.md b/docs/framework/react/guide/tanstack-start.md new file mode 100644 index 0000000000..737afcd37c --- /dev/null +++ b/docs/framework/react/guide/tanstack-start.md @@ -0,0 +1,289 @@ +--- +id: tanstack-start +title: TanStack Start +--- + +TanStack Start is a full-stack framework for building server-rendered React applications built on top of [TanStack Router](https://tanstack.com/router). + +To set up a TanStack Start project, you'll need to: + +1. Install the dependencies +2. Add a configuration file +3. Create required templating + +Follow this guide to build a basic TanStack Start web application. Together, we will use TanStack Start to: + +- Serve an index page... +- Which displays a counter... +- With a button to increment the counter persistently. + +[Here is what that will look like](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/start-basic-counter) + +Create a new project if you're starting fresh. + +```shell +mkdir myApp +cd myApp +npm init -y +``` + +Create a `tsconfig.json` file with at least the following settings: + +```jsonc +{ + "compilerOptions": { + "jsx": "react-jsx", + "moduleResolution": "Bundler", + "module": "Preserve", + "target": "ES2022", + "skipLibCheck": true, + }, +} +``` + +# Install Dependencies + +TanStack Start is powered by [Vinxi](https://vinxi.vercel.app/) and [TanStack Router](https://tanstack.com/router) and requires them as dependencies. + +To install them, run: + +```shell +npm i @tanstack/start @tanstack/react-router vinxi +``` + +You'll also need React and the Vite React plugin, so install them too: + +```shell +npm i react react-dom @vitejs/plugin-react +``` + +and some TypeScript: + +```shell +npm i -D typescript @types/react @types/react-dom +``` + +# Update Configuration Files + +We'll then update our `package.json` to reference the new Vinxi entry point and set `"type": "module"`: + +```jsonc +{ + // ... + "type": "module", + "scripts": { + "dev": "vinxi dev", + "build": "vinxi build", + "start": "vinxi start", + }, +} +``` + +To tell Vinxi that it should start TanStack Start's minimal behavior, we need to configure the `app.config.ts` file: + +```typescript +// app.config.ts +import { defineConfig } from '@tanstack/start/config' + +export default defineConfig({}) +``` + +# Add the Basic Templating + +There are four required files for TanStack Start usage: + +1. The router configuration +2. The server entry point +3. The client entry point +4. The root of your application + +Once configuration is done, we'll have a file tree that looks like the following: + +``` +. +├── app/ +│ ├── routes/ +│ │ └── `__root.tsx` +│ ├── `client.tsx` +│ ├── `router.tsx` +│ ├── `routeTree.gen.ts` +│ └── `ssr.tsx` +├── `.gitignore` +├── `app.config.ts` +├── `package.json` +└── `tsconfig.json` +``` + +## The Router Configuration + +This is the file that will dictate the behavior of TanStack Router used within Start. Here, you can configure everything +from the default [preloading functionality](./preloading.md) to [caching staleness](./data-loading.md). + +```tsx +// app/router.tsx +import { createRouter as createTanStackRouter } from '@tanstack/react-router' +import { routeTree } from './routeTree.gen' + +export function createRouter() { + const router = createTanStackRouter({ + routeTree, + }) + + return router +} + +declare module '@tanstack/react-router' { + interface Register { + router: ReturnType + } +} +``` + +> `routeTree.gen.ts` is not a file you're expected to have at this point. +> It will be generated when you run TanStack Start (via `npm run dev` or `npm run start`) for the first time. + +## The Server Entry Point + +As TanStack Start is an [SSR](https://unicorn-utterances.com/posts/what-is-ssr-and-ssg) framework, we need to pipe this router +information to our server entry point: + +```tsx +// app/ssr.tsx +import { + createStartHandler, + defaultStreamHandler, +} from '@tanstack/start/server' +import { getRouterManifest } from '@tanstack/start/router-manifest' + +import { createRouter } from './router' + +export default createStartHandler({ + createRouter, + getRouterManifest, +})(defaultStreamHandler) +``` + +This allows us to know what routes and loaders we need to execute when the user hits a given route. + +## The Client Entry Point + +Now we need a way to hydrate our client-side JavaScript once the route resolves to the client. We do this by piping the same +router information to our client entry point: + +```tsx +// app/client.tsx +import { hydrateRoot } from 'react-dom/client' +import { StartClient } from '@tanstack/start' +import { createRouter } from './router' + +const router = createRouter() + +hydrateRoot(document.getElementById('root')!, ) +``` + +This enables us to kick off client-side routing once the user's initial server request has fulfilled. + +## The Root of Your Application + +Finally, we need to create the root of our application. This is the entry point for all other routes. The code in this file will wrap all other routes in the application. + +```tsx +// app/routes/__root.tsx +import { createRootRoute } from '@tanstack/react-router' +import { Outlet, ScrollRestoration } from '@tanstack/react-router' +import { Body, Head, Html, Meta, Scripts } from '@tanstack/start' +import * as React from 'react' + +export const Route = createRootRoute({ + meta: () => [ + { + charSet: 'utf-8', + }, + { + name: 'viewport', + content: 'width=device-width, initial-scale=1', + }, + { + title: 'TanStack Start Starter', + }, + ], + component: RootComponent, +}) + +function RootComponent() { + return ( + + + + ) +} + +function RootDocument({ children }: { children: React.ReactNode }) { + return ( + + + + + + {children} + + + + + ) +} +``` + +# Writing Your First Route + +Now that we have the basic templating setup, we can write our first route. This is done by creating a new file in the `app/routes` directory. + +```tsx +// app/routes/index.tsx +import * as fs from 'fs' +import { createFileRoute, useRouter } from '@tanstack/react-router' +import { createServerFn } from '@tanstack/start' + +const filePath = 'count.txt' + +async function readCount() { + return parseInt( + await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'), + ) +} + +const getCount = createServerFn('GET', () => { + return readCount() +}) + +const updateCount = createServerFn('POST', async (addBy: number) => { + const count = await readCount() + await fs.promises.writeFile(filePath, `${count + addBy}`) +}) + +export const Route = createFileRoute('/')({ + component: Home, + loader: async () => await getCount(), +}) + +function Home() { + const router = useRouter() + const state = Route.useLoaderData() + + return ( + + ) +} +``` + +That's it! 🤯 You've now set up a TanStack Start project and written your first route. 🎉 + +You can now run `npm run dev` to start your server and navigate to `http://localhost:3000` to see your route in action. diff --git a/docs/router/guide/type-safety.md b/docs/framework/react/guide/type-safety.md similarity index 91% rename from docs/router/guide/type-safety.md rename to docs/framework/react/guide/type-safety.md index 3faaed79e7..0cc6c0fc1d 100644 --- a/docs/router/guide/type-safety.md +++ b/docs/framework/react/guide/type-safety.md @@ -14,7 +14,7 @@ Routes are hierarchical, and so are their definitions. If you're using file-base ### Code-based Routing -If you're using the `Route` class directly, you'll need to be aware of how to ensure your routes are typed properly using the `Route`'s `getParentRoute` option. This is because child routes need to be aware of **all** of their parent routes types. Without this, those precious search params you parsed out of your _layout_ and _pathless layout_ routes, 3 levels up, would be lost to the JS void. +If you're using the `Route` class directly, you'll need to be aware of how to ensure your routes are typed properly using the `Route`'s `getParentRoute` option. This is because child routes need to be aware of **all** of their parent routes types. Without this, those precious search params you parsed out of your layout route 3 levels up would be lost to the JS void. So, don't forget to pass the parent route to your child routes! @@ -26,11 +26,7 @@ const parentRoute = createRoute({ ## Exported Hooks, Components, and Utilities -For the types of your router to work with top-level exports like `Link`, `useNavigate`, `useParams`, etc. they must permeate the TypeScript module boundary and be registered right into the library. To do this, we use declaration merging on the exported `Register` interface. - - - -# React +For the types of your router to work with top-level exports like `Link`, `useNavigate`, `useParams`, etc. they must permeate the type-script module boundary and be registered right into the library. To do this, we use declaration merging on the exported `Register` interface. ```ts const router = createRouter({ @@ -44,22 +40,6 @@ declare module '@tanstack/react-router' { } ``` -# Solid - -```ts -const router = createRouter({ - // ... -}) - -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} -``` - - - By registering your router with the module, you can now use the exported hooks, components, and utilities with your router's exact types. ## Fixing the Component Context Problem @@ -85,7 +65,7 @@ function PostsComponent() { Every hook and component that requires a context hint will have a `from` param where you can pass the ID or path of the route you are rendering within. -> 🧠 Quick tip: If your component is code-split, you can use the [getRouteApi function](./code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-getrouteapi-helper) to avoid having to pass in the `Route.fullPath` to get access to the typed `useParams()` and `useSearch()` hooks. +> 🧠 Quick tip: If your component is code-split, you can use the [getRouteApi function](./code-splitting.md#manually-accessing-route-apis-in-other-files-with-the-routeapi-class) to avoid having to pass in the `Route.fullPath` to get access to the typed `useParams()` and `useSearch()` hooks. ### What if I don't know the route? What if it's a shared component? @@ -137,13 +117,12 @@ As your application scales, TypeScript check times will naturally increase. Ther ### Only infer types you need -A great pattern with client side data caches (TanStack Query, etc.) is to prefetch data. For example with TanStack Query you might have a route which calls `queryClient.query` in a `loader`. +A great pattern with client side data caches (TanStack Query, etc.) is to prefetch data. For example with TanStack Query you might have a route which calls `queryClient.ensureQueryData` in a `loader`. ```tsx export const Route = createFileRoute('/posts/$postId/deep')({ - // (ctx: LoaderFnContext) => Promise loader: ({ context: { queryClient }, params: { postId } }) => - queryClient.query({ ...postQueryOptions(postId), staleTime: 'static' }), + queryClient.ensureQueryData(postQueryOptions(postId)), component: PostDeepComponent, }) @@ -155,16 +134,12 @@ function PostDeepComponent() { } ``` -This may look fine and for small route trees and you may not notice any TS performance issues. However in this case TS has to infer the loader's return type, despite it never being used in your route. If the loader data is a complex type with many routes that prefetch in this manner, it can slow down editor performance. In this case, the change is quite simple and let typescript infer `Promise`. +This may look fine and for small route trees and you may not notice any TS performance issues. However in this case TS has to infer the loader's return type, despite it never being used in your route. If the loader data is a complex type with many routes that prefetch in this manner, it can slow down editor performance. In this case, the change is quite simple and let typescript infer Promise. ```tsx export const Route = createFileRoute('/posts/$postId/deep')({ - // (ctx: LoaderFnContext) => Promise loader: async ({ context: { queryClient }, params: { postId } }) => { - await queryClient.query({ - ...postQueryOptions(postId), - staleTime: 'static', - }) + await queryClient.ensureQueryData(postQueryOptions(postId)) }, component: PostDeepComponent, }) @@ -186,11 +161,12 @@ Consider the following usage of `Link` ```tsx + ``` -**These examples are bad for TS performance**. That's because `search` resolves to a union of all `search` params for all routes and TS has to check whatever you pass to the `search` prop against this potentially big union. As your application grows, this check time will increase linearly to number of routes and search params. We have done our best to optimize for this case (TypeScript will typically do this work once and cache it) but the initial check against this large union is expensive. This also applies to `params` and other API's such as `useSearch`, `useParams`, `useNavigate` etc. +**These examples are bad for TS performance**. That's because `search` resolves to a union of all `search` params for all routes and TS has to check whatever you pass to the `search` prop against this potentially big union. As your application grows, this check time will increase linearly to number of routes and search params. We have done our best to optimize for this case (TypeScript will typically do this work once and cache it) but the initial check against this large union is expensive. This also applies to `params` and other API's such as `useSearch`, `useParams`, `useNavigate` etc -Instead you should try to narrow to relevant routes with `from` or `to`. +Instead you should try to narrow to relevant routes with `from` or `to` ```tsx @@ -204,7 +180,7 @@ const from: '/posts/$postId/deep' | '/posts/' = '/posts/' ``` -You can also pass branches to `from` to only resolve `search` or `params` to be from any descendants of that branch: +You can also pass branches to `from` to only resolve `search` or `params` to be from any descendants of that branch ```tsx const from = '/posts' diff --git a/docs/framework/react/installation.md b/docs/framework/react/installation.md new file mode 100644 index 0000000000..9d477c3932 --- /dev/null +++ b/docs/framework/react/installation.md @@ -0,0 +1,23 @@ +--- +title: Installation +--- + +You can install TanStack Router with any [NPM](https://npmjs.com) package manager. + +```bash +npm i @tanstack/react-router +# or +pnpm add @tanstack/react-router +#or +yarn add @tanstack/react-router +#or +bun add @tanstack/react-router +``` + +TanStack Router is currently only compatible with React and ReactDOM. If you would like to contribute to the React Native adapter, please reach out to us on [Discord](https://tlinz.com/discord). + +### Requirements + +- React v18.x.x +- ReactDOM v18.x.x +- TypeScript v5.x.x (TypeScript is optional, but recommended) diff --git a/docs/framework/react/migrate-from-react-location.md b/docs/framework/react/migrate-from-react-location.md new file mode 100644 index 0000000000..556cfce470 --- /dev/null +++ b/docs/framework/react/migrate-from-react-location.md @@ -0,0 +1,267 @@ +--- +title: Migration from React Location +--- + +Before you begin your journey in migrating from React Location, its important that you have a good understanding of the [Routing Concepts](./guide/routing-concepts.md) and [Design Decisions](./decisions-on-dx.md) used by TanStack Router. + +## Differences between React Location and TanStack Router + +React Location and TanStack Router share much of same design decisions concepts, but there are some key differences that you should be aware of. + +- React Location uses _generics_ to infer types for routes, while TanStack Router uses _module declaration merging_ to infer types. +- Route configuration in React Location is done using a single array of route definitions, while in TanStack Router, route configuration is done using a tree of route definitions starting with the [root route](./guide/routing-concepts.md#the-root-route). +- [File-based routing](./guide/file-based-routing.md) is the recommended way to define routes in TanStack Router, while React Location only allows you to define routes in a single file using a code-based approach. + - TanStack Router does support a [code-based approach](./guide/code-based-routing.md) to defining routes, but it is not recommended for most use cases. You can read more about why, over here: [why is file-based routing the preferred way to define routes?](./decisions-on-dx.md#3-why-is-file-based-routing-the-preferred-way-to-define-routes) + +## Migration guide + +In this guide we'll go over the process of migrating the [React Location Basic example](https://github.com/TanStack/router/tree/react-location/examples/basic) over to TanStack Router using file-based routing, with the end goal of having the same functionality as the original example (styling and other non-routing related code will be omitted). + +> [!TIP] +> To use a code-based approach for defining your routes, you can read the [code-based Routing](./guide/code-based-routing.md) guide. + +### Step 1: Swap over to TanStack Router's dependencies + +First, we need to install the dependencies for TanStack Router. + +```bash +npm install @tanstack/react-router @tanstack/router-devtools +``` + +And remove the React Location dependencies. + +```bash +npm uninstall @tanstack/react-location @tanstack/react-location-devtools +``` + +### Step 2: Use the file-based routing watcher + +If your project uses Vite (or one the supported bundlers), you can use the TanStack Router plugin to watch for changes in your routes files and automatically update the routes configuration. + +Installation of the Vite plugin: + +```bash +npm install -D @tanstack/router-plugin +``` + +And add it to your `vite.config.js`: + +```js +import { defineConfig } from 'vite' +import viteReact from '@vitejs/plugin-react' +import { TanStackRouterVite } from '@tanstack/router-plugin/vite' + +export default defineConfig({ + // ... + plugins: [TanStackRouterVite(), viteReact()], +}) +``` + +However, if your application does not use Vite, you use one of our other [supported bundlers](./guide/file-based-routing.md#prerequisites), or you can use the `@tanstack/router-cli` package to watch for changes in your routes files and automatically update the routes configuration. + +### Step 3: Add the file-based configuration file to your project + +Create a `tsr.config.json` file in the root of your project with the following content: + +```json +{ + "routesDirectory": "./src/routes", + "generatedRouteTree": "./src/routeTree.gen.ts" +} +``` + +You can find the full list of options for the `tsr.config.json` file [here](./guide/file-based-routing.md#options). + +### Step 4: Create the routes directory + +Create a `routes` directory in the `src` directory of your project. + +```bash +mkdir src/routes +``` + +### Step 5: Create the root route file + +```tsx +// src/routes/__root.tsx +import { createRootRoute, Outlet, Link } from '@tanstack/react-router' +import { TanStackRouterDevtools } from '@tanstack/router-devtools' + +export const Route = createRootRoute({ + component: () => { + return ( + <> +
+ + Home + + Posts +
+
+ + + + ) + }, +}) +``` + +### Step 6: Create the index route file + +```tsx +// src/routes/index.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/')({ + component: Index, +}) +``` + +> You will need to move any related components and logic needed for the index route from the `src/index.tsx` file to the `src/routes/index.tsx` file. + +### Step 7: Create the posts route file + +```tsx +// src/routes/posts.tsx +import { createFileRoute, Link, Outlet } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts')({ + component: Posts, + loader: async () => { + const posts = await fetchPosts() + return { + posts, + } + }, +}) + +function Posts() { + const { posts } = Route.useLoaderData() + return ( +
+ + +
+ ) +} +``` + +> You will need to move any related components and logic needed for the posts route from the `src/index.tsx` file to the `src/routes/posts.tsx` file. + +### Step 8: Create the posts index route file + +```tsx +// src/routes/posts.index.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/')({ + component: PostsIndex, +}) +``` + +> You will need to move any related components and logic needed for the posts index route from the `src/index.tsx` file to the `src/routes/posts.index.tsx` file. + +### Step 9: Create the posts id route file + +```tsx +// src/routes/posts.$postId.tsx +import { createFileRoute } from '@tanstack/react-router' + +export const Route = createFileRoute('/posts/$postId')({ + component: PostsId, + loader: async ({ params: { postId } }) => { + const post = await fetchPost(postId) + return { + post, + } + }, +}) + +function PostsId() { + const { post } = Route.useLoaderData() + // ... +} +``` + +> You will need to move any related components and logic needed for the posts id route from the `src/index.tsx` file to the `src/routes/posts.$postId.tsx` file. + +### Step 10: Generate the route tree + +If you are using one of the supported bundlers, the route tree will be generated automatically when you run the dev script. + +If you are not using one of the supported bundlers, you can generate the route tree by running the following command: + +```bash +npx tsr generate +``` + +### Step 11: Update the main entry file to render the Router + +Once you've generated the route-tree, you can then update the `src/index.tsx` file to create the router instance and render it. + +```tsx +// src/index.tsx +import React from 'react' +import ReactDOM from 'react-dom' +import { createRouter, RouterProvider } from '@tanstack/react-router' + +// Import the generated route tree +import { routeTree } from './routeTree.gen' + +// Create a new router instance +const router = createRouter({ routeTree }) + +// Register the router instance for type safety +declare module '@tanstack/react-router' { + interface Register { + router: typeof router + } +} + +const domElementId = 'root' // Assuming you have a root element with the id 'root' + +// Render the app +const rootElement = document.getElementById(domElementId) +if (!rootElement) { + throw new Error(`Element with id ${domElementId} not found`) +} + +ReactDOM.createRoot(rootElement).render( + + + , +) +``` + +### Finished! + +You should now have successfully migrated your application from React Location to TanStack Router using file-based routing. + +React Location also has a few more features that you might be using in your application. Here are some guides to help you migrate those features: + +- [Search params](./guide/search-params.md) +- [Data loading](./guide/data-loading.md) +- [History types](./guide/history-types.md) +- [Wildcard / Splat / Catch-all routes](./guide/routing-concepts.md#splat--catch-all-routes) +- [Authenticated routes](./guide/authenticated-routes.md) + +TanStack Router also has a few more features that you might want to explore: + +- [Router Context](./guide/router-context.md) +- [Preloading](./guide/preloading.md) +- [Pathless / Layout Routes](./guide/routing-concepts.md#pathless--layout-routes) +- [Route masking](./guide/route-masking.md) +- [SSR](./guide/ssr.md) +- ... and more! + +If you are facing any issues or have any questions, feel free to ask for help in the TanStack Discord. diff --git a/docs/framework/react/migrate-from-react-router.md b/docs/framework/react/migrate-from-react-router.md new file mode 100644 index 0000000000..5f32a4d019 --- /dev/null +++ b/docs/framework/react/migrate-from-react-router.md @@ -0,0 +1,34 @@ +--- +title: Migration from React Router Checklist +toc: false +--- + +**_If your UI is blank, open the console, and you will probably have some errors that read something along the lines of `cannot use 'useNavigate' outside of context` . This means there are React Router api’s that are still imported and referenced that you need to find and remove. The easiest way to make sure you find all React Router imports is to uninstall `react-router-dom` and then you should get typescript errors in your files. Then you will know what to change to a `@tanstack/react-router` import._** + +Here is the [example repo](https://github.com/Benanna2019/SickFitsForEveryone/tree/migrate-to-tanstack/router/React-Router) + +- [ ] Install Router - `npm i @tanstack/react-router` +- [ ] **Optional:** Uninstall React Router to get TypeScript errors on imports. + - At this point I don’t know if you can do a gradual migration, but it seems likely you could have multiple router providers, not desirable. + - The api’s between React Router and TanStack Router are very similar and could most likely be handled in a sprint cycle or two if that is your companies way of doing things. +- [ ] Create Routes for each existing React Router route we have +- [ ] Create root route +- [ ] Create router instance +- [ ] Add global module in main.tsx +- [ ] Remove any React Router (`createBrowserRouter` or `BrowserRouter`), `Routes`, and `Route` Components from main.tsx +- [ ] **Optional:** Refactor `render` function for custom setup/providers - The repo referenced above has an example - This was necessary in the case of Supertokens. Supertoken has a specific setup with React Router and a different setup with all other React implementations +- [ ] Set RouterProvider and pass it the router as the prop +- [ ] Replace all instances of React Router `Link` component with `@tanstack/react-router` `Link` component + - [ ] Add `to` prop with literal path + - [ ] Add `params` prop, where necessary with params like so `params={{ orderId: order.id }}` +- [ ] Replace all instances of React Router `useNavigate` hook with `@tanstack/react-router` `useNavigate` hook + - [ ] Set `to` property and `params` property where needed +- [ ] Replace any React Router `Outlet`'s with the `@tanstack/react-router` equivalent +- [ ] If you are using `useSearchParams` hook from React Router, move the search params default value to the validateSearch property on a Route definition. + - [ ] Instead of using the `useSearchParams` hook, use `@tanstack/react-router` `Link`'s search property to update the search params state + - [ ] To read search params you can do something like the following + - `const { page } = useSearch({ from: productPage.fullPath })` +- [ ] If using React Router’s `useParams` hook, update the import to be from `@tanstack/react-router` and set the `from` property to the literal path name where you want to read the params object from + - So say we have a route with the path name `orders/$orderid`. + - In the `useParams` hook we would set up our hook like so: `const params = useParams({ from: "/orders/$orderId" })` + - Then wherever we wanted to access the order id we would get it off of the params object `params.orderId` diff --git a/docs/framework/react/overview.md b/docs/framework/react/overview.md new file mode 100644 index 0000000000..dcf38f8ebd --- /dev/null +++ b/docs/framework/react/overview.md @@ -0,0 +1,159 @@ +--- +title: Overview +--- + +**TanStack Router is a router for building React applications**. Some of its features include: + +- 100% inferred TypeScript support +- Typesafe navigation +- Nested Routing and layout routes +- Built-in Route Loaders w/ SWR Caching +- Designed for client-side data caches (TanStack Query, SWR, etc.) +- Automatic route prefetching +- Asynchronous route elements and error boundaries +- File-based Route Generation +- Typesafe JSON-first Search Params state management APIs +- Path and Search Parameter Schema Validation +- Search Param Navigation APIs +- Custom Search Param parser/serializer support +- Search param middleware +- Route matching/loading middleware + +To get started quickly, head to the next page. For a more lengthy explanation, buckle up while I bring you up to speed! + +## "A Fork in the Route" + +Using a router to build applications is widely regarded as a must-have and is usually one of the first choices you’ll make in your tech stack. + +**So, why should to choose TanStack Router over another router?** + +To answer this question, we need to look at the other options in the space. There are many if you look hard enough, but in my experience, only a couple are worth exploring seriously: + +- **Next.js** - Widely regarded as the de facto framework for starting a new React project, it’s laser focused on performance, workflow, and bleeding edge technology. It’s APIs and abstractions are powerful, but can sometimes come across as non-standard. It's extremely fast growth and adoption in the industry has resulted in a featured packed experience, but not at the expense of feeling overwhelming and sometimes bloated. +- **Remix / React Router** - A full-stack framework based on the historically successful React Router offers a similarly powerful developer and user experience, with APIs and vision based firmly on web standards like Request/Response and a focus on running anywhere JS can run. Many of its APIs and abstractions are wonderfully designed and were inspiration for more than a few TanStack Router APIs. That said, its rigid design, bolted-on type safety and sometimes strict over-adherence to platform APIs can leave some developers wanting more. + +Both of these frameworks (and their routers) are great, and I can personally attest that both are very good solutions for build React applications. My experience has also taught me that these solutions could also be much better, especially around the actual routing APIs that are available to developers to make their apps faster, easier, and more enjoyable to work with. + +It's probably no surprise at this point that picking a router is so important that it is often tied 1-to-1 with your choice of framework, since most frameworks rely on a specific router. + +**Does this mean that TanStack Router is a framework?** + +TanStack Router itself is not a "framework" in the traditional sense, since it doesn't address a few other common full-stack concerns. However TanStack Router has been designed to be upgradable to a full-stack framework when used in conjunction with other tools that address bundling, deployments, and server-side-specific functionality. This is why we are currently developing [TanStack Start](https://tanstack.com/start), a full-stack framework that is built on top of TanStack Router and tools like Vinxi, Nitro, and Vite. + +For a deeper dive on the history of TanStack Router, feel free to read the [TanStack Router History](#). + +## Why TanStack Router? + +TanStack Router delivers on the same fundamental expectations as other routers that you’ve come to expect: + +- Nested routes, layout routes, grouped routes +- File-based Routing +- Parallel data loading +- Prefetching +- URL Path Params +- Error Boundaries and Handling +- SSR +- Prefetching +- Route Masking + +And it also delivers some new features that raise the bar: + +- 100% inferred TypeScript support +- Typesafe navigation +- Built-in SWR Caching for loaders +- Designed for client-side data caches (TanStack Query, SWR, etc.) +- Typesafe JSON-first Search Params state management APIs +- Path and Search Parameter Schema Validation +- Search Parameter Navigation APIs +- Custom Search Param parser/serializer support +- Search param middleware +- Inherited Route Context +- Mixed file-based and code-based routing + +Let’s dive into some of the more important ones in more detail! + +## 100% Inferred TypeScript Support + +Everything these days is written “in Typescript” or at the very least offers type definitions that are veneered over runtime functionality, but too few packages in the ecosystem actually design their APIs with TypeScript in mind. So while I’m pleased that your router is auto-completing your option fields and catching a few property/method typos here and there, there is much more to be had. + +- TanStack Router is fully aware of all of your routes and their configuration at any given point in your code. This includes the path, path params, search params, context, and any other configuration you’ve provided. Ultimately this means that you can navigate to any route in your app with 100% type safety and confidence that your link or navigate call will succeed. +- TanStack Router provides lossless type-inference. It uses countless generic type parameters to enforce and propagate any type information you give it throughout the rest its API and ultimately your app. No other router offers this level of type safety and developer confidence. + +What does all of that mean for you? + +- Faster feature development with auto-completion and type hints +- Safer and faster refactors +- Confidence that your code will work as expected + +## 1st Class Search Parameters + +Search parameters are often an afterthought, treated like a black box of strings (or string) that you can parse and update, but not much else. Existing solutions are **not** type-safe either, adding to the caution that is required to deal with them. Even the most "modern" frameworks and routers and leave it up to you to figure out how to manage this state. Sometimes they'll parse the search string into an object for you, or sometimes you're left to do it yourself with `URLSearchParams`. + +Let's step back and remember that **search params are the most powerful state manager in your entire application.** They are global, serializable, bookmarkable, and shareable making them the perfect place to store any kind of state that needs to survive a page refresh or a social share. + +To live up to that responsibility, search parameters are a first-class citizen in TanStack Router. While still based on standard URLSearchParams, TanStack Router uses a powerful parser/serializer to manage deeper and more complex data structures in your search params, all while keeping them type-safe and easy to work with. + +**It's like having `useState` right in the URL!** + +Search parameters are: + +- Automatically parsed and serialized as JSON +- Validated and typed +- Inherited from parent routes +- Accessible in loaders, components, and hooks +- Easily modified with the useSearch hook, Link, navigate, and router.navigate APIs +- Customizable with a custom search filters and middleware +- Subscribed via fine-grained search param selectors for efficient re-renders + +Once you start using TanStack Router's search parameters, you'll wonder how you ever lived without them. + +## Built-In Caching and Friendly Data Loading + +Data loading is a critical part of any application and while most existing routers offer some form of critical data loading APIs, they often fall short when it comes to caching and data lifecycle management. Existing solutions suffer from a few common problems: + +- No caching at all. Data is always fresh, but your users are left waiting for frequently accessed data to load over and over again. +- Overly-aggressive caching. Data is cached for too long, leading to stale data and a poor user experience. +- Blunt invalidation strategies and APIs. Data may be invalidated too often, leading to unnecessary network requests and wasted resources, or you may not have any fine-grained control over when data is invalidated at all. + +TanStack Router solves these problems with a two-prong approach to caching and data loading: + +### Built-in Cache + +TanStack Router provides a light-weight built-in caching layer that works seamlessly with the Router. This caching layer is loosely based on TanStack Query, but with fewer features and a much smaller API surface area. Like TanStack Query, sane but powerful defaults guaranty that your data is cached for reuse, invalidated when necessary, and garbage collected when not in use. It also provides a simple API for invalidating the cache manually when needed. + +### Flexible & Powerful Data Lifecycle APIs + +TanStack Router is designed with a flexible and powerful data loading API that more easily integrates with existing data fetching libraries like TanStack Query, SWR, Apollo, Relay, or even your own custom data fetching solution. Configurable APIs like `context`, `beforeLoad`, `loaderDeps` and `loader` work in unison to make it easy to define declarative data dependencies, prefetch data, and manage the lifecycle of an external data source with ease. + +## Inherited Route Context + +TanStack Router's router and route context is a powerful feature that allows you to define context that is specific to a route which is then inherited by all child routes. Even the router and root route's themselves can provide context. Context can be built up both synchronously and asynchronously, and can be used to share data, configuration, or even functions between routes and route configurations. This is especially useful for scenarios like: + +- Authentication and Authorization +- Hybrid SSR/CSR data fetching and preloading +- Theming +- Singletons and global utilities +- Curried or partial application across preloading, loading, and rendering stages + +Also, what would route context be if it weren't type-safe? TanStack Router's route context is fully type-safe and inferred at zero cost to you. + +## File-based and/or Code-Based Routing + +TanStack Router supports both file-based and code-based routing at the same time. This flexibility allows you to choose the approach that best fits your project's needs. + +TanStack Router's file-based routing approach is uniquely user-facing. Route configuration is generated for you either by the Vite plugin or TanStack Router CLI, leaving the usage of said generated code up to you! This means that you're always in total control of your routes and router, even if you use file-based routing. + +## Acknowledgements + +TanStack Router builds on concepts and patterns popularized by many other OSS projects, including: + +- [TRPC](https://trpc.io/) +- [Remix](https://remix.run) +- [Chicane](https://swan-io.github.io/chicane/) +- [Next.js](https://nextjs.org) + +We acknowledge the investment, risk and research that went into their development, but are excited to push the bar they have set even higher. + +## Let's go! + +Enough overview, there's so much more to do with TanStack Router. Hit that next button and let's get started! diff --git a/docs/framework/react/quick-start.md b/docs/framework/react/quick-start.md new file mode 100644 index 0000000000..07d08da9dd --- /dev/null +++ b/docs/framework/react/quick-start.md @@ -0,0 +1,225 @@ +--- +title: Quick Start +--- + +If you're feeling impatient and prefer to skip all of our wonderful documentation, here is the bare minimum to get going with TanStack Router using both file-based route generation and code-based route configuration: + +## Using File-Based Route Generation + +File based route generation (through Vite, and other supported bundlers) is the recommended way to use TanStack Router as it provides the best experience, performance, and ergonomics for the least amount of effort. + +### Install the Vite Plugin and the Router Devtools + +```bash +npm i -D @tanstack/router-plugin @tanstack/router-devtools +# or +pnpm add -D @tanstack/router-plugin @tanstack/router-devtools +# or +yarn add -D @tanstack/router-plugin @tanstack/router-devtools +# or +bun add -D @tanstack/router-plugin @tanstack/router-devtools +``` + +### Configure the Vite Plugin + +```tsx +// vite.config.ts +import { defineConfig } from 'vite' +import viteReact from '@vitejs/plugin-react' +import { TanStackRouterVite } from '@tanstack/router-plugin/vite' + +// https://vitejs.dev/config/ +export default defineConfig({ + plugins: [ + TanStackRouterVite(), + viteReact(), + // ..., + ], +}) +``` + +> [!TIP] +> If you are not using Vite, or any supported bundler, you can check out the [File-Based Routing](./guide/file-based-routing.md) guide for more info. + +Create the following files: + +- `src/routes/__root.tsx` +- `src/routes/index.lazy.tsx` +- `src/routes/about.lazy.tsx` +- `src/main.tsx` + +> 🧠 Route files with the `.lazy.tsx` extension are lazy loaded via separate bundles to keep the main bundle size as lean as possible. + +### `src/routes/__root.tsx` + +```tsx +import { createRootRoute, Link, Outlet } from '@tanstack/react-router' +import { TanStackRouterDevtools } from '@tanstack/router-devtools' + +export const Route = createRootRoute({ + component: () => ( + <> +
+ + Home + {' '} + + About + +
+
+ + + + ), +}) +``` + +### `src/routes/index.lazy.tsx` + +```tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/')({ + component: Index, +}) + +function Index() { + return ( +
+

Welcome Home!

+
+ ) +} +``` + +### `src/routes/about.lazy.tsx` + +```tsx +import { createLazyFileRoute } from '@tanstack/react-router' + +export const Route = createLazyFileRoute('/about')({ + component: About, +}) + +function About() { + return
Hello from About!
+} +``` + +### `src/main.tsx` + +Regardless if you are using the `@tanstack/router-plugin` package or manually running the `tsr watch`/`tsr generate` commands from your package scripts, the following file will be generated for you at `src/routeTree.gen.ts`. + +Import the generated route tree and create a new router instance: + +```tsx +import React, { StrictMode } from 'react' +import ReactDOM from 'react-dom/client' +import { RouterProvider, createRouter } from '@tanstack/react-router' + +// Import the generated route tree +import { routeTree } from './routeTree.gen' + +// Create a new router instance +const router = createRouter({ routeTree }) + +// Register the router instance for type safety +declare module '@tanstack/react-router' { + interface Register { + router: typeof router + } +} + +// Render the app +const rootElement = document.getElementById('root')! +if (!rootElement.innerHTML) { + const root = ReactDOM.createRoot(rootElement) + root.render( + + + , + ) +} +``` + +If you are working with this pattern you should change the `id` of the root `
` on your `index.html` file to `
` + +## Using Code-Based Route Configuration + +> [!IMPORTANT] +> The following example shows how to configure routes using code, and for simplicity's sake is in a single file for this demo. While code-based generation allows you to declare many routes and even the router instance in a single file, we recommend splitting your routes into separate files for better organization and performance as your application grows. + +```tsx +import React, { StrictMode } from 'react' +import ReactDOM from 'react-dom/client' +import { + Outlet, + RouterProvider, + Link, + createRouter, + createRoute, + createRootRoute, +} from '@tanstack/react-router' +import { TanStackRouterDevtools } from '@tanstack/router-devtools' + +const rootRoute = createRootRoute({ + component: () => ( + <> +
+ + Home + {' '} + + About + +
+
+ + + + ), +}) + +const indexRoute = createRoute({ + getParentRoute: () => rootRoute, + path: '/', + component: function Index() { + return ( +
+

Welcome Home!

+
+ ) + }, +}) + +const aboutRoute = createRoute({ + getParentRoute: () => rootRoute, + path: '/about', + component: function About() { + return
Hello from About!
+ }, +}) + +const routeTree = rootRoute.addChildren([indexRoute, aboutRoute]) + +const router = createRouter({ routeTree }) + +declare module '@tanstack/react-router' { + interface Register { + router: typeof router + } +} + +const rootElement = document.getElementById('app')! +if (!rootElement.innerHTML) { + const root = ReactDOM.createRoot(rootElement) + root.render( + + + , + ) +} +``` + +If you glossed over these examples or didn't understand something, we don't blame you, because there's so much more to learn to really take advantage of TanStack Router! Let's move on. diff --git a/docs/framework/react/start/authentication.md b/docs/framework/react/start/authentication.md new file mode 100644 index 0000000000..3c7d0f6f62 --- /dev/null +++ b/docs/framework/react/start/authentication.md @@ -0,0 +1,28 @@ +--- +id: authentication +title: Authentication +--- + + + +Authentication is the process of verifying the identity of a user. This is a critical part of any application that requires users to log in or access protected resources. TanStack Start provides the necessary full-stack APIs to implement authentication in your application. + +## What should I use? + +TanStack Start is **designed to work with any authentication provider**, so if you already have an authentication provider or strategy in mind, you can use either find an existing example or implement your own authentication logic using the full-stack APIs provided by TanStack Start. + +That said, authentication is not something to be taken lightly. After much vetting, usage and reviewing on our end, we highly recommend using [Clerk](https://clerk.dev) for the best possible authentication experience. Clerk provides a full suite of authentication APIs and UI components that make it easy to implement authentication in your application and provide a seamless user experience. + +## What is Clerk? + +[![Clerk Logo](https://raw.githubusercontent.com/tannerlinsley/files/master/partners/clerk.svg)](https://go.clerk.com/wOwHtuJ) + +Clerk is a modern authentication platform that provides a full suite of authentication APIs and UI components to help you implement authentication in your application. Clerk is designed to be easy to use and provides a seamless user experience. With Clerk, you can implement authentication in your application in minutes and provide your users with a secure and reliable authentication experience. + +- To learn more about Clerk, visit the [Clerk website](https://go.clerk.com/wOwHtuJ) +- To sign up, visit the [Clerk dashboard](https://go.clerk.com/PrSDXti) +- To get started with Clerk, check out our [official Start + Clerk examples!](../../../../examples/react/start-clerk-basic/) + +## Documentation & APIs + +Documentation for implementing your own authentication logic with TanStack Start is coming soon! In the meantime, you can check out any of the `-auth` prefixed [examples](../../../../examples) for a starting point. diff --git a/docs/framework/react/start/databases.md b/docs/framework/react/start/databases.md new file mode 100644 index 0000000000..3ce97fff59 --- /dev/null +++ b/docs/framework/react/start/databases.md @@ -0,0 +1,27 @@ +--- +id: databases +title: Databases +--- + +Databases are at the core of any dynamic application, providing the necessary infrastructure to store, retrieve, and manage data. TanStack Start makes it easy to integrate with a variety of databases, offering a flexible approach to managing your application's data layer. + +## What should I use? + +TanStack Start is **designed to work with any database provider**, so if you already have a preferred database system, you can integrate it with TanStack Start using the provided full-stack APIs. Whether you're working with SQL, NoSQL, or other types of databases, TanStack Start can handle your needs. + +That said, the choice of a database is critical to your application's performance, scalability, and reliability, which is we highly recommend using [Convex](https://convex.dev) for the best possible database experience. + +## What is Convex? + +[![Convex Logo](https://raw.githubusercontent.com/tannerlinsley/files/master/partners/convex.svg)](https://convex.dev) + +Convex is a powerful, serverless database platform that simplifies the process of managing your application's data. With Convex, you can build full-stack applications without the need to manually manage database servers or write complex queries. Convex provides a real-time, scalable, and transactional data backend that seamlessly integrates with TanStack Start, making it an excellent choice for modern web applications. + +Convex’s declarative data model and automatic conflict resolution ensure that your application remains consistent and responsive, even at scale. It’s designed to be developer-friendly, with a focus on simplicity and productivity. + +- To learn more about Convex, visit the [Convex website](https://convex.dev) +- To sign up, visit the [Convex dashboard](https://dashboard.convex.dev/signup) + +## Documentation & APIs + +Documentation for integrating different databases with TanStack Start is coming soon! In the meantime, keep an eye on our examples and guide to learn how to fully leverage your data layer across your TanStack Start application. diff --git a/docs/framework/react/start/getting-started.md b/docs/framework/react/start/getting-started.md new file mode 100644 index 0000000000..8b9acae243 --- /dev/null +++ b/docs/framework/react/start/getting-started.md @@ -0,0 +1,287 @@ +--- +id: getting-started +title: Getting Started +--- + +To set up a TanStack Start project, you'll need to: + +1. Install the dependencies +2. Add a configuration file +3. Create required templating + +Follow this guide to build a basic TanStack Start web application. Together, we will use TanStack Start to: + +- Serve an index page... +- Which displays a counter... +- With a button to increment the counter persistently. + +[Here is what that will look like](https://stackblitz.com/github/tanstack/router/tree/main/examples/react/start-basic-counter) + +Create a new project if you're starting fresh. + +```shell +mkdir myApp +cd myApp +npm init -y +``` + +Create a `tsconfig.json` file with at least the following settings: + +```jsonc +{ + "compilerOptions": { + "jsx": "react-jsx", + "moduleResolution": "Bundler", + "module": "Preserve", + "target": "ES2022", + "skipLibCheck": true, + }, +} +``` + +## Install Dependencies + +TanStack Start is powered by [Vinxi](https://vinxi.vercel.app/) and [TanStack Router](https://tanstack.com/router) and requires them as dependencies. + +To install them, run: + +```shell +npm i @tanstack/start @tanstack/react-router vinxi +``` + +You'll also need React and the Vite React plugin, so install them too: + +```shell +npm i react react-dom @vitejs/plugin-react +``` + +and some TypeScript: + +```shell +npm i -D typescript @types/react @types/react-dom +``` + +## Update Configuration Files + +We'll then update our `package.json` to reference the new Vinxi entry point and set `"type": "module"`: + +```jsonc +{ + // ... + "type": "module", + "scripts": { + "dev": "vinxi dev", + "build": "vinxi build", + "start": "vinxi start", + }, +} +``` + +To tell Vinxi that it should start TanStack Start's minimal behavior, we need to configure the `app.config.ts` file: + +```typescript +// app.config.ts +import { defineConfig } from '@tanstack/start/config' + +export default defineConfig({}) +``` + +## Add the Basic Templating + +There are four required files for TanStack Start usage: + +1. The router configuration +2. The server entry point +3. The client entry point +4. The root of your application + +Once configuration is done, we'll have a file tree that looks like the following: + +``` +. +├── app/ +│ ├── routes/ +│ │ └── `__root.tsx` +│ ├── `client.tsx` +│ ├── `router.tsx` +│ ├── `routeTree.gen.ts` +│ └── `ssr.tsx` +├── `.gitignore` +├── `app.config.ts` +├── `package.json` +└── `tsconfig.json` +``` + +## The Router Configuration + +This is the file that will dictate the behavior of TanStack Router used within Start. Here, you can configure everything +from the default [preloading functionality](./preloading.md) to [caching staleness](./data-loading.md). + +```tsx +// app/router.tsx +import { createRouter as createTanStackRouter } from '@tanstack/react-router' +import { routeTree } from './routeTree.gen' + +export function createRouter() { + const router = createTanStackRouter({ + routeTree, + }) + + return router +} + +declare module '@tanstack/react-router' { + interface Register { + router: ReturnType + } +} +``` + +> `routeTree.gen.ts` is not a file you're expected to have at this point. +> It will be generated when you run TanStack Start (via `npm run dev` or `npm run start`) for the first time. + +## The Server Entry Point + +As TanStack Start is an [SSR](https://unicorn-utterances.com/posts/what-is-ssr-and-ssg) framework, we need to pipe this router +information to our server entry point: + +```tsx +// app/ssr.tsx +import { + createStartHandler, + defaultStreamHandler, +} from '@tanstack/start/server' +import { getRouterManifest } from '@tanstack/start/router-manifest' + +import { createRouter } from './router' + +export default createStartHandler({ + createRouter, + getRouterManifest, +})(defaultStreamHandler) +``` + +This allows us to know what routes and loaders we need to execute when the user hits a given route. + +## The Client Entry Point + +Now we need a way to hydrate our client-side JavaScript once the route resolves to the client. We do this by piping the same +router information to our client entry point: + +```tsx +// app/client.tsx +import { hydrateRoot } from 'react-dom/client' +import { StartClient } from '@tanstack/start' +import { createRouter } from './router' + +const router = createRouter() + +hydrateRoot(document.getElementById('root')!, ) +``` + +This enables us to kick off client-side routing once the user's initial server request has fulfilled. + +## The Root of Your Application + +Finally, we need to create the root of our application. This is the entry point for all other routes. The code in this file will wrap all other routes in the application. + +```tsx +// app/routes/__root.tsx +import { createRootRoute } from '@tanstack/react-router' +import { Outlet, ScrollRestoration } from '@tanstack/react-router' +import { Body, Head, Html, Meta, Scripts } from '@tanstack/start' +import * as React from 'react' + +export const Route = createRootRoute({ + meta: () => [ + { + charSet: 'utf-8', + }, + { + name: 'viewport', + content: 'width=device-width, initial-scale=1', + }, + { + title: 'TanStack Start Starter', + }, + ], + component: RootComponent, +}) + +function RootComponent() { + return ( + + + + ) +} + +function RootDocument({ children }: { children: React.ReactNode }) { + return ( + + + + + + {children} + + + + + ) +} +``` + +## Writing Your First Route + +Now that we have the basic templating setup, we can write our first route. This is done by creating a new file in the `app/routes` directory. + +```tsx +// app/routes/index.tsx +import * as fs from 'fs' +import { createFileRoute, useRouter } from '@tanstack/react-router' +import { createServerFn } from '@tanstack/start' + +const filePath = 'count.txt' + +async function readCount() { + return parseInt( + await fs.promises.readFile(filePath, 'utf-8').catch(() => '0'), + ) +} + +const getCount = createServerFn('GET', () => { + return readCount() +}) + +const updateCount = createServerFn('POST', async (addBy: number) => { + const count = await readCount() + await fs.promises.writeFile(filePath, `${count + addBy}`) +}) + +export const Route = createFileRoute('/')({ + component: Home, + loader: async () => await getCount(), +}) + +function Home() { + const router = useRouter() + const state = Route.useLoaderData() + + return ( + + ) +} +``` + +That's it! 🤯 You've now set up a TanStack Start project and written your first route. 🎉 + +You can now run `npm run dev` to start your server and navigate to `http://localhost:3000` to see your route in action. diff --git a/docs/framework/react/start/hosting.md b/docs/framework/react/start/hosting.md new file mode 100644 index 0000000000..ebdecf8eee --- /dev/null +++ b/docs/framework/react/start/hosting.md @@ -0,0 +1,25 @@ +--- +id: hosting +title: Hosting +--- + +Hosting is the process of deploying your application to the internet so that users can access it. This is a critical part of any web development project, ensuring your application is available to the world. TanStack Start is built on [Nitro](https://nitro.unjs.io/), a powerful server toolkit for deploying web applications anywhere. Nitro allows TanStack Start to provide a unified API for SSR, streaming, and hydration on any hosting provider. + +## What should I use? + +TanStack Start is **designed to work with any hosting provider**, so if you already have a hosting provider in mind, you can deploy your application there using the full-stack APIs provided by TanStack Start. + +However, since hosting is one of the most crucial aspects of your application's performance, reliability, and scalability, we highly recommend using [Vercel](https://vercel.com) for the best possible hosting experience. + +## What is Vercel? + +[![Vercel Logo](https://raw.githubusercontent.com/tannerlinsley/files/master/partners/vercel.svg)](https://vercel.com) + +Vercel is a leading hosting platform that provides a fast, secure, and reliable environment for deploying your web applications. With Vercel, you can deploy your TanStack Start application in just a few clicks and benefit from features like a global edge network, automatic scaling, and seamless integrations with GitHub and GitLab. Vercel is designed to make your development process as smooth as possible, from local development to production deployment. + +- To learn more about Vercel, visit the [Vercel website](https://vercel.com) +- To sign up, visit the [Vercel dashboard](https://vercel.com/signup) + +## Documentation & APIs + +Documentation for deploying your application with different hosting providers is coming soon! diff --git a/docs/framework/react/start/observability.md b/docs/framework/react/start/observability.md new file mode 100644 index 0000000000..35077c510b --- /dev/null +++ b/docs/framework/react/start/observability.md @@ -0,0 +1,27 @@ +--- +id: observability +title: Observability +--- + +Observability is a critical aspect of modern web development, enabling you to monitor, trace, and debug your application’s performance and errors. TanStack Start integrates seamlessly with observability tools to provide comprehensive insights into how your application behaves in production, helping you ensure that everything runs smoothly. + +## What should I use? + +TanStack Start is **designed to work with any observability tool**, so you can integrate your preferred solution using the full-stack APIs provided by TanStack Start. Whether you need logging, tracing, or error monitoring, TanStack Start is flexible enough to meet your observability needs. + +However, for the best observability experience, we highly recommend using [Sentry](https://sentry.io). Sentry is a powerful, full-featured observability platform that provides real-time insights into your application's performance and error tracking. + +## What is Sentry? + +[![Sentry Logo](https://raw.githubusercontent.com/tannerlinsley/files/master/partners/sentry.svg)](https://sentry.io) + +Sentry is a leading observability platform that helps developers monitor and fix crashes in real-time. With Sentry, you can track errors, performance issues, and trends across your entire stack, from the frontend to the backend. Sentry integrates seamlessly with TanStack Start, enabling you to identify and resolve issues faster, maintain a high level of performance, and deliver a better experience to your users. + +Sentry’s comprehensive dashboards, alerting capabilities, and in-depth error analysis tools make it an invaluable resource for any development team looking to maintain control over their application’s health in production. + +- To learn more about Sentry, visit the [Sentry website](https://sentry.io) +- To sign up, visit the [Sentry dashboard](https://sentry.io/signup) + +## Documentation & APIs + +Documentation for integrating different observability tools with TanStack Start is coming soon! Stay tuned for more examples and guides on how to use Sentry effectively with your TanStack Start projects. diff --git a/docs/framework/react/start/overview.md b/docs/framework/react/start/overview.md new file mode 100644 index 0000000000..40f066adac --- /dev/null +++ b/docs/framework/react/start/overview.md @@ -0,0 +1,86 @@ +--- +id: overview +title: TanStack Start Overview +--- + +TanStack Start is a full-stack React framework powered by TanStack Router. It provides a full-document SSR, streaming, server functions, bundling, and more, powered by TanStack Router, Vinxi, and Vite. It is ready to deploy to your favorite hosting provider! + +## Router or Start? + +TanStack Router is a powerful, type-safe, and full-featured routing system for React applications. It is designed to handle the beefiest of full-stack routing requirements with ease. TanStack Start builds on top of Router's type system to provide type-safe full-stack APIs that keep you in the fast lane. + +What you get with TanStack Router: + +- 100% inferred TypeScript support +- Typesafe navigation +- Nested Routing and layout routes +- Built-in Route Loaders w/ SWR Caching +- Designed for client-side data caches (TanStack Query, SWR, etc.) +- Automatic route prefetching +- Asynchronous route elements and error boundaries +- File-based Route Generation +- Typesafe JSON-first Search Params state management APIs +- Path and Search Parameter Schema Validation +- Search Param Navigation APIs +- Custom Search Param parser/serializer support +- Search param middleware +- Route matching/loading middleware + +What you get with TanStack Start: + +- Full-document SSR +- Streaming +- Server Functions / RPCs +- Bundling +- Deployment +- Full-Stack Type Safety + +**In summary, use TanStack Router for client-side routing and TanStack Start for full-stack routing.** + +## How does it work? + +TanStack Start uses a tool called **Vinxi** to bundle and deploy your application. In fact, this is the same tool that powers Solid Start! With Vinxi, we can do a few things we couldn't do before: + +- Provide a unified API for SSR, streaming, and hydration +- Extract server-only code from your client-side code (e.g. server functions) +- Bundle your application for deployment to any hosting provider + +## When should I use it? + +TanStack Start is perfect for you if you want to build a full-stack React application with the following requirements: + +- Full-document SSR & Hydration +- Streaming +- Server Functions / RPCs +- Full-Stack Type Safety +- Robust Routing +- Rich Client-Side Interactivity + +## When might I not want to use it? + +TanStack Start is not for you if: + +- Your site will be 100% static +- Your goal is a server-rendered site with zero JS or minimal client-side interactivity +- You're looking for a React-Server-Component-first framework. (We'll support RSCs soon in our own awesome flavor!) + +## How is TanStack Start funded? + +TanStack works closely with our partners to provide the best possible developer experience while also providing solutions that work anywhere and are vetted by industry experts. Each of our partners plays a unique role in the TanStack ecosystem: + +- **Vercel**
+ Vercel + The leading hosting platform for web applications that provides a fast, secure, and reliable environment for deploying your web applications. We work closely with Vercel to ensure that TanStack Start applications not only deploy seamlessly to their platform, but also implement best practices for performance, security, and reliability regardless of where you end up deploying. +- **Clerk** + Clerk + The best possible authentication experience for modern web applications, including TanStack Start applications. Clerk provides TanStack Start users with first-class integrations and solutions to auth and collaborates closely with the TanStack team to ensure that TanStack Start provides APIs that are up to date with the latest in auth best practices. +- **Convex** + Convex + A serverless database platform that integrates seamlessly with TanStack Start. Convex is designed to simplify the process of managing your application's data and provides a real-time, scalable, and transactional data backend that works well with TanStack Start applications. Convex also collaborates closely with the TanStack team to ensure that TanStack Start provides APIs that are up to date with the latest in database best practices. +- **Sentry** + Sentry + A powerful, full-featured observability platform that integrates seamlessly with TanStack Start. Sentry helps developers monitor and fix crashes in real-time and provides insights into your application's performance and error tracking. Sentry collaborates closely with the TanStack team to ensure that TanStack Start provides APIs that are up to date with the latest in observability best practices. + +## Ready to get started? + +Proceed to the next page to learn how to install TanStack Start and create your first app! diff --git a/docs/router/api/file-based-routing.md b/docs/router/api/file-based-routing.md deleted file mode 100644 index 7c94d484d1..0000000000 --- a/docs/router/api/file-based-routing.md +++ /dev/null @@ -1,271 +0,0 @@ ---- -title: File-Based Routing API Reference ---- - -TanStack Router's file-based routing is quite flexible and can be configured to suit your project's needs. - -## Configuration options - -The following options are available for configuring the file-based routing: - -- [`routesDirectory` (required)](#routesdirectory-required) -- [`generatedRouteTree` (required)](#generatedroutetree-required) -- [`virtualRouteConfig`](#virtualrouteconfig) -- [`routeFilePrefix`](#routefileprefix) -- [`routeFileIgnorePrefix`](#routefileignoreprefix) -- [`routeFileIgnorePattern`](#routefileignorepattern) -- [`indexToken`](#indextoken) -- [`routeToken`](#routetoken) -- [`quoteStyle`](#quotestyle) -- [`semicolons`](#semicolons) -- [`autoCodeSplitting`](#autocodesplitting) -- [`disableTypes`](#disabletypes) -- [`addExtensions`](#addextensions) -- [`disableLogging`](#disablelogging) -- [`routeTreeFileHeader`](#routetreefileheader) -- [`routeTreeFileFooter`](#routetreefilefooter) -- [`enableRouteTreeFormatting`](#enableroutetreeformatting) -- [`tmpDir`](#tmpdir) - -> [!WARNING] -> Do not set the `routeFilePrefix`, `routeFileIgnorePrefix`, or `routeFileIgnorePattern` options, to match any of the tokens used in the **File Naming Conventions** guide, or you may run into unexpected behavior. - -### `routesDirectory` (required) - -This is the path to the directory where the route files are located, relative to the cwd (current working directory). - -By default, the value is set to the following and cannot be set to an empty `string` or `undefined`. - -```txt -./src/routes -``` - -### `generatedRouteTree` (required) - -This is the path to the file where the generated route tree will be saved, relative to the cwd (current working directory). - -By default, the value is set to the following and cannot be set to an empty `string` or `undefined`. - -```txt -./src/routeTree.gen.ts -``` - -If the [`disableTypes`](#disabletypes) is set to `true`, the generated route tree will be saved with the `.js` extension instead of `.ts`. - -### `virtualRouteConfig` - -This option is used to configure the Virtual File Routes feature. See the "Virtual File Routes" guide for more information. - -By default, this value is set to `undefined`. - -### `routeFilePrefix` - -This option is used to identify route files in the route directory. This means that only files that start with this prefix will be considered for routing. - -By default, this value is set to `` and as such all files in the route directory will be considered for routing. - -### `routeFileIgnorePrefix` - -This option is used to ignore specific files and directories in the route directory. This can be useful if you want to "opt-in" certain files or directories that you do not want to be considered for routing. - -By default, this value is set to `-`. - -When using this option, it allows you have structures like this where it let's you co-located related files that are not route files: - -```txt -src/routes -├── posts -│ ├── -components // Ignored -│ │ ├── Post.tsx -│ ├── index.tsx -│ ├── route.tsx -``` - -### `routeFileIgnorePattern` - -This option is used to ignore specific files and directories in the route directory. It can be used in regular expression format. For example, `.((css|const).ts)|test-page` will ignore files / directories with names containing `.css.ts`, `.const.ts` or `test-page`. - -By default, this value is set to `undefined`. - -### `routeToken` - -As mentioned in the Routing Concepts guide, a layout route is rendered at the specified path, and the child routes are rendered within the layout route. The `routeToken` is used to identify the layout route file in the route directory. - -By default, this value is set to `route`. - -> 🧠 the following filenames would equal the same runtime URL: - -```txt -src/routes/posts.tsx -> /posts -src/routes/posts.route.tsx -> /posts -src/routes/posts/route.tsx -> /posts -``` - -#### Using regex patterns for `routeToken` - -You can use a regular expression pattern instead of a literal string to match multiple layout route naming conventions. This is useful when you want more flexibility in your file naming. - -**In `tsr.config.json`** (JSON config), use an object with `regex` and optional `flags` properties: - -```json -{ - "routeToken": { "regex": "[a-z]+-layout", "flags": "i" } -} -``` - -**In code** (inline config), you can use a native `RegExp`: - -```ts -{ - routeToken: /[a-z]+-layout/i -} -``` - -With the regex pattern `[a-z]+-layout`, filenames like `dashboard.main-layout.tsx`, `posts.protected-layout.tsx`, or `admin.settings-layout.tsx` would all be recognized as layout routes. - -> [!NOTE] -> The regex is matched against the **entire** final segment of the route path. For example, with `routeToken: { "regex": "[a-z]+-layout" }`: -> -> - `dashboard.main-layout.tsx` matches (`main-layout` is the full segment) -> - `dashboard.my-layout-extra.tsx` does NOT match (the segment is `my-layout-extra`, not just `my-layout`) - -### `indexToken` - -As mentioned in the Routing Concepts guide, an index route is a route that is matched when the URL path is exactly the same as the parent route. The `indexToken` is used to identify the index route file in the route directory. - -By default, this value is set to `index`. - -> 🧠 the following filenames would equal the same runtime URL: - -```txt -src/routes/posts.index.tsx -> /posts/ -src/routes/posts/index.tsx -> /posts/ -``` - -#### Using regex patterns for `indexToken` - -Similar to `routeToken`, you can use a regular expression pattern for `indexToken` to match multiple index route naming conventions. - -**In `tsr.config.json`** (JSON config): - -```json -{ - "indexToken": { "regex": "[a-z]+-page" } -} -``` - -**In code** (inline config): - -```ts -{ - indexToken: /[a-z]+-page/ -} -``` - -With the regex pattern `[a-z]+-page`, filenames like `home-page.tsx`, `posts.list-page.tsx`, or `dashboard.overview-page.tsx` would all be recognized as index routes. - -#### Escaping regex tokens - -When using regex tokens, you can still escape a segment to prevent it from being treated as a token by wrapping it in square brackets. For example, if your `indexToken` is `{ "regex": "[a-z]+-page" }` and you want a literal route segment called `home-page`, name your file `[home-page].tsx`. - -### `quoteStyle` - -When your generated route tree is generated and when you first create a new route, those files will be formatted with the quote style you specify here. - -By default, this value is set to `single`. - -> [!TIP] -> You should ignore the path of your generated route tree file from your linter and formatter to avoid conflicts. - -### `semicolons` - -When your generated route tree is generated and when you first create a new route, those files will be formatted with semicolons if this option is set to `true`. - -By default, this value is set to `false`. - -> [!TIP] -> You should ignore the path of your generated route tree file from your linter and formatter to avoid conflicts. - -### `autoCodeSplitting` - -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. - -By default, this value is set to `false`. - -> [!IMPORTANT] -> The next major release of TanStack Router (i.e. v2), will have this value defaulted to `true`. - -### `disableTypes` - -This option is used to disable generating types for the route tree. - -If set to `true`, the generated route tree will not include any types and will be written as a `.js` file instead of a `.ts` file. - -By default, this value is set to `false`. - -### `addExtensions` - -- Type: `boolean | string` -- Default: `false` - -This option controls file extensions on import paths in the generated route tree. - -- `false` — Extensions are stripped from import paths (e.g. `'./routes/posts'`) -- `true` — The original file extensions are kept (e.g. `'./routes/posts.tsx'`) -- `string` — The original extension is replaced with the provided one (e.g. `'js'` produces `'./routes/posts.js'`) - -Passing a string is useful when your project uses ESM, since Node.js ESM requires `.js` extensions for imports even when the source files are `.ts` or `.tsx`. - -```ts -// Example: replace .tsx/.ts extensions with .js in generated imports -TanStackRouterVite({ - addExtensions: 'js', -}) -``` - -### `disableLogging` - -This option turns off the console logging for the route generation process. - -By default, this value is set to `false`. - -### `routeTreeFileHeader` - -This option let's you prepend content to the start of the generated route tree file. - -By default, this value is set to: - -```json -[ - "/* eslint-disable */", - "// @ts-nocheck", - "// noinspection JSUnusedGlobalSymbols" -] -``` - -### `routeTreeFileFooter` - -This option let's you append content to the end of the generated route tree file. - -By default, this value is set to: - -```json -[] -``` - -### `enableRouteTreeFormatting` - -This option turns on the formatting function on the generated route tree file, which can be time-consuming for large projects. - -By default, this value is set to `true`. - -### `tmpDir` - -Atomic file writes (route files and the generated route tree file) are implemented by creating a temporary file first and then renaming it to their actual location. - -This config option allows to configure the path of the temp directory that will be used for creating those temporary files. -If it is a relative path, it will be resolved to the current working directory. -If this value is not set, `process.env.TSR_TMP_DIR` will be used. -If `process.env.TSR_TMP_DIR` is not set, it will default to `.tanstack/tmp` relative to the current working directory. diff --git a/docs/router/api/router/NavigateOptionsType.md b/docs/router/api/router/NavigateOptionsType.md deleted file mode 100644 index e9c3470e18..0000000000 --- a/docs/router/api/router/NavigateOptionsType.md +++ /dev/null @@ -1,78 +0,0 @@ ---- -id: NavigateOptionsType -title: NavigateOptions type ---- - -The `NavigateOptions` type is used to describe the options that can be used when describing a navigation action in TanStack Router. - -```tsx -type NavigateOptions = ToOptions & { - replace?: boolean - resetScroll?: boolean - hashScrollIntoView?: boolean | ScrollIntoViewOptions - viewTransition?: boolean | ViewTransitionOptions - ignoreBlocker?: boolean - reloadDocument?: boolean - href?: string -} -``` - -## NavigateOptions properties - -The `NavigateOptions` object accepts the following properties: - -### `replace` - -- Type: `boolean` -- Optional -- Defaults to `false`. -- If `true`, the location will be committed to the browser history using `history.replace` instead of `history.push`. - -### `resetScroll` - -- Type: `boolean` -- Optional -- Defaults to `true` so that the scroll position will be reset to 0,0 after the location is committed to the browser history. -- If `false`, the scroll position will not be reset to 0,0 after the location is committed to history. - -### `hashScrollIntoView` - -- Type: `boolean | ScrollIntoViewOptions` -- Optional -- Defaults to `true` so the element with an id matching the hash will be scrolled into view after the location is committed to history. -- If `false`, the element with an id matching the hash will not be scrolled into view after the location is committed to history. -- If an object is provided, it will be passed to the `scrollIntoView` method as options. -- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) for more information on `ScrollIntoViewOptions`. - -### `viewTransition` - -- Type: `boolean | ViewTransitionOptions` -- Optional -- Defaults to `false`. -- If `true`, navigation will be called using `document.startViewTransition()`. -- If [`ViewTransitionOptions`](./ViewTransitionOptionsType.md), route navigations will be called using `document.startViewTransition({update, types})` where `types` will determine the strings array passed with `ViewTransitionOptions["types"]`. If the browser does not support viewTransition types, the navigation will fall back to normal `document.startTransition()`, same as if `true` was passed. -- If the browser does not support this api, this option will be ignored. -- See [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Document/startViewTransition) for more information on how this function works. -- See [Google](https://developer.chrome.com/docs/web-platform/view-transitions/same-document#view-transition-types) for more information on viewTransition types - -### `ignoreBlocker` - -- Type: `boolean` -- Optional -- Defaults to `false`. -- If `true`, navigation will ignore any blockers that might prevent it. - -### `reloadDocument` - -- Type: `boolean` -- Optional -- Defaults to `false`. -- If `true`, navigation to a route inside of router will trigger a full page load instead of the traditional SPA navigation. - -### `href` - -- Type: `string` -- Optional -- This can be used instead of `to` to navigate to a fully built href, e.g. pointing to an external target. - -- [`ToOptions`](./ToOptionsType.md) diff --git a/docs/router/api/router/ParsedHistoryStateType.md b/docs/router/api/router/ParsedHistoryStateType.md deleted file mode 100644 index bbc398e7a2..0000000000 --- a/docs/router/api/router/ParsedHistoryStateType.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -id: ParsedHistoryStateType -title: ParsedHistoryState type ---- - -The `ParsedHistoryState` type represents a parsed state object. Additionally to `HistoryState`, it contains the index and the unique key of the route. - -```tsx -export type ParsedHistoryState = HistoryState & { - key?: string // TODO: Remove in v2 - use __TSR_key instead - __TSR_key?: string - __TSR_index: number -} -``` diff --git a/docs/router/api/router/RedirectType.md b/docs/router/api/router/RedirectType.md deleted file mode 100644 index 021c4ccd25..0000000000 --- a/docs/router/api/router/RedirectType.md +++ /dev/null @@ -1,47 +0,0 @@ ---- -id: RedirectType -title: Redirect type ---- - -The `Redirect` type is used to represent a redirect action in TanStack Router. - -```tsx -export type Redirect = { - statusCode?: number - throw?: any - headers?: HeadersInit -} & NavigateOptions -``` - -- [`NavigateOptions`](./NavigateOptionsType.md) - -## Redirect properties - -The `Redirect` object accepts/contains the following properties: - -### `statusCode` property - -- Type: `number` -- Optional -- The HTTP status code to use when redirecting - -### `throw` property - -- Type: `any` -- Optional -- If provided, will throw the redirect object instead of returning it. This can be useful in places where `throwing` in a function might cause it to have a return type of `never`. In that case, you can use `redirect({ throw: true })` to throw the redirect object instead of returning it. - -### `headers` property - -- Type: `HeadersInit` -- Optional -- The HTTP headers to use when redirecting. - -### Navigation Properties - -Since `Redirect` extends `NavigateOptions`, it also supports navigation properties: - -- **`to`**: Use for internal application routes (e.g., `/dashboard`, `../profile`) -- **`href`**: Use for external URLs (e.g., `https://example.com`, `https://authprovider.com`) - -> **Important**: For external URLs, always use the `href` property instead of `to`. The `to` property is designed for internal navigation within your application. diff --git a/docs/router/api/router/RouteApiType.md b/docs/router/api/router/RouteApiType.md deleted file mode 100644 index a8ba9d4b5a..0000000000 --- a/docs/router/api/router/RouteApiType.md +++ /dev/null @@ -1,183 +0,0 @@ ---- -id: RouteApiType -title: RouteApi Type ---- - -The `RouteApi` describes an instance that provides type-safe versions of common hooks like `useParams`, `useSearch`, `useRouteContext`, `useNavigate`, `useLoaderData`, and `useLoaderDeps` that are pre-bound to a specific route ID and corresponding registered route types. - -## `RouteApi` properties and methods - -The `RouteApi` has the following properties and methods: - -### `useMatch` method - -```tsx - useMatch(opts?: { - select?: (match: TAllContext) => TSelected - }): TSelected -``` - -- A type-safe version of the [`useMatch`](./useMatchHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. -- Options - - `opts.select` - - Optional - - `(match: RouteMatch) => TSelected` - - If supplied, this function will be called with the route match and the return value will be returned from `useMatch`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. - - `opts.structuralSharing` - - Optional - - `boolean` - - Configures whether structural sharing is enabled for the value returned by `select`. - - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. -- Returns - - If a `select` function is provided, the return value of the `select` function. - - If no `select` function is provided, the `RouteMatch` object or a loosened version of the `RouteMatch` object if `opts.strict` is `false`. - -### `useRouteContext` method - -```tsx - useRouteContext(opts?: { - select?: (search: TAllContext) => TSelected - }): TSelected -``` - -- A type-safe version of the [`useRouteContext`](./useRouteContextHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. -- Options - - `opts.select` - - Optional - - `(match: RouteContext) => TSelected` - - If supplied, this function will be called with the route match and the return value will be returned from `useRouteContext`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. -- Returns - - If a `select` function is provided, the return value of the `select` function. - - If no `select` function is provided, the `RouteContext` object or a loosened version of the `RouteContext` object if `opts.strict` is `false`. - -### `useSearch` method - -```tsx - useSearch(opts?: { - select?: (search: TFullSearchSchema) => TSelected - }): TSelected -``` - -- A type-safe version of the [`useSearch`](./useSearchHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. -- Options - - `opts.select` - - Optional - - `(match: TFullSearchSchema) => TSelected` - - If supplied, this function will be called with the route match and the return value will be returned from `useSearch`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. - - `opts.structuralSharing` - - Optional - - `boolean` - - Configures whether structural sharing is enabled for the value returned by `select`. - - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. -- Returns - - If a `select` function is provided, the return value of the `select` function. - - If no `select` function is provided, the `TFullSearchSchema` object or a loosened version of the `TFullSearchSchema` object if `opts.strict` is `false`. - -### `useParams` method - -```tsx - useParams(opts?: { - select?: (params: TAllParams) => TSelected - }): TSelected -``` - -- A type-safe version of the [`useParams`](./useParamsHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. -- Options - - `opts.select` - - Optional - - `(match: TAllParams) => TSelected` - - If supplied, this function will be called with the route match and the return value will be returned from `useParams`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. - - `opts.structuralSharing` - - Optional - - `boolean` - - Configures whether structural sharing is enabled for the value returned by `select`. - - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. -- Returns - - If a `select` function is provided, the return value of the `select` function. - - If no `select` function is provided, the `TAllParams` object or a loosened version of the `TAllParams` object if `opts.strict` is `false`. - -### `useLoaderData` method - -```tsx - useLoaderData(opts?: { - select?: (search: TLoaderData) => TSelected - }): TSelected -``` - -- A type-safe version of the [`useLoaderData`](./useLoaderDataHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. -- Options - - `opts.select` - - Optional - - `(match: TLoaderData) => TSelected` - - If supplied, this function will be called with the route match and the return value will be returned from `useLoaderData`. This value will also be used to determine if the hook should re-render its parent component using shallow equality checks. - - `opts.structuralSharing` - - Optional - - `boolean` - - Configures whether structural sharing is enabled for the value returned by `select`. - - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. -- Returns - - If a `select` function is provided, the return value of the `select` function. - - If no `select` function is provided, the `TLoaderData` object or a loosened version of the `TLoaderData` object if `opts.strict` is `false`. - -### `useLoaderDeps` method - -```tsx - useLoaderDeps(opts?: { - select?: (search: TLoaderDeps) => TSelected - }): TSelected -``` - -- A type-safe version of the [`useLoaderDeps`](./useLoaderDepsHook.md) hook that is pre-bound to the route ID that the `RouteApi` instance was created with. -- Options - - `opts.select` - - Optional - - `(match: TLoaderDeps) => TSelected` - - If supplied, this function will be called with the route match and the return value will be returned from `useLoaderDeps`. - - `opts.structuralSharing` - - Optional - - `boolean` - - Configures whether structural sharing is enabled for the value returned by `select`. - - See the [Render Optimizations guide](../../guide/render-optimizations.md) for more information. -- Returns - - If a `select` function is provided, the return value of the `select` function. - - If no `select` function is provided, the `TLoaderDeps` object. - -### `useNavigate` method - -```tsx - useNavigate(): // navigate function -``` - -- A type-safe version of [`useNavigate`](./useNavigateHook.md) that is pre-bound to the route ID that the `RouteApi` instance was created with. - -### `redirect` method - -```tsx - redirect(opts?: RedirectOptions): Redirect -``` - -- A type-safe version of the [`redirect`](./redirectFunction.md) function that is pre-bound to the route ID that the `RouteApi` instance was created with. -- The `from` parameter is automatically set to the route ID, enabling type-safe relative redirects. -- Options - - All options from [`redirect`](./redirectFunction.md) except `from`, which is automatically provided. -- Returns - - A `Redirect` object that can be thrown from `beforeLoad` or `loader` callbacks. - -#### Example - -```tsx -import { getRouteApi } from '@tanstack/react-router' - -const routeApi = getRouteApi('/dashboard/settings') - -export const Route = createFileRoute('/dashboard/settings')({ - beforeLoad: ({ context }) => { - if (!context.user) { - // Type-safe redirect - 'from' is automatically '/dashboard/settings' - throw routeApi.redirect({ - to: '../login', // Relative path to sibling route - }) - } - }, -}) -``` diff --git a/docs/router/api/router/RouteMatchType.md b/docs/router/api/router/RouteMatchType.md deleted file mode 100644 index b5009ebe68..0000000000 --- a/docs/router/api/router/RouteMatchType.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -id: RouteMatchType -title: RouteMatch type ---- - -The `RouteMatch` type represents a route match in TanStack Router. - -```tsx -interface RouteMatch { - id: string - routeId: string - pathname: string - params: Route['allParams'] - status: 'pending' | 'success' | 'error' | 'notFound' - isFetching: false | 'beforeLoad' | 'loader' - error: unknown - paramsError: unknown - searchError: unknown - updatedAt: number - loaderData?: Route['loaderData'] - context: Route['allContext'] - search: Route['fullSearchSchema'] - abortController: AbortController - cause: 'preload' | 'enter' | 'stay' - ssr?: boolean | 'data-only' -} -``` - -`status` describes the match's render state. `isFetching` independently exposes -active `beforeLoad` or loader work. In particular, a successful match can report -`isFetching: 'loader'` while stale data remains visible during a background -reload. - -The router state can contain matches below the pending, error, or not-found -boundary. Those matches remain observable as part of the structurally matched -lane even though the route renderer stops at the boundary. diff --git a/docs/router/api/router/RouteOptionsType.md b/docs/router/api/router/RouteOptionsType.md deleted file mode 100644 index 2adfc6e5c6..0000000000 --- a/docs/router/api/router/RouteOptionsType.md +++ /dev/null @@ -1,402 +0,0 @@ ---- -id: RouteOptionsType -title: RouteOptions type ---- - -The `RouteOptions` type is used to describe the options that can be used when creating a route. - -## RouteOptions properties - -The `RouteOptions` type accepts an object with the following properties: - -### `getParentRoute` method - -- Type: `() => TParentRoute` -- Required -- A function that returns the parent route of the route being created. This is required to provide full type safety to child route configurations and to ensure that the route tree is built correctly. - -### `path` property - -- Type: `string` -- Required, unless an `id` is provided to configure the route as a pathless layout route -- The path segment that will be used to match the route. - -### `id` property - -- Type: `string` -- Optional, but required if a `path` is not provided -- The unique identifier for the route if it is to be configured as a pathless layout route. If provided, the route will not match against the location pathname and its routes will be flattened into its parent route for matching. - -### `component` property - -- Type: `RouteComponent` or `LazyRouteComponent` -- Optional - Defaults to `` -- The content to be rendered when the route is matched. - -### `errorComponent` property - -- Type: `RouteComponent` or `LazyRouteComponent` -- Optional - Defaults to `routerOptions.defaultErrorComponent` -- The content to be rendered when the route encounters an error. - -### `pendingComponent` property - -- Type: `RouteComponent` or `LazyRouteComponent` -- Optional - Defaults to `routerOptions.defaultPendingComponent` -- The content to be rendered if and when the route is pending and has reached its pendingMs threshold. - -### `notFoundComponent` property - -- Type: `NotFoundRouteComponent` or `LazyRouteComponent` -- Optional - Defaults to `routerOptions.defaultNotFoundComponent` -- The content to be rendered when the route is not found. - -### `validateSearch` method - -- Type: `(rawSearchParams: unknown) => TSearchSchema` -- Optional -- A function that will be called when this route is matched and passed the raw search params from the current location and return valid parsed search params. If this function throws, the route will be put into an error state and the error will be thrown during render. If this function does not throw, its return value will be used as the route's search params and the return type will be inferred into the rest of the router. -- This is a planning callback. It must be deterministic and side-effect-free for the same input; do not navigate or mutate application/router state from it. -- Optionally, the parameter type can be tagged with the `SearchSchemaInput` type like this: `(searchParams: TSearchSchemaInput & SearchSchemaInput) => TSearchSchema`. If this tag is present, `TSearchSchemaInput` will be used to type the `search` property of `` and `navigate()` **instead of** `TSearchSchema`. The difference between `TSearchSchemaInput` and `TSearchSchema` can be useful, for example, to express optional search parameters. - -### `search.middlewares` property - -- Type: `(({search: TSearchSchema, next: (newSearch: TSearchSchema) => TSearchSchema}) => TSearchSchema)[]` -- Optional -- Search middlewares are functions that transform the search parameters when generating new links for a route or its descendants. -- A search middleware is passed in the current search (if it is the first middleware to run) or is invoked by the previous middleware calling `next`. - -### `parseParams` method (⚠️ deprecated, use `params.parse` instead) - -- Type: `(rawParams: Record) => TParams` -- Optional -- A function that will be called when this route is matched and passed the raw params from the current location and return valid parsed params. If this function throws, the route will be put into an error state and the error will be thrown during render. If this function does not throw, its return value will be used as the route's params and the return type will be inferred into the rest of the router. -- This is a planning callback. It must be deterministic and side-effect-free for the same input. - -### `stringifyParams` method (⚠️ deprecated, use `params.stringify` instead) - -- Type: `(params: TParams) => Record` -- Required if `parseParams` is provided -- A function that will be called when this route's parsed params are being used to build a location. This function should return a valid object of `Record` mapping. - -### `params.parse` method - -- Type: `(rawParams: Record) => TParams | false` -- Optional -- A function that will be called when this route is matched and passed the raw params from the current location and return valid parsed params. If this function throws, the route will be put into an error state and the error will be thrown during render. If this function returns parsed params, its return value will be used as the route's params and the return type will be inferred into the rest of the router. -- This is a planning callback. It must be deterministic and side-effect-free for the same input. -- Experimental: returning `false` during incoming route matching skips this route and allows matching to continue to another candidate route. - -### `params.priority` property - -- Type: `number` -- Optional -- Defaults to `0` -- Controls the matching order when multiple route candidates with `params.parse` can match the same URL segment. Higher numbers are tried first. If a higher-priority route's `params.parse` returns `false`, matching continues to the next candidate. -- This only affects competing candidates that use `params.parse`; normal route specificity still applies, so static routes continue to match before dynamic, optional, or wildcard routes. - -### `params.stringify` method - -- Type: `(params: TParams) => Record` -- A function that will be called when this route's parsed params are being used to build a location. This function should return a valid object of `Record` mapping. - -### `beforeLoad` method - -- Type: - -```tsx -type beforeLoad = ( - opts: RouteMatch & { - search: TFullSearchSchema - abortController: AbortController - preload: boolean - params: TAllParams - context: TParentContext - location: ParsedLocation - navigate: NavigateFn // @deprecated - buildLocation: BuildLocationFn - cause: 'preload' | 'enter' | 'stay' - }, -) => Promise | TRouteContext | void -``` - -- Optional -- [`ParsedLocation`](./ParsedLocationType.md) -- This async function is called before a route is loaded. If it fails, the route's loader and its descendants will not run. During navigation, ordinary errors become the match's error state and are passed to the `onError` function. During a preload, ordinary errors and not-found results are represented in the returned speculative match lane instead of rejecting the `preloadRoute` promise. -- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the `pendingComponent` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render. -- If this function returns a `TRouteContext` object, that object will be merged into the route's context and be made available in the `loader` and other related route components/methods. -- It's common to use this function to check if a user is authenticated and redirect them to a login page if they are not. To do this, you can either return or throw a `redirect` object from this function. - -> 🚧 `opts.navigate` has been deprecated and will be removed in the next major release. Use `throw redirect({ to: '/somewhere' })` instead. Read more about the `redirect` function [here](./redirectFunction.md). - -### `loader` method - -- Type: - -```tsx -type loaderFn = ( - opts: RouteMatch & { - abortController: AbortController - cause: 'preload' | 'enter' | 'stay' - context: TAllContext - deps: TLoaderDeps - location: ParsedLocation - params: TAllParams - preload: boolean - parentMatchPromise: Promise> - navigate: NavigateFn // @deprecated - route: AnyRoute - }, -) => Promise | TLoaderData | void - -type loader = - | loaderFn - | { - handler: loaderFn - staleReloadMode?: 'background' | 'blocking' - } -``` - -- Optional -- [`ParsedLocation`](./ParsedLocationType.md) -- This async function is called when a route is matched and passed the route's match object. During navigation, ordinary errors become the match's error state and are passed to the `onError` function. During a preload, ordinary errors and not-found results are represented in the returned speculative match lane instead of rejecting the `preloadRoute` promise. -- If this function returns a promise, the route will be put into a pending state and cause rendering to suspend until the promise resolves. If this route's pendingMs threshold is reached, the `pendingComponent` will be shown until it resolves. If the promise rejects, the route will be put into an error state and the error will be thrown during render. -- If this function returns a `TLoaderData` object, that object will be stored on the route match and can remain available in the in-memory cache after the match becomes inactive. Navigation-owned data uses `gcTime` for retention, while preload-owned data uses `preloadGcTime`. It can be accessed using the `useLoaderData` hook in any component that is a child of the route match before another `` is rendered. -- Deps must be returned by your `loaderDeps` function in order to appear. -- Use the object form to configure loader-specific behavior like `staleReloadMode`. -- `staleReloadMode: 'background'` preserves stale-while-revalidate behavior for stale successful matches. -- `staleReloadMode: 'blocking'` waits for the stale loader reload to complete before continuing. - -> 🚧 `opts.navigate` has been deprecated and will be removed in the next major release. Use `throw redirect({ to: '/somewhere' })` instead. Read more about the `redirect` function [here](./redirectFunction.md). - -### `loaderDeps` method - -- Type: - -```tsx -type loaderDeps = (opts: { search: TFullSearchSchema }) => Record -``` - -- Optional -- A function that will be called before this route is matched to provide additional unique identification to the route match and serve as a dependency tracker for when the match should be reloaded. It should return any serializable value that can uniquely identify the route match from navigation to navigation. -- This is a planning callback and cache-key function. It must be deterministic and side-effect-free for the same validated search input. The returned value and any serialization methods on it, such as `toJSON`, must also be side-effect-free. -- By default, path params are already used to uniquely identify a route match, so it's unnecessary to return these here. -- If your route match relies on search params for unique identification, it's required that you return them here so they can be made available in the `loader`'s `deps` argument. - -### `staleTime` property - -- Type: `number` -- Optional -- Defaults to `routerOptions.defaultStaleTime`, which defaults to `0` -- The amount of time in milliseconds that a route match's loader data will be considered fresh. If a route match is matched again within this time frame, its loader data will not be reloaded. - -### `preload` property - -- Type: `boolean` -- Optional -- Defaults to `true` -- If `false`, speculative preloads still run this route's `beforeLoad` function but skip its `loader`. A navigation runs both `beforeLoad` and the skipped `loader` normally. - -### `preloadStaleTime` property - -- Type: `number` -- Optional -- Defaults to `routerOptions.defaultPreloadStaleTime`, which defaults to `30_000` ms (30 seconds) -- The amount of time in milliseconds that loader data produced by a preload is considered fresh. Another preload or the first navigation can reuse it within this interval. After navigation accepts the generation, subsequent freshness uses `staleTime`. - -### `gcTime` property - -- Type: `number` -- Optional -- Defaults to `routerOptions.defaultGcTime`, which defaults to 5 minutes. -- The retention window in milliseconds for unused loader data from an ordinary load. Once the data is older than this value, it is eligible for pruning during a later cache reconciliation. - -### `shouldReload` property - -- Type: `boolean | ((args: LoaderArgs) => boolean)` -- Optional -- If `false` or returns `false`, the route match's loader data will not be reloaded on subsequent matches. -- If `true` or returns `true`, the route match's loader data will be reloaded on subsequent matches. -- If `undefined` or returns `undefined`, the route match's loader data will adhere to the default stale-while-revalidate behavior. - -### `caseSensitive` property - -- Type: `boolean` -- Optional -- If `true`, this route will be matched as case-sensitive. - -### `wrapInSuspense` property - -- Type: `boolean` -- Optional -- If `true`, this route will be forcefully wrapped in a suspense boundary, regardless if a reason is found to do so from inspecting its provided components. - -### `pendingMs` property - -- Type: `number` -- Optional -- Defaults to `routerOptions.defaultPendingMs`, which defaults to `1000` -- The threshold in milliseconds that a route must be pending before its `pendingComponent` is shown. - -### `pendingMinMs` property - -- Type: `number` -- Optional -- Defaults to `routerOptions.defaultPendingMinMs` which defaults to `500` -- The minimum amount of time in milliseconds that the pending component will be shown for if it is shown. This is useful to prevent the pending component from flashing on the screen for a split second. - -### `preloadGcTime` property - -- Type: `number` -- Optional -- Defaults to `routerOptions.defaultPreloadGcTime`, which defaults to 5 minutes. -- The retention window in milliseconds for unused loader data produced by a preload. Once the data is older than this value, it is eligible for pruning during a later cache reconciliation. Use `preloadStaleTime` to control whether retained data is fresh enough to reuse without reloading. - -### `preSearchFilters` property (⚠️ deprecated, use `search.middlewares` instead) - -- Type: `((search: TFullSearchSchema) => TFullSearchSchema)[]` -- Optional -- An array of functions that will be called when generating any new links to this route or its grandchildren. -- Each function will be called with the current search params and should return a new search params object that will be used to generate the link. -- It has a `pre` prefix because it is called before the user-provided function that is passed to `navigate`/`Link` etc has a chance to modify the search params. - -### `postSearchFilters` property (⚠️ deprecated, use `search.middlewares` instead) - -- Type: `((search: TFullSearchSchema) => TFullSearchSchema)[]` -- Optional -- An array of functions that will be called when generating any new links to this route or its grandchildren. -- Each function will be called with the current search params and should return a new search params object that will be used to generate the link. -- It has a `post` prefix because it is called after the user-provided function that is passed to `navigate`/`Link` etc has modified the search params. - -### `onError` property - -- Type: `(error: any) => void` -- Optional -- A function that will be called when an error is thrown during a navigation or preload event. -- If this function throws a [`redirect`](./redirectFunction.md), the redirect replaces the original error and becomes control flow for the current navigation or preload operation. If it throws a not-found result, that result replaces the original error in the current match lane. - -### `onEnter` property - -- Type: `(match: RouteMatch) => void` -- Optional -- A function that will be called when a route is matched and loaded after not being matched in the previous location. -- Routes below an error or not-found boundary do not enter the active route lifecycle. The boundary itself remains active. A previously hidden route receives `onEnter` when a navigation makes it active again. - -### `onStay` property - -- Type: `(match: RouteMatch) => void` -- Optional -- A function that will be called when a route is matched and loaded after being matched in the previous location. -- Both navigations must include the route in the active branch, through the first error or not-found boundary. - -### `onLeave` property - -- Type: `(match: RouteMatch) => void` -- Optional -- A function that will be called when a route is no longer matched after being matched in the previous location. -- This also runs when a navigation hides a previously active route below an error or not-found boundary, even if the route remains structurally matched. -- Background reloads update route data without dispatching these lifecycle callbacks. - -### `onCatch` property - -- Type: `(error: unknown) => void` in React and Vue; `(error: Error) => void` in Solid -- Optional - Defaults to `routerOptions.defaultOnCatch` -- A function that will be called when errors are caught when the route encounters an error. - -### `remountDeps` method - -- Type: - -```tsx -type remountDeps = (opts: RemountDepsOptions) => any - -interface RemountDepsOptions< - in out TRouteId, - in out TFullSearchSchema, - in out TAllParams, - in out TLoaderDeps, -> { - routeId: TRouteId - search: TFullSearchSchema - params: TAllParams - loaderDeps: TLoaderDeps -} -``` - -- Optional -- A function that will be called to determine whether a route component shall be remounted after navigation. If this function returns a different value than previously, it will remount. -- The return value needs to be JSON serializable. -- By default, a route component will not be remounted if it stays active after a navigation. - -Example: -If you want to configure to remount a route component upon `params` change, use: - -```tsx -remountDeps: ({ params }) => params -``` - -### `headers` method - -- Type: - -```tsx -type headers = (opts: { - matches: Array - match: RouteMatch - params: TAllParams - loaderData?: TLoaderData -}) => Promise> | Record -``` - -- Optional -- Allows you to specify custom HTTP headers to be sent when this route is rendered during SSR. The function receives the current match context and should return a plain object of header name/value pairs. - -### `head` method - -- Type: - -```tsx -type head = (ctx: { - matches: Array - match: RouteMatch - params: TAllParams - loaderData?: TLoaderData -}) => - | Promise<{ - links?: RouteMatch['links'] - scripts?: RouteMatch['headScripts'] - meta?: RouteMatch['meta'] - styles?: RouteMatch['styles'] - }> - | { - links?: RouteMatch['links'] - scripts?: RouteMatch['headScripts'] - meta?: RouteMatch['meta'] - styles?: RouteMatch['styles'] - } -``` - -- Optional -- Returns additional elements to inject into the document `` for this route. Use it to add route-level SEO metadata, preload links, inline styles, or custom scripts. - -### `scripts` method - -- Type: - -```tsx -type scripts = (ctx: { - matches: Array - match: RouteMatch - params: TAllParams - loaderData?: TLoaderData -}) => Promise | RouteMatch['scripts'] -``` - -- Optional -- A shorthand helper to return only ` - - diff --git a/e2e/react-router/basepath-file-based/package.json b/e2e/react-router/basepath-file-based/package.json deleted file mode 100644 index 3dfbb58180..0000000000 --- a/e2e/react-router/basepath-file-based/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basepath-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basepath-file-based/playwright.config.ts b/e2e/react-router/basepath-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/basepath-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basepath-file-based/src/main.tsx b/e2e/react-router/basepath-file-based/src/main.tsx deleted file mode 100644 index 28f985de68..0000000000 --- a/e2e/react-router/basepath-file-based/src/main.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, - basepath: '/app', -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basepath-file-based/src/routeTree.gen.ts b/e2e/react-router/basepath-file-based/src/routeTree.gen.ts deleted file mode 100644 index 3badc3f843..0000000000 --- a/e2e/react-router/basepath-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,137 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' -import { Route as RedirectRouteImport } from './routes/redirect' -import { Route as RedirectReloadRouteImport } from './routes/redirectReload' -import { Route as ScrollErrorRouteImport } from './routes/scroll-error' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectRoute = RedirectRouteImport.update({ - id: '/redirect', - path: '/redirect', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectReloadRoute = RedirectReloadRouteImport.update({ - id: '/redirectReload', - path: '/redirectReload', - getParentRoute: () => rootRouteImport, -} as any) -const ScrollErrorRoute = ScrollErrorRouteImport.update({ - id: '/scroll-error', - path: '/scroll-error', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/redirect': typeof RedirectRoute - '/redirectReload': typeof RedirectReloadRoute - '/scroll-error': typeof ScrollErrorRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/redirect': typeof RedirectRoute - '/redirectReload': typeof RedirectReloadRoute - '/scroll-error': typeof ScrollErrorRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute - '/redirect': typeof RedirectRoute - '/redirectReload': typeof RedirectReloadRoute - '/scroll-error': typeof ScrollErrorRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/about' | '/redirect' | '/redirectReload' | '/scroll-error' - id: - | '__root__' - | '/' - | '/about' - | '/redirect' - | '/redirectReload' - | '/scroll-error' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute - RedirectRoute: typeof RedirectRoute - RedirectReloadRoute: typeof RedirectReloadRoute - ScrollErrorRoute: typeof ScrollErrorRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect': { - id: '/redirect' - path: '/redirect' - fullPath: '/redirect' - preLoaderRoute: typeof RedirectRouteImport - parentRoute: typeof rootRouteImport - } - '/redirectReload': { - id: '/redirectReload' - path: '/redirectReload' - fullPath: '/redirectReload' - preLoaderRoute: typeof RedirectReloadRouteImport - parentRoute: typeof rootRouteImport - } - '/scroll-error': { - id: '/scroll-error' - path: '/scroll-error' - fullPath: '/scroll-error' - preLoaderRoute: typeof ScrollErrorRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, - RedirectRoute: RedirectRoute, - RedirectReloadRoute: RedirectReloadRoute, - ScrollErrorRoute: ScrollErrorRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/basepath-file-based/src/routes/__root.tsx b/e2e/react-router/basepath-file-based/src/routes/__root.tsx deleted file mode 100644 index 9c657c7d5b..0000000000 --- a/e2e/react-router/basepath-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute() diff --git a/e2e/react-router/basepath-file-based/src/routes/about.tsx b/e2e/react-router/basepath-file-based/src/routes/about.tsx deleted file mode 100644 index 2d0dba2d6f..0000000000 --- a/e2e/react-router/basepath-file-based/src/routes/about.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/about')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = Route.useNavigate() - - return ( -
- -
- ) -} diff --git a/e2e/react-router/basepath-file-based/src/routes/index.tsx b/e2e/react-router/basepath-file-based/src/routes/index.tsx deleted file mode 100644 index 551724d337..0000000000 --- a/e2e/react-router/basepath-file-based/src/routes/index.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: App, -}) - -function App() { - const navigate = Route.useNavigate() - - return ( -
- {' '} - {' '} - {' '} - {' '} - -
- ) -} diff --git a/e2e/react-router/basepath-file-based/src/routes/redirect.tsx b/e2e/react-router/basepath-file-based/src/routes/redirect.tsx deleted file mode 100644 index 5c7093630d..0000000000 --- a/e2e/react-router/basepath-file-based/src/routes/redirect.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect')({ - beforeLoad: () => { - throw redirect({ to: '/about' }) - }, - component: RouteComponent, -}) - -function RouteComponent() { - return
Hello "/redirect"!
-} diff --git a/e2e/react-router/basepath-file-based/src/routes/redirectReload.tsx b/e2e/react-router/basepath-file-based/src/routes/redirectReload.tsx deleted file mode 100644 index 517ff6c5a1..0000000000 --- a/e2e/react-router/basepath-file-based/src/routes/redirectReload.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirectReload')({ - beforeLoad: () => { - throw redirect({ to: '/about', reloadDocument: true }) - }, - component: RouteComponent, -}) - -function RouteComponent() { - return
Hello "/redirectReload"!
-} diff --git a/e2e/react-router/basepath-file-based/src/routes/scroll-error.tsx b/e2e/react-router/basepath-file-based/src/routes/scroll-error.tsx deleted file mode 100644 index 227c152172..0000000000 --- a/e2e/react-router/basepath-file-based/src/routes/scroll-error.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/scroll-error')({ - component: ScrollErrorComponent, -}) - -function ScrollErrorComponent() { - return ( -
- About -
-

Scroll Error Test

-
-
- ) -} diff --git a/e2e/react-router/basepath-file-based/tests/reload-document.test.ts b/e2e/react-router/basepath-file-based/tests/reload-document.test.ts deleted file mode 100644 index ce07699aed..0000000000 --- a/e2e/react-router/basepath-file-based/tests/reload-document.test.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('navigate() respects basepath for when reloadDocument=true', async ({ - page, -}) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const aboutBtn = page.getByTestId(`to-about-btn`) - await aboutBtn.click() - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() - - const homeBtn = page.getByTestId(`to-home-btn`) - await homeBtn.click() - await page.waitForURL('/app/') - await expect(page.getByTestId(`home-component`)).toBeInViewport() -}) - -test('redirect respects basepath', async ({ page }) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const redirectBtn = page.getByTestId(`to-redirect-btn`) - await redirectBtn.click() - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() -}) - -test('redirect respects basepath with reloadDocument = true on redirect', async ({ - page, -}) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const redirectBtn = page.getByTestId(`to-redirect-reload-btn`) - await redirectBtn.click() - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() -}) - -test('navigate() with href containing basepath', async ({ page }) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const aboutBtn = page.getByTestId(`to-about-href-with-basepath-btn`) - await aboutBtn.click() - // Should navigate to /app/about, NOT /app/app/about - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() -}) - -test('navigate() with href containing basepath and reloadDocument=true', async ({ - page, -}) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const aboutBtn = page.getByTestId(`to-about-href-with-basepath-reload-btn`) - await aboutBtn.click() - // Should navigate to /app/about, NOT stay on current page - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() -}) diff --git a/e2e/react-router/basepath-file-based/tests/scroll-restoration-session-storage-error.test.ts b/e2e/react-router/basepath-file-based/tests/scroll-restoration-session-storage-error.test.ts deleted file mode 100644 index d6a50de840..0000000000 --- a/e2e/react-router/basepath-file-based/tests/scroll-restoration-session-storage-error.test.ts +++ /dev/null @@ -1,78 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -async function reloadAfterStorageFailure(page: Page) { - const errors: Array = [] - page.on('pageerror', (error) => errors.push(error.message)) - const snapshot = await page.evaluate(async () => { - let failures = 0 - const setItem = Storage.prototype.setItem - Storage.prototype.setItem = function (...args) { - try { - return setItem.apply(this, args) - } catch (error) { - failures++ - throw error - } - } - const scrolled = new Promise((resolve) => - addEventListener('scroll', () => resolve(), { once: true }), - ) - scrollTo(0, 200) - await scrolled - // Handler integration; genuine reload handoff is covered by the Start suite. - dispatchEvent(new PageTransitionEvent('pagehide', { persisted: false })) - return { mode: history.scrollRestoration, failures } - }) - expect(snapshot.failures).toBeGreaterThan(0) - // Storage failure must still allow native fallback; failure to restore is not a requirement. - expect(snapshot.mode).toBe('auto') - await page.reload() - await page.waitForLoadState('networkidle') - await expect( - page.getByRole('heading', { name: 'Scroll Error Test' }), - ).toBeVisible() - expect(await page.evaluate(() => history.scrollRestoration)).toBe('manual') - expect(errors).toEqual([]) -} - -test.describe('Scroll Restoration with Session Storage Error', () => { - test('should not crash when sessionStorage.setItem throws an error', async ({ - page, - }) => { - await page.goto('/app/scroll-error') - await page.waitForLoadState('networkidle') - - await page.evaluate(() => { - Storage.prototype.setItem = () => { - throw new Error('Test Error') - } - }) - - await reloadAfterStorageFailure(page) - }) - - test('should not crash when sessionStorage quota is exceeded', async ({ - page, - }) => { - await page.goto('/app/scroll-error') - await page.waitForLoadState('networkidle') - - await page.evaluate(() => { - let i = 0 - const chunk = 'x'.repeat(32) - - try { - while (true) { - sessionStorage.setItem(`key_${i}`, chunk) - i += 1 - } - } catch { - console.log(`Stored ${i} keys in session storage`) - } - }) - - await reloadAfterStorageFailure(page) - }) -}) diff --git a/e2e/react-router/basepath-file-based/tsconfig.json b/e2e/react-router/basepath-file-based/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basepath-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basepath-file-based/vite.config.js b/e2e/react-router/basepath-file-based/vite.config.js deleted file mode 100644 index 784341f8bc..0000000000 --- a/e2e/react-router/basepath-file-based/vite.config.js +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - base: '/app/', - plugins: [tanstackRouter({ target: 'react' }), react()], -}) diff --git a/e2e/react-router/basic-esbuild-file-based/.devcontainer/devcontainer.json b/e2e/react-router/basic-esbuild-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-esbuild-file-based/.gitignore b/e2e/react-router/basic-esbuild-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/basic-esbuild-file-based/index.html b/e2e/react-router/basic-esbuild-file-based/index.html deleted file mode 100644 index b67448091c..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - Vite App - - - - -
- - - diff --git a/e2e/react-router/basic-esbuild-file-based/package.json b/e2e/react-router/basic-esbuild-file-based/package.json deleted file mode 100644 index 59210c24d7..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-esbuild-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "esbuild src/main.tsx --serve=5601 --bundle --outfile=dist/main.js --watch --servedir=.", - "build": "esbuild src/main.tsx --bundle --outfile=dist/main.js && tsc --noEmit", - "serve": "esbuild src/main.tsx --bundle --outfile=dist/main.js --servedir=.", - "start": "dev", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "esbuild": "^0.27.4" - } -} diff --git a/e2e/react-router/basic-esbuild-file-based/playwright.config.ts b/e2e/react-router/basic-esbuild-file-based/playwright.config.ts deleted file mode 100644 index a38252921f..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm run build && pnpm run serve --serve=${PORT} --define:process.env.NODE_ENV=\\"test\\"`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) 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 deleted file mode 100644 index 954ddc026f..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/esbuild.config.js +++ /dev/null @@ -1,6 +0,0 @@ -import { tanstackRouter } from '@tanstack/router-plugin/esbuild' - -export default { - // ... - plugins: [tanstackRouter()], -} diff --git a/e2e/react-router/basic-esbuild-file-based/src/main.tsx b/e2e/react-router/basic-esbuild-file-based/src/main.tsx deleted file mode 100644 index 8f55bb9854..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/main.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basic-esbuild-file-based/src/posts.tsx b/e2e/react-router/basic-esbuild-file-based/src/posts.tsx deleted file mode 100644 index 97c96d77eb..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/basic-esbuild-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-esbuild-file-based/src/routeTree.gen.ts deleted file mode 100644 index 095f3f6619..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,424 +0,0 @@ -/* prettier-ignore-start */ - -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file is auto-generated by TanStack Router - -import { createFileRoute } from '@tanstack/react-router' - -// Import Routes - -import { Route as rootRoute } from './routes/__root' -import { Route as PostsImport } from './routes/posts' -import { Route as LayoutImport } from './routes/_layout' -import { Route as IndexImport } from './routes/index' -import { Route as PostsIndexImport } from './routes/posts.index' -import { Route as PostsPostIdImport } from './routes/posts.$postId' -import { Route as LayoutLayout2Import } from './routes/_layout/_layout-2' -import { Route as groupLazyinsideImport } from './routes/(group)/lazyinside' -import { Route as groupLayoutImport } from './routes/(group)/_layout' -import { Route as LayoutLayout2LayoutBImport } from './routes/_layout/_layout-2/layout-b' -import { Route as LayoutLayout2LayoutAImport } from './routes/_layout/_layout-2/layout-a' -import { Route as groupLayoutInsideImport } from './routes/(group)/_layout.inside' - -// Create Virtual Routes - -const groupImport = createFileRoute('/(group)')() - -// Create/Update Routes - -const groupRoute = groupImport.update({ - id: '/(group)', - getParentRoute: () => rootRoute, -} as any) - -const PostsRoute = PostsImport.update({ - path: '/posts', - getParentRoute: () => rootRoute, -} as any) - -const LayoutRoute = LayoutImport.update({ - id: '/_layout', - getParentRoute: () => rootRoute, -} as any) - -const IndexRoute = IndexImport.update({ - path: '/', - getParentRoute: () => rootRoute, -} as any) - -const PostsIndexRoute = PostsIndexImport.update({ - path: '/', - getParentRoute: () => PostsRoute, -} as any) - -const PostsPostIdRoute = PostsPostIdImport.update({ - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) - -const LayoutLayout2Route = LayoutLayout2Import.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) - -const groupLazyinsideRoute = groupLazyinsideImport - .update({ - path: '/lazyinside', - getParentRoute: () => groupRoute, - } as any) - .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route)) - -const groupLayoutRoute = groupLayoutImport.update({ - id: '/_layout', - getParentRoute: () => groupRoute, -} as any) - -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBImport.update({ - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) - -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutAImport.update({ - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) - -const groupLayoutInsideRoute = groupLayoutInsideImport.update({ - path: '/inside', - getParentRoute: () => groupLayoutRoute, -} as any) - -// Populate the FileRoutesByPath interface - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexImport - parentRoute: typeof rootRoute - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '' - preLoaderRoute: typeof LayoutImport - parentRoute: typeof rootRoute - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsImport - parentRoute: typeof rootRoute - } - '/(group)': { - id: '/(group)' - path: '/' - fullPath: '/' - preLoaderRoute: typeof groupImport - parentRoute: typeof rootRoute - } - '/(group)/_layout': { - id: '/(group)/_layout' - path: '/' - fullPath: '/' - preLoaderRoute: typeof groupLayoutImport - parentRoute: typeof groupRoute - } - '/(group)/lazyinside': { - id: '/(group)/lazyinside' - path: '/lazyinside' - fullPath: '/lazyinside' - preLoaderRoute: typeof groupLazyinsideImport - parentRoute: typeof groupImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '' - preLoaderRoute: typeof LayoutLayout2Import - parentRoute: typeof LayoutImport - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdImport - parentRoute: typeof PostsImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexImport - parentRoute: typeof PostsImport - } - '/(group)/_layout/inside': { - id: '/(group)/_layout/inside' - path: '/inside' - fullPath: '/inside' - preLoaderRoute: typeof groupLayoutInsideImport - parentRoute: typeof groupLayoutImport - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutAImport - parentRoute: typeof LayoutLayout2Import - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBImport - parentRoute: typeof LayoutLayout2Import - } - } -} - -// Create and export the route tree - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface groupLayoutRouteChildren { - groupLayoutInsideRoute: typeof groupLayoutInsideRoute -} - -const groupLayoutRouteChildren: groupLayoutRouteChildren = { - groupLayoutInsideRoute: groupLayoutInsideRoute, -} - -const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren( - groupLayoutRouteChildren, -) - -interface groupRouteChildren { - groupLayoutRoute: typeof groupLayoutRouteWithChildren - groupLazyinsideRoute: typeof groupLazyinsideRoute -} - -const groupRouteChildren: groupRouteChildren = { - groupLayoutRoute: groupLayoutRouteWithChildren, - groupLazyinsideRoute: groupLazyinsideRoute, -} - -const groupRouteWithChildren = groupRoute._addFileChildren(groupRouteChildren) - -export interface FileRoutesByFullPath { - '/': typeof groupLayoutRouteWithChildren - '': typeof LayoutLayout2RouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/inside': typeof groupLayoutInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} - -export interface FileRoutesByTo { - '/': typeof groupLayoutRouteWithChildren - '': typeof LayoutLayout2RouteWithChildren - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/inside': typeof groupLayoutInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} - -export interface FileRoutesById { - __root__: typeof rootRoute - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/(group)': typeof groupRouteWithChildren - '/(group)/_layout': typeof groupLayoutRouteWithChildren - '/(group)/lazyinside': typeof groupLazyinsideRoute - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/(group)/_layout/inside': typeof groupLayoutInsideRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute -} - -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '' - | '/posts' - | '/lazyinside' - | '/posts/$postId' - | '/posts/' - | '/inside' - | '/layout-a' - | '/layout-b' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '' - | '/lazyinside' - | '/posts/$postId' - | '/posts' - | '/inside' - | '/layout-a' - | '/layout-b' - id: - | '__root__' - | '/' - | '/_layout' - | '/posts' - | '/(group)' - | '/(group)/_layout' - | '/(group)/lazyinside' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/posts/' - | '/(group)/_layout/inside' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - fileRoutesById: FileRoutesById -} - -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - PostsRoute: typeof PostsRouteWithChildren - groupRoute: typeof groupRouteWithChildren -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - PostsRoute: PostsRouteWithChildren, - groupRoute: groupRouteWithChildren, -} - -export const routeTree = rootRoute - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -/* prettier-ignore-end */ - -/* ROUTE_MANIFEST_START -{ - "routes": { - "__root__": { - "filePath": "__root.tsx", - "children": [ - "/", - "/_layout", - "/posts", - "/(group)" - ] - }, - "/": { - "filePath": "index.tsx" - }, - "/_layout": { - "filePath": "_layout.tsx", - "children": [ - "/_layout/_layout-2" - ] - }, - "/posts": { - "filePath": "posts.tsx", - "children": [ - "/posts/$postId", - "/posts/" - ] - }, - "/(group)": { - "filePath": "(group)", - "children": [ - "/(group)/_layout", - "/(group)/lazyinside" - ] - }, - "/(group)/_layout": { - "filePath": "(group)/_layout.tsx", - "parent": "/(group)", - "children": [ - "/(group)/_layout/inside" - ] - }, - "/(group)/lazyinside": { - "filePath": "(group)/lazyinside.tsx", - "parent": "/(group)" - }, - "/_layout/_layout-2": { - "filePath": "_layout/_layout-2.tsx", - "parent": "/_layout", - "children": [ - "/_layout/_layout-2/layout-a", - "/_layout/_layout-2/layout-b" - ] - }, - "/posts/$postId": { - "filePath": "posts.$postId.tsx", - "parent": "/posts" - }, - "/posts/": { - "filePath": "posts.index.tsx", - "parent": "/posts" - }, - "/(group)/_layout/inside": { - "filePath": "(group)/_layout.inside.tsx", - "parent": "/(group)/_layout" - }, - "/_layout/_layout-2/layout-a": { - "filePath": "_layout/_layout-2/layout-a.tsx", - "parent": "/_layout/_layout-2" - }, - "/_layout/_layout-2/layout-b": { - "filePath": "_layout/_layout-2/layout-b.tsx", - "parent": "/_layout/_layout-2" - } - } -} -ROUTE_MANIFEST_END */ diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx deleted file mode 100644 index d204409f95..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute, getRouteApi, useSearch } from '@tanstack/react-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/_layout/inside') - -export const Route = createFileRoute('/(group)/_layout/inside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/_layout/inside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx deleted file mode 100644 index 4b755791c0..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/(group)/_layout')({ - component: () => ( - <> -
/(group)/_layout!
- - - ), -}) diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx deleted file mode 100644 index 527be4f520..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { - createLazyFileRoute, - getRouteApi, - useSearch, -} from '@tanstack/react-router' - -const routeApi = getRouteApi('/(group)/lazyinside') - -export const Route = createLazyFileRoute('/(group)/lazyinside')({ - component: () => { - const searchViaHook = useSearch({ from: '/(group)/lazyinside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx deleted file mode 100644 index df8ec637cf..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { z } from 'zod' - -export const Route = createFileRoute('/(group)/lazyinside')({ - validateSearch: z.object({ hello: z.string().optional() }), -}) diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/__root.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/__root.tsx deleted file mode 100644 index 26c845142f..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Inside Group - {' '} - - Lazy Inside Group - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/index.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/index.tsx deleted file mode 100644 index eac82a9174..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import * as React from 'react' -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx b/e2e/react-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index cded91ef96..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from 'react' -import { ErrorComponent, createFileRoute } from '@tanstack/react-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/basic-esbuild-file-based/tests/app.spec.ts b/e2e/react-router/basic-esbuild-file-based/tests/app.spec.ts deleted file mode 100644 index c52191a7d4..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/tests/app.spec.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.goto('/') - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Navigating to a route inside a route group', async ({ page }) => { - await page.getByTestId('link-to-route-inside-group').click() - await expect(page.getByTestId('search-via-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-api')).toContainText('world') -}) - -test('Navigating to a lazy route inside a route group', async ({ page }) => { - await page.getByTestId('link-to-lazy-route-inside-group').click() - await expect(page.getByTestId('search-via-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-api')).toContainText('world') -}) diff --git a/e2e/react-router/basic-esbuild-file-based/tsconfig.json b/e2e/react-router/basic-esbuild-file-based/tsconfig.json deleted file mode 100644 index 5db3b20eba..0000000000 --- a/e2e/react-router/basic-esbuild-file-based/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json b/e2e/react-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-file-based-code-splitting/.gitignore b/e2e/react-router/basic-file-based-code-splitting/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/basic-file-based-code-splitting/index.html b/e2e/react-router/basic-file-based-code-splitting/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic-file-based-code-splitting/package.json b/e2e/react-router/basic-file-based-code-splitting/package.json deleted file mode 100644 index 82ebb90e93..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-file-based-code-splitting", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic-file-based-code-splitting/playwright.config.ts b/e2e/react-router/basic-file-based-code-splitting/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/main.tsx b/e2e/react-router/basic-file-based-code-splitting/src/main.tsx deleted file mode 100644 index 3dc73ddd51..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/main.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/posts.tsx b/e2e/react-router/basic-file-based-code-splitting/src/posts.tsx deleted file mode 100644 index 97c96d77eb..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts deleted file mode 100644 index c7a15cd84e..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routeTree.gen.ts +++ /dev/null @@ -1,288 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as SharedSingletonRouteImport } from './routes/shared-singleton' -import { Route as ViewportTestRouteImport } from './routes/viewport-test' -import { Route as WithoutLoaderRouteImport } from './routes/without-loader' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const SharedSingletonRoute = SharedSingletonRouteImport.update({ - id: '/shared-singleton', - path: '/shared-singleton', - getParentRoute: () => rootRouteImport, -} as any) -const ViewportTestRoute = ViewportTestRouteImport.update({ - id: '/viewport-test', - path: '/viewport-test', - getParentRoute: () => rootRouteImport, -} as any) -const WithoutLoaderRoute = WithoutLoaderRouteImport.update({ - id: '/without-loader', - path: '/without-loader', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRouteWithChildren - '/shared-singleton': typeof SharedSingletonRoute - '/viewport-test': typeof ViewportTestRoute - '/without-loader': typeof WithoutLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/shared-singleton': typeof SharedSingletonRoute - '/viewport-test': typeof ViewportTestRoute - '/without-loader': typeof WithoutLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/shared-singleton': typeof SharedSingletonRoute - '/viewport-test': typeof ViewportTestRoute - '/without-loader': typeof WithoutLoaderRoute - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/shared-singleton' - | '/viewport-test' - | '/without-loader' - | '/posts/$postId' - | '/posts/' - | '/layout-a' - | '/layout-b' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/shared-singleton' - | '/viewport-test' - | '/without-loader' - | '/posts/$postId' - | '/posts' - | '/layout-a' - | '/layout-b' - id: - | '__root__' - | '/' - | '/_layout' - | '/posts' - | '/shared-singleton' - | '/viewport-test' - | '/without-loader' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/posts/' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - PostsRoute: typeof PostsRouteWithChildren - SharedSingletonRoute: typeof SharedSingletonRoute - ViewportTestRoute: typeof ViewportTestRoute - WithoutLoaderRoute: typeof WithoutLoaderRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/shared-singleton': { - id: '/shared-singleton' - path: '/shared-singleton' - fullPath: '/shared-singleton' - preLoaderRoute: typeof SharedSingletonRouteImport - parentRoute: typeof rootRouteImport - } - '/viewport-test': { - id: '/viewport-test' - path: '/viewport-test' - fullPath: '/viewport-test' - preLoaderRoute: typeof ViewportTestRouteImport - parentRoute: typeof rootRouteImport - } - '/without-loader': { - id: '/without-loader' - path: '/without-loader' - fullPath: '/without-loader' - preLoaderRoute: typeof WithoutLoaderRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - } -} - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - PostsRoute: PostsRouteWithChildren, - SharedSingletonRoute: SharedSingletonRoute, - ViewportTestRoute: ViewportTestRoute, - WithoutLoaderRoute: WithoutLoaderRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/__root.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/__root.tsx deleted file mode 100644 index cb2a94ee19..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/__root.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - without-loader - {' '} - - shared-singleton - {' '} - - This Route Does Not Exist - -
-
-
- - viewport-test - - - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index ed2dea8800..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 4799d403e9..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx deleted file mode 100644 index 47d1148be2..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import * as React from 'react' -import { ErrorComponent, createFileRoute } from '@tanstack/react-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, - codeSplitGroupings: [ - ['component'], - ['pendingComponent', 'errorComponent', 'notFoundComponent'], - ], -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx deleted file mode 100644 index c7a09ed7f8..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/posts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/shared-singleton.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/shared-singleton.tsx deleted file mode 100644 index 4523cddb31..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/shared-singleton.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -// All shared state lives in declarations — no bare expression statements. -// The singleton tracks how many times this module scope executes. -const singleton = (() => { - const g = globalThis as any - g.__tsrSharedSingleton ??= { initCount: 0 } - g.__tsrSharedSingleton.initCount++ - return { initCountAtCreate: g.__tsrSharedSingleton.initCount as number } -})() - -function getInitCount() { - return (globalThis as any).__tsrSharedSingleton?.initCount as number -} - -export const Route = createFileRoute('/shared-singleton')({ - loader: () => { - return { - loaderSawInitCount: getInitCount(), - initCountAtCreateFromLoader: singleton.initCountAtCreate, - } - }, - component: SharedSingletonComponent, -}) - -function SharedSingletonComponent() { - const data = Route.useLoaderData() - - return ( -
-

Shared Singleton

-
- initCount (global):{' '} - {getInitCount()} -
-
- loaderSawInitCount:{' '} - {data.loaderSawInitCount} -
-
- initCountAtCreate (loader module):{' '} - - {data.initCountAtCreateFromLoader} - -
-
- initCountAtCreate (component module):{' '} - - {singleton.initCountAtCreate} - -
-
- ) -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx deleted file mode 100644 index 81fd50c98b..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/viewport-test')({ - component: () =>
Hello /viewport-test!
, -}) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx b/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx deleted file mode 100644 index a4f4fac74e..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/routes/without-loader.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/without-loader')({ - component: () =>
Hello /without-loader!
, -}) diff --git a/e2e/react-router/basic-file-based-code-splitting/src/styles.css b/e2e/react-router/basic-file-based-code-splitting/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-file-based-code-splitting/src/vite-env.d.ts b/e2e/react-router/basic-file-based-code-splitting/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-file-based-code-splitting/tests/app.spec.ts b/e2e/react-router/basic-file-based-code-splitting/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/basic-file-based-code-splitting/tests/preload.spec.ts b/e2e/react-router/basic-file-based-code-splitting/tests/preload.spec.ts deleted file mode 100644 index fd17fcc47b..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/tests/preload.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('hovering a link with preload=intent to a route without a loader should preload route', async ({ - page, -}) => { - await page.waitForLoadState('networkidle') - - const requestPromise = new Promise((resolve) => { - page.on('request', (request) => { - resolve(request.url()) - }) - }) - - await page.getByRole('link', { name: 'without-loader' }).hover() - const url = await requestPromise - const expectedString = - process.env.NODE_ENV === 'development' - ? 'without-loader.tsx?tsr-split' - : '/assets/without-loader' - expect(url).toContain(expectedString) -}) - -test('scrolling into viewport a link with preload=viewport to a route should preload route', async ({ - page, -}) => { - await page.waitForLoadState('networkidle') - - const [request] = await Promise.all([ - page.waitForRequest(() => true), - page.getByRole('link', { name: 'viewport-test' }).scrollIntoViewIfNeeded(), - ]) - - const expectedString = - process.env.NODE_ENV === 'development' - ? 'viewport-test.tsx?tsr-split' - : '/assets/viewport-test' - expect(request.url()).toEqual(expect.stringContaining(expectedString)) -}) diff --git a/e2e/react-router/basic-file-based-code-splitting/tests/shared-bindings.spec.ts b/e2e/react-router/basic-file-based-code-splitting/tests/shared-bindings.spec.ts deleted file mode 100644 index 2ad4ec3e78..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/tests/shared-bindings.spec.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('shared module bindings should init once', async ({ page }) => { - await page.getByTestId('shared-singleton-link').click() - - // If module scope is duplicated between reference + split chunk, this becomes "2". - await expect(page.getByTestId('shared-init-count')).toHaveText('1') - - // Extra signals (useful when debugging failures) - await expect(page.getByTestId('shared-loader-saw')).toHaveText('1') - await expect(page.getByTestId('shared-created-at-loader')).toHaveText('1') - await expect(page.getByTestId('shared-created-at-module')).toHaveText('1') -}) diff --git a/e2e/react-router/basic-file-based-code-splitting/tsconfig.json b/e2e/react-router/basic-file-based-code-splitting/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-file-based-code-splitting/vite.config.ts b/e2e/react-router/basic-file-based-code-splitting/vite.config.ts deleted file mode 100644 index fe770c6efe..0000000000 --- a/e2e/react-router/basic-file-based-code-splitting/vite.config.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - codeSplittingOptions: { - splitBehavior: ({ routeId }) => { - if ( - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - routeId === undefined || - routeId.startsWith('$$TSR_') || - // @ts-expect-error - routeId === '' - ) { - console.error( - 'The routeId is empty or undefined. This should not happen.', - ) - process.exit(1) - } - if (routeId === '/posts') { - return [ - ['loader'], - ['component'], - ['pendingComponent', 'notFoundComponent', 'errorComponent'], - ] - } - }, - }, - }), - react(), - ], -}) diff --git a/e2e/react-router/basic-file-based/.devcontainer/devcontainer.json b/e2e/react-router/basic-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-file-based/.gitignore b/e2e/react-router/basic-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/basic-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/basic-file-based/index.html b/e2e/react-router/basic-file-based/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/react-router/basic-file-based/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/react-router/basic-file-based/package.json b/e2e/react-router/basic-file-based/package.json deleted file mode 100644 index 0f3d243432..0000000000 --- a/e2e/react-router/basic-file-based/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "pnpm run test:e2e:default", - "test:e2e:default": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "combinate": "^1.1.11", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic-file-based/playwright.config.ts b/e2e/react-router/basic-file-based/playwright.config.ts deleted file mode 100644 index ea3ef9ffec..0000000000 --- a/e2e/react-router/basic-file-based/playwright.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -const command = `pnpm build && pnpm preview --host 0.0.0.0 --port ${PORT}` - -console.info('Running with mode: ', process.env.MODE || 'default') - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - MODE: process.env.MODE || '', - VITE_MODE: process.env.MODE || '', - PORT: String(PORT), - }, - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-file-based/public/external.html b/e2e/react-router/basic-file-based/public/external.html deleted file mode 100644 index 3b4062b778..0000000000 --- a/e2e/react-router/basic-file-based/public/external.html +++ /dev/null @@ -1,9 +0,0 @@ - - - - External destination - - - Hello World - - diff --git a/e2e/react-router/basic-file-based/src/components/RenderCounter.tsx b/e2e/react-router/basic-file-based/src/components/RenderCounter.tsx deleted file mode 100644 index 38eff63cd3..0000000000 --- a/e2e/react-router/basic-file-based/src/components/RenderCounter.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { useRef } from 'react' - -export const RenderCounter = () => { - const renderCounter = useRef(0) - renderCounter.current = renderCounter.current + 1 - return <>{renderCounter.current} -} diff --git a/e2e/react-router/basic-file-based/src/main.tsx b/e2e/react-router/basic-file-based/src/main.tsx deleted file mode 100644 index d6a5aef382..0000000000 --- a/e2e/react-router/basic-file-based/src/main.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { - RouterProvider, - createRouteMask, - createRouter, -} from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -const mask = createRouteMask({ - routeTree, - from: '/masks/admin/$userId', - to: '/masks/public/$username', - params: (prev) => ({ - username: `user-${prev.userId}`, - }), -}) - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, - routeMasks: [mask], - rewrite: { - output: ({ url }) => { - if (url.pathname === '/document-navigation-target') { - return new URL(`http://127.0.0.1:${window.location.port}/external.html`) - } - return url - }, - }, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basic-file-based/src/posts.tsx b/e2e/react-router/basic-file-based/src/posts.tsx deleted file mode 100644 index 97c96d77eb..0000000000 --- a/e2e/react-router/basic-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/basic-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-file-based/src/routeTree.gen.ts deleted file mode 100644 index 83b504992f..0000000000 --- a/e2e/react-router/basic-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,2991 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as AnchorRouteImport } from './routes/anchor' -import { Route as ComponentTypesTestRouteImport } from './routes/component-types-test' -import { Route as DocumentNavigationRouteImport } from './routes/document-navigation' -import { Route as DocumentNavigationTargetRouteImport } from './routes/document-navigation-target' -import { Route as EditingARouteImport } from './routes/editing-a' -import { Route as EditingBRouteImport } from './routes/editing-b' -import { Route as FullpathTestRouteRouteImport } from './routes/fullpath-test/route' -import { Route as HistoryBlockingRouteImport } from './routes/history-blocking' -import { Route as HoverPreloadHashRouteImport } from './routes/hover-preload-hash' -import { Route as LazyErrorRouteImport } from './routes/lazy-error' -import { Route as MasksRouteImport } from './routes/masks' -import { Route as NonNestedRouteRouteImport } from './routes/non-nested/route' -import { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps' -import { Route as PathlessLayoutRouteRouteImport } from './routes/pathless-layout/route' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as RemountDepsRouteImport } from './routes/remountDeps' -import { Route as SearchParamsRouteRouteImport } from './routes/search-params/route' -import { Route as Char45824Char54620Char48124Char44397RouteRouteImport } from './routes/대한민국/route' -import { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside' -import { Route as groupLayoutRouteImport } from './routes/(group)/_layout' -import { Route as groupInsideRouteImport } from './routes/(group)/inside' -import { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as FullpathTestLayoutRouteRouteImport } from './routes/fullpath-test/_layout/route' -import { Route as NonNestedDeepRouteRouteImport } from './routes/non-nested/deep/route' -import { Route as NonNestedNamedRouteRouteImport } from './routes/non-nested/named/route' -import { Route as NonNestedPathRouteRouteImport } from './routes/non-nested/path/route' -import { Route as NonNestedPrefixRouteRouteImport } from './routes/non-nested/prefix/route' -import { Route as NonNestedSuffixRouteRouteImport } from './routes/non-nested/suffix/route' -import { Route as ParamsPsIndexRouteImport } from './routes/params-ps/index' -import { Route as ParamsPsNonNestedRouteRouteImport } from './routes/params-ps/non-nested/route' -import { Route as ParamsPsStrictFalseRouteRouteImport } from './routes/params-ps/strict-false/route' -import { Route as PathlessLayoutLayoutRouteRouteImport } from './routes/pathless-layout/_layout/route' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as RedirectIndexRouteImport } from './routes/redirect/index' -import { Route as RedirectTargetRouteImport } from './routes/redirect/$target' -import { Route as RelativeIndexRouteImport } from './routes/relative/index' -import { Route as RelativeLinkRouteRouteImport } from './routes/relative/link/route' -import { Route as RelativeUseNavigateRouteRouteImport } from './routes/relative/useNavigate/route' -import { Route as SearchParamsIndexRouteImport } from './routes/search-params/index' -import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default' -import { Route as StructuralSharingEnabledRouteImport } from './routes/structural-sharing.$enabled' -import { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout' -import { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' -import { Route as FullpathTestLayoutIndexRouteImport } from './routes/fullpath-test/_layout/index' -import { Route as FullpathTestLayoutIdRouteImport } from './routes/fullpath-test/_layout/$id' -import { Route as MasksAdminUserIdRouteImport } from './routes/masks.admin.$userId' -import { Route as MasksPublicUsernameRouteImport } from './routes/masks.public.$username' -import { Route as NonNestedDeepBazRouteRouteImport } from './routes/non-nested/deep/$baz.route' -import { Route as NonNestedNamedBazRouteRouteImport } from './routes/non-nested/named/$baz.route' -import { Route as NonNestedPathBazRouteRouteImport } from './routes/non-nested/path/baz.route' -import { Route as NonNestedPrefixPrefixChar123bazChar125RouteRouteImport } from './routes/non-nested/prefix/prefix{$baz}.route' -import { Route as NonNestedSuffixChar123bazChar125suffixRouteRouteImport } from './routes/non-nested/suffix/{$baz}suffix.route' -import { Route as ParamsPsNamedIndexRouteImport } from './routes/params-ps/named/index' -import { Route as ParamsPsNamedFooRouteRouteImport } from './routes/params-ps/named/$foo/route' -import { Route as ParamsPsNamedPrefixChar123fooChar125RouteImport } from './routes/params-ps/named/prefix{$foo}' -import { Route as ParamsPsNamedChar123fooChar125suffixRouteImport } from './routes/params-ps/named/{$foo}suffix' -import { Route as ParamsPsNonNestedFooRouteRouteImport } from './routes/params-ps/non-nested/$foo_/route' -import { Route as ParamsPsStrictFalseVersionRouteRouteImport } from './routes/params-ps/strict-false/$version.route' -import { Route as ParamsPsWildcardIndexRouteImport } from './routes/params-ps/wildcard/index' -import { Route as ParamsPsWildcardSplatRouteImport } from './routes/params-ps/wildcard/$' -import { Route as ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport } from './routes/params-ps/wildcard/prefix@대{$}' -import { Route as ParamsPsWildcardPrefixChar123Char125RouteImport } from './routes/params-ps/wildcard/prefix{$}' -import { Route as ParamsPsWildcardChar123Char125suffixRouteImport } from './routes/params-ps/wildcard/{$}suffix' -import { Route as ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport } from './routes/params-ps/wildcard/{$}suffix@대' -import { Route as ParamsSingleValueRouteImport } from './routes/params.single.$value' -import { Route as PathlessLayoutLayoutIndexRouteImport } from './routes/pathless-layout/_layout/index' -import { Route as PathlessLayoutLayoutChildRouteImport } from './routes/pathless-layout/_layout/child' -import { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit' -import { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index' -import { Route as RedirectTargetDestinationRouteImport } from './routes/redirect/$target/destination' -import { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad' -import { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader' -import { Route as RedirectTargetViaRouteRedirectBeforeLoadRouteImport } from './routes/redirect/$target/via-route-redirect-beforeLoad' -import { Route as RedirectTargetViaRouteRedirectLoaderRouteImport } from './routes/redirect/$target/via-route-redirect-loader' -import { Route as RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport } from './routes/redirect/$target/via-routeApi-redirect-beforeLoad' -import { Route as RedirectTargetViaRouteApiRedirectLoaderRouteImport } from './routes/redirect/$target/via-routeApi-redirect-loader' -import { Route as RedirectPreloadFirstRouteImport } from './routes/redirect/preload/first' -import { Route as RedirectPreloadSecondRouteImport } from './routes/redirect/preload/second' -import { Route as RedirectPreloadThirdRouteImport } from './routes/redirect/preload/third' -import { Route as RelativeLinkRelativeLinkARouteImport } from './routes/relative/link/relative-link-a' -import { Route as RelativeLinkRelativeLinkBRouteImport } from './routes/relative/link/relative-link-b' -import { Route as RelativeUseNavigateRelativeUseNavigateARouteImport } from './routes/relative/useNavigate/relative-useNavigate-a' -import { Route as RelativeUseNavigateRelativeUseNavigateBRouteImport } from './routes/relative/useNavigate/relative-useNavigate-b' -import { Route as Char45824Char54620Char48124Char44397WildcardSplatRouteImport } from './routes/대한민국/wildcard.$' -import { Route as Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport } from './routes/대한민국/🚀.$id' -import { Route as NonNestedDeepBazIndexRouteImport } from './routes/non-nested/deep/$baz.index' -import { Route as NonNestedDeepBazBarRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.route' -import { Route as NonNestedNamedBazIndexRouteImport } from './routes/non-nested/named/$baz.index' -import { Route as NonNestedNamedBazFooRouteImport } from './routes/non-nested/named/$baz.foo' -import { Route as NonNestedNamedBazBarRouteImport } from './routes/non-nested/named/$baz_.bar' -import { Route as NonNestedPathBazIndexRouteImport } from './routes/non-nested/path/baz.index' -import { Route as NonNestedPathBazFooRouteImport } from './routes/non-nested/path/baz.foo' -import { Route as NonNestedPathBazBarRouteImport } from './routes/non-nested/path/baz_.bar' -import { Route as NonNestedPrefixPrefixChar123bazChar125IndexRouteImport } from './routes/non-nested/prefix/prefix{$baz}.index' -import { Route as NonNestedPrefixPrefixChar123bazChar125FooRouteImport } from './routes/non-nested/prefix/prefix{$baz}.foo' -import { Route as NonNestedPrefixPrefixChar123bazChar125BarRouteImport } from './routes/non-nested/prefix/prefix{$baz}_.bar' -import { Route as NonNestedSuffixChar123bazChar125suffixIndexRouteImport } from './routes/non-nested/suffix/{$baz}suffix.index' -import { Route as NonNestedSuffixChar123bazChar125suffixFooRouteImport } from './routes/non-nested/suffix/{$baz}suffix.foo' -import { Route as NonNestedSuffixChar123bazChar125suffixBarRouteImport } from './routes/non-nested/suffix/{$baz}suffix_.bar' -import { Route as ParamsPsNamedFooBarRouteRouteImport } from './routes/params-ps/named/$foo/$bar.route' -import { Route as ParamsPsNonNestedFooBarRouteImport } from './routes/params-ps/non-nested/$foo_/$bar' -import { Route as RelativeLinkNestedIndexRouteImport } from './routes/relative/link/nested/index' -import { Route as RelativeLinkPathIndexRouteImport } from './routes/relative/link/path/index' -import { Route as RelativeLinkWithSearchIndexRouteImport } from './routes/relative/link/with-search/index' -import { Route as RelativeUseNavigateNestedIndexRouteImport } from './routes/relative/useNavigate/nested/index' -import { Route as RelativeUseNavigatePathIndexRouteImport } from './routes/relative/useNavigate/path/index' -import { Route as RelativeUseNavigateWithSearchIndexRouteImport } from './routes/relative/useNavigate/with-search/index' -import { Route as NonNestedDeepBazBarIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.index' -import { Route as NonNestedDeepBazBarFooRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.route' -import { Route as NonNestedDeepBazBarQuxRouteImport } from './routes/non-nested/deep/$baz_.bar_.qux' -import { Route as ParamsPsNamedFooBarBazRouteImport } from './routes/params-ps/named/$foo/$bar.$baz' -import { Route as RelativeLinkNestedDeepIndexRouteImport } from './routes/relative/link/nested/deep/index' -import { Route as RelativeLinkPathPathIndexRouteImport } from './routes/relative/link/path/$path/index' -import { Route as RelativeUseNavigateNestedDeepIndexRouteImport } from './routes/relative/useNavigate/nested/deep/index' -import { Route as RelativeUseNavigatePathPathIndexRouteImport } from './routes/relative/useNavigate/path/$path/index' -import { Route as NonNestedDeepBazBarFooIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.index' -import { Route as NonNestedDeepBazBarFooQuxRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo_.qux' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const AnchorRoute = AnchorRouteImport.update({ - id: '/anchor', - path: '/anchor', - getParentRoute: () => rootRouteImport, -} as any) -const ComponentTypesTestRoute = ComponentTypesTestRouteImport.update({ - id: '/component-types-test', - path: '/component-types-test', - getParentRoute: () => rootRouteImport, -} as any) -const DocumentNavigationRoute = DocumentNavigationRouteImport.update({ - id: '/document-navigation', - path: '/document-navigation', - getParentRoute: () => rootRouteImport, -} as any) -const DocumentNavigationTargetRoute = - DocumentNavigationTargetRouteImport.update({ - id: '/document-navigation-target', - path: '/document-navigation-target', - getParentRoute: () => rootRouteImport, - } as any) -const EditingARoute = EditingARouteImport.update({ - id: '/editing-a', - path: '/editing-a', - getParentRoute: () => rootRouteImport, -} as any) -const EditingBRoute = EditingBRouteImport.update({ - id: '/editing-b', - path: '/editing-b', - getParentRoute: () => rootRouteImport, -} as any) -const FullpathTestRouteRoute = FullpathTestRouteRouteImport.update({ - id: '/fullpath-test', - path: '/fullpath-test', - getParentRoute: () => rootRouteImport, -} as any) -const HistoryBlockingRoute = HistoryBlockingRouteImport.update({ - id: '/history-blocking', - path: '/history-blocking', - getParentRoute: () => rootRouteImport, -} as any) -const HoverPreloadHashRoute = HoverPreloadHashRouteImport.update({ - id: '/hover-preload-hash', - path: '/hover-preload-hash', - getParentRoute: () => rootRouteImport, -} as any) -const LazyErrorRoute = LazyErrorRouteImport.update({ - id: '/lazy-error', - path: '/lazy-error', - getParentRoute: () => rootRouteImport, -} as any).lazy(() => import('./routes/lazy-error.lazy').then((d) => d.Route)) -const MasksRoute = MasksRouteImport.update({ - id: '/masks', - path: '/masks', - getParentRoute: () => rootRouteImport, -} as any) -const NonNestedRouteRoute = NonNestedRouteRouteImport.update({ - id: '/non-nested', - path: '/non-nested', - getParentRoute: () => rootRouteImport, -} as any) -const NotRemountDepsRoute = NotRemountDepsRouteImport.update({ - id: '/notRemountDeps', - path: '/notRemountDeps', - getParentRoute: () => rootRouteImport, -} as any) -const PathlessLayoutRouteRoute = PathlessLayoutRouteRouteImport.update({ - id: '/pathless-layout', - path: '/pathless-layout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const RemountDepsRoute = RemountDepsRouteImport.update({ - id: '/remountDeps', - path: '/remountDeps', - getParentRoute: () => rootRouteImport, -} as any) -const SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({ - id: '/search-params', - path: '/search-params', - getParentRoute: () => rootRouteImport, -} as any) -const Char45824Char54620Char48124Char44397RouteRoute = - Char45824Char54620Char48124Char44397RouteRouteImport.update({ - id: '/대한민국', - path: '/대한민국', - getParentRoute: () => rootRouteImport, - } as any) -const anotherGroupOnlyrouteinsideRoute = - anotherGroupOnlyrouteinsideRouteImport.update({ - id: '/(another-group)/onlyrouteinside', - path: '/onlyrouteinside', - getParentRoute: () => rootRouteImport, - } as any) -const groupLayoutRoute = groupLayoutRouteImport.update({ - id: '/(group)/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const groupInsideRoute = groupInsideRouteImport.update({ - id: '/(group)/inside', - path: '/inside', - getParentRoute: () => rootRouteImport, -} as any) -const groupLazyinsideRoute = groupLazyinsideRouteImport - .update({ - id: '/(group)/lazyinside', - path: '/lazyinside', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route)) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const FullpathTestLayoutRouteRoute = FullpathTestLayoutRouteRouteImport.update({ - id: '/_layout', - getParentRoute: () => FullpathTestRouteRoute, -} as any) -const NonNestedDeepRouteRoute = NonNestedDeepRouteRouteImport.update({ - id: '/deep', - path: '/deep', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedNamedRouteRoute = NonNestedNamedRouteRouteImport.update({ - id: '/named', - path: '/named', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedPathRouteRoute = NonNestedPathRouteRouteImport.update({ - id: '/path', - path: '/path', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedPrefixRouteRoute = NonNestedPrefixRouteRouteImport.update({ - id: '/prefix', - path: '/prefix', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedSuffixRouteRoute = NonNestedSuffixRouteRouteImport.update({ - id: '/suffix', - path: '/suffix', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const ParamsPsIndexRoute = ParamsPsIndexRouteImport.update({ - id: '/params-ps/', - path: '/params-ps/', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsNonNestedRouteRoute = ParamsPsNonNestedRouteRouteImport.update({ - id: '/params-ps/non-nested', - path: '/params-ps/non-nested', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsStrictFalseRouteRoute = - ParamsPsStrictFalseRouteRouteImport.update({ - id: '/params-ps/strict-false', - path: '/params-ps/strict-false', - getParentRoute: () => rootRouteImport, - } as any) -const PathlessLayoutLayoutRouteRoute = - PathlessLayoutLayoutRouteRouteImport.update({ - id: '/_layout', - getParentRoute: () => PathlessLayoutRouteRoute, - } as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const RedirectIndexRoute = RedirectIndexRouteImport.update({ - id: '/redirect/', - path: '/redirect/', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetRoute = RedirectTargetRouteImport.update({ - id: '/redirect/$target', - path: '/redirect/$target', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeIndexRoute = RelativeIndexRouteImport.update({ - id: '/relative/', - path: '/relative/', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeLinkRouteRoute = RelativeLinkRouteRouteImport.update({ - id: '/relative/link', - path: '/relative/link', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeUseNavigateRouteRoute = - RelativeUseNavigateRouteRouteImport.update({ - id: '/relative/useNavigate', - path: '/relative/useNavigate', - getParentRoute: () => rootRouteImport, - } as any) -const SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({ - id: '/default', - path: '/default', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const StructuralSharingEnabledRoute = - StructuralSharingEnabledRouteImport.update({ - id: '/structural-sharing/$enabled', - path: '/structural-sharing/$enabled', - getParentRoute: () => rootRouteImport, - } as any) -const groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({ - id: '/insidelayout', - path: '/insidelayout', - getParentRoute: () => groupLayoutRoute, -} as any) -const groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({ - id: '/(group)/subfolder/inside', - path: '/subfolder/inside', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) -const FullpathTestLayoutIndexRoute = FullpathTestLayoutIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => FullpathTestLayoutRouteRoute, -} as any) -const FullpathTestLayoutIdRoute = FullpathTestLayoutIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => FullpathTestLayoutRouteRoute, -} as any) -const MasksAdminUserIdRoute = MasksAdminUserIdRouteImport.update({ - id: '/admin/$userId', - path: '/admin/$userId', - getParentRoute: () => MasksRoute, -} as any) -const MasksPublicUsernameRoute = MasksPublicUsernameRouteImport.update({ - id: '/public/$username', - path: '/public/$username', - getParentRoute: () => MasksRoute, -} as any) -const NonNestedDeepBazRouteRoute = NonNestedDeepBazRouteRouteImport.update({ - id: '/$baz', - path: '/$baz', - getParentRoute: () => NonNestedDeepRouteRoute, -} as any) -const NonNestedNamedBazRouteRoute = NonNestedNamedBazRouteRouteImport.update({ - id: '/$baz', - path: '/$baz', - getParentRoute: () => NonNestedNamedRouteRoute, -} as any) -const NonNestedPathBazRouteRoute = NonNestedPathBazRouteRouteImport.update({ - id: '/baz', - path: '/baz', - getParentRoute: () => NonNestedPathRouteRoute, -} as any) -const NonNestedPrefixPrefixChar123bazChar125RouteRoute = - NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({ - id: '/prefix{$baz}', - path: '/prefix{$baz}', - getParentRoute: () => NonNestedPrefixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixRouteRoute = - NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({ - id: '/{$baz}suffix', - path: '/{$baz}suffix', - getParentRoute: () => NonNestedSuffixRouteRoute, - } as any) -const ParamsPsNamedIndexRoute = ParamsPsNamedIndexRouteImport.update({ - id: '/params-ps/named/', - path: '/params-ps/named/', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsNamedFooRouteRoute = ParamsPsNamedFooRouteRouteImport.update({ - id: '/params-ps/named/$foo', - path: '/params-ps/named/$foo', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsNamedPrefixChar123fooChar125Route = - ParamsPsNamedPrefixChar123fooChar125RouteImport.update({ - id: '/params-ps/named/prefix{$foo}', - path: '/params-ps/named/prefix{$foo}', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsNamedChar123fooChar125suffixRoute = - ParamsPsNamedChar123fooChar125suffixRouteImport.update({ - id: '/params-ps/named/{$foo}suffix', - path: '/params-ps/named/{$foo}suffix', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsNonNestedFooRouteRoute = - ParamsPsNonNestedFooRouteRouteImport.update({ - id: '/$foo_', - path: '/$foo', - getParentRoute: () => ParamsPsNonNestedRouteRoute, - } as any) -const ParamsPsStrictFalseVersionRouteRoute = - ParamsPsStrictFalseVersionRouteRouteImport.update({ - id: '/$version', - path: '/$version', - getParentRoute: () => ParamsPsStrictFalseRouteRoute, - } as any) -const ParamsPsWildcardIndexRoute = ParamsPsWildcardIndexRouteImport.update({ - id: '/params-ps/wildcard/', - path: '/params-ps/wildcard/', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsWildcardSplatRoute = ParamsPsWildcardSplatRouteImport.update({ - id: '/params-ps/wildcard/$', - path: '/params-ps/wildcard/$', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsWildcardPrefixAtChar45824Char123Char125Route = - ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({ - id: '/params-ps/wildcard/prefix@대{$}', - path: '/params-ps/wildcard/prefix@대{$}', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsWildcardPrefixChar123Char125Route = - ParamsPsWildcardPrefixChar123Char125RouteImport.update({ - id: '/params-ps/wildcard/prefix{$}', - path: '/params-ps/wildcard/prefix{$}', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsWildcardChar123Char125suffixRoute = - ParamsPsWildcardChar123Char125suffixRouteImport.update({ - id: '/params-ps/wildcard/{$}suffix', - path: '/params-ps/wildcard/{$}suffix', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsWildcardChar123Char125suffixAtChar45824Route = - ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({ - id: '/params-ps/wildcard/{$}suffix@대', - path: '/params-ps/wildcard/{$}suffix@대', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsSingleValueRoute = ParamsSingleValueRouteImport.update({ - id: '/params/single/$value', - path: '/params/single/$value', - getParentRoute: () => rootRouteImport, -} as any) -const PathlessLayoutLayoutIndexRoute = - PathlessLayoutLayoutIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PathlessLayoutLayoutRouteRoute, - } as any) -const PathlessLayoutLayoutChildRoute = - PathlessLayoutLayoutChildRouteImport.update({ - id: '/child', - path: '/child', - getParentRoute: () => PathlessLayoutLayoutRouteRoute, - } as any) -const PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({ - id: '/posts_/$postId/edit', - path: '/posts/$postId/edit', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => RedirectTargetRoute, -} as any) -const RedirectTargetDestinationRoute = - RedirectTargetDestinationRouteImport.update({ - id: '/destination', - path: '/destination', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaBeforeLoadRoute = - RedirectTargetViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({ - id: '/via-loader', - path: '/via-loader', - getParentRoute: () => RedirectTargetRoute, -} as any) -const RedirectTargetViaRouteRedirectBeforeLoadRoute = - RedirectTargetViaRouteRedirectBeforeLoadRouteImport.update({ - id: '/via-route-redirect-beforeLoad', - path: '/via-route-redirect-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaRouteRedirectLoaderRoute = - RedirectTargetViaRouteRedirectLoaderRouteImport.update({ - id: '/via-route-redirect-loader', - path: '/via-route-redirect-loader', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaRouteApiRedirectBeforeLoadRoute = - RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport.update({ - id: '/via-routeApi-redirect-beforeLoad', - path: '/via-routeApi-redirect-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaRouteApiRedirectLoaderRoute = - RedirectTargetViaRouteApiRedirectLoaderRouteImport.update({ - id: '/via-routeApi-redirect-loader', - path: '/via-routeApi-redirect-loader', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectPreloadFirstRoute = RedirectPreloadFirstRouteImport.update({ - id: '/redirect/preload/first', - path: '/redirect/preload/first', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectPreloadSecondRoute = RedirectPreloadSecondRouteImport.update({ - id: '/redirect/preload/second', - path: '/redirect/preload/second', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectPreloadThirdRoute = RedirectPreloadThirdRouteImport.update({ - id: '/redirect/preload/third', - path: '/redirect/preload/third', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeLinkRelativeLinkARoute = - RelativeLinkRelativeLinkARouteImport.update({ - id: '/relative-link-a', - path: '/relative-link-a', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeLinkRelativeLinkBRoute = - RelativeLinkRelativeLinkBRouteImport.update({ - id: '/relative-link-b', - path: '/relative-link-b', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeUseNavigateRelativeUseNavigateARoute = - RelativeUseNavigateRelativeUseNavigateARouteImport.update({ - id: '/relative-useNavigate-a', - path: '/relative-useNavigate-a', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigateRelativeUseNavigateBRoute = - RelativeUseNavigateRelativeUseNavigateBRouteImport.update({ - id: '/relative-useNavigate-b', - path: '/relative-useNavigate-b', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const Char45824Char54620Char48124Char44397WildcardSplatRoute = - Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({ - id: '/wildcard/$', - path: '/wildcard/$', - getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute, - } as any) -const Char45824Char54620Char48124Char44397Char55357Char56960IdRoute = - Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({ - id: '/🚀/$id', - path: '/🚀/$id', - getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute, - } as any) -const NonNestedDeepBazIndexRoute = NonNestedDeepBazIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedDeepBazRouteRoute, -} as any) -const NonNestedDeepBazBarRouteRoute = - NonNestedDeepBazBarRouteRouteImport.update({ - id: '/$baz_/bar', - path: '/$baz/bar', - getParentRoute: () => NonNestedDeepRouteRoute, - } as any) -const NonNestedNamedBazIndexRoute = NonNestedNamedBazIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedNamedBazRouteRoute, -} as any) -const NonNestedNamedBazFooRoute = NonNestedNamedBazFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedNamedBazRouteRoute, -} as any) -const NonNestedNamedBazBarRoute = NonNestedNamedBazBarRouteImport.update({ - id: '/$baz_/bar', - path: '/$baz/bar', - getParentRoute: () => NonNestedNamedRouteRoute, -} as any) -const NonNestedPathBazIndexRoute = NonNestedPathBazIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedPathBazRouteRoute, -} as any) -const NonNestedPathBazFooRoute = NonNestedPathBazFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedPathBazRouteRoute, -} as any) -const NonNestedPathBazBarRoute = NonNestedPathBazBarRouteImport.update({ - id: '/baz_/bar', - path: '/baz/bar', - getParentRoute: () => NonNestedPathRouteRoute, -} as any) -const NonNestedPrefixPrefixChar123bazChar125IndexRoute = - NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute, - } as any) -const NonNestedPrefixPrefixChar123bazChar125FooRoute = - NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute, - } as any) -const NonNestedPrefixPrefixChar123bazChar125BarRoute = - NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({ - id: '/prefix{$baz}_/bar', - path: '/prefix{$baz}/bar', - getParentRoute: () => NonNestedPrefixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixIndexRoute = - NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixFooRoute = - NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixBarRoute = - NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({ - id: '/{$baz}suffix_/bar', - path: '/{$baz}suffix/bar', - getParentRoute: () => NonNestedSuffixRouteRoute, - } as any) -const ParamsPsNamedFooBarRouteRoute = - ParamsPsNamedFooBarRouteRouteImport.update({ - id: '/$bar', - path: '/$bar', - getParentRoute: () => ParamsPsNamedFooRouteRoute, - } as any) -const ParamsPsNonNestedFooBarRoute = ParamsPsNonNestedFooBarRouteImport.update({ - id: '/$bar', - path: '/$bar', - getParentRoute: () => ParamsPsNonNestedFooRouteRoute, -} as any) -const RelativeLinkNestedIndexRoute = RelativeLinkNestedIndexRouteImport.update({ - id: '/nested/', - path: '/nested/', - getParentRoute: () => RelativeLinkRouteRoute, -} as any) -const RelativeLinkPathIndexRoute = RelativeLinkPathIndexRouteImport.update({ - id: '/path/', - path: '/path/', - getParentRoute: () => RelativeLinkRouteRoute, -} as any) -const RelativeLinkWithSearchIndexRoute = - RelativeLinkWithSearchIndexRouteImport.update({ - id: '/with-search/', - path: '/with-search/', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeUseNavigateNestedIndexRoute = - RelativeUseNavigateNestedIndexRouteImport.update({ - id: '/nested/', - path: '/nested/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigatePathIndexRoute = - RelativeUseNavigatePathIndexRouteImport.update({ - id: '/path/', - path: '/path/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigateWithSearchIndexRoute = - RelativeUseNavigateWithSearchIndexRouteImport.update({ - id: '/with-search/', - path: '/with-search/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const NonNestedDeepBazBarIndexRoute = - NonNestedDeepBazBarIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedDeepBazBarRouteRoute, - } as any) -const NonNestedDeepBazBarFooRouteRoute = - NonNestedDeepBazBarFooRouteRouteImport.update({ - id: '/$foo', - path: '/$foo', - getParentRoute: () => NonNestedDeepBazBarRouteRoute, - } as any) -const NonNestedDeepBazBarQuxRoute = NonNestedDeepBazBarQuxRouteImport.update({ - id: '/$baz_/bar_/qux', - path: '/$baz/bar/qux', - getParentRoute: () => NonNestedDeepRouteRoute, -} as any) -const ParamsPsNamedFooBarBazRoute = ParamsPsNamedFooBarBazRouteImport.update({ - id: '/$baz', - path: '/$baz', - getParentRoute: () => ParamsPsNamedFooBarRouteRoute, -} as any) -const RelativeLinkNestedDeepIndexRoute = - RelativeLinkNestedDeepIndexRouteImport.update({ - id: '/nested/deep/', - path: '/nested/deep/', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeLinkPathPathIndexRoute = - RelativeLinkPathPathIndexRouteImport.update({ - id: '/path/$path/', - path: '/path/$path/', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeUseNavigateNestedDeepIndexRoute = - RelativeUseNavigateNestedDeepIndexRouteImport.update({ - id: '/nested/deep/', - path: '/nested/deep/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigatePathPathIndexRoute = - RelativeUseNavigatePathPathIndexRouteImport.update({ - id: '/path/$path/', - path: '/path/$path/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const NonNestedDeepBazBarFooIndexRoute = - NonNestedDeepBazBarFooIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedDeepBazBarFooRouteRoute, - } as any) -const NonNestedDeepBazBarFooQuxRoute = - NonNestedDeepBazBarFooQuxRouteImport.update({ - id: '/$foo_/qux', - path: '/$foo/qux', - getParentRoute: () => NonNestedDeepBazBarRouteRoute, - } as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/fullpath-test': typeof FullpathTestRouteRouteWithChildren - '/non-nested': typeof NonNestedRouteRouteWithChildren - '/pathless-layout': typeof PathlessLayoutRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - '/anchor': typeof AnchorRoute - '/component-types-test': typeof ComponentTypesTestRoute - '/document-navigation': typeof DocumentNavigationRoute - '/document-navigation-target': typeof DocumentNavigationTargetRoute - '/editing-a': typeof EditingARoute - '/editing-b': typeof EditingBRoute - '/history-blocking': typeof HistoryBlockingRoute - '/hover-preload-hash': typeof HoverPreloadHashRoute - '/lazy-error': typeof LazyErrorRoute - '/masks': typeof MasksRouteWithChildren - '/notRemountDeps': typeof NotRemountDepsRoute - '/posts': typeof PostsRouteWithChildren - '/remountDeps': typeof RemountDepsRoute - '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren - '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren - '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren - '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren - '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren - '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren - '/params-ps/strict-false': typeof ParamsPsStrictFalseRouteRouteWithChildren - '/relative/link': typeof RelativeLinkRouteRouteWithChildren - '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren - '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute - '/inside': typeof groupInsideRoute - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute - '/params-ps/': typeof ParamsPsIndexRoute - '/posts/': typeof PostsIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/relative/': typeof RelativeIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren - '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren - '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren - '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren - '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren - '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren - '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren - '/params-ps/strict-false/$version': typeof ParamsPsStrictFalseVersionRouteRoute - '/insidelayout': typeof groupLayoutInsidelayoutRoute - '/subfolder/inside': typeof groupSubfolderInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/fullpath-test/$id': typeof FullpathTestLayoutIdRoute - '/masks/admin/$userId': typeof MasksAdminUserIdRoute - '/masks/public/$username': typeof MasksPublicUsernameRoute - '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route - '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute - '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute - '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route - '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute - '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - '/params/single/$value': typeof ParamsSingleValueRoute - '/pathless-layout/child': typeof PathlessLayoutLayoutChildRoute - '/posts/$postId/edit': typeof PostsPostIdEditRoute - '/redirect/$target/destination': typeof RedirectTargetDestinationRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/redirect/$target/via-route-redirect-beforeLoad': typeof RedirectTargetViaRouteRedirectBeforeLoadRoute - '/redirect/$target/via-route-redirect-loader': typeof RedirectTargetViaRouteRedirectLoaderRoute - '/redirect/$target/via-routeApi-redirect-beforeLoad': typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute - '/redirect/$target/via-routeApi-redirect-loader': typeof RedirectTargetViaRouteApiRedirectLoaderRoute - '/redirect/preload/first': typeof RedirectPreloadFirstRoute - '/redirect/preload/second': typeof RedirectPreloadSecondRoute - '/redirect/preload/third': typeof RedirectPreloadThirdRoute - '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute - '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute - '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute - '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute - '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute - '/fullpath-test/': typeof FullpathTestLayoutIndexRoute - '/params-ps/named/': typeof ParamsPsNamedIndexRoute - '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute - '/pathless-layout/': typeof PathlessLayoutLayoutIndexRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren - '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren - '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute - '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute - '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute - '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute - '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute - '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute - '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute - '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute - '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute - '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute - '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute - '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute - '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute - '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute - '/relative/link/path/': typeof RelativeLinkPathIndexRoute - '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute - '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute - '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute - '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute - '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren - '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute - '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute - '/non-nested/deep/$baz/bar/': typeof NonNestedDeepBazBarIndexRoute - '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute - '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute - '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute - '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute - '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute - '/non-nested/deep/$baz/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/fullpath-test': typeof FullpathTestLayoutIndexRoute - '/non-nested': typeof NonNestedRouteRouteWithChildren - '/pathless-layout': typeof PathlessLayoutLayoutIndexRoute - '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - '/anchor': typeof AnchorRoute - '/component-types-test': typeof ComponentTypesTestRoute - '/document-navigation': typeof DocumentNavigationRoute - '/document-navigation-target': typeof DocumentNavigationTargetRoute - '/editing-a': typeof EditingARoute - '/editing-b': typeof EditingBRoute - '/history-blocking': typeof HistoryBlockingRoute - '/hover-preload-hash': typeof HoverPreloadHashRoute - '/lazy-error': typeof LazyErrorRoute - '/masks': typeof MasksRouteWithChildren - '/notRemountDeps': typeof NotRemountDepsRoute - '/remountDeps': typeof RemountDepsRoute - '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren - '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren - '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren - '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren - '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren - '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren - '/params-ps/strict-false': typeof ParamsPsStrictFalseRouteRouteWithChildren - '/relative/link': typeof RelativeLinkRouteRouteWithChildren - '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren - '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute - '/inside': typeof groupInsideRoute - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/search-params/default': typeof SearchParamsDefaultRoute - '/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute - '/params-ps': typeof ParamsPsIndexRoute - '/posts': typeof PostsIndexRoute - '/redirect': typeof RedirectIndexRoute - '/relative': typeof RelativeIndexRoute - '/search-params': typeof SearchParamsIndexRoute - '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren - '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren - '/params-ps/strict-false/$version': typeof ParamsPsStrictFalseVersionRouteRoute - '/insidelayout': typeof groupLayoutInsidelayoutRoute - '/subfolder/inside': typeof groupSubfolderInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/fullpath-test/$id': typeof FullpathTestLayoutIdRoute - '/masks/admin/$userId': typeof MasksAdminUserIdRoute - '/masks/public/$username': typeof MasksPublicUsernameRoute - '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route - '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute - '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute - '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route - '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute - '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - '/params/single/$value': typeof ParamsSingleValueRoute - '/pathless-layout/child': typeof PathlessLayoutLayoutChildRoute - '/posts/$postId/edit': typeof PostsPostIdEditRoute - '/redirect/$target/destination': typeof RedirectTargetDestinationRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/redirect/$target/via-route-redirect-beforeLoad': typeof RedirectTargetViaRouteRedirectBeforeLoadRoute - '/redirect/$target/via-route-redirect-loader': typeof RedirectTargetViaRouteRedirectLoaderRoute - '/redirect/$target/via-routeApi-redirect-beforeLoad': typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute - '/redirect/$target/via-routeApi-redirect-loader': typeof RedirectTargetViaRouteApiRedirectLoaderRoute - '/redirect/preload/first': typeof RedirectPreloadFirstRoute - '/redirect/preload/second': typeof RedirectPreloadSecondRoute - '/redirect/preload/third': typeof RedirectPreloadThirdRoute - '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute - '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute - '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute - '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute - '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute - '/params-ps/named': typeof ParamsPsNamedIndexRoute - '/params-ps/wildcard': typeof ParamsPsWildcardIndexRoute - '/redirect/$target': typeof RedirectTargetIndexRoute - '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren - '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute - '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute - '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute - '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute - '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute - '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute - '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute - '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute - '/non-nested/deep/$baz': typeof NonNestedDeepBazIndexRoute - '/non-nested/named/$baz': typeof NonNestedNamedBazIndexRoute - '/non-nested/path/baz': typeof NonNestedPathBazIndexRoute - '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute - '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute - '/relative/link/nested': typeof RelativeLinkNestedIndexRoute - '/relative/link/path': typeof RelativeLinkPathIndexRoute - '/relative/link/with-search': typeof RelativeLinkWithSearchIndexRoute - '/relative/useNavigate/nested': typeof RelativeUseNavigateNestedIndexRoute - '/relative/useNavigate/path': typeof RelativeUseNavigatePathIndexRoute - '/relative/useNavigate/with-search': typeof RelativeUseNavigateWithSearchIndexRoute - '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute - '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute - '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarIndexRoute - '/relative/link/nested/deep': typeof RelativeLinkNestedDeepIndexRoute - '/relative/link/path/$path': typeof RelativeLinkPathPathIndexRoute - '/relative/useNavigate/nested/deep': typeof RelativeUseNavigateNestedDeepIndexRoute - '/relative/useNavigate/path/$path': typeof RelativeUseNavigatePathPathIndexRoute - '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute - '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/fullpath-test': typeof FullpathTestRouteRouteWithChildren - '/non-nested': typeof NonNestedRouteRouteWithChildren - '/pathless-layout': typeof PathlessLayoutRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - '/_layout': typeof LayoutRouteWithChildren - '/anchor': typeof AnchorRoute - '/component-types-test': typeof ComponentTypesTestRoute - '/document-navigation': typeof DocumentNavigationRoute - '/document-navigation-target': typeof DocumentNavigationTargetRoute - '/editing-a': typeof EditingARoute - '/editing-b': typeof EditingBRoute - '/history-blocking': typeof HistoryBlockingRoute - '/hover-preload-hash': typeof HoverPreloadHashRoute - '/lazy-error': typeof LazyErrorRoute - '/masks': typeof MasksRouteWithChildren - '/notRemountDeps': typeof NotRemountDepsRoute - '/posts': typeof PostsRouteWithChildren - '/remountDeps': typeof RemountDepsRoute - '/fullpath-test/_layout': typeof FullpathTestLayoutRouteRouteWithChildren - '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren - '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren - '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren - '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren - '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren - '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren - '/params-ps/strict-false': typeof ParamsPsStrictFalseRouteRouteWithChildren - '/pathless-layout/_layout': typeof PathlessLayoutLayoutRouteRouteWithChildren - '/relative/link': typeof RelativeLinkRouteRouteWithChildren - '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren - '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute - '/(group)/_layout': typeof groupLayoutRouteWithChildren - '/(group)/inside': typeof groupInsideRoute - '/(group)/lazyinside': typeof groupLazyinsideRoute - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/structural-sharing/$enabled': typeof StructuralSharingEnabledRoute - '/params-ps/': typeof ParamsPsIndexRoute - '/posts/': typeof PostsIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/relative/': typeof RelativeIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren - '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren - '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren - '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren - '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren - '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren - '/params-ps/non-nested/$foo_': typeof ParamsPsNonNestedFooRouteRouteWithChildren - '/params-ps/strict-false/$version': typeof ParamsPsStrictFalseVersionRouteRoute - '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute - '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/fullpath-test/_layout/$id': typeof FullpathTestLayoutIdRoute - '/masks/admin/$userId': typeof MasksAdminUserIdRoute - '/masks/public/$username': typeof MasksPublicUsernameRoute - '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route - '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute - '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute - '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route - '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute - '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - '/params/single/$value': typeof ParamsSingleValueRoute - '/pathless-layout/_layout/child': typeof PathlessLayoutLayoutChildRoute - '/posts_/$postId/edit': typeof PostsPostIdEditRoute - '/redirect/$target/destination': typeof RedirectTargetDestinationRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/redirect/$target/via-route-redirect-beforeLoad': typeof RedirectTargetViaRouteRedirectBeforeLoadRoute - '/redirect/$target/via-route-redirect-loader': typeof RedirectTargetViaRouteRedirectLoaderRoute - '/redirect/$target/via-routeApi-redirect-beforeLoad': typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute - '/redirect/$target/via-routeApi-redirect-loader': typeof RedirectTargetViaRouteApiRedirectLoaderRoute - '/redirect/preload/first': typeof RedirectPreloadFirstRoute - '/redirect/preload/second': typeof RedirectPreloadSecondRoute - '/redirect/preload/third': typeof RedirectPreloadThirdRoute - '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute - '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute - '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute - '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute - '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute - '/fullpath-test/_layout/': typeof FullpathTestLayoutIndexRoute - '/params-ps/named/': typeof ParamsPsNamedIndexRoute - '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute - '/pathless-layout/_layout/': typeof PathlessLayoutLayoutIndexRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/non-nested/deep/$baz_/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren - '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren - '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute - '/non-nested/named/$baz_/bar': typeof NonNestedNamedBazBarRoute - '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute - '/non-nested/path/baz_/bar': typeof NonNestedPathBazBarRoute - '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - '/non-nested/prefix/prefix{$baz}_/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute - '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute - '/non-nested/suffix/{$baz}suffix_/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute - '/params-ps/non-nested/$foo_/$bar': typeof ParamsPsNonNestedFooBarRoute - '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute - '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute - '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute - '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute - '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute - '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute - '/relative/link/path/': typeof RelativeLinkPathIndexRoute - '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute - '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute - '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute - '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute - '/non-nested/deep/$baz_/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren - '/non-nested/deep/$baz_/bar_/qux': typeof NonNestedDeepBazBarQuxRoute - '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute - '/non-nested/deep/$baz_/bar/': typeof NonNestedDeepBazBarIndexRoute - '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute - '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute - '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute - '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute - '/non-nested/deep/$baz_/bar/$foo_/qux': typeof NonNestedDeepBazBarFooQuxRoute - '/non-nested/deep/$baz_/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/fullpath-test' - | '/non-nested' - | '/pathless-layout' - | '/search-params' - | '/대한민국' - | '/anchor' - | '/component-types-test' - | '/document-navigation' - | '/document-navigation-target' - | '/editing-a' - | '/editing-b' - | '/history-blocking' - | '/hover-preload-hash' - | '/lazy-error' - | '/masks' - | '/notRemountDeps' - | '/posts' - | '/remountDeps' - | '/non-nested/deep' - | '/non-nested/named' - | '/non-nested/path' - | '/non-nested/prefix' - | '/non-nested/suffix' - | '/params-ps/non-nested' - | '/params-ps/strict-false' - | '/relative/link' - | '/relative/useNavigate' - | '/onlyrouteinside' - | '/inside' - | '/lazyinside' - | '/posts/$postId' - | '/redirect/$target' - | '/search-params/default' - | '/structural-sharing/$enabled' - | '/params-ps/' - | '/posts/' - | '/redirect/' - | '/relative/' - | '/search-params/' - | '/non-nested/deep/$baz' - | '/non-nested/named/$baz' - | '/non-nested/path/baz' - | '/non-nested/prefix/prefix{$baz}' - | '/non-nested/suffix/{$baz}suffix' - | '/params-ps/named/$foo' - | '/params-ps/non-nested/$foo' - | '/params-ps/strict-false/$version' - | '/insidelayout' - | '/subfolder/inside' - | '/layout-a' - | '/layout-b' - | '/fullpath-test/$id' - | '/masks/admin/$userId' - | '/masks/public/$username' - | '/params-ps/named/prefix{$foo}' - | '/params-ps/named/{$foo}suffix' - | '/params-ps/wildcard/$' - | '/params-ps/wildcard/prefix@대{$}' - | '/params-ps/wildcard/prefix{$}' - | '/params-ps/wildcard/{$}suffix' - | '/params-ps/wildcard/{$}suffix@대' - | '/params/single/$value' - | '/pathless-layout/child' - | '/posts/$postId/edit' - | '/redirect/$target/destination' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/redirect/$target/via-route-redirect-beforeLoad' - | '/redirect/$target/via-route-redirect-loader' - | '/redirect/$target/via-routeApi-redirect-beforeLoad' - | '/redirect/$target/via-routeApi-redirect-loader' - | '/redirect/preload/first' - | '/redirect/preload/second' - | '/redirect/preload/third' - | '/relative/link/relative-link-a' - | '/relative/link/relative-link-b' - | '/relative/useNavigate/relative-useNavigate-a' - | '/relative/useNavigate/relative-useNavigate-b' - | '/대한민국/wildcard/$' - | '/대한민국/🚀/$id' - | '/fullpath-test/' - | '/params-ps/named/' - | '/params-ps/wildcard/' - | '/pathless-layout/' - | '/redirect/$target/' - | '/non-nested/deep/$baz/bar' - | '/params-ps/named/$foo/$bar' - | '/non-nested/named/$baz/foo' - | '/non-nested/named/$baz/bar' - | '/non-nested/path/baz/foo' - | '/non-nested/path/baz/bar' - | '/non-nested/prefix/prefix{$baz}/foo' - | '/non-nested/prefix/prefix{$baz}/bar' - | '/non-nested/suffix/{$baz}suffix/foo' - | '/non-nested/suffix/{$baz}suffix/bar' - | '/params-ps/non-nested/$foo/$bar' - | '/non-nested/deep/$baz/' - | '/non-nested/named/$baz/' - | '/non-nested/path/baz/' - | '/non-nested/prefix/prefix{$baz}/' - | '/non-nested/suffix/{$baz}suffix/' - | '/relative/link/nested/' - | '/relative/link/path/' - | '/relative/link/with-search/' - | '/relative/useNavigate/nested/' - | '/relative/useNavigate/path/' - | '/relative/useNavigate/with-search/' - | '/non-nested/deep/$baz/bar/$foo' - | '/non-nested/deep/$baz/bar/qux' - | '/params-ps/named/$foo/$bar/$baz' - | '/non-nested/deep/$baz/bar/' - | '/relative/link/nested/deep/' - | '/relative/link/path/$path/' - | '/relative/useNavigate/nested/deep/' - | '/relative/useNavigate/path/$path/' - | '/non-nested/deep/$baz/bar/$foo/qux' - | '/non-nested/deep/$baz/bar/$foo/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/fullpath-test' - | '/non-nested' - | '/pathless-layout' - | '/대한민국' - | '/anchor' - | '/component-types-test' - | '/document-navigation' - | '/document-navigation-target' - | '/editing-a' - | '/editing-b' - | '/history-blocking' - | '/hover-preload-hash' - | '/lazy-error' - | '/masks' - | '/notRemountDeps' - | '/remountDeps' - | '/non-nested/deep' - | '/non-nested/named' - | '/non-nested/path' - | '/non-nested/prefix' - | '/non-nested/suffix' - | '/params-ps/non-nested' - | '/params-ps/strict-false' - | '/relative/link' - | '/relative/useNavigate' - | '/onlyrouteinside' - | '/inside' - | '/lazyinside' - | '/posts/$postId' - | '/search-params/default' - | '/structural-sharing/$enabled' - | '/params-ps' - | '/posts' - | '/redirect' - | '/relative' - | '/search-params' - | '/params-ps/named/$foo' - | '/params-ps/non-nested/$foo' - | '/params-ps/strict-false/$version' - | '/insidelayout' - | '/subfolder/inside' - | '/layout-a' - | '/layout-b' - | '/fullpath-test/$id' - | '/masks/admin/$userId' - | '/masks/public/$username' - | '/params-ps/named/prefix{$foo}' - | '/params-ps/named/{$foo}suffix' - | '/params-ps/wildcard/$' - | '/params-ps/wildcard/prefix@대{$}' - | '/params-ps/wildcard/prefix{$}' - | '/params-ps/wildcard/{$}suffix' - | '/params-ps/wildcard/{$}suffix@대' - | '/params/single/$value' - | '/pathless-layout/child' - | '/posts/$postId/edit' - | '/redirect/$target/destination' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/redirect/$target/via-route-redirect-beforeLoad' - | '/redirect/$target/via-route-redirect-loader' - | '/redirect/$target/via-routeApi-redirect-beforeLoad' - | '/redirect/$target/via-routeApi-redirect-loader' - | '/redirect/preload/first' - | '/redirect/preload/second' - | '/redirect/preload/third' - | '/relative/link/relative-link-a' - | '/relative/link/relative-link-b' - | '/relative/useNavigate/relative-useNavigate-a' - | '/relative/useNavigate/relative-useNavigate-b' - | '/대한민국/wildcard/$' - | '/대한민국/🚀/$id' - | '/params-ps/named' - | '/params-ps/wildcard' - | '/redirect/$target' - | '/params-ps/named/$foo/$bar' - | '/non-nested/named/$baz/foo' - | '/non-nested/named/$baz/bar' - | '/non-nested/path/baz/foo' - | '/non-nested/path/baz/bar' - | '/non-nested/prefix/prefix{$baz}/foo' - | '/non-nested/prefix/prefix{$baz}/bar' - | '/non-nested/suffix/{$baz}suffix/foo' - | '/non-nested/suffix/{$baz}suffix/bar' - | '/params-ps/non-nested/$foo/$bar' - | '/non-nested/deep/$baz' - | '/non-nested/named/$baz' - | '/non-nested/path/baz' - | '/non-nested/prefix/prefix{$baz}' - | '/non-nested/suffix/{$baz}suffix' - | '/relative/link/nested' - | '/relative/link/path' - | '/relative/link/with-search' - | '/relative/useNavigate/nested' - | '/relative/useNavigate/path' - | '/relative/useNavigate/with-search' - | '/non-nested/deep/$baz/bar/qux' - | '/params-ps/named/$foo/$bar/$baz' - | '/non-nested/deep/$baz/bar' - | '/relative/link/nested/deep' - | '/relative/link/path/$path' - | '/relative/useNavigate/nested/deep' - | '/relative/useNavigate/path/$path' - | '/non-nested/deep/$baz/bar/$foo/qux' - | '/non-nested/deep/$baz/bar/$foo' - id: - | '__root__' - | '/' - | '/fullpath-test' - | '/non-nested' - | '/pathless-layout' - | '/search-params' - | '/대한민국' - | '/_layout' - | '/anchor' - | '/component-types-test' - | '/document-navigation' - | '/document-navigation-target' - | '/editing-a' - | '/editing-b' - | '/history-blocking' - | '/hover-preload-hash' - | '/lazy-error' - | '/masks' - | '/notRemountDeps' - | '/posts' - | '/remountDeps' - | '/fullpath-test/_layout' - | '/non-nested/deep' - | '/non-nested/named' - | '/non-nested/path' - | '/non-nested/prefix' - | '/non-nested/suffix' - | '/params-ps/non-nested' - | '/params-ps/strict-false' - | '/pathless-layout/_layout' - | '/relative/link' - | '/relative/useNavigate' - | '/(another-group)/onlyrouteinside' - | '/(group)/_layout' - | '/(group)/inside' - | '/(group)/lazyinside' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/redirect/$target' - | '/search-params/default' - | '/structural-sharing/$enabled' - | '/params-ps/' - | '/posts/' - | '/redirect/' - | '/relative/' - | '/search-params/' - | '/non-nested/deep/$baz' - | '/non-nested/named/$baz' - | '/non-nested/path/baz' - | '/non-nested/prefix/prefix{$baz}' - | '/non-nested/suffix/{$baz}suffix' - | '/params-ps/named/$foo' - | '/params-ps/non-nested/$foo_' - | '/params-ps/strict-false/$version' - | '/(group)/_layout/insidelayout' - | '/(group)/subfolder/inside' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - | '/fullpath-test/_layout/$id' - | '/masks/admin/$userId' - | '/masks/public/$username' - | '/params-ps/named/prefix{$foo}' - | '/params-ps/named/{$foo}suffix' - | '/params-ps/wildcard/$' - | '/params-ps/wildcard/prefix@대{$}' - | '/params-ps/wildcard/prefix{$}' - | '/params-ps/wildcard/{$}suffix' - | '/params-ps/wildcard/{$}suffix@대' - | '/params/single/$value' - | '/pathless-layout/_layout/child' - | '/posts_/$postId/edit' - | '/redirect/$target/destination' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/redirect/$target/via-route-redirect-beforeLoad' - | '/redirect/$target/via-route-redirect-loader' - | '/redirect/$target/via-routeApi-redirect-beforeLoad' - | '/redirect/$target/via-routeApi-redirect-loader' - | '/redirect/preload/first' - | '/redirect/preload/second' - | '/redirect/preload/third' - | '/relative/link/relative-link-a' - | '/relative/link/relative-link-b' - | '/relative/useNavigate/relative-useNavigate-a' - | '/relative/useNavigate/relative-useNavigate-b' - | '/대한민국/wildcard/$' - | '/대한민국/🚀/$id' - | '/fullpath-test/_layout/' - | '/params-ps/named/' - | '/params-ps/wildcard/' - | '/pathless-layout/_layout/' - | '/redirect/$target/' - | '/non-nested/deep/$baz_/bar' - | '/params-ps/named/$foo/$bar' - | '/non-nested/named/$baz/foo' - | '/non-nested/named/$baz_/bar' - | '/non-nested/path/baz/foo' - | '/non-nested/path/baz_/bar' - | '/non-nested/prefix/prefix{$baz}/foo' - | '/non-nested/prefix/prefix{$baz}_/bar' - | '/non-nested/suffix/{$baz}suffix/foo' - | '/non-nested/suffix/{$baz}suffix_/bar' - | '/params-ps/non-nested/$foo_/$bar' - | '/non-nested/deep/$baz/' - | '/non-nested/named/$baz/' - | '/non-nested/path/baz/' - | '/non-nested/prefix/prefix{$baz}/' - | '/non-nested/suffix/{$baz}suffix/' - | '/relative/link/nested/' - | '/relative/link/path/' - | '/relative/link/with-search/' - | '/relative/useNavigate/nested/' - | '/relative/useNavigate/path/' - | '/relative/useNavigate/with-search/' - | '/non-nested/deep/$baz_/bar/$foo' - | '/non-nested/deep/$baz_/bar_/qux' - | '/params-ps/named/$foo/$bar/$baz' - | '/non-nested/deep/$baz_/bar/' - | '/relative/link/nested/deep/' - | '/relative/link/path/$path/' - | '/relative/useNavigate/nested/deep/' - | '/relative/useNavigate/path/$path/' - | '/non-nested/deep/$baz_/bar/$foo_/qux' - | '/non-nested/deep/$baz_/bar/$foo/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - FullpathTestRouteRoute: typeof FullpathTestRouteRouteWithChildren - NonNestedRouteRoute: typeof NonNestedRouteRouteWithChildren - PathlessLayoutRouteRoute: typeof PathlessLayoutRouteRouteWithChildren - SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren - Char45824Char54620Char48124Char44397RouteRoute: typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - LayoutRoute: typeof LayoutRouteWithChildren - AnchorRoute: typeof AnchorRoute - ComponentTypesTestRoute: typeof ComponentTypesTestRoute - DocumentNavigationRoute: typeof DocumentNavigationRoute - DocumentNavigationTargetRoute: typeof DocumentNavigationTargetRoute - EditingARoute: typeof EditingARoute - EditingBRoute: typeof EditingBRoute - HistoryBlockingRoute: typeof HistoryBlockingRoute - HoverPreloadHashRoute: typeof HoverPreloadHashRoute - LazyErrorRoute: typeof LazyErrorRoute - MasksRoute: typeof MasksRouteWithChildren - NotRemountDepsRoute: typeof NotRemountDepsRoute - PostsRoute: typeof PostsRouteWithChildren - RemountDepsRoute: typeof RemountDepsRoute - ParamsPsNonNestedRouteRoute: typeof ParamsPsNonNestedRouteRouteWithChildren - ParamsPsStrictFalseRouteRoute: typeof ParamsPsStrictFalseRouteRouteWithChildren - RelativeLinkRouteRoute: typeof RelativeLinkRouteRouteWithChildren - RelativeUseNavigateRouteRoute: typeof RelativeUseNavigateRouteRouteWithChildren - anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute - groupLayoutRoute: typeof groupLayoutRouteWithChildren - groupInsideRoute: typeof groupInsideRoute - groupLazyinsideRoute: typeof groupLazyinsideRoute - RedirectTargetRoute: typeof RedirectTargetRouteWithChildren - StructuralSharingEnabledRoute: typeof StructuralSharingEnabledRoute - ParamsPsIndexRoute: typeof ParamsPsIndexRoute - RedirectIndexRoute: typeof RedirectIndexRoute - RelativeIndexRoute: typeof RelativeIndexRoute - ParamsPsNamedFooRouteRoute: typeof ParamsPsNamedFooRouteRouteWithChildren - groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute - ParamsPsNamedPrefixChar123fooChar125Route: typeof ParamsPsNamedPrefixChar123fooChar125Route - ParamsPsNamedChar123fooChar125suffixRoute: typeof ParamsPsNamedChar123fooChar125suffixRoute - ParamsPsWildcardSplatRoute: typeof ParamsPsWildcardSplatRoute - ParamsPsWildcardPrefixAtChar45824Char123Char125Route: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - ParamsPsWildcardPrefixChar123Char125Route: typeof ParamsPsWildcardPrefixChar123Char125Route - ParamsPsWildcardChar123Char125suffixRoute: typeof ParamsPsWildcardChar123Char125suffixRoute - ParamsPsWildcardChar123Char125suffixAtChar45824Route: typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - ParamsSingleValueRoute: typeof ParamsSingleValueRoute - PostsPostIdEditRoute: typeof PostsPostIdEditRoute - RedirectPreloadFirstRoute: typeof RedirectPreloadFirstRoute - RedirectPreloadSecondRoute: typeof RedirectPreloadSecondRoute - RedirectPreloadThirdRoute: typeof RedirectPreloadThirdRoute - ParamsPsNamedIndexRoute: typeof ParamsPsNamedIndexRoute - ParamsPsWildcardIndexRoute: typeof ParamsPsWildcardIndexRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/anchor': { - id: '/anchor' - path: '/anchor' - fullPath: '/anchor' - preLoaderRoute: typeof AnchorRouteImport - parentRoute: typeof rootRouteImport - } - '/component-types-test': { - id: '/component-types-test' - path: '/component-types-test' - fullPath: '/component-types-test' - preLoaderRoute: typeof ComponentTypesTestRouteImport - parentRoute: typeof rootRouteImport - } - '/document-navigation': { - id: '/document-navigation' - path: '/document-navigation' - fullPath: '/document-navigation' - preLoaderRoute: typeof DocumentNavigationRouteImport - parentRoute: typeof rootRouteImport - } - '/document-navigation-target': { - id: '/document-navigation-target' - path: '/document-navigation-target' - fullPath: '/document-navigation-target' - preLoaderRoute: typeof DocumentNavigationTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/editing-a': { - id: '/editing-a' - path: '/editing-a' - fullPath: '/editing-a' - preLoaderRoute: typeof EditingARouteImport - parentRoute: typeof rootRouteImport - } - '/editing-b': { - id: '/editing-b' - path: '/editing-b' - fullPath: '/editing-b' - preLoaderRoute: typeof EditingBRouteImport - parentRoute: typeof rootRouteImport - } - '/fullpath-test': { - id: '/fullpath-test' - path: '/fullpath-test' - fullPath: '/fullpath-test' - preLoaderRoute: typeof FullpathTestRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/history-blocking': { - id: '/history-blocking' - path: '/history-blocking' - fullPath: '/history-blocking' - preLoaderRoute: typeof HistoryBlockingRouteImport - parentRoute: typeof rootRouteImport - } - '/hover-preload-hash': { - id: '/hover-preload-hash' - path: '/hover-preload-hash' - fullPath: '/hover-preload-hash' - preLoaderRoute: typeof HoverPreloadHashRouteImport - parentRoute: typeof rootRouteImport - } - '/lazy-error': { - id: '/lazy-error' - path: '/lazy-error' - fullPath: '/lazy-error' - preLoaderRoute: typeof LazyErrorRouteImport - parentRoute: typeof rootRouteImport - } - '/masks': { - id: '/masks' - path: '/masks' - fullPath: '/masks' - preLoaderRoute: typeof MasksRouteImport - parentRoute: typeof rootRouteImport - } - '/non-nested': { - id: '/non-nested' - path: '/non-nested' - fullPath: '/non-nested' - preLoaderRoute: typeof NonNestedRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/notRemountDeps': { - id: '/notRemountDeps' - path: '/notRemountDeps' - fullPath: '/notRemountDeps' - preLoaderRoute: typeof NotRemountDepsRouteImport - parentRoute: typeof rootRouteImport - } - '/pathless-layout': { - id: '/pathless-layout' - path: '/pathless-layout' - fullPath: '/pathless-layout' - preLoaderRoute: typeof PathlessLayoutRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/remountDeps': { - id: '/remountDeps' - path: '/remountDeps' - fullPath: '/remountDeps' - preLoaderRoute: typeof RemountDepsRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params': { - id: '/search-params' - path: '/search-params' - fullPath: '/search-params' - preLoaderRoute: typeof SearchParamsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/대한민국': { - id: '/대한민국' - path: '/대한민국' - fullPath: '/대한민국' - preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteRouteImport - parentRoute: typeof rootRouteImport - } - '/(another-group)/onlyrouteinside': { - id: '/(another-group)/onlyrouteinside' - path: '/onlyrouteinside' - fullPath: '/onlyrouteinside' - preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/_layout': { - id: '/(group)/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof groupLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/inside': { - id: '/(group)/inside' - path: '/inside' - fullPath: '/inside' - preLoaderRoute: typeof groupInsideRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/lazyinside': { - id: '/(group)/lazyinside' - path: '/lazyinside' - fullPath: '/lazyinside' - preLoaderRoute: typeof groupLazyinsideRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/fullpath-test/_layout': { - id: '/fullpath-test/_layout' - path: '' - fullPath: '/fullpath-test' - preLoaderRoute: typeof FullpathTestLayoutRouteRouteImport - parentRoute: typeof FullpathTestRouteRoute - } - '/non-nested/deep': { - id: '/non-nested/deep' - path: '/deep' - fullPath: '/non-nested/deep' - preLoaderRoute: typeof NonNestedDeepRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/named': { - id: '/non-nested/named' - path: '/named' - fullPath: '/non-nested/named' - preLoaderRoute: typeof NonNestedNamedRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/path': { - id: '/non-nested/path' - path: '/path' - fullPath: '/non-nested/path' - preLoaderRoute: typeof NonNestedPathRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/prefix': { - id: '/non-nested/prefix' - path: '/prefix' - fullPath: '/non-nested/prefix' - preLoaderRoute: typeof NonNestedPrefixRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/suffix': { - id: '/non-nested/suffix' - path: '/suffix' - fullPath: '/non-nested/suffix' - preLoaderRoute: typeof NonNestedSuffixRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/params-ps/': { - id: '/params-ps/' - path: '/params-ps' - fullPath: '/params-ps/' - preLoaderRoute: typeof ParamsPsIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/non-nested': { - id: '/params-ps/non-nested' - path: '/params-ps/non-nested' - fullPath: '/params-ps/non-nested' - preLoaderRoute: typeof ParamsPsNonNestedRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/strict-false': { - id: '/params-ps/strict-false' - path: '/params-ps/strict-false' - fullPath: '/params-ps/strict-false' - preLoaderRoute: typeof ParamsPsStrictFalseRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/pathless-layout/_layout': { - id: '/pathless-layout/_layout' - path: '' - fullPath: '/pathless-layout' - preLoaderRoute: typeof PathlessLayoutLayoutRouteRouteImport - parentRoute: typeof PathlessLayoutRouteRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/redirect/': { - id: '/redirect/' - path: '/redirect' - fullPath: '/redirect/' - preLoaderRoute: typeof RedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target': { - id: '/redirect/$target' - path: '/redirect/$target' - fullPath: '/redirect/$target' - preLoaderRoute: typeof RedirectTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/': { - id: '/relative/' - path: '/relative' - fullPath: '/relative/' - preLoaderRoute: typeof RelativeIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/link': { - id: '/relative/link' - path: '/relative/link' - fullPath: '/relative/link' - preLoaderRoute: typeof RelativeLinkRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/useNavigate': { - id: '/relative/useNavigate' - path: '/relative/useNavigate' - fullPath: '/relative/useNavigate' - preLoaderRoute: typeof RelativeUseNavigateRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params/': { - id: '/search-params/' - path: '/' - fullPath: '/search-params/' - preLoaderRoute: typeof SearchParamsIndexRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/search-params/default': { - id: '/search-params/default' - path: '/default' - fullPath: '/search-params/default' - preLoaderRoute: typeof SearchParamsDefaultRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/structural-sharing/$enabled': { - id: '/structural-sharing/$enabled' - path: '/structural-sharing/$enabled' - fullPath: '/structural-sharing/$enabled' - preLoaderRoute: typeof StructuralSharingEnabledRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/_layout/insidelayout': { - id: '/(group)/_layout/insidelayout' - path: '/insidelayout' - fullPath: '/insidelayout' - preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport - parentRoute: typeof groupLayoutRoute - } - '/(group)/subfolder/inside': { - id: '/(group)/subfolder/inside' - path: '/subfolder/inside' - fullPath: '/subfolder/inside' - preLoaderRoute: typeof groupSubfolderInsideRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - '/fullpath-test/_layout/': { - id: '/fullpath-test/_layout/' - path: '/' - fullPath: '/fullpath-test/' - preLoaderRoute: typeof FullpathTestLayoutIndexRouteImport - parentRoute: typeof FullpathTestLayoutRouteRoute - } - '/fullpath-test/_layout/$id': { - id: '/fullpath-test/_layout/$id' - path: '/$id' - fullPath: '/fullpath-test/$id' - preLoaderRoute: typeof FullpathTestLayoutIdRouteImport - parentRoute: typeof FullpathTestLayoutRouteRoute - } - '/masks/admin/$userId': { - id: '/masks/admin/$userId' - path: '/admin/$userId' - fullPath: '/masks/admin/$userId' - preLoaderRoute: typeof MasksAdminUserIdRouteImport - parentRoute: typeof MasksRoute - } - '/masks/public/$username': { - id: '/masks/public/$username' - path: '/public/$username' - fullPath: '/masks/public/$username' - preLoaderRoute: typeof MasksPublicUsernameRouteImport - parentRoute: typeof MasksRoute - } - '/non-nested/deep/$baz': { - id: '/non-nested/deep/$baz' - path: '/$baz' - fullPath: '/non-nested/deep/$baz' - preLoaderRoute: typeof NonNestedDeepBazRouteRouteImport - parentRoute: typeof NonNestedDeepRouteRoute - } - '/non-nested/named/$baz': { - id: '/non-nested/named/$baz' - path: '/$baz' - fullPath: '/non-nested/named/$baz' - preLoaderRoute: typeof NonNestedNamedBazRouteRouteImport - parentRoute: typeof NonNestedNamedRouteRoute - } - '/non-nested/path/baz': { - id: '/non-nested/path/baz' - path: '/baz' - fullPath: '/non-nested/path/baz' - preLoaderRoute: typeof NonNestedPathBazRouteRouteImport - parentRoute: typeof NonNestedPathRouteRoute - } - '/non-nested/prefix/prefix{$baz}': { - id: '/non-nested/prefix/prefix{$baz}' - path: '/prefix{$baz}' - fullPath: '/non-nested/prefix/prefix{$baz}' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteImport - parentRoute: typeof NonNestedPrefixRouteRoute - } - '/non-nested/suffix/{$baz}suffix': { - id: '/non-nested/suffix/{$baz}suffix' - path: '/{$baz}suffix' - fullPath: '/non-nested/suffix/{$baz}suffix' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteImport - parentRoute: typeof NonNestedSuffixRouteRoute - } - '/params-ps/named/': { - id: '/params-ps/named/' - path: '/params-ps/named' - fullPath: '/params-ps/named/' - preLoaderRoute: typeof ParamsPsNamedIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/named/$foo': { - id: '/params-ps/named/$foo' - path: '/params-ps/named/$foo' - fullPath: '/params-ps/named/$foo' - preLoaderRoute: typeof ParamsPsNamedFooRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/named/prefix{$foo}': { - id: '/params-ps/named/prefix{$foo}' - path: '/params-ps/named/prefix{$foo}' - fullPath: '/params-ps/named/prefix{$foo}' - preLoaderRoute: typeof ParamsPsNamedPrefixChar123fooChar125RouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/named/{$foo}suffix': { - id: '/params-ps/named/{$foo}suffix' - path: '/params-ps/named/{$foo}suffix' - fullPath: '/params-ps/named/{$foo}suffix' - preLoaderRoute: typeof ParamsPsNamedChar123fooChar125suffixRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/non-nested/$foo_': { - id: '/params-ps/non-nested/$foo_' - path: '/$foo' - fullPath: '/params-ps/non-nested/$foo' - preLoaderRoute: typeof ParamsPsNonNestedFooRouteRouteImport - parentRoute: typeof ParamsPsNonNestedRouteRoute - } - '/params-ps/strict-false/$version': { - id: '/params-ps/strict-false/$version' - path: '/$version' - fullPath: '/params-ps/strict-false/$version' - preLoaderRoute: typeof ParamsPsStrictFalseVersionRouteRouteImport - parentRoute: typeof ParamsPsStrictFalseRouteRoute - } - '/params-ps/wildcard/': { - id: '/params-ps/wildcard/' - path: '/params-ps/wildcard' - fullPath: '/params-ps/wildcard/' - preLoaderRoute: typeof ParamsPsWildcardIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/$': { - id: '/params-ps/wildcard/$' - path: '/params-ps/wildcard/$' - fullPath: '/params-ps/wildcard/$' - preLoaderRoute: typeof ParamsPsWildcardSplatRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/prefix@대{$}': { - id: '/params-ps/wildcard/prefix@대{$}' - path: '/params-ps/wildcard/prefix@대{$}' - fullPath: '/params-ps/wildcard/prefix@대{$}' - preLoaderRoute: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/prefix{$}': { - id: '/params-ps/wildcard/prefix{$}' - path: '/params-ps/wildcard/prefix{$}' - fullPath: '/params-ps/wildcard/prefix{$}' - preLoaderRoute: typeof ParamsPsWildcardPrefixChar123Char125RouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/{$}suffix': { - id: '/params-ps/wildcard/{$}suffix' - path: '/params-ps/wildcard/{$}suffix' - fullPath: '/params-ps/wildcard/{$}suffix' - preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/{$}suffix@대': { - id: '/params-ps/wildcard/{$}suffix@대' - path: '/params-ps/wildcard/{$}suffix@대' - fullPath: '/params-ps/wildcard/{$}suffix@대' - preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport - parentRoute: typeof rootRouteImport - } - '/params/single/$value': { - id: '/params/single/$value' - path: '/params/single/$value' - fullPath: '/params/single/$value' - preLoaderRoute: typeof ParamsSingleValueRouteImport - parentRoute: typeof rootRouteImport - } - '/pathless-layout/_layout/': { - id: '/pathless-layout/_layout/' - path: '/' - fullPath: '/pathless-layout/' - preLoaderRoute: typeof PathlessLayoutLayoutIndexRouteImport - parentRoute: typeof PathlessLayoutLayoutRouteRoute - } - '/pathless-layout/_layout/child': { - id: '/pathless-layout/_layout/child' - path: '/child' - fullPath: '/pathless-layout/child' - preLoaderRoute: typeof PathlessLayoutLayoutChildRouteImport - parentRoute: typeof PathlessLayoutLayoutRouteRoute - } - '/posts_/$postId/edit': { - id: '/posts_/$postId/edit' - path: '/posts/$postId/edit' - fullPath: '/posts/$postId/edit' - preLoaderRoute: typeof PostsPostIdEditRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target/': { - id: '/redirect/$target/' - path: '/' - fullPath: '/redirect/$target/' - preLoaderRoute: typeof RedirectTargetIndexRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/destination': { - id: '/redirect/$target/destination' - path: '/destination' - fullPath: '/redirect/$target/destination' - preLoaderRoute: typeof RedirectTargetDestinationRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-beforeLoad': { - id: '/redirect/$target/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/redirect/$target/via-beforeLoad' - preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-loader': { - id: '/redirect/$target/via-loader' - path: '/via-loader' - fullPath: '/redirect/$target/via-loader' - preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-route-redirect-beforeLoad': { - id: '/redirect/$target/via-route-redirect-beforeLoad' - path: '/via-route-redirect-beforeLoad' - fullPath: '/redirect/$target/via-route-redirect-beforeLoad' - preLoaderRoute: typeof RedirectTargetViaRouteRedirectBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-route-redirect-loader': { - id: '/redirect/$target/via-route-redirect-loader' - path: '/via-route-redirect-loader' - fullPath: '/redirect/$target/via-route-redirect-loader' - preLoaderRoute: typeof RedirectTargetViaRouteRedirectLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-routeApi-redirect-beforeLoad': { - id: '/redirect/$target/via-routeApi-redirect-beforeLoad' - path: '/via-routeApi-redirect-beforeLoad' - fullPath: '/redirect/$target/via-routeApi-redirect-beforeLoad' - preLoaderRoute: typeof RedirectTargetViaRouteApiRedirectBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-routeApi-redirect-loader': { - id: '/redirect/$target/via-routeApi-redirect-loader' - path: '/via-routeApi-redirect-loader' - fullPath: '/redirect/$target/via-routeApi-redirect-loader' - preLoaderRoute: typeof RedirectTargetViaRouteApiRedirectLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/preload/first': { - id: '/redirect/preload/first' - path: '/redirect/preload/first' - fullPath: '/redirect/preload/first' - preLoaderRoute: typeof RedirectPreloadFirstRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/preload/second': { - id: '/redirect/preload/second' - path: '/redirect/preload/second' - fullPath: '/redirect/preload/second' - preLoaderRoute: typeof RedirectPreloadSecondRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/preload/third': { - id: '/redirect/preload/third' - path: '/redirect/preload/third' - fullPath: '/redirect/preload/third' - preLoaderRoute: typeof RedirectPreloadThirdRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/link/relative-link-a': { - id: '/relative/link/relative-link-a' - path: '/relative-link-a' - fullPath: '/relative/link/relative-link-a' - preLoaderRoute: typeof RelativeLinkRelativeLinkARouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/relative-link-b': { - id: '/relative/link/relative-link-b' - path: '/relative-link-b' - fullPath: '/relative/link/relative-link-b' - preLoaderRoute: typeof RelativeLinkRelativeLinkBRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/useNavigate/relative-useNavigate-a': { - id: '/relative/useNavigate/relative-useNavigate-a' - path: '/relative-useNavigate-a' - fullPath: '/relative/useNavigate/relative-useNavigate-a' - preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateARouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/relative-useNavigate-b': { - id: '/relative/useNavigate/relative-useNavigate-b' - path: '/relative-useNavigate-b' - fullPath: '/relative/useNavigate/relative-useNavigate-b' - preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateBRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/대한민국/wildcard/$': { - id: '/대한민국/wildcard/$' - path: '/wildcard/$' - fullPath: '/대한민국/wildcard/$' - preLoaderRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRouteImport - parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute - } - '/대한민국/🚀/$id': { - id: '/대한민국/🚀/$id' - path: '/🚀/$id' - fullPath: '/대한민국/🚀/$id' - preLoaderRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport - parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute - } - '/non-nested/deep/$baz/': { - id: '/non-nested/deep/$baz/' - path: '/' - fullPath: '/non-nested/deep/$baz/' - preLoaderRoute: typeof NonNestedDeepBazIndexRouteImport - parentRoute: typeof NonNestedDeepBazRouteRoute - } - '/non-nested/deep/$baz_/bar': { - id: '/non-nested/deep/$baz_/bar' - path: '/$baz/bar' - fullPath: '/non-nested/deep/$baz/bar' - preLoaderRoute: typeof NonNestedDeepBazBarRouteRouteImport - parentRoute: typeof NonNestedDeepRouteRoute - } - '/non-nested/named/$baz/': { - id: '/non-nested/named/$baz/' - path: '/' - fullPath: '/non-nested/named/$baz/' - preLoaderRoute: typeof NonNestedNamedBazIndexRouteImport - parentRoute: typeof NonNestedNamedBazRouteRoute - } - '/non-nested/named/$baz/foo': { - id: '/non-nested/named/$baz/foo' - path: '/foo' - fullPath: '/non-nested/named/$baz/foo' - preLoaderRoute: typeof NonNestedNamedBazFooRouteImport - parentRoute: typeof NonNestedNamedBazRouteRoute - } - '/non-nested/named/$baz_/bar': { - id: '/non-nested/named/$baz_/bar' - path: '/$baz/bar' - fullPath: '/non-nested/named/$baz/bar' - preLoaderRoute: typeof NonNestedNamedBazBarRouteImport - parentRoute: typeof NonNestedNamedRouteRoute - } - '/non-nested/path/baz/': { - id: '/non-nested/path/baz/' - path: '/' - fullPath: '/non-nested/path/baz/' - preLoaderRoute: typeof NonNestedPathBazIndexRouteImport - parentRoute: typeof NonNestedPathBazRouteRoute - } - '/non-nested/path/baz/foo': { - id: '/non-nested/path/baz/foo' - path: '/foo' - fullPath: '/non-nested/path/baz/foo' - preLoaderRoute: typeof NonNestedPathBazFooRouteImport - parentRoute: typeof NonNestedPathBazRouteRoute - } - '/non-nested/path/baz_/bar': { - id: '/non-nested/path/baz_/bar' - path: '/baz/bar' - fullPath: '/non-nested/path/baz/bar' - preLoaderRoute: typeof NonNestedPathBazBarRouteImport - parentRoute: typeof NonNestedPathRouteRoute - } - '/non-nested/prefix/prefix{$baz}/': { - id: '/non-nested/prefix/prefix{$baz}/' - path: '/' - fullPath: '/non-nested/prefix/prefix{$baz}/' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRouteImport - parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute - } - '/non-nested/prefix/prefix{$baz}/foo': { - id: '/non-nested/prefix/prefix{$baz}/foo' - path: '/foo' - fullPath: '/non-nested/prefix/prefix{$baz}/foo' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRouteImport - parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute - } - '/non-nested/prefix/prefix{$baz}_/bar': { - id: '/non-nested/prefix/prefix{$baz}_/bar' - path: '/prefix{$baz}/bar' - fullPath: '/non-nested/prefix/prefix{$baz}/bar' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRouteImport - parentRoute: typeof NonNestedPrefixRouteRoute - } - '/non-nested/suffix/{$baz}suffix/': { - id: '/non-nested/suffix/{$baz}suffix/' - path: '/' - fullPath: '/non-nested/suffix/{$baz}suffix/' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRouteImport - parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute - } - '/non-nested/suffix/{$baz}suffix/foo': { - id: '/non-nested/suffix/{$baz}suffix/foo' - path: '/foo' - fullPath: '/non-nested/suffix/{$baz}suffix/foo' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRouteImport - parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute - } - '/non-nested/suffix/{$baz}suffix_/bar': { - id: '/non-nested/suffix/{$baz}suffix_/bar' - path: '/{$baz}suffix/bar' - fullPath: '/non-nested/suffix/{$baz}suffix/bar' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRouteImport - parentRoute: typeof NonNestedSuffixRouteRoute - } - '/params-ps/named/$foo/$bar': { - id: '/params-ps/named/$foo/$bar' - path: '/$bar' - fullPath: '/params-ps/named/$foo/$bar' - preLoaderRoute: typeof ParamsPsNamedFooBarRouteRouteImport - parentRoute: typeof ParamsPsNamedFooRouteRoute - } - '/params-ps/non-nested/$foo_/$bar': { - id: '/params-ps/non-nested/$foo_/$bar' - path: '/$bar' - fullPath: '/params-ps/non-nested/$foo/$bar' - preLoaderRoute: typeof ParamsPsNonNestedFooBarRouteImport - parentRoute: typeof ParamsPsNonNestedFooRouteRoute - } - '/relative/link/nested/': { - id: '/relative/link/nested/' - path: '/nested' - fullPath: '/relative/link/nested/' - preLoaderRoute: typeof RelativeLinkNestedIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/path/': { - id: '/relative/link/path/' - path: '/path' - fullPath: '/relative/link/path/' - preLoaderRoute: typeof RelativeLinkPathIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/with-search/': { - id: '/relative/link/with-search/' - path: '/with-search' - fullPath: '/relative/link/with-search/' - preLoaderRoute: typeof RelativeLinkWithSearchIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/useNavigate/nested/': { - id: '/relative/useNavigate/nested/' - path: '/nested' - fullPath: '/relative/useNavigate/nested/' - preLoaderRoute: typeof RelativeUseNavigateNestedIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/path/': { - id: '/relative/useNavigate/path/' - path: '/path' - fullPath: '/relative/useNavigate/path/' - preLoaderRoute: typeof RelativeUseNavigatePathIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/with-search/': { - id: '/relative/useNavigate/with-search/' - path: '/with-search' - fullPath: '/relative/useNavigate/with-search/' - preLoaderRoute: typeof RelativeUseNavigateWithSearchIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/non-nested/deep/$baz_/bar/': { - id: '/non-nested/deep/$baz_/bar/' - path: '/' - fullPath: '/non-nested/deep/$baz/bar/' - preLoaderRoute: typeof NonNestedDeepBazBarIndexRouteImport - parentRoute: typeof NonNestedDeepBazBarRouteRoute - } - '/non-nested/deep/$baz_/bar/$foo': { - id: '/non-nested/deep/$baz_/bar/$foo' - path: '/$foo' - fullPath: '/non-nested/deep/$baz/bar/$foo' - preLoaderRoute: typeof NonNestedDeepBazBarFooRouteRouteImport - parentRoute: typeof NonNestedDeepBazBarRouteRoute - } - '/non-nested/deep/$baz_/bar_/qux': { - id: '/non-nested/deep/$baz_/bar_/qux' - path: '/$baz/bar/qux' - fullPath: '/non-nested/deep/$baz/bar/qux' - preLoaderRoute: typeof NonNestedDeepBazBarQuxRouteImport - parentRoute: typeof NonNestedDeepRouteRoute - } - '/params-ps/named/$foo/$bar/$baz': { - id: '/params-ps/named/$foo/$bar/$baz' - path: '/$baz' - fullPath: '/params-ps/named/$foo/$bar/$baz' - preLoaderRoute: typeof ParamsPsNamedFooBarBazRouteImport - parentRoute: typeof ParamsPsNamedFooBarRouteRoute - } - '/relative/link/nested/deep/': { - id: '/relative/link/nested/deep/' - path: '/nested/deep' - fullPath: '/relative/link/nested/deep/' - preLoaderRoute: typeof RelativeLinkNestedDeepIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/path/$path/': { - id: '/relative/link/path/$path/' - path: '/path/$path' - fullPath: '/relative/link/path/$path/' - preLoaderRoute: typeof RelativeLinkPathPathIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/useNavigate/nested/deep/': { - id: '/relative/useNavigate/nested/deep/' - path: '/nested/deep' - fullPath: '/relative/useNavigate/nested/deep/' - preLoaderRoute: typeof RelativeUseNavigateNestedDeepIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/path/$path/': { - id: '/relative/useNavigate/path/$path/' - path: '/path/$path' - fullPath: '/relative/useNavigate/path/$path/' - preLoaderRoute: typeof RelativeUseNavigatePathPathIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/non-nested/deep/$baz_/bar/$foo/': { - id: '/non-nested/deep/$baz_/bar/$foo/' - path: '/' - fullPath: '/non-nested/deep/$baz/bar/$foo/' - preLoaderRoute: typeof NonNestedDeepBazBarFooIndexRouteImport - parentRoute: typeof NonNestedDeepBazBarFooRouteRoute - } - '/non-nested/deep/$baz_/bar/$foo_/qux': { - id: '/non-nested/deep/$baz_/bar/$foo_/qux' - path: '/$foo/qux' - fullPath: '/non-nested/deep/$baz/bar/$foo/qux' - preLoaderRoute: typeof NonNestedDeepBazBarFooQuxRouteImport - parentRoute: typeof NonNestedDeepBazBarRouteRoute - } - } -} - -interface FullpathTestLayoutRouteRouteChildren { - FullpathTestLayoutIdRoute: typeof FullpathTestLayoutIdRoute - FullpathTestLayoutIndexRoute: typeof FullpathTestLayoutIndexRoute -} - -const FullpathTestLayoutRouteRouteChildren: FullpathTestLayoutRouteRouteChildren = - { - FullpathTestLayoutIdRoute: FullpathTestLayoutIdRoute, - FullpathTestLayoutIndexRoute: FullpathTestLayoutIndexRoute, - } - -const FullpathTestLayoutRouteRouteWithChildren = - FullpathTestLayoutRouteRoute._addFileChildren( - FullpathTestLayoutRouteRouteChildren, - ) - -interface FullpathTestRouteRouteChildren { - FullpathTestLayoutRouteRoute: typeof FullpathTestLayoutRouteRouteWithChildren -} - -const FullpathTestRouteRouteChildren: FullpathTestRouteRouteChildren = { - FullpathTestLayoutRouteRoute: FullpathTestLayoutRouteRouteWithChildren, -} - -const FullpathTestRouteRouteWithChildren = - FullpathTestRouteRoute._addFileChildren(FullpathTestRouteRouteChildren) - -interface NonNestedDeepBazRouteRouteChildren { - NonNestedDeepBazIndexRoute: typeof NonNestedDeepBazIndexRoute -} - -const NonNestedDeepBazRouteRouteChildren: NonNestedDeepBazRouteRouteChildren = { - NonNestedDeepBazIndexRoute: NonNestedDeepBazIndexRoute, -} - -const NonNestedDeepBazRouteRouteWithChildren = - NonNestedDeepBazRouteRoute._addFileChildren( - NonNestedDeepBazRouteRouteChildren, - ) - -interface NonNestedDeepBazBarFooRouteRouteChildren { - NonNestedDeepBazBarFooIndexRoute: typeof NonNestedDeepBazBarFooIndexRoute -} - -const NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren = - { - NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute, - } - -const NonNestedDeepBazBarFooRouteRouteWithChildren = - NonNestedDeepBazBarFooRouteRoute._addFileChildren( - NonNestedDeepBazBarFooRouteRouteChildren, - ) - -interface NonNestedDeepBazBarRouteRouteChildren { - NonNestedDeepBazBarFooRouteRoute: typeof NonNestedDeepBazBarFooRouteRouteWithChildren - NonNestedDeepBazBarIndexRoute: typeof NonNestedDeepBazBarIndexRoute - NonNestedDeepBazBarFooQuxRoute: typeof NonNestedDeepBazBarFooQuxRoute -} - -const NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren = - { - NonNestedDeepBazBarFooRouteRoute: - NonNestedDeepBazBarFooRouteRouteWithChildren, - NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute, - NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute, - } - -const NonNestedDeepBazBarRouteRouteWithChildren = - NonNestedDeepBazBarRouteRoute._addFileChildren( - NonNestedDeepBazBarRouteRouteChildren, - ) - -interface NonNestedDeepRouteRouteChildren { - NonNestedDeepBazRouteRoute: typeof NonNestedDeepBazRouteRouteWithChildren - NonNestedDeepBazBarRouteRoute: typeof NonNestedDeepBazBarRouteRouteWithChildren - NonNestedDeepBazBarQuxRoute: typeof NonNestedDeepBazBarQuxRoute -} - -const NonNestedDeepRouteRouteChildren: NonNestedDeepRouteRouteChildren = { - NonNestedDeepBazRouteRoute: NonNestedDeepBazRouteRouteWithChildren, - NonNestedDeepBazBarRouteRoute: NonNestedDeepBazBarRouteRouteWithChildren, - NonNestedDeepBazBarQuxRoute: NonNestedDeepBazBarQuxRoute, -} - -const NonNestedDeepRouteRouteWithChildren = - NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren) - -interface NonNestedNamedBazRouteRouteChildren { - NonNestedNamedBazFooRoute: typeof NonNestedNamedBazFooRoute - NonNestedNamedBazIndexRoute: typeof NonNestedNamedBazIndexRoute -} - -const NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren = - { - NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute, - NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute, - } - -const NonNestedNamedBazRouteRouteWithChildren = - NonNestedNamedBazRouteRoute._addFileChildren( - NonNestedNamedBazRouteRouteChildren, - ) - -interface NonNestedNamedRouteRouteChildren { - NonNestedNamedBazRouteRoute: typeof NonNestedNamedBazRouteRouteWithChildren - NonNestedNamedBazBarRoute: typeof NonNestedNamedBazBarRoute -} - -const NonNestedNamedRouteRouteChildren: NonNestedNamedRouteRouteChildren = { - NonNestedNamedBazRouteRoute: NonNestedNamedBazRouteRouteWithChildren, - NonNestedNamedBazBarRoute: NonNestedNamedBazBarRoute, -} - -const NonNestedNamedRouteRouteWithChildren = - NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren) - -interface NonNestedPathBazRouteRouteChildren { - NonNestedPathBazFooRoute: typeof NonNestedPathBazFooRoute - NonNestedPathBazIndexRoute: typeof NonNestedPathBazIndexRoute -} - -const NonNestedPathBazRouteRouteChildren: NonNestedPathBazRouteRouteChildren = { - NonNestedPathBazFooRoute: NonNestedPathBazFooRoute, - NonNestedPathBazIndexRoute: NonNestedPathBazIndexRoute, -} - -const NonNestedPathBazRouteRouteWithChildren = - NonNestedPathBazRouteRoute._addFileChildren( - NonNestedPathBazRouteRouteChildren, - ) - -interface NonNestedPathRouteRouteChildren { - NonNestedPathBazRouteRoute: typeof NonNestedPathBazRouteRouteWithChildren - NonNestedPathBazBarRoute: typeof NonNestedPathBazBarRoute -} - -const NonNestedPathRouteRouteChildren: NonNestedPathRouteRouteChildren = { - NonNestedPathBazRouteRoute: NonNestedPathBazRouteRouteWithChildren, - NonNestedPathBazBarRoute: NonNestedPathBazBarRoute, -} - -const NonNestedPathRouteRouteWithChildren = - NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren) - -interface NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren { - NonNestedPrefixPrefixChar123bazChar125FooRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - NonNestedPrefixPrefixChar123bazChar125IndexRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute -} - -const NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren = - { - NonNestedPrefixPrefixChar123bazChar125FooRoute: - NonNestedPrefixPrefixChar123bazChar125FooRoute, - NonNestedPrefixPrefixChar123bazChar125IndexRoute: - NonNestedPrefixPrefixChar123bazChar125IndexRoute, - } - -const NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren = - NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren( - NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren, - ) - -interface NonNestedPrefixRouteRouteChildren { - NonNestedPrefixPrefixChar123bazChar125RouteRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren - NonNestedPrefixPrefixChar123bazChar125BarRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRoute -} - -const NonNestedPrefixRouteRouteChildren: NonNestedPrefixRouteRouteChildren = { - NonNestedPrefixPrefixChar123bazChar125RouteRoute: - NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren, - NonNestedPrefixPrefixChar123bazChar125BarRoute: - NonNestedPrefixPrefixChar123bazChar125BarRoute, -} - -const NonNestedPrefixRouteRouteWithChildren = - NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren) - -interface NonNestedSuffixChar123bazChar125suffixRouteRouteChildren { - NonNestedSuffixChar123bazChar125suffixFooRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRoute - NonNestedSuffixChar123bazChar125suffixIndexRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRoute -} - -const NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren = - { - NonNestedSuffixChar123bazChar125suffixFooRoute: - NonNestedSuffixChar123bazChar125suffixFooRoute, - NonNestedSuffixChar123bazChar125suffixIndexRoute: - NonNestedSuffixChar123bazChar125suffixIndexRoute, - } - -const NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren = - NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren( - NonNestedSuffixChar123bazChar125suffixRouteRouteChildren, - ) - -interface NonNestedSuffixRouteRouteChildren { - NonNestedSuffixChar123bazChar125suffixRouteRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren - NonNestedSuffixChar123bazChar125suffixBarRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRoute -} - -const NonNestedSuffixRouteRouteChildren: NonNestedSuffixRouteRouteChildren = { - NonNestedSuffixChar123bazChar125suffixRouteRoute: - NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren, - NonNestedSuffixChar123bazChar125suffixBarRoute: - NonNestedSuffixChar123bazChar125suffixBarRoute, -} - -const NonNestedSuffixRouteRouteWithChildren = - NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren) - -interface NonNestedRouteRouteChildren { - NonNestedDeepRouteRoute: typeof NonNestedDeepRouteRouteWithChildren - NonNestedNamedRouteRoute: typeof NonNestedNamedRouteRouteWithChildren - NonNestedPathRouteRoute: typeof NonNestedPathRouteRouteWithChildren - NonNestedPrefixRouteRoute: typeof NonNestedPrefixRouteRouteWithChildren - NonNestedSuffixRouteRoute: typeof NonNestedSuffixRouteRouteWithChildren -} - -const NonNestedRouteRouteChildren: NonNestedRouteRouteChildren = { - NonNestedDeepRouteRoute: NonNestedDeepRouteRouteWithChildren, - NonNestedNamedRouteRoute: NonNestedNamedRouteRouteWithChildren, - NonNestedPathRouteRoute: NonNestedPathRouteRouteWithChildren, - NonNestedPrefixRouteRoute: NonNestedPrefixRouteRouteWithChildren, - NonNestedSuffixRouteRoute: NonNestedSuffixRouteRouteWithChildren, -} - -const NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren( - NonNestedRouteRouteChildren, -) - -interface PathlessLayoutLayoutRouteRouteChildren { - PathlessLayoutLayoutChildRoute: typeof PathlessLayoutLayoutChildRoute - PathlessLayoutLayoutIndexRoute: typeof PathlessLayoutLayoutIndexRoute -} - -const PathlessLayoutLayoutRouteRouteChildren: PathlessLayoutLayoutRouteRouteChildren = - { - PathlessLayoutLayoutChildRoute: PathlessLayoutLayoutChildRoute, - PathlessLayoutLayoutIndexRoute: PathlessLayoutLayoutIndexRoute, - } - -const PathlessLayoutLayoutRouteRouteWithChildren = - PathlessLayoutLayoutRouteRoute._addFileChildren( - PathlessLayoutLayoutRouteRouteChildren, - ) - -interface PathlessLayoutRouteRouteChildren { - PathlessLayoutLayoutRouteRoute: typeof PathlessLayoutLayoutRouteRouteWithChildren -} - -const PathlessLayoutRouteRouteChildren: PathlessLayoutRouteRouteChildren = { - PathlessLayoutLayoutRouteRoute: PathlessLayoutLayoutRouteRouteWithChildren, -} - -const PathlessLayoutRouteRouteWithChildren = - PathlessLayoutRouteRoute._addFileChildren(PathlessLayoutRouteRouteChildren) - -interface SearchParamsRouteRouteChildren { - SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute - SearchParamsIndexRoute: typeof SearchParamsIndexRoute -} - -const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = { - SearchParamsDefaultRoute: SearchParamsDefaultRoute, - SearchParamsIndexRoute: SearchParamsIndexRoute, -} - -const SearchParamsRouteRouteWithChildren = - SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren) - -interface Char45824Char54620Char48124Char44397RouteRouteChildren { - Char45824Char54620Char48124Char44397WildcardSplatRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute -} - -const Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren = - { - Char45824Char54620Char48124Char44397WildcardSplatRoute: - Char45824Char54620Char48124Char44397WildcardSplatRoute, - Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: - Char45824Char54620Char48124Char44397Char55357Char56960IdRoute, - } - -const Char45824Char54620Char48124Char44397RouteRouteWithChildren = - Char45824Char54620Char48124Char44397RouteRoute._addFileChildren( - Char45824Char54620Char48124Char44397RouteRouteChildren, - ) - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface MasksRouteChildren { - MasksAdminUserIdRoute: typeof MasksAdminUserIdRoute - MasksPublicUsernameRoute: typeof MasksPublicUsernameRoute -} - -const MasksRouteChildren: MasksRouteChildren = { - MasksAdminUserIdRoute: MasksAdminUserIdRoute, - MasksPublicUsernameRoute: MasksPublicUsernameRoute, -} - -const MasksRouteWithChildren = MasksRoute._addFileChildren(MasksRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface ParamsPsNonNestedFooRouteRouteChildren { - ParamsPsNonNestedFooBarRoute: typeof ParamsPsNonNestedFooBarRoute -} - -const ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren = - { - ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute, - } - -const ParamsPsNonNestedFooRouteRouteWithChildren = - ParamsPsNonNestedFooRouteRoute._addFileChildren( - ParamsPsNonNestedFooRouteRouteChildren, - ) - -interface ParamsPsNonNestedRouteRouteChildren { - ParamsPsNonNestedFooRouteRoute: typeof ParamsPsNonNestedFooRouteRouteWithChildren -} - -const ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren = - { - ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren, - } - -const ParamsPsNonNestedRouteRouteWithChildren = - ParamsPsNonNestedRouteRoute._addFileChildren( - ParamsPsNonNestedRouteRouteChildren, - ) - -interface ParamsPsStrictFalseRouteRouteChildren { - ParamsPsStrictFalseVersionRouteRoute: typeof ParamsPsStrictFalseVersionRouteRoute -} - -const ParamsPsStrictFalseRouteRouteChildren: ParamsPsStrictFalseRouteRouteChildren = - { - ParamsPsStrictFalseVersionRouteRoute: ParamsPsStrictFalseVersionRouteRoute, - } - -const ParamsPsStrictFalseRouteRouteWithChildren = - ParamsPsStrictFalseRouteRoute._addFileChildren( - ParamsPsStrictFalseRouteRouteChildren, - ) - -interface RelativeLinkRouteRouteChildren { - RelativeLinkRelativeLinkARoute: typeof RelativeLinkRelativeLinkARoute - RelativeLinkRelativeLinkBRoute: typeof RelativeLinkRelativeLinkBRoute - RelativeLinkNestedIndexRoute: typeof RelativeLinkNestedIndexRoute - RelativeLinkPathIndexRoute: typeof RelativeLinkPathIndexRoute - RelativeLinkWithSearchIndexRoute: typeof RelativeLinkWithSearchIndexRoute - RelativeLinkNestedDeepIndexRoute: typeof RelativeLinkNestedDeepIndexRoute - RelativeLinkPathPathIndexRoute: typeof RelativeLinkPathPathIndexRoute -} - -const RelativeLinkRouteRouteChildren: RelativeLinkRouteRouteChildren = { - RelativeLinkRelativeLinkARoute: RelativeLinkRelativeLinkARoute, - RelativeLinkRelativeLinkBRoute: RelativeLinkRelativeLinkBRoute, - RelativeLinkNestedIndexRoute: RelativeLinkNestedIndexRoute, - RelativeLinkPathIndexRoute: RelativeLinkPathIndexRoute, - RelativeLinkWithSearchIndexRoute: RelativeLinkWithSearchIndexRoute, - RelativeLinkNestedDeepIndexRoute: RelativeLinkNestedDeepIndexRoute, - RelativeLinkPathPathIndexRoute: RelativeLinkPathPathIndexRoute, -} - -const RelativeLinkRouteRouteWithChildren = - RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren) - -interface RelativeUseNavigateRouteRouteChildren { - RelativeUseNavigateRelativeUseNavigateARoute: typeof RelativeUseNavigateRelativeUseNavigateARoute - RelativeUseNavigateRelativeUseNavigateBRoute: typeof RelativeUseNavigateRelativeUseNavigateBRoute - RelativeUseNavigateNestedIndexRoute: typeof RelativeUseNavigateNestedIndexRoute - RelativeUseNavigatePathIndexRoute: typeof RelativeUseNavigatePathIndexRoute - RelativeUseNavigateWithSearchIndexRoute: typeof RelativeUseNavigateWithSearchIndexRoute - RelativeUseNavigateNestedDeepIndexRoute: typeof RelativeUseNavigateNestedDeepIndexRoute - RelativeUseNavigatePathPathIndexRoute: typeof RelativeUseNavigatePathPathIndexRoute -} - -const RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren = - { - RelativeUseNavigateRelativeUseNavigateARoute: - RelativeUseNavigateRelativeUseNavigateARoute, - RelativeUseNavigateRelativeUseNavigateBRoute: - RelativeUseNavigateRelativeUseNavigateBRoute, - RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute, - RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute, - RelativeUseNavigateWithSearchIndexRoute: - RelativeUseNavigateWithSearchIndexRoute, - RelativeUseNavigateNestedDeepIndexRoute: - RelativeUseNavigateNestedDeepIndexRoute, - RelativeUseNavigatePathPathIndexRoute: - RelativeUseNavigatePathPathIndexRoute, - } - -const RelativeUseNavigateRouteRouteWithChildren = - RelativeUseNavigateRouteRoute._addFileChildren( - RelativeUseNavigateRouteRouteChildren, - ) - -interface groupLayoutRouteChildren { - groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute -} - -const groupLayoutRouteChildren: groupLayoutRouteChildren = { - groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute, -} - -const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren( - groupLayoutRouteChildren, -) - -interface RedirectTargetRouteChildren { - RedirectTargetDestinationRoute: typeof RedirectTargetDestinationRoute - RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute - RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute - RedirectTargetViaRouteRedirectBeforeLoadRoute: typeof RedirectTargetViaRouteRedirectBeforeLoadRoute - RedirectTargetViaRouteRedirectLoaderRoute: typeof RedirectTargetViaRouteRedirectLoaderRoute - RedirectTargetViaRouteApiRedirectBeforeLoadRoute: typeof RedirectTargetViaRouteApiRedirectBeforeLoadRoute - RedirectTargetViaRouteApiRedirectLoaderRoute: typeof RedirectTargetViaRouteApiRedirectLoaderRoute - RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute -} - -const RedirectTargetRouteChildren: RedirectTargetRouteChildren = { - RedirectTargetDestinationRoute: RedirectTargetDestinationRoute, - RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute, - RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute, - RedirectTargetViaRouteRedirectBeforeLoadRoute: - RedirectTargetViaRouteRedirectBeforeLoadRoute, - RedirectTargetViaRouteRedirectLoaderRoute: - RedirectTargetViaRouteRedirectLoaderRoute, - RedirectTargetViaRouteApiRedirectBeforeLoadRoute: - RedirectTargetViaRouteApiRedirectBeforeLoadRoute, - RedirectTargetViaRouteApiRedirectLoaderRoute: - RedirectTargetViaRouteApiRedirectLoaderRoute, - RedirectTargetIndexRoute: RedirectTargetIndexRoute, -} - -const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren( - RedirectTargetRouteChildren, -) - -interface ParamsPsNamedFooBarRouteRouteChildren { - ParamsPsNamedFooBarBazRoute: typeof ParamsPsNamedFooBarBazRoute -} - -const ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren = - { - ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute, - } - -const ParamsPsNamedFooBarRouteRouteWithChildren = - ParamsPsNamedFooBarRouteRoute._addFileChildren( - ParamsPsNamedFooBarRouteRouteChildren, - ) - -interface ParamsPsNamedFooRouteRouteChildren { - ParamsPsNamedFooBarRouteRoute: typeof ParamsPsNamedFooBarRouteRouteWithChildren -} - -const ParamsPsNamedFooRouteRouteChildren: ParamsPsNamedFooRouteRouteChildren = { - ParamsPsNamedFooBarRouteRoute: ParamsPsNamedFooBarRouteRouteWithChildren, -} - -const ParamsPsNamedFooRouteRouteWithChildren = - ParamsPsNamedFooRouteRoute._addFileChildren( - ParamsPsNamedFooRouteRouteChildren, - ) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - FullpathTestRouteRoute: FullpathTestRouteRouteWithChildren, - NonNestedRouteRoute: NonNestedRouteRouteWithChildren, - PathlessLayoutRouteRoute: PathlessLayoutRouteRouteWithChildren, - SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren, - Char45824Char54620Char48124Char44397RouteRoute: - Char45824Char54620Char48124Char44397RouteRouteWithChildren, - LayoutRoute: LayoutRouteWithChildren, - AnchorRoute: AnchorRoute, - ComponentTypesTestRoute: ComponentTypesTestRoute, - DocumentNavigationRoute: DocumentNavigationRoute, - DocumentNavigationTargetRoute: DocumentNavigationTargetRoute, - EditingARoute: EditingARoute, - EditingBRoute: EditingBRoute, - HistoryBlockingRoute: HistoryBlockingRoute, - HoverPreloadHashRoute: HoverPreloadHashRoute, - LazyErrorRoute: LazyErrorRoute, - MasksRoute: MasksRouteWithChildren, - NotRemountDepsRoute: NotRemountDepsRoute, - PostsRoute: PostsRouteWithChildren, - RemountDepsRoute: RemountDepsRoute, - ParamsPsNonNestedRouteRoute: ParamsPsNonNestedRouteRouteWithChildren, - ParamsPsStrictFalseRouteRoute: ParamsPsStrictFalseRouteRouteWithChildren, - RelativeLinkRouteRoute: RelativeLinkRouteRouteWithChildren, - RelativeUseNavigateRouteRoute: RelativeUseNavigateRouteRouteWithChildren, - anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute, - groupLayoutRoute: groupLayoutRouteWithChildren, - groupInsideRoute: groupInsideRoute, - groupLazyinsideRoute: groupLazyinsideRoute, - RedirectTargetRoute: RedirectTargetRouteWithChildren, - StructuralSharingEnabledRoute: StructuralSharingEnabledRoute, - ParamsPsIndexRoute: ParamsPsIndexRoute, - RedirectIndexRoute: RedirectIndexRoute, - RelativeIndexRoute: RelativeIndexRoute, - ParamsPsNamedFooRouteRoute: ParamsPsNamedFooRouteRouteWithChildren, - groupSubfolderInsideRoute: groupSubfolderInsideRoute, - ParamsPsNamedPrefixChar123fooChar125Route: - ParamsPsNamedPrefixChar123fooChar125Route, - ParamsPsNamedChar123fooChar125suffixRoute: - ParamsPsNamedChar123fooChar125suffixRoute, - ParamsPsWildcardSplatRoute: ParamsPsWildcardSplatRoute, - ParamsPsWildcardPrefixAtChar45824Char123Char125Route: - ParamsPsWildcardPrefixAtChar45824Char123Char125Route, - ParamsPsWildcardPrefixChar123Char125Route: - ParamsPsWildcardPrefixChar123Char125Route, - ParamsPsWildcardChar123Char125suffixRoute: - ParamsPsWildcardChar123Char125suffixRoute, - ParamsPsWildcardChar123Char125suffixAtChar45824Route: - ParamsPsWildcardChar123Char125suffixAtChar45824Route, - ParamsSingleValueRoute: ParamsSingleValueRoute, - PostsPostIdEditRoute: PostsPostIdEditRoute, - RedirectPreloadFirstRoute: RedirectPreloadFirstRoute, - RedirectPreloadSecondRoute: RedirectPreloadSecondRoute, - RedirectPreloadThirdRoute: RedirectPreloadThirdRoute, - ParamsPsNamedIndexRoute: ParamsPsNamedIndexRoute, - ParamsPsWildcardIndexRoute: ParamsPsWildcardIndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx b/e2e/react-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx deleted file mode 100644 index d00b8024ac..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { getRouteApi, useSearch } from '@tanstack/react-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(another-group)/onlyrouteinside') - -export const Route = createFileRoute('/(another-group)/onlyrouteinside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ - from: '/(another-group)/onlyrouteinside', - }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx deleted file mode 100644 index cf8fe01af6..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { getRouteApi, useSearch } from '@tanstack/react-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/_layout/insidelayout') - -export const Route = createFileRoute('/(group)/_layout/insidelayout')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx deleted file mode 100644 index c8b874997b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(group)/_layout.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/(group)/_layout')({ - component: () => ( - <> -
/(group)/_layout!
- - - ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/inside.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/inside.tsx deleted file mode 100644 index 013df0e012..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(group)/inside.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { getRouteApi, useSearch } from '@tanstack/react-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/inside') - -export const Route = createFileRoute('/(group)/inside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/inside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx deleted file mode 100644 index 7112ca410e..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/react-router' -import { getRouteApi, useSearch } from '@tanstack/react-router' - -const routeApi = getRouteApi('/(group)/lazyinside') - -export const Route = createLazyFileRoute('/(group)/lazyinside')({ - component: () => { - const searchViaHook = useSearch({ from: '/(group)/lazyinside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx deleted file mode 100644 index df8ec637cf..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(group)/lazyinside.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { z } from 'zod' - -export const Route = createFileRoute('/(group)/lazyinside')({ - validateSearch: z.object({ hello: z.string().optional() }), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx b/e2e/react-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx deleted file mode 100644 index 58505e7f20..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { getRouteApi, useSearch } from '@tanstack/react-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/subfolder/inside') - -export const Route = createFileRoute('/(group)/subfolder/inside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook.hello}
-
- {searchViaRouteHook.hello} -
-
{searchViaRouteApi.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/__root.tsx b/e2e/react-router/basic-file-based/src/routes/__root.tsx deleted file mode 100644 index 298f97c1ba..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, - useCanGoBack, - useRouter, - useRouterState, -} from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - const router = useRouter() - const canGoBack = useCanGoBack() - // test useRouterState doesn't crash client side navigation - const _state = useRouterState() - - return ( - <> - -
- {' '} - - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Only Route Inside Group - {' '} - - Inside Group - {' '} - - Inside Subfolder Inside Group - {' '} - - Inside Group Inside Layout - {' '} - - Lazy Inside Group - {' '} - - redirect - {' '} - - relative routing - {' '} - - unicode path - {' '} - - This Route Does Not Exist - {' '} - - Masks - {' '} - - Pathless Layout - {' '} - - FullPath Test - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/_layout.tsx b/e2e/react-router/basic-file-based/src/routes/_layout.tsx deleted file mode 100644 index 0fcaac3a52..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2.tsx b/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 388d0b3b87..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index ed2dea8800..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 4799d403e9..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/basic-file-based/src/routes/anchor.tsx b/e2e/react-router/basic-file-based/src/routes/anchor.tsx deleted file mode 100644 index cae0a3e583..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/anchor.tsx +++ /dev/null @@ -1,224 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { useLayoutEffect, useRef, useState } from 'react' -import { Link, useLocation, useNavigate } from '@tanstack/react-router' - -export const Route = createFileRoute('/anchor')({ - component: AnchorComponent, -}) - -const anchors: Array<{ - id: string - title: string - hashScrollIntoView?: boolean | ScrollIntoViewOptions -}> = [ - { - id: 'default-anchor', - title: 'Default Anchor', - }, - { - id: 'false-anchor', - title: 'No Scroll Into View', - hashScrollIntoView: false, - }, - { - id: 'smooth-scroll', - title: 'Smooth Scroll', - hashScrollIntoView: { behavior: 'smooth' }, - }, - { - id: '/\\section', - title: 'Fragment with slashes', - }, -] as const - -function AnchorSection({ id, title }: { id: string; title: string }) { - const [hasShown, setHasShown] = useState(false) - const elementRef = useRef(null) - - useLayoutEffect(() => { - const observer = new IntersectionObserver( - ([entry]) => { - if (!hasShown && entry.isIntersecting) { - setHasShown(true) - } - }, - { threshold: 0.01 }, - ) - - const currentRef = elementRef.current - if (currentRef) { - observer.observe(currentRef) - } - - return () => { - if (currentRef) { - observer.unobserve(currentRef) - } - } - }, [hasShown]) - - return ( -
-

- {title} - {hasShown ? ' (shown)' : ''} -

-
- ) -} - -function AnchorComponent() { - const navigate = useNavigate() - const location = useLocation() - const [withScroll, setWithScroll] = useState(true) - - return ( -
- -
-
{ - event.preventDefault() - event.stopPropagation() - const formData = new FormData(event.target as HTMLFormElement) - - const toHash = formData.get('hash') as string - - if (!toHash) { - return - } - - const hashScrollIntoView = withScroll - ? ({ - behavior: formData.get('scrollBehavior') as ScrollBehavior, - block: formData.get('scrollBlock') as ScrollLogicalPosition, - inline: formData.get('scrollInline') as ScrollLogicalPosition, - } satisfies ScrollIntoViewOptions) - : false - - navigate({ hash: toHash, hashScrollIntoView }) - }} - > -

Scroll with navigate

-
- -
- -
-
- {withScroll ? ( - <> -
- -
- -
- -
- -
- -
- - ) : null} -
- -
-
- - {anchors.map((anchor) => ( - - ))} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/component-types-test.tsx b/e2e/react-router/basic-file-based/src/routes/component-types-test.tsx deleted file mode 100644 index 5f675393d4..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/component-types-test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// Test route for type safety of different component types -// This test should -// - check that `false` can be set on the `errorComponent` -// ...without causing build-time TypeScript errors -export const Route = createFileRoute('/component-types-test')({ - component: () =>
Testing test types
, - errorComponent: false, // Should not cause TypeScript error - pendingComponent: undefined, // Should not cause TypeScript error - notFoundComponent: undefined, // Should not cause TypeScript error -}) diff --git a/e2e/react-router/basic-file-based/src/routes/document-navigation-target.tsx b/e2e/react-router/basic-file-based/src/routes/document-navigation-target.tsx deleted file mode 100644 index 905b0c31b9..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/document-navigation-target.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/document-navigation-target')({}) diff --git a/e2e/react-router/basic-file-based/src/routes/document-navigation.tsx b/e2e/react-router/basic-file-based/src/routes/document-navigation.tsx deleted file mode 100644 index 66c2b704d1..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/document-navigation.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' -import type { AnyRouter } from '@tanstack/react-router' - -export const Route = createFileRoute('/document-navigation')({ - component: DocumentNavigation, -}) - -const adminHref = `http://127.0.0.1:${window.location.port}/external.html` - -function DocumentNavigation() { - const navigate = Route.useNavigate() - - return ( -
- - - - - - - - Navigate to admin - - Replace with admin - - - Reload admin - - - Navigate with external mask - - - Replace with external mask - - to={`${adminHref}?value=a+b&value=a%20b#raw%2f`}> - Navigate to absolute href - - - Reload relative href - -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/editing-a.tsx b/e2e/react-router/basic-file-based/src/routes/editing-a.tsx deleted file mode 100644 index bf98108848..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/editing-a.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { useBlocker } from '@tanstack/react-router' - -export const Route = createFileRoute('/editing-a')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = Route.useNavigate() - const [input, setInput] = React.useState('') - - const { proceed, status } = useBlocker({ - shouldBlockFn: ({ next }) => { - if (next.fullPath === '/editing-b' && input.length > 0) { - return true - } - return false - }, - withResolver: true, - }) - - return ( -
-

Editing A

- - - {status === 'blocked' && ( - - )} -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/editing-b.tsx b/e2e/react-router/basic-file-based/src/routes/editing-b.tsx deleted file mode 100644 index 1f3c2f1f2a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/editing-b.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { useBlocker } from '@tanstack/react-router' - -export const Route = createFileRoute('/editing-b')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = Route.useNavigate() - const [input, setInput] = React.useState('') - - const { proceed, status } = useBlocker({ - condition: input, - }) - - return ( -
-

Editing B

- - - {status === 'blocked' && ( - - )} -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/$id.tsx b/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/$id.tsx deleted file mode 100644 index 44b1f077ff..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/$id.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute, useMatches } from '@tanstack/react-router' - -export const Route = createFileRoute('/fullpath-test/_layout/$id')({ - component: IdComponent, -}) - -function IdComponent() { - const matches = useMatches() - const { id } = Route.useParams() - // Find this route's match by routeId - const idMatch = matches.find( - (m) => m.routeId === '/fullpath-test/_layout/$id', - ) - - return ( -
-
- {idMatch?.fullPath ?? 'undefined'} -
-
Param: {id}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/index.tsx b/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/index.tsx deleted file mode 100644 index e84b81047a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute, useMatches } from '@tanstack/react-router' - -export const Route = createFileRoute('/fullpath-test/_layout/')({ - component: IndexComponent, -}) - -function IndexComponent() { - const matches = useMatches() - // Find this index route's match by routeId - const indexMatch = matches.find( - (m) => m.routeId === '/fullpath-test/_layout/', - ) - - return ( -
-
- {indexMatch?.fullPath ?? 'undefined'} -
-
{Route.to}
-
FullPath Test Index
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/route.tsx b/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/route.tsx deleted file mode 100644 index 770888e62a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/fullpath-test/_layout/route.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Outlet, createFileRoute, useMatches } from '@tanstack/react-router' - -export const Route = createFileRoute('/fullpath-test/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - const matches = useMatches() - // Find this layout's match by routeId - const layoutMatch = matches.find( - (m) => m.routeId === '/fullpath-test/_layout', - ) - - return ( -
-
- {layoutMatch?.fullPath ?? 'undefined'} -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/fullpath-test/route.tsx b/e2e/react-router/basic-file-based/src/routes/fullpath-test/route.tsx deleted file mode 100644 index e876f36cbc..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/fullpath-test/route.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/fullpath-test')({ - component: () => ( -
-

FullPath Test Section

- -
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/history-blocking.tsx b/e2e/react-router/basic-file-based/src/routes/history-blocking.tsx deleted file mode 100644 index 019893a628..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/history-blocking.tsx +++ /dev/null @@ -1,119 +0,0 @@ -import * as React from 'react' -import { - Link, - createFileRoute, - useBlocker, - useRouter, -} from '@tanstack/react-router' - -export const Route = createFileRoute('/history-blocking')({ - validateSearch: (search: Record) => ({ - step: Number(search.step) || 0, - }), - component: HistoryBlocking, -}) - -function HistoryBlocking() { - const router = useRouter() - const { step } = Route.useSearch() - const [draft, setDraft] = React.useState('') - const [ignoreBlocker, setIgnoreBlocker] = React.useState(false) - const [documentHref, setDocumentHref] = React.useState('/') - const [navigationError, setNavigationError] = React.useState('') - const { status, reset, proceed } = useBlocker({ - shouldBlockFn: () => draft.length > 0, - enableBeforeUnload: draft.length > 0, - withResolver: true, - }) - - return ( -
-

History blocking

-

Step {step}

- - -

{draft ? 'Unsaved changes' : 'No changes'}

-

Blocker status: {status}

- {status === 'blocked' && ( - <> - - - - )} - - {[false, true].map((replace) => ( - - ))} - {navigationError &&

{navigationError}

} - - Add history entry - - - - {[-2, -1, 0, 1, 2].map((delta) => ( - - ))} - Leave document -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/hover-preload-hash.tsx b/e2e/react-router/basic-file-based/src/routes/hover-preload-hash.tsx deleted file mode 100644 index 6b62bac50a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/hover-preload-hash.tsx +++ /dev/null @@ -1,265 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/hover-preload-hash')({ - component: Page, -}) - -function Page() { - return ( - <> -
Hello from About!
- - To hash - - -

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

Hash is here

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

- - ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/index.tsx b/e2e/react-router/basic-file-based/src/routes/index.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/lazy-error.lazy.tsx b/e2e/react-router/basic-file-based/src/routes/lazy-error.lazy.tsx deleted file mode 100644 index a68465a84d..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/lazy-error.lazy.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/react-router' - -export const Route = createLazyFileRoute('/lazy-error')({ - component: LazyErrorComponent, - errorComponent: () => ( -
- Lazy route error component -
- ), -}) - -function LazyErrorComponent() { - return
Lazy route component
-} diff --git a/e2e/react-router/basic-file-based/src/routes/lazy-error.tsx b/e2e/react-router/basic-file-based/src/routes/lazy-error.tsx deleted file mode 100644 index 1eff96d7dc..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/lazy-error.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/lazy-error')({ - loader: () => { - throw new Error('Lazy route loader error') - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/masks.admin.$userId.tsx b/e2e/react-router/basic-file-based/src/routes/masks.admin.$userId.tsx deleted file mode 100644 index 5590a14062..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/masks.admin.$userId.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/masks/admin/$userId')({ - component: AdminUserRoute, -}) - -function AdminUserRoute() { - const params = Route.useParams() - - return ( -
-
{params.userId}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/masks.public.$username.tsx b/e2e/react-router/basic-file-based/src/routes/masks.public.$username.tsx deleted file mode 100644 index 200f7a3b6b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/masks.public.$username.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/masks/public/$username')({ - component: PublicUserRoute, -}) - -function PublicUserRoute() { - const params = Route.useParams() - - return ( -
-
{params.username}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/masks.tsx b/e2e/react-router/basic-file-based/src/routes/masks.tsx deleted file mode 100644 index bbe2342833..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/masks.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useRouterState, -} from '@tanstack/react-router' - -export const Route = createFileRoute('/masks')({ - component: MasksLayout, -}) - -function MasksLayout() { - const location = useRouterState({ - select: (state) => state.location, - }) - - return ( -
-

Route Masks

- -
-
{location.pathname}
-
- {location.maskedLocation?.pathname ?? ''} -
-
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx deleted file mode 100644 index 2c02a8f54a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx deleted file mode 100644 index 22955de3bb..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested named baz route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx deleted file mode 100644 index cbfe5cb72f..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar/foo index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx deleted file mode 100644 index 0e87a46ec5..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello deeply nested named baz/bar/foo route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx deleted file mode 100644 index 7668c77d3d..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo_/qux')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar/foo/qux -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx deleted file mode 100644 index 723dc0a6e2..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx deleted file mode 100644 index a9299e9f43..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello deeply nested baz/bar route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx deleted file mode 100644 index 7b38d5373e..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar_/qux')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar/qux -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/deep/route.tsx deleted file mode 100644 index 8db1457fef..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/deep/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/deep')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested deep layout -
-
- - To Baz - - - To named baz/bar - - - To named baz/bar/foo - - - To named baz/bar/foo/qux - - - To named baz/bar/qux - -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx deleted file mode 100644 index e89a7b2ead..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/named/$baz/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested named baz foo page -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx deleted file mode 100644 index 4b7ead5028..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/named/$baz/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested named baz index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx deleted file mode 100644 index 0339500185..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/named/$baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested named baz route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx deleted file mode 100644 index e39ff43a5e..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/named/$baz_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested named bar -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/named/route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/named/route.tsx deleted file mode 100644 index 55803fc8c3..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/named/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/named')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested named layout -
-
- - To named index - - - To named foo - - - To named foo 2 - - - To named bar - - - To named bar 2 - -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx deleted file mode 100644 index f80dd73a79..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/path/baz/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested path baz foo page -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx deleted file mode 100644 index ac8c66b672..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/path/baz/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested path baz index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx deleted file mode 100644 index 3a6172415c..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/path/baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested path baz route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx deleted file mode 100644 index ce18ed69a2..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/path/baz_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested path bar -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/path/route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/path/route.tsx deleted file mode 100644 index b6df6654e5..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/path/route.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/path')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested path layout -
-
- - To path index - - - To path foo - - - To path foo 2 - - - To path bar - - - To path bar 2 - -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx deleted file mode 100644 index 9283c8a611..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested prefix foo page -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx deleted file mode 100644 index d7afe25934..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested prefix index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx deleted file mode 100644 index baa99c974a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested prefix route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx deleted file mode 100644 index 6a0cd93430..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested prefix bar -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/route.tsx deleted file mode 100644 index c0b1b5d8cb..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/prefix/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/prefix')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested prefix layout -
-
- - To prefix index - - - To prefix foo - - - To prefix foo 2 - - - To prefix bar - - - To prefix bar 2 - -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx deleted file mode 100644 index 2c23aaea94..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/route.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

- Non-nested paths -

-
    -
  • - - To named param tests - - - To prefix param tests - - - To suffix param tests - - - To path tests - -
  • -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/route.tsx deleted file mode 100644 index a7548429a0..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested suffix layout -
-
- - To suffix index - - - To suffix foo - - - To suffix foo 2 - - - To suffix bar - - - To suffix bar 2 - -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx deleted file mode 100644 index 41796223b9..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested suffix foo page -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx deleted file mode 100644 index 3291f4a104..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested suffix index -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx deleted file mode 100644 index 724217f6ab..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested suffix route layout -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx b/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx deleted file mode 100644 index b56ff69c44..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested suffix bar -
-
- {JSON.stringify(params)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/notRemountDeps.tsx b/e2e/react-router/basic-file-based/src/routes/notRemountDeps.tsx deleted file mode 100644 index 8774849fd2..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/notRemountDeps.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/notRemountDeps')({ - validateSearch(search: { searchParam: string }) { - return { searchParam: search.searchParam } - }, - loaderDeps(opts) { - return opts.search - }, - component: Home, - remountDeps(opts) { - return opts.params - }, -}) - -let counter = 0 - -function Home() { - const search = Route.useSearch() - const navigate = Route.useNavigate() - - const [mounts, setMounts] = React.useState(counter) - React.useEffect(() => { - setMounts(++counter) - }, []) - - return ( -
- - -
Search: {search.searchParam}
-
Page component mounts: {mounts}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/index.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/index.tsx deleted file mode 100644 index b8976b901b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/index.tsx +++ /dev/null @@ -1,149 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

Named path params

-
    -
  • - - /params-ps/named/$foo - -
  • -
  • - - /params-ps/named/$foo - with special characters - -
  • -
  • - - /params-ps/named/{'prefix{$foo}'} - -
  • -
  • - - /params-ps/named/{'{$foo}suffix'} - -
  • -
-
-

Wildcard path params

-
    -
  • - - /params-ps/wildcard/$ - -
  • -
  • - - /params-ps/wildcard/$ with escaped params - -
  • -
  • - - /params-ps/wildcard/$ with encoded params - -
  • -
  • - - /params-ps/wildcard/{'prefix{$}'} - -
  • -
  • - - /params-ps/wildcard/{'prefix@대{$}'} - -
  • -
  • - - /params-ps/wildcard/{'{$}suffix'} - -
  • -
  • - - /params-ps/wildcard/{'{$}suffix@대'} - -
  • -
-
-

Non-nested path params

-
    -
  • - - Non-nested - -
  • -
-
-

Parsed params with strict false

-
    -
  • - - /params-ps/strict-false/$version (1) - -
  • -
  • - - /params-ps/strict-false/$version (2) - -
  • -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx deleted file mode 100644 index 2a38545def..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/named/$foo/$bar/$baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - const { foo, bar, baz } = Route.useParams() - return ( -
- Hello "/params-ps/named/{foo}/{bar}/{baz}"! -
- baz: {baz} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx deleted file mode 100644 index 653dcd951a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx +++ /dev/null @@ -1,45 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useParams, -} from '@tanstack/react-router' -import { RenderCounter } from '../../../../components/RenderCounter' - -export const Route = createFileRoute('/params-ps/named/$foo/$bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const { foo, bar, baz } = useParams({ - strict: false, - }) - - return ( -
- Hello "/params-ps/named/{foo}/{bar}"! -
- Bar Render Count:{' '} - - - -
-
- Bar: {bar} -
-
- Baz in Bar:{' '} - {baz ?? 'no param'} -
- - To Baz - - -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx deleted file mode 100644 index 65427a6446..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -import { RenderCounter } from '../../../../components/RenderCounter' - -export const Route = createFileRoute('/params-ps/named/$foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const foo = Route.useParams() - return ( -
-

ParamsNamedFoo

-
- RenderCount:{' '} - - - -
-
{JSON.stringify(foo)}
- - Index - - - Bar1 - - - Bar2 - - - Bar with special characters - - -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/named/index.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/named/index.tsx deleted file mode 100644 index e11cbd530c..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/named/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/named/')({ - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx deleted file mode 100644 index 69f6163299..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/params-ps/named/prefix{$foo}')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsNamedFooPrefix

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx deleted file mode 100644 index f98b9cc57a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/params-ps/named/{$foo}suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsNamedFooSuffix

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx deleted file mode 100644 index 333dead388..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute, useParams } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/non-nested/$foo_/$bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const fooParams = useParams({ from: `/params-ps/non-nested/$foo_` }) - const routeParams = Route.useParams() - - return ( -
-
{JSON.stringify(fooParams)}
-
- {JSON.stringify(routeParams)} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx deleted file mode 100644 index a05ef2993b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/non-nested/$foo_')() diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx deleted file mode 100644 index 93fd936218..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/non-nested')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

Non-nested path params

-
    -
  • - - /params-ps/non-nested/foo/bar - - - /params-ps/non-nested/foo2/bar2 - -
  • -
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/$version.route.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/$version.route.tsx deleted file mode 100644 index 6803de8c9b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/$version.route.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute, useParams } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/strict-false/$version')({ - params: { - parse: (params) => ({ - ...params, - version: parseInt(params.version), - }), - stringify: (params) => ({ - ...params, - version: `${params.version}`, - }), - }, - component: RouteComponent, -}) - -function RouteComponent() { - const { version } = useParams({ strict: false }) - - return
{String(version)}
-} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/route.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/route.tsx deleted file mode 100644 index f9f96cb7da..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/strict-false/route.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useParams, -} from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/strict-false')({ - component: RouteComponent, -}) - -function RouteComponent() { - const { version } = useParams({ strict: false }) - return ( -
-

ParamsStrictFalseParse

-
- Type:{' '} - {typeof version} -
-
- Value:{' '} - {String(version)} -
- - Version 1 - - - Version 2 - - -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx deleted file mode 100644 index 603dff0d59..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/params-ps/wildcard/$')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplat

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx deleted file mode 100644 index 62415d5ac4..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/wildcard/')({ - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx deleted file mode 100644 index 3da8af4ec4..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/wildcard/prefix@대{$}')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatPrefix

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx deleted file mode 100644 index dc994cb8ec..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/params-ps/wildcard/prefix{$}')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatPrefix

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx deleted file mode 100644 index a7a2995771..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/params-ps/wildcard/{$}suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatSuffix

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx b/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx deleted file mode 100644 index ac358666e4..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/params-ps/wildcard/{$}suffix@대')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatSuffix

-
{JSON.stringify(p)}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/params.single.$value.tsx b/e2e/react-router/basic-file-based/src/routes/params.single.$value.tsx deleted file mode 100644 index 7ee38c0db8..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/params.single.$value.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link } from '@tanstack/react-router' - -export const Route = createFileRoute('/params/single/$value')({ - component: RouteComponent, -}) - -function RouteComponent() { - const value = Route.useParams({ select: (s) => s.value }) - - return ( -
-
-

What's the value???

-

Check path param value is printed correctly for a single param.

-
-

- Value: {value} -

-
- - Self link to same - - - Self link to amended value {`e2e${value}`} - -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/child.tsx b/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/child.tsx deleted file mode 100644 index 256ea60e9e..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/child.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/pathless-layout/_layout/child')({ - component: () => ( -
Pathless Layout Child Route
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/index.tsx b/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/index.tsx deleted file mode 100644 index d6f3e355d9..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/pathless-layout/_layout/')({ - component: () => ( -
Pathless Layout Index
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/route.tsx b/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/route.tsx deleted file mode 100644 index ea237a5ea3..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/pathless-layout/_layout/route.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/pathless-layout/_layout')({ - component: () => ( -
-
Pathless Layout Wrapper
- - -
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/pathless-layout/route.tsx b/e2e/react-router/basic-file-based/src/routes/pathless-layout/route.tsx deleted file mode 100644 index de42c74567..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/pathless-layout/route.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/pathless-layout')({ - component: () => ( -
-

Pathless Layout Section

- -
- ), - notFoundComponent: () => ( -
- Not Found in Pathless Layout -
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/posts.$postId.tsx b/e2e/react-router/basic-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index 3466bd9d9d..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

- {post.title} -

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/posts.index.tsx b/e2e/react-router/basic-file-based/src/routes/posts.index.tsx deleted file mode 100644 index 90a8777a52..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/basic-file-based/src/routes/posts.tsx b/e2e/react-router/basic-file-based/src/routes/posts.tsx deleted file mode 100644 index 39b3328366..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - head: () => ({ - meta: [ - { - title: 'Posts page', - }, - ], - }), - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx b/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx deleted file mode 100644 index 80b89bdc9e..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/posts_.$postId.edit.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute, getRouteApi, useParams } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts_/$postId/edit')({ - component: PostEditPage, -}) - -const api = getRouteApi(`/posts_/$postId/edit`) - -function PostEditPage() { - const paramsViaApi = api.useParams() - const paramsViaHook = useParams({ from: `/posts_/$postId/edit` }) - - const paramsViaRouteHook = Route.useParams() - - return ( - <> -
{paramsViaHook.postId}
-
{paramsViaRouteHook.postId}
-
{paramsViaApi.postId}
- - ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target.tsx deleted file mode 100644 index 37e4729107..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { retainSearchParams } from '@tanstack/react-router' -import z from 'zod' - -export const Route = createFileRoute('/redirect/$target')({ - params: { - parse: (p) => - z - .object({ - target: z.union([z.literal('internal'), z.literal('external')]), - }) - .parse(p), - }, - validateSearch: z.object({ - reloadDocument: z.boolean().optional(), - preload: z.literal(false).optional(), - externalHost: z.string().optional(), - }), - search: { - middlewares: [retainSearchParams(['externalHost'])], - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/destination.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/destination.tsx deleted file mode 100644 index 39f99c9899..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/destination.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/$target/destination')({ - component: () => ( -
- Redirect destination for {Route.fullPath} -
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/index.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/index.tsx deleted file mode 100644 index 0dc806b935..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/index.tsx +++ /dev/null @@ -1,120 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/$target/')({ - component: () => { - const preload = Route.useSearch({ select: (s) => s.preload }) - return ( -
-
- - via-beforeLoad - -
-
- - via-beforeLoad (reloadDocument=true) - -
-
- - via-loader - -
-
- - via-loader (reloadDocument=true) - -
- {/* Route.redirect() tests - uses relative redirect to ./destination */} -
- - via-route-redirect-beforeLoad - -
-
- - via-route-redirect-loader - -
- {/* getRouteApi().redirect() tests - uses relative redirect to ./destination */} -
- - via-routeApi-redirect-beforeLoad - -
-
- - via-routeApi-redirect-loader - -
-
- ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx deleted file mode 100644 index 1f4a1a9e50..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/$target/via-beforeLoad')({ - beforeLoad: ({ - params: { target }, - search: { reloadDocument, externalHost }, - }) => { - switch (target) { - case 'internal': - throw redirect({ to: '/posts', reloadDocument }) - case 'external': - throw redirect({ href: externalHost ?? 'http://example.com' }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx deleted file mode 100644 index 4b111c62de..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/$target/via-loader')({ - loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({ - reloadDocument, - externalHost, - }), - loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => { - switch (target) { - case 'internal': - throw redirect({ to: '/posts', reloadDocument }) - case 'external': - const href = externalHost ?? 'http://example.com' - throw redirect({ href }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-beforeLoad.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-beforeLoad.tsx deleted file mode 100644 index 2393a1ea02..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-beforeLoad.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute( - '/redirect/$target/via-route-redirect-beforeLoad', -)({ - beforeLoad: ({ params: { target }, search: { externalHost } }) => { - switch (target) { - case 'internal': - // Use relative redirect to sibling route - this is the key feature being tested - // Note: '../destination' is the correct relative path for sibling navigation - throw Route.redirect({ to: '../destination' }) - case 'external': - throw Route.redirect({ href: externalHost ?? 'http://example.com' }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-loader.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-loader.tsx deleted file mode 100644 index 0b81ba3e6a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-route-redirect-loader.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute( - '/redirect/$target/via-route-redirect-loader', -)({ - loaderDeps: ({ search: { externalHost } }) => ({ - externalHost, - }), - loader: ({ params: { target }, deps: { externalHost } }) => { - switch (target) { - case 'internal': - // Use relative redirect to sibling route - this is the key feature being tested - // Note: '../destination' is the correct relative path for sibling navigation - throw Route.redirect({ to: '../destination' }) - case 'external': - throw Route.redirect({ href: externalHost ?? 'http://example.com' }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-beforeLoad.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-beforeLoad.tsx deleted file mode 100644 index 7653d858e0..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-beforeLoad.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute, getRouteApi } from '@tanstack/react-router' - -const routeApi = getRouteApi( - '/redirect/$target/via-routeApi-redirect-beforeLoad', -) - -export const Route = createFileRoute( - '/redirect/$target/via-routeApi-redirect-beforeLoad', -)({ - beforeLoad: ({ params: { target }, search: { externalHost } }) => { - switch (target) { - case 'internal': - // Use relative redirect to sibling route - this is the key feature being tested - // Note: '../destination' is the correct relative path for sibling navigation - throw routeApi.redirect({ to: '../destination' }) - case 'external': - throw routeApi.redirect({ href: externalHost ?? 'http://example.com' }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-loader.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-loader.tsx deleted file mode 100644 index 5bd9086f9b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/$target/via-routeApi-redirect-loader.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute, getRouteApi } from '@tanstack/react-router' - -const routeApi = getRouteApi('/redirect/$target/via-routeApi-redirect-loader') - -export const Route = createFileRoute( - '/redirect/$target/via-routeApi-redirect-loader', -)({ - loaderDeps: ({ search: { externalHost } }) => ({ - externalHost, - }), - loader: ({ params: { target }, deps: { externalHost } }) => { - switch (target) { - case 'internal': - // Use relative redirect to sibling route - this is the key feature being tested - // Note: '../destination' is the correct relative path for sibling navigation - throw routeApi.redirect({ to: '../destination' }) - case 'external': - throw routeApi.redirect({ href: externalHost ?? 'http://example.com' }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/index.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/index.tsx deleted file mode 100644 index 816065decd..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/index.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/')({ - component: () => ( -
- - internal - {' '} - - external - -
- ), -}) diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/preload/first.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/preload/first.tsx deleted file mode 100644 index f004c427d9..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/preload/first.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/preload/first')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- - go to second - -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/preload/second.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/preload/second.tsx deleted file mode 100644 index b0c04a2fb0..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/preload/second.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/redirect/preload/second')({ - loader: async () => { - await new Promise((r) => setTimeout(r, 1000)) - throw redirect({ from: Route.fullPath, to: '../third' }) - }, - component: RouteComponent, - pendingComponent: () =>

second pending

, -}) - -function RouteComponent() { - return
Hello "/redirect/preload/second"!
-} diff --git a/e2e/react-router/basic-file-based/src/routes/redirect/preload/third.tsx b/e2e/react-router/basic-file-based/src/routes/redirect/preload/third.tsx deleted file mode 100644 index 5d429a67d3..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/redirect/preload/third.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/redirect/preload/third')({ - component: RouteComponent, -}) - -function RouteComponent() { - return
Hello "/redirect/preload/third"!
-} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/index.tsx deleted file mode 100644 index 0450c32433..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Relative Routing Tests - Home -
-
- Using Links - Using useNavigate -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx deleted file mode 100644 index 5cc4b4e58a..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/link/nested/deep/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/nested/deep/"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/nested/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/nested/index.tsx deleted file mode 100644 index afca201e02..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/nested/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/link/nested/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/nested/"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx deleted file mode 100644 index 36e95665bc..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/link/path/$path/')({ - component: RouteComponent, - loader: ({ params }) => { - return params - }, -}) - -function RouteComponent() { - const { path } = Route.useParams() - - return ( -
-
- Hello from "/relative/links/path/{path}"! -
-
- - To {path === 'a' ? 'b' : 'a'} - -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/path/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/path/index.tsx deleted file mode 100644 index be1c7b7a47..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/path/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/link/path/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Relative Routing Tests - Path Params -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx deleted file mode 100644 index 72a1ee20ec..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/link/relative-link-a')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/relative-link-a"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx deleted file mode 100644 index e751331b3f..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/link/relative-link-b')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/relative-link-b"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/route.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/route.tsx deleted file mode 100644 index ae3193613f..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/route.tsx +++ /dev/null @@ -1,103 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useNavigate, -} from '@tanstack/react-router' -import { useEffect } from 'react' - -export const Route = createFileRoute('/relative/link')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = useNavigate() - - useEffect(() => { - console.log('navigate') - }, [navigate]) - - return ( -
-
- Relative Routing - Links - Index -
-
- - Return To Home - - - Return To Index - - - Reload - - - Back - - - To Relative Link A - - - To Relative Link B - - - To Deeply Nested - - - To Path Param A - - - To With Search Params - -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/link/with-search/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/link/with-search/index.tsx deleted file mode 100644 index fd7515ac11..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/link/with-search/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute, Link } from '@tanstack/react-router' -import { z } from 'zod' - -export const Route = createFileRoute('/relative/link/with-search/')({ - component: RouteComponent, - validateSearch: z.object({ - searchParam: z.string().default('1'), - }), -}) - -function RouteComponent() { - const { searchParam } = Route.useSearch() - return ( - <> -
- Hello "/relative/link/with-search/" searchParam: {searchParam}! -
-
- - Update Search - - - ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx deleted file mode 100644 index 453a088d63..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/useNavigate/nested/deep/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/nested/deep/"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx deleted file mode 100644 index ace502df18..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/useNavigate/nested/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/nested/"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx deleted file mode 100644 index 7305fdabca..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute, useNavigate } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/useNavigate/path/$path/')({ - component: RouteComponent, - loader: ({ params }) => { - return params - }, -}) - -function RouteComponent() { - const navigate = useNavigate() - - const { path } = Route.useParams() - - return ( -
-
- Hello from "/relative/useNavigate/path/{path}"! -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx deleted file mode 100644 index 18abb4af18..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/relative/useNavigate/path/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Relative Routing Tests - Path Params -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx deleted file mode 100644 index e236d80f63..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute( - '/relative/useNavigate/relative-useNavigate-a', -)({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/relative-useNavigate-a"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx deleted file mode 100644 index b6e1d607dd..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute( - '/relative/useNavigate/relative-useNavigate-b', -)({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/relative-useNavigate-b"! -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/route.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/route.tsx deleted file mode 100644 index 567df92e8b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/route.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { Outlet, createFileRoute, useNavigate } from '@tanstack/react-router' -import { useEffect } from 'react' - -export const Route = createFileRoute('/relative/useNavigate')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = useNavigate() - - useEffect(() => { - console.log('navigate') - }, [navigate]) - - return ( -
-
- Relative Routing - Links - Index -
-
- - - - - - - - - -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx b/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx deleted file mode 100644 index 7342202e1d..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { createFileRoute, useNavigate } from '@tanstack/react-router' -import { z } from 'zod' - -export const Route = createFileRoute('/relative/useNavigate/with-search/')({ - component: RouteComponent, - validateSearch: z.object({ - searchParam: z.string().default('1'), - }), -}) - -function RouteComponent() { - const navigate = useNavigate() - const { searchParam } = Route.useSearch() - - return ( - <> -
- Hello "/relative/useNavigate/with-search/" searchParam: {searchParam}! -
-
- - - ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/remountDeps.tsx b/e2e/react-router/basic-file-based/src/routes/remountDeps.tsx deleted file mode 100644 index 594a1ea567..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/remountDeps.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/remountDeps')({ - validateSearch(search: { searchParam: string }) { - return { searchParam: search.searchParam } - }, - loaderDeps(opts) { - return opts.search - }, - component: Home, - remountDeps(opts) { - return opts.search - }, -}) - -let counter = 0 - -function Home() { - const search = Route.useSearch() - const navigate = Route.useNavigate() - - const [mounts, setMounts] = React.useState(counter) - React.useEffect(() => { - setMounts(++counter) - }, []) - - return ( -
- - -
Search: {search.searchParam}
-
Page component mounts: {mounts}
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/search-params/default.tsx b/e2e/react-router/basic-file-based/src/routes/search-params/default.tsx deleted file mode 100644 index 19e1149b8d..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/search-params/default.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { z } from 'zod' - -export const Route = createFileRoute('/search-params/default')({ - validateSearch: z.object({ - default: z.string().default('d1'), - }), - beforeLoad: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - loader: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - component: () => { - const search = Route.useSearch() - const context = Route.useRouteContext() - return ( - <> -
{search.default}
-
{context.hello}
- - ) - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/search-params/index.tsx b/e2e/react-router/basic-file-based/src/routes/search-params/index.tsx deleted file mode 100644 index d56d5ddac1..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/search-params/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/search-params/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- - go to /search-params/default - -
- - go to /search-params/default?default=d2 - -
- - go to /search-params/default?default=🚀대한민국 - -
- - go to - /search-params/default?default=%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD - -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/search-params/route.tsx b/e2e/react-router/basic-file-based/src/routes/search-params/route.tsx deleted file mode 100644 index 3f659c812d..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/search-params/route.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/search-params')({ - beforeLoad: async () => { - await new Promise((resolve) => setTimeout(resolve, 100)) - return { hello: 'world' as string } - }, -}) diff --git a/e2e/react-router/basic-file-based/src/routes/structural-sharing.$enabled.tsx b/e2e/react-router/basic-file-based/src/routes/structural-sharing.$enabled.tsx deleted file mode 100644 index 1aa8a1e5b4..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/structural-sharing.$enabled.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, getRouteApi, useSearch } from '@tanstack/react-router' -import React from 'react' -import { z } from 'zod' - -const enabledSchema = { - enabled: z.preprocess((val) => { - if (typeof val === 'string') { - if (val.toLowerCase() === 'true') return true - if (val.toLowerCase() === 'false') return false - } - return val - }, z.boolean()), -} - -export const Route = createFileRoute('/structural-sharing/$enabled')({ - component: RouteComponent, - params: { - parse: (p) => z.object(enabledSchema).parse(p), - }, - validateSearch: z.object({ foo: z.string(), bar: z.string() }), -}) - -function useRenderCount() { - const count = React.useRef(0) - count.current++ - return count.current -} - -const api = getRouteApi('/structural-sharing/$enabled') -function RouteComponent() { - console.log('rendering') - const renderCount = useRenderCount() - const { enabled } = Route.useParams() - - const searchViaRouteHook = Route.useSearch({ - select: ({ foo, bar }) => { - return { values: [foo, bar] } - }, - structuralSharing: enabled, - }) - - const searchViaHook = useSearch({ - from: Route.id, - select: ({ foo, bar }) => { - return { values: [foo, bar] } - }, - structuralSharing: enabled, - }) - - const searchViaRouteApiHook = api.useSearch({ - select: ({ foo, bar }) => { - return { values: [foo, bar] } - }, - structuralSharing: enabled, - }) - - return ( - <> -
{JSON.stringify(enabled)}
-
{renderCount}
-
{JSON.stringify(searchViaHook)}
-
- {JSON.stringify(searchViaRouteHook)} -
-
- {JSON.stringify(searchViaRouteApiHook)} -
- -
- - go to f2/b2 - - - ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/대한민국/route.tsx b/e2e/react-router/basic-file-based/src/routes/대한민국/route.tsx deleted file mode 100644 index cff4d82723..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/대한민국/route.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/대한민국')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

- Hello "/대한민국"! -

-
    -
  • - - link to latin id - -
  • -
  • - - link to unicode id - -
  • -
  • - - link to foo/bar - -
  • -
  • - - link to foo%\/🚀대 - -
  • -
-
- -
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx b/e2e/react-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx deleted file mode 100644 index 5a0770344b..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/대한민국/wildcard/$')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-

Unicode Wildcard Params

-
- Hello /대한민국/wildcard/ - {params._splat} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx b/e2e/react-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx deleted file mode 100644 index c822248670..0000000000 --- a/e2e/react-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/대한민국/🚀/$id')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-

Unicode Named Params

-
- Hello /대한민국/🚀/ - {params.id} -
-
- ) -} diff --git a/e2e/react-router/basic-file-based/src/styles.css b/e2e/react-router/basic-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-file-based/src/vite-env.d.ts b/e2e/react-router/basic-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-file-based/tests/app.spec.ts b/e2e/react-router/basic-file-based/tests/app.spec.ts deleted file mode 100644 index bd9c365484..0000000000 --- a/e2e/react-router/basic-file-based/tests/app.spec.ts +++ /dev/null @@ -1,410 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('lazy file route errorComponent is rendered when the loader throws', async ({ - page, -}) => { - await page.goto('/lazy-error') - - await expect(page.getByTestId('lazy-route-error-component')).toContainText( - 'Lazy route error component', - ) - await expect(page.locator('body')).not.toContainText('Something went wrong!') -}) - -test("useBlocker doesn't block navigation if condition is not met", async ({ - page, -}) => { - await page.goto('/editing-a') - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByRole('button', { name: 'Go to next step' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') -}) - -test('useBlocker does block navigation if condition is met', async ({ - page, -}) => { - await page.goto('/editing-a') - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go to next step' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') - - await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible() -}) - -test('Proceeding through blocked navigation works', async ({ page }) => { - await page.goto('/editing-a') - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go to next step' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByRole('button', { name: 'Proceed' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') -}) - -test("legacy useBlocker doesn't block navigation if condition is not met", async ({ - page, -}) => { - await page.goto('/editing-b') - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByRole('button', { name: 'Go back' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') -}) - -test('legacy useBlocker does block navigation if condition is met', async ({ - page, -}) => { - await page.goto('/editing-b') - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go back' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') - - await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible() -}) - -test('legacy Proceeding through blocked navigation works', async ({ page }) => { - await page.goto('/editing-b') - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go back' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByRole('button', { name: 'Proceed' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') -}) - -test('useCanGoBack correctly disables back button', async ({ page }) => { - const getBackButtonDisabled = async () => { - const backButton = page.getByTestId('back-button') - const isDisabled = (await backButton.getAttribute('disabled')) !== null - return isDisabled - } - - expect(await getBackButtonDisabled()).toBe(true) - - await page.getByRole('link', { name: 'Posts' }).click() - await expect(page.getByTestId('posts-links')).toBeInViewport() - expect(await getBackButtonDisabled()).toBe(false) - - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByTestId('post-title')).toBeInViewport() - expect(await getBackButtonDisabled()).toBe(false) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goBack() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goForward() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goBack() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goBack() - expect(await getBackButtonDisabled()).toBe(true) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(true) -}) - -test('useCanGoBack correctly disables back button, using router.history and window.history', async ({ - page, -}) => { - const getBackButtonDisabled = async () => { - const backButton = page.getByTestId('back-button') - const isDisabled = (await backButton.getAttribute('disabled')) !== null - return isDisabled - } - - await page.getByRole('link', { name: 'Posts' }).click() - await expect(page.getByTestId('posts-links')).toBeInViewport() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByTestId('post-title')).toBeInViewport() - await page.getByTestId('back-button').click() - expect(await getBackButtonDisabled()).toBe(false) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(false) - - await page.getByTestId('back-button').click() - expect(await getBackButtonDisabled()).toBe(true) - - await page.evaluate('window.history.forward()') - expect(await getBackButtonDisabled()).toBe(false) - - await page.evaluate('window.history.forward()') - expect(await getBackButtonDisabled()).toBe(false) - - await page.evaluate('window.history.back()') - expect(await getBackButtonDisabled()).toBe(false) - - await page.evaluate('window.history.back()') - expect(await getBackButtonDisabled()).toBe(true) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(true) -}) - -const testCases = [ - { - description: 'Navigating to a route inside a route group', - testId: 'link-to-route-inside-group', - }, - { - description: - 'Navigating to a route inside a subfolder inside a route group ', - testId: 'link-to-route-inside-group-inside-subfolder', - }, - { - description: 'Navigating to a route inside a route group inside a layout', - testId: 'link-to-route-inside-group-inside-layout', - }, - { - description: 'Navigating to a lazy route inside a route group', - testId: 'link-to-lazy-route-inside-group', - }, - - { - description: 'Navigating to the only route inside a route group ', - testId: 'link-to-only-route-inside-group', - }, -] - -testCases.forEach(({ description, testId }) => { - test(description, async ({ page }) => { - await page.getByTestId(testId).click() - await expect(page.getByTestId('search-via-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-hook')).toContainText( - 'world', - ) - await expect(page.getByTestId('search-via-route-api')).toContainText( - 'world', - ) - }) -}) - -test('navigating to an unnested route', async ({ page }) => { - const postId = 'hello-world' - await page.goto(`/posts/${postId}/edit`) - await page.waitForURL(`/posts/${postId}/edit`) - await expect(page.getByTestId('params-via-hook')).toContainText(postId) - await expect(page.getByTestId('params-via-route-hook')).toContainText(postId) - await expect(page.getByTestId('params-via-route-api')).toContainText(postId) -}) - -async function getRenderCount(page: Page) { - const renderCount = parseInt( - await page.getByTestId('render-count').innerText(), - ) - return renderCount -} -async function structuralSharingTest(page: Page, enabled: boolean) { - page.goto(`/structural-sharing/${enabled}/?foo=f1&bar=b1`) - await expect(page.getByTestId('enabled')).toHaveText(JSON.stringify(enabled)) - - async function checkSearch({ foo, bar }: { foo: string; bar: string }) { - expect(page.url().endsWith(`?foo=${foo}&bar=${bar}`)).toBe(true) - const expectedSearch = JSON.stringify({ values: [foo, bar] }) - await expect(page.getByTestId('search-via-hook')).toHaveText(expectedSearch) - await expect(page.getByTestId('search-via-route-hook')).toHaveText( - expectedSearch, - ) - await expect(page.getByTestId('search-via-route-api-hook')).toHaveText( - expectedSearch, - ) - } - - await checkSearch({ bar: 'b1', foo: 'f1' }) - await page.getByTestId('link').click() - await checkSearch({ bar: 'b2', foo: 'f2' }) -} - -test('structural sharing disabled', async ({ page }) => { - await structuralSharingTest(page, false) - expect(await getRenderCount(page)).toBe(2) - await page.getByTestId('link').click() - expect(await getRenderCount(page)).toBeGreaterThan(2) -}) - -test('structural sharing enabled', async ({ page }) => { - await structuralSharingTest(page, true) - expect(await getRenderCount(page)).toBe(2) - await page.getByTestId('link').click() - expect(await getRenderCount(page)).toBe(2) -}) - -test('Should change title on client side navigation', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Posts' }).click() - - await expect(page).toHaveTitle('Posts page') -}) - -test('Should change post navigating back and forth', async ({ page }) => { - await page.goto('/posts/1') - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - - await page.getByRole('link', { name: 'qui est esse' }).click() - await expect(page.getByTestId('post-title')).toContainText('qui est esse') - - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByTestId('post-title')).toContainText('sunt aut facere') -}) - -test('Should not remount deps when remountDeps does not change ', async ({ - page, -}) => { - await page.goto('/notRemountDeps') - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) -}) - -test('Should remount deps when remountDeps does change ', async ({ page }) => { - await page.goto('/remountDeps') - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 2', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 3', - ) -}) - -test.describe('Unicode route rendering', () => { - test('should render non-latin route correctly', async ({ page, baseURL }) => { - await page.goto('/대한민국') - - await expect(page.locator('body')).toContainText('Hello "/대한민국"!') - - expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`) - }) -}) - -test.describe('Pathless layout routes', () => { - test('direct navigation to pathless layout route renders correctly', async ({ - page, - }) => { - await page.goto('/pathless-layout') - await expect(page.getByTestId('pathless-layout-header')).toContainText( - 'Pathless Layout Section', - ) - await expect(page.getByTestId('pathless-layout-wrapper')).toContainText( - 'Pathless Layout Wrapper', - ) - await expect(page.getByTestId('pathless-layout-index')).toContainText( - 'Pathless Layout Index', - ) - }) - - test('client-side navigation to pathless layout route', async ({ page }) => { - await page.goto('/') - await page.getByTestId('link-to-pathless-layout').click() - await expect(page.getByTestId('pathless-layout-header')).toContainText( - 'Pathless Layout Section', - ) - await expect(page.getByTestId('pathless-layout-wrapper')).toContainText( - 'Pathless Layout Wrapper', - ) - }) - - test('navigation within pathless layout preserves layout', async ({ - page, - }) => { - await page.goto('/pathless-layout') - await page.getByTestId('link-to-child').click() - await expect(page.getByTestId('pathless-layout-header')).toContainText( - 'Pathless Layout Section', - ) - await expect(page.getByTestId('pathless-layout-wrapper')).toContainText( - 'Pathless Layout Wrapper', - ) - await expect(page.getByTestId('pathless-layout-child')).toContainText( - 'Pathless Layout Child Route', - ) - }) - - test('direct navigation to child of pathless layout', async ({ page }) => { - await page.goto('/pathless-layout/child') - await expect(page.getByTestId('pathless-layout-header')).toContainText( - 'Pathless Layout Section', - ) - await expect(page.getByTestId('pathless-layout-wrapper')).toContainText( - 'Pathless Layout Wrapper', - ) - await expect(page.getByTestId('pathless-layout-child')).toContainText( - 'Pathless Layout Child Route', - ) - }) - - test('navigating to non-existent route under pathless layout shows not found', async ({ - page, - }) => { - await page.goto('/pathless-layout/does-not-exist') - await expect(page.getByTestId('pathless-layout-not-found')).toContainText( - 'Not Found in Pathless Layout', - ) - await expect(page.locator('body')).toContainText('Not Found') - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/document-navigation.spec.ts b/e2e/react-router/basic-file-based/tests/document-navigation.spec.ts deleted file mode 100644 index bd81eaa44b..0000000000 --- a/e2e/react-router/basic-file-based/tests/document-navigation.spec.ts +++ /dev/null @@ -1,68 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -const appPort = Number(process.env.E2E_APP_PORT ?? 0) -const adminHref = `http://127.0.0.1:${appPort}/external.html` - -for (const role of ['button', 'link'] as const) { - for (const { name, href, replace } of [ - { name: 'Navigate to admin', href: adminHref, replace: false }, - { name: 'Replace with admin', href: adminHref, replace: true }, - { name: 'Reload admin', href: adminHref, replace: false }, - { name: 'Navigate with external mask', href: adminHref, replace: false }, - { name: 'Replace with external mask', href: adminHref, replace: true }, - { - name: 'Navigate to absolute href', - href: `${adminHref}?value=a+b&value=a%20b#raw%2f`, - replace: false, - }, - ]) { - test(`${role}: ${name}`, async ({ page }) => { - const errors: Array = [] - page.on('pageerror', (error) => errors.push(error)) - await page.goto('/') - await page.goto('/document-navigation') - const historyLength = await page.evaluate(() => window.history.length) - const response = page.waitForResponse(href.split('#')[0]) - - const control = page.getByRole(role, { name, exact: true }) - if (role === 'link') { - await expect(control).toHaveAttribute('href', href) - } - await control.click() - - expect((await response).request().isNavigationRequest()).toBe(true) - await expect(page).toHaveURL(href) - await expect(page.locator('body')).toHaveText('Hello World') - // Cross-origin Links use native anchors, which push even with replace=true. - const replacesHistory = role === 'button' && replace - expect(await page.evaluate(() => window.history.length)).toBe( - historyLength + (replacesHistory ? 0 : 1), - ) - expect(errors).toEqual([]) - - await page.goBack() - - await expect(page).toHaveURL( - replacesHistory ? '/' : '/document-navigation', - ) - }) - } - - test(`${role}: explicit reload resolves a raw relative href in the browser`, async ({ - page, - }) => { - await page.goto('/document-navigation') - const response = page.waitForResponse((candidate) => - candidate.request().isNavigationRequest(), - ) - - await page - .getByRole(role, { name: 'Reload relative href', exact: true }) - .click() - - expect((await response).request().resourceType()).toBe('document') - await expect(page).toHaveURL('/?value=a+b&value=a%20b#raw%2f') - await expect(page.getByRole('heading')).toContainText('Welcome Home!') - }) -} diff --git a/e2e/react-router/basic-file-based/tests/fullpath-types.spec.ts b/e2e/react-router/basic-file-based/tests/fullpath-types.spec.ts deleted file mode 100644 index 8f4df9f966..0000000000 --- a/e2e/react-router/basic-file-based/tests/fullpath-types.spec.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.describe('FullPath type/runtime match (Issues #4892, #2675, #6403)', () => { - test.describe('Pathless layout routes should have parent fullPath, not empty string', () => { - test('direct navigation to pathless layout shows correct fullPath', async ({ - page, - }) => { - await page.goto('/fullpath-test') - // The pathless layout's fullPath should be '/fullpath-test' (same as parent), not '' - await expect(page.getByTestId('pathless-layout-fullpath')).toHaveText( - '/fullpath-test', - ) - }) - - test('client-side navigation to pathless layout shows correct fullPath', async ({ - page, - }) => { - await page.goto('/') - await page.getByTestId('link-to-fullpath-test').click() - await expect(page.getByTestId('pathless-layout-fullpath')).toHaveText( - '/fullpath-test', - ) - }) - }) - - test.describe('Index routes should have trailing slash in fullPath', () => { - test('direct navigation to index route shows fullPath with trailing slash', async ({ - page, - }) => { - await page.goto('/fullpath-test') - // The index route's fullPath should be '/fullpath-test/' (with trailing slash) - await expect(page.getByTestId('index-route-fullpath')).toHaveText( - '/fullpath-test/', - ) - }) - - test('param route under pathless layout shows correct fullPath', async ({ - page, - }) => { - await page.goto('/fullpath-test/123') - // The param route's fullPath should be '/fullpath-test/$id' - await expect(page.getByTestId('param-route-fullpath')).toHaveText( - '/fullpath-test/$id', - ) - await expect(page.getByTestId('fullpath-test-param')).toHaveText( - 'Param: 123', - ) - }) - }) - - test.describe('Route.to should NOT have trailing slash (Issue #3005)', () => { - test('index route Route.to should not have trailing slash', async ({ - page, - }) => { - await page.goto('/fullpath-test') - // Route.to should be '/fullpath-test' (without trailing slash) - // while Route.fullPath is '/fullpath-test/' (with trailing slash) - await expect(page.getByTestId('index-route-to')).toHaveText( - '/fullpath-test', - ) - }) - }) - - test.describe('Existing pathless layout routes', () => { - test('existing pathless layout index shows correct fullPath at runtime', async ({ - page, - }) => { - // This tests the existing /pathless-layout route which has a pathless _layout - await page.goto('/pathless-layout') - await expect(page.getByTestId('pathless-layout-header')).toContainText( - 'Pathless Layout Section', - ) - await expect(page.getByTestId('pathless-layout-wrapper')).toContainText( - 'Pathless Layout Wrapper', - ) - await expect(page.getByTestId('pathless-layout-index')).toContainText( - 'Pathless Layout Index', - ) - }) - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/history-blocking.spec.ts b/e2e/react-router/basic-file-based/tests/history-blocking.spec.ts deleted file mode 100644 index df1f863a03..0000000000 --- a/e2e/react-router/basic-file-based/tests/history-blocking.spec.ts +++ /dev/null @@ -1,254 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -async function prepareDocumentTraversal(page: Page, delta: number) { - if (delta < 0) { - for (let i = 0; i < Math.abs(delta); i++) { - await page.goto(`/?entry=${i}`) - } - await page.goto('/history-blocking') - } else { - await page.goto('/history-blocking') - for (let i = 0; i < delta; i++) { - await page.goto(`/?entry=${i}`) - } - for (let i = 0; i < delta; i++) { - await page.goBack() - } - } - await expect( - page.getByRole('heading', { name: 'History blocking' }), - ).toBeVisible() - await page.getByLabel('Draft', { exact: true }).fill('Unsaved draft') - await expect(page.getByText('Unsaved changes', { exact: true })).toBeVisible() -} - -async function prepareSameDocumentTraversal(page: Page, delta: number) { - await page.goto('/history-blocking') - for (let step = 1; step <= Math.abs(delta); step++) { - await page.getByRole('link', { name: 'Add history entry' }).click() - await expect(page.getByText(`Step ${step}`, { exact: true })).toBeVisible() - } - if (delta > 0) { - for (let step = delta - 1; step >= 0; step--) { - await page - .getByRole('button', { name: 'History back', exact: true }) - .click() - await expect( - page.getByText(`Step ${step}`, { exact: true }), - ).toBeVisible() - } - } - await page.getByLabel('Draft', { exact: true }).fill('Unsaved draft') - await expect(page.getByText('Unsaved changes', { exact: true })).toBeVisible() -} - -function dismissUnloadDialogs(page: Page) { - const dialogs: Array = [] - page.on('dialog', async (dialog) => { - dialogs.push(dialog.type()) - await dialog.dismiss() - }) - return dialogs -} - -for (const [direction, delta] of [ - ['back', -1], - ['forward', 1], - ['go(-1)', -1], - ['go(1)', 1], - ['go(-2)', -2], - ['go(2)', 2], -] as const) { - test(`history ${direction} to another document warns before losing edits`, async ({ - page, - }) => { - await prepareDocumentTraversal(page, delta) - const dialogs = dismissUnloadDialogs(page) - const originalUrl = page.url() - - await page - .getByRole('button', { name: `History ${direction}`, exact: true }) - .click() - - await expect.poll(() => dialogs).toEqual(['beforeunload']) - await expect(page).toHaveURL(originalUrl) - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - }) - - test(`history ${direction} can explicitly bypass a document unload warning`, async ({ - page, - }) => { - await prepareDocumentTraversal(page, delta) - await page.getByLabel('Ignore blockers').check() - const dialogs = dismissUnloadDialogs(page) - - await page - .getByRole('button', { name: `History ${direction}`, exact: true }) - .click() - - await expect(page).toHaveURL(/\/\?entry=\d$/) - expect(dialogs).toEqual([]) - }) - - test(`ignored same-document ${direction} preserves the next document unload warning`, async ({ - page, - }) => { - await prepareSameDocumentTraversal(page, delta) - await page.getByLabel('Ignore blockers').check() - const dialogs = dismissUnloadDialogs(page) - - await page - .getByRole('button', { name: `History ${direction}`, exact: true }) - .click() - - await expect( - page.getByText(`Step ${delta < 0 ? 0 : delta}`, { - exact: true, - }), - ).toBeVisible() - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - await expect( - page.getByText('Blocker status: idle', { exact: true }), - ).toBeVisible() - expect(dialogs).toEqual([]) - - await page.getByRole('link', { name: 'Leave document' }).click() - - await expect.poll(() => dialogs).toEqual(['beforeunload']) - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - }) - - test(`same-document ${direction} still checks blockers by default`, async ({ - page, - }) => { - await prepareSameDocumentTraversal(page, delta) - const originalUrl = page.url() - - await page - .getByRole('button', { name: `History ${direction}`, exact: true }) - .click() - - await expect( - page.getByText('Blocker status: blocked', { exact: true }), - ).toBeVisible() - await expect( - page.getByText(`Step ${delta < 0 ? -delta : 0}`, { exact: true }), - ).toBeVisible() - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - await page.getByRole('button', { name: 'Stay here' }).click() - await expect( - page.getByText('Blocker status: idle', { exact: true }), - ).toBeVisible() - await expect(page).toHaveURL(originalUrl) - await expect( - page.getByText(`Step ${delta < 0 ? -delta : 0}`, { exact: true }), - ).toBeVisible() - }) -} - -for (const ignoreBlocker of [false, true]) { - test(`history go(0) ${ignoreBlocker ? 'can bypass' : 'preserves'} the reload warning`, async ({ - page, - }) => { - await page.goto('/history-blocking') - await page.getByLabel('Draft', { exact: true }).fill('Unsaved draft') - await expect( - page.getByText('Unsaved changes', { exact: true }), - ).toBeVisible() - if (ignoreBlocker) { - await page.getByLabel('Ignore blockers').check() - } - const dialogs = dismissUnloadDialogs(page) - - await page - .getByRole('button', { name: 'History go(0)', exact: true }) - .click() - - if (ignoreBlocker) { - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue('') - expect(dialogs).toEqual([]) - } else { - await expect.poll(() => dialogs).toEqual(['beforeunload']) - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - } - }) -} - -for (const action of ['Navigate document', 'Replace document']) { - test(`${action}: invalid URLs preserve the next unload warning`, async ({ - page, - }) => { - await page.goto('/history-blocking') - await page.getByLabel('Draft', { exact: true }).fill('Unsaved draft') - await page.getByLabel('Ignore blockers').check() - await page.getByLabel('Document destination').fill('https://[') - const dialogs = dismissUnloadDialogs(page) - - await page.getByRole('button', { name: action, exact: true }).click() - - await expect(page.getByRole('status')).toBeVisible() - expect(dialogs).toEqual([]) - await page.getByRole('link', { name: 'Leave document' }).click() - - await expect.poll(() => dialogs).toEqual(['beforeunload']) - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - }) - - test(`${action}: the current fragment preserves the next unload warning`, async ({ - page, - }) => { - await page.goto('/history-blocking?step=0#same') - await page.getByLabel('Draft', { exact: true }).fill('Unsaved draft') - await page.getByLabel('Ignore blockers').check() - await page.getByLabel('Document destination').fill('#same') - const dialogs = dismissUnloadDialogs(page) - - await page.getByRole('button', { name: action, exact: true }).click() - - await expect(page).toHaveURL('/history-blocking?step=0#same') - expect(dialogs).toEqual([]) - await page.getByRole('link', { name: 'Leave document' }).click() - - await expect.poll(() => dialogs).toEqual(['beforeunload']) - await expect(page.getByLabel('Draft', { exact: true })).toHaveValue( - 'Unsaved draft', - ) - }) - - for (const ignoreBlocker of [false, true]) { - test(`${action}: ${ignoreBlocker ? 'skipped' : 'accepted'} blockers need no native confirmation`, async ({ - page, - }) => { - await page.goto('/history-blocking') - await page.getByLabel('Draft', { exact: true }).fill('Unsaved draft') - if (ignoreBlocker) { - await page.getByLabel('Ignore blockers').check() - } - const dialogs = dismissUnloadDialogs(page) - - await page.getByRole('button', { name: action, exact: true }).click() - if (!ignoreBlocker) { - await page - .getByRole('button', { name: 'Continue navigation', exact: true }) - .click() - } - - await expect(page).toHaveURL('/') - expect(dialogs).toEqual([]) - }) - } -} diff --git a/e2e/react-router/basic-file-based/tests/hover-preload-hash.spec.ts b/e2e/react-router/basic-file-based/tests/hover-preload-hash.spec.ts deleted file mode 100644 index 1263faf391..0000000000 --- a/e2e/react-router/basic-file-based/tests/hover-preload-hash.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import { toRuntimePath } from '@tanstack/router-e2e-utils' - -test('clicking hash link then hovering another link does not scroll back to hash', async ({ - page, -}) => { - // Go to the page without hash - await page.goto(toRuntimePath('/hover-preload-hash')) - - // Click the hash link to navigate to position1 - await page.getByTestId('link-to-hash').click() - await expect(page.locator('#position1')).toBeInViewport() - - // Scroll up so position1 is no longer in view - await page.evaluate(() => window.scrollTo(0, 0)) - await expect(page.locator('#position1')).not.toBeInViewport() - - // Hover the link to trigger intent preload (should NOT scroll back) - await page.getByTestId('link-to-only-route-inside-group').hover() - await page.waitForTimeout(400) - - // Ensure we did not jump back to the hash target - await expect(page.locator('#position1')).not.toBeInViewport() -}) diff --git a/e2e/react-router/basic-file-based/tests/mask.spec.ts b/e2e/react-router/basic-file-based/tests/mask.spec.ts deleted file mode 100644 index d5076a5854..0000000000 --- a/e2e/react-router/basic-file-based/tests/mask.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test('route masks transform params and expose masked pathname in the browser (react)', async ({ - page, -}) => { - await page.goto('/') - - await page.getByTestId('link-to-masks').click() - await expect(page.getByText('Route Masks')).toBeVisible() - - const link = page.getByTestId('link-to-admin-mask') - await link.click() - - await page.waitForURL('/masks/public/user-42') - - await expect(page.getByTestId('admin-user-component')).toBeInViewport() - await expect(page.getByTestId('admin-user-id')).toHaveText('42') - - await expect(page.getByTestId('router-pathname')).toHaveText( - '/masks/admin/42', - ) - - await expect(page.getByTestId('router-masked-pathname')).toHaveText( - '/masks/public/user-42', - ) -}) diff --git a/e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts b/e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts deleted file mode 100644 index ea0e585c75..0000000000 --- a/e2e/react-router/basic-file-based/tests/non-nested-paths.spec.ts +++ /dev/null @@ -1,351 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -const testCases: Array<{ - name: string - testPathDesc: string - testPathPrefix: string - testPathSuffix: string - paramValue: Record - paramValue2: Record -}> = [ - { - name: 'Named path params', - testPathDesc: 'named', - testPathPrefix: '', - testPathSuffix: '', - paramValue: { baz: 'baz' }, - paramValue2: { baz: 'baz_' }, - }, - { - name: 'prefix params', - testPathPrefix: 'prefix', - testPathSuffix: '', - testPathDesc: 'prefix', - paramValue: { baz: 'baz' }, - paramValue2: { baz: 'baz_' }, - }, - { - name: 'suffix params', - testPathPrefix: '', - testPathSuffix: 'suffix', - testPathDesc: 'suffix', - paramValue: { baz: 'baz' }, - paramValue2: { baz: 'baz2' }, - }, - { - name: 'path', - testPathPrefix: '', - testPathSuffix: '', - testPathDesc: 'path', - paramValue: {}, - paramValue2: {}, - }, -] - -test.describe('Non-nested paths', () => { - testCases.forEach( - ({ - name, - testPathDesc, - testPathPrefix, - testPathSuffix, - paramValue, - paramValue2, - }) => { - test.describe(name, () => { - const path = `/non-nested/${testPathDesc}` - const paramNameDesc = Object.keys(paramValue)[0] ?? 'baz' - - test.beforeEach(async ({ page }) => { - await page.goto('/non-nested') - await page.waitForURL('/non-nested') - }) - - test('Should not un-nest nested paths', async ({ page }) => { - const nonNestedPathHeading = page.getByTestId( - 'non-nested-path-heading', - ) - await expect(nonNestedPathHeading).toBeVisible() - - await page.getByTestId(`l-to-${testPathDesc}`).click() - await page.waitForURL(path) - - const rootRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const pathRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`, - ) - - const indexHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-index-heading`, - ) - - const fooHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-foo-heading`, - ) - - const indexParams = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-index-param`, - ) - - const fooParams = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-foo-param`, - ) - - const indexLink = page.getByTestId(`to-${testPathDesc}-index`) - const fooLink = page.getByTestId(`to-${testPathDesc}-foo`) - const foo2Link = page.getByTestId(`to-${testPathDesc}-foo-2`) - - const indexPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}` - const fooPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo` - const foo2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo` - - console.log(await indexLink.getAttribute('href')) - await expect(indexLink).toHaveAttribute('href', indexPath) - await expect(fooLink).toHaveAttribute('href', fooPath) - await expect(foo2Link).toHaveAttribute('href', foo2Path) - - await indexLink.click() - await page.waitForURL(indexPath) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).toBeVisible() - await expect(indexHeading).toBeVisible() - const indexParamValue = await indexParams.innerText() - expect(JSON.parse(indexParamValue)).toEqual(paramValue) - - await fooLink.click() - await page.waitForURL(fooPath) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).toBeVisible() - await expect(fooHeading).toBeVisible() - const fooParamValue = await fooParams.innerText() - expect(JSON.parse(fooParamValue)).toEqual(paramValue) - - await foo2Link.click() - await page.waitForURL(foo2Path) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).toBeVisible() - await expect(fooHeading).toBeVisible() - const foo2ParamValue = await fooParams.innerText() - expect(JSON.parse(foo2ParamValue)).toEqual(paramValue2) - }) - - test('Should not nest non-nested paths', async ({ page }) => { - const nonNestedPathHeading = page.getByTestId( - 'non-nested-path-heading', - ) - await expect(nonNestedPathHeading).toBeVisible() - - await page.getByTestId(`l-to-${testPathDesc}`).click() - await page.waitForURL(path) - - const rootRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const pathRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`, - ) - - const barHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-bar-heading`, - ) - - const barParams = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-bar-param`, - ) - - const barLink = page.getByTestId(`to-${testPathDesc}-bar`) - const bar2Link = page.getByTestId(`to-${testPathDesc}-bar-2`) - - const barPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar` - const bar2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar` - await expect(barLink).toHaveAttribute('href', barPath) - - await expect(bar2Link).toHaveAttribute('href', bar2Path) - - await barLink.click() - await page.waitForURL(barPath) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).not.toBeVisible() - await expect(barHeading).toBeVisible() - const barParamValue = await barParams.innerText() - expect(JSON.parse(barParamValue)).toEqual(paramValue) - - await bar2Link.click() - await page.waitForURL(bar2Path) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).not.toBeVisible() - await expect(barHeading).toBeVisible() - const bar2ParamValue = await barParams.innerText() - expect(JSON.parse(bar2ParamValue)).toEqual(paramValue2) - }) - }) - }, - ) -}) - -test.describe('Deeply nested non-nested paths', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/non-nested/deep') - await page.waitForURL('/non-nested/deep') - }) - - test('It should nest nested paths 1 level deep', async ({ page }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const bazLink = page.getByTestId('to-deep-baz') - await bazLink.click() - await page.waitForURL('/non-nested/deep/baz') - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazIndexHeading = page.getByTestId( - 'non-nested-deep-baz-index-heading', - ) - const bazIndexParams = page.getByTestId('non-nested-deep-baz-index-param') - - await expect(bazRouteHeading).toBeVisible() - await expect(bazIndexHeading).toBeVisible() - expect(await bazIndexParams.innerText()).toBe( - JSON.stringify({ baz: 'baz' }), - ) - }) - - test('It should not nest non-nested paths 1 level deep', async ({ page }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - const bazBarLink = page.getByTestId('to-deep-baz-bar') - - await bazBarLink.click() - await page.waitForURL('/non-nested/deep/baz-bar/bar') - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazBarRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-route-heading', - ) - const bazBarIndexHeading = page.getByTestId( - 'non-nested-deep-baz-bar-index-heading', - ) - const bazBarIndexParams = page.getByTestId( - 'non-nested-deep-baz-bar-index-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).toBeVisible() - await expect(bazBarIndexHeading).toBeVisible() - expect(await bazBarIndexParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar' }), - ) - }) - - test('It should not nest non-nested paths 2 levels deep', async ({ - page, - }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const bazBarQuxLink = page.getByTestId('to-deep-baz-bar-qux') - await bazBarQuxLink.click() - - await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/qux') - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazBarRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-route-heading', - ) - const bazBarQuxHeading = page.getByTestId( - 'non-nested-deep-baz-bar-qux-heading', - ) - const bazBarQuxParams = page.getByTestId( - 'non-nested-deep-baz-bar-qux-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).not.toBeVisible() - await expect(bazBarQuxHeading).toBeVisible() - await expect(bazBarQuxParams).toBeVisible() - expect(await bazBarQuxParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar-qux' }), - ) - }) - - test('It should nest and un-nest non-nested across paths multiple levels deep', async ({ - page, - }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const bazBarFooLink = page.getByTestId('to-deep-baz-bar-foo') - await bazBarFooLink.click() - - await page.waitForURL('/non-nested/deep/baz-bar/bar/foo') - - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazBarRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-route-heading', - ) - const bazBarFooRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-foo-route-heading', - ) - const bazBarFooIndexHeading = page.getByTestId( - 'non-nested-deep-baz-bar-foo-index-heading', - ) - const bazBarFooIndexParams = page.getByTestId( - 'non-nested-deep-baz-bar-foo-index-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).toBeVisible() - await expect(bazBarFooRouteHeading).toBeVisible() - await expect(bazBarFooIndexHeading).toBeVisible() - await expect(bazBarFooIndexParams).toBeVisible() - expect(await bazBarFooIndexParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar', foo: 'foo' }), - ) - - const bazBarFooQuxLink = page.getByTestId('to-deep-baz-bar-foo-qux') - await bazBarFooQuxLink.click() - await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/foo/qux') - - const bazBarFooQuxHeading = page.getByTestId( - 'non-nested-deep-baz-bar-foo-qux-heading', - ) - const bazBarFooQuxParams = page.getByTestId( - 'non-nested-deep-baz-bar-foo-qux-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).toBeVisible() - await expect(bazBarFooRouteHeading).not.toBeVisible() - await expect(bazBarFooQuxHeading).toBeVisible() - await expect(bazBarFooQuxParams).toBeVisible() - expect(await bazBarFooQuxParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar-qux', foo: 'foo' }), - ) - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/open-redirect-prevention.spec.ts b/e2e/react-router/basic-file-based/tests/open-redirect-prevention.spec.ts deleted file mode 100644 index bbb2dac7a1..0000000000 --- a/e2e/react-router/basic-file-based/tests/open-redirect-prevention.spec.ts +++ /dev/null @@ -1,106 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.describe('Open redirect prevention', () => { - test.describe('CRLF injection attacks', () => { - test('should not redirect to external site via CR injection (%0d)', async ({ - page, - baseURL, - }) => { - // This URL attempts to exploit CRLF injection to redirect to google.com - // %0d = \r (carriage return) - // Without the fix, /\r/google.com/ would be interpreted as //google.com/ - // which browsers resolve as a protocol-relative URL to http://google.com/ - await page.goto('/%0d/google.com/') - await page.waitForLoadState('networkidle') - - // Should stay on the same origin - the path should be treated as a local path - // not as an external redirect - expect(page.url().startsWith(baseURL!)).toBe(true) - // The origin should be localhost, not google.com - const url = new URL(page.url()) - expect(url.origin).toBe(new URL(baseURL!).origin) - }) - - test('should not redirect to external site via LF injection (%0a)', async ({ - page, - baseURL, - }) => { - // %0a = \n (line feed) - await page.goto('/%0a/evil.com/') - await page.waitForLoadState('networkidle') - - // Should stay on the same origin - expect(page.url().startsWith(baseURL!)).toBe(true) - const url = new URL(page.url()) - expect(url.origin).toBe(new URL(baseURL!).origin) - }) - - test('should not redirect to external site via CRLF injection (%0d%0a)', async ({ - page, - baseURL, - }) => { - // Combined CRLF injection attempt - await page.goto('/%0d%0a/attacker.com/') - await page.waitForLoadState('networkidle') - - // Should stay on the same origin - expect(page.url().startsWith(baseURL!)).toBe(true) - const url = new URL(page.url()) - expect(url.origin).toBe(new URL(baseURL!).origin) - }) - - test('should not redirect to external site via multiple control chars', async ({ - page, - baseURL, - }) => { - // Multiple CR/LF characters - await page.goto('/%0d%0d%0a/malicious.com/path') - await page.waitForLoadState('networkidle') - - // Should stay on the same origin - expect(page.url().startsWith(baseURL!)).toBe(true) - const url = new URL(page.url()) - expect(url.origin).toBe(new URL(baseURL!).origin) - }) - }) - - test.describe('Protocol-relative URL prevention', () => { - test('should handle paths that could be misinterpreted as protocol-relative URLs', async ({ - page, - baseURL, - }) => { - // %0d is kept encoded, so /%0d/test-path/ stays as-is and won't become //test-path/ - await page.goto('/%0d/test-path/') - await page.waitForLoadState('networkidle') - - // Should stay on the same origin - expect(page.url().startsWith(baseURL!)).toBe(true) - const url = new URL(page.url()) - expect(url.origin).toBe(new URL(baseURL!).origin) - }) - }) - - test.describe('Normal navigation still works', () => { - test('should navigate to normal paths correctly', async ({ - page, - baseURL, - }) => { - await page.goto('/posts') - await page.waitForLoadState('networkidle') - - expect(page.url()).toBe(`${baseURL}/posts`) - }) - - test('should handle URL-encoded characters in normal paths', async ({ - page, - baseURL, - }) => { - // Normal URL encoding should still work - await page.goto('/params/single/hello%20world') - await page.waitForLoadState('networkidle') - - expect(page.url().startsWith(baseURL!)).toBe(true) - }) - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/params.spec.ts b/e2e/react-router/basic-file-based/tests/params.spec.ts deleted file mode 100644 index fa0377f3ca..0000000000 --- a/e2e/react-router/basic-file-based/tests/params.spec.ts +++ /dev/null @@ -1,521 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test.describe('ensure single params have been parsed correctly whilst being stable in the browser', () => { - const cases = [ - { value: 'hello', expected: 'hello' }, - { - value: '100%25', - expected: '100%', - }, - { - value: '100%2525', - expected: '100%25', - }, - { - value: '100%26', - expected: '100&', - }, - ] - - function getParsedValue(page: Page) { - return page.getByTestId('parsed-param-value').textContent() - } - - for (const { value, expected } of cases) { - test(`navigating to /params/single/${value}`, async ({ page, baseURL }) => { - await page.goto(`/params/single/${value}`) - - // on the first run, the value should be the same as the expected value - const valueOnFirstRun = await getParsedValue(page) - expect(valueOnFirstRun).toBe(expected) - - // the url/pathname should be the same as the expected value - const urlOnFirstRun = page.url().replace(baseURL!, '') - expect(urlOnFirstRun).toBe(`/params/single/${value}`) - - // click on the self link to the same value - await page.getByTestId('self-link-same').click() - const valueOnSecondRun = await getParsedValue(page) - expect(valueOnSecondRun).toBe(expected) - - // click on the self link to the amended value - await page.getByTestId('self-link-amended').click() - const valueOnThirdRun = await getParsedValue(page) - expect(valueOnThirdRun).toBe(`e2e${expected}`) - - // the url/pathname should be the same as the expected value - const urlOnThirdRun = page.url().replace(baseURL!, '') - expect(urlOnThirdRun).toBe(`/params/single/e2e${value}`) - }) - } -}) - -test.describe('params operations + non-nested routes', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps/non-nested') - }) - - test('useParams must resolve non-nested path params', async ({ page }) => { - await page.waitForURL('/params-ps/non-nested') - - const fooBarLink = page.getByTestId('l-to-non-nested-foo-bar') - - const foo2Bar2Link = page.getByTestId('l-to-non-nested-foo2-bar2') - - await expect(fooBarLink).toHaveAttribute( - 'href', - '/params-ps/non-nested/foo/bar', - ) - - await fooBarLink.click() - await page.waitForURL('/params-ps/non-nested/foo/bar') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe('/params-ps/non-nested/foo/bar') - - const fooParamsValue = page.getByTestId('foo-params-value') - const fooParamsText = await fooParamsValue.innerText() - const fooParamsObj = JSON.parse(fooParamsText) - expect(fooParamsObj).toEqual({ foo: 'foo' }) - - const paramsValue = page.getByTestId('foo-bar-params-value') - const paramsText = await paramsValue.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual({ foo: 'foo', bar: 'bar' }) - - await expect(foo2Bar2Link).toHaveAttribute( - 'href', - '/params-ps/non-nested/foo2/bar2', - ) - await foo2Bar2Link.click() - await page.waitForURL('/params-ps/non-nested/foo2/bar2') - const pagePathname2 = new URL(page.url()).pathname - expect(pagePathname2).toBe('/params-ps/non-nested/foo2/bar2') - - const foo2ParamsValue = page.getByTestId('foo-params-value') - const foo2ParamsText = await foo2ParamsValue.innerText() - const foo2ParamsObj = JSON.parse(foo2ParamsText) - expect(foo2ParamsObj).toEqual({ foo: 'foo2' }) - - const params2Value = page.getByTestId('foo-bar-params-value') - const params2Text = await params2Value.innerText() - const params2Obj = JSON.parse(params2Text) - expect(params2Obj).toEqual({ foo: 'foo2', bar: 'bar2' }) - }) -}) - -test.describe('params operations + prefix/suffix', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps') - }) - - test.describe('named params', () => { - const NAMED_PARAMS_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-named-foo', - pathname: '/params-ps/named/foo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFoo', - }, - { - id: 'l-to-named-prefixfoo', - pathname: '/params-ps/named/prefixfoo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooPrefix', - }, - { - id: 'l-to-named-foosuffix', - pathname: '/params-ps/named/foosuffix', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooSuffix', - }, - { - id: 'l-to-named-foo-special-characters', - pathname: '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80', - params: { foo: 'foo%\\/🚀대' }, - destHeadingId: 'ParamsNamedFoo', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - - test(`ensure use params doesn't cause excess renders and is stable across various usage options`, async ({ - page, - }) => { - await page.goto('/params-ps/named/foo') - await page.waitForLoadState('networkidle') - - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe('/params-ps/named/foo') - - const fooRenderCount = page.getByTestId('foo-render-count') - const fooIndexLink = page.getByTestId('params-foo-links-index') - const fooBar1Link = page.getByTestId('params-foo-links-bar1') - const fooBar2Link = page.getByTestId('params-foo-links-bar2') - const fooBarBazLink = page.getByTestId('params-foo-bar-links-baz') - const fooValue = page.getByTestId('params-output') - const fooBarValue = page.getByTestId('foo-bar-value') - const fooBazInBarValue = page.getByTestId('foo-baz-in-bar-value') - const fooBarRenderCount = page.getByTestId('foo-bar-render-count') - const fooBarBazValue = page.getByTestId('foo-bar-baz-value') - - await expect(fooRenderCount).toBeInViewport() - await expect(fooValue).toBeInViewport() - await expect(fooIndexLink).toBeInViewport() - await expect(fooBar1Link).toBeInViewport() - await expect(fooBar2Link).toBeInViewport() - await expect(fooRenderCount).toHaveText('1') - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - - await fooBar1Link.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarRenderCount).toBeInViewport() - await expect(fooBarValue).toBeInViewport() - await expect(fooBazInBarValue).toBeInViewport() - await expect(fooBarBazLink).toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - await expect(fooBarRenderCount).toHaveText('1') - await expect(fooBarValue).toHaveText('1') - await expect(fooBazInBarValue).toHaveText('no param') - - await fooBarBazLink.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarRenderCount).toBeInViewport() - await expect(fooBarValue).toBeInViewport() - await expect(fooBazInBarValue).toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - await expect(fooBarRenderCount).toHaveText('2') - await expect(fooBarValue).toHaveText('1') - await expect(fooBazInBarValue).toHaveText('1_10') - await expect(fooBarBazValue).toHaveText('1_10') - - await fooBar2Link.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarValue).toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - await expect(fooBarValue).toHaveText('2') - - await fooIndexLink.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarValue).not.toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - }) - }) - - test.describe('wildcard param', () => { - const WILDCARD_PARAM_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-wildcard-foo', - pathname: '/params-ps/wildcard/foo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplat', - }, - { - id: 'l-to-wildcard-prefixfoo', - pathname: '/params-ps/wildcard/prefixfoo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatPrefix', - }, - { - id: 'l-to-wildcard-foosuffix', - pathname: '/params-ps/wildcard/foosuffix', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatSuffix', - }, - { - id: 'l-to-wildcard-escaped', - pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`, - params: { - _splat: 'test[s\\/.\\/parameter%!🚀]', - '*': 'test[s\\/.\\/parameter%!🚀]', - }, - destHeadingId: 'ParamsWildcardSplat', - }, - { - id: 'l-to-wildcard-prefix-escaped', - pathname: `/params-ps/wildcard/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`, - params: { - _splat: 'test[s\\/.\\/parameter%!🚀]', - '*': 'test[s\\/.\\/parameter%!🚀]', - }, - destHeadingId: 'ParamsWildcardSplatPrefix', - }, - { - id: 'l-to-wildcard-suffix-escaped', - pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]suffix@%EB%8C%80`, - params: { - _splat: 'test[s\\/.\\/parameter%!🚀]', - '*': 'test[s\\/.\\/parameter%!🚀]', - }, - destHeadingId: 'ParamsWildcardSplatSuffix', - }, - { - id: 'l-to-wildcard-encoded', - pathname: - '/params-ps/wildcard/%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - params: { - '*': '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - _splat: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - }, - destHeadingId: 'ParamsWildcardSplat', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - }) -}) - -test.describe('Unicode params', () => { - test('should render non-latin route correctly across multiple params', async ({ - page, - baseURL, - }) => { - await page.goto('/params-ps') - await page.waitForURL('/params-ps') - const fooLink = page.getByTestId('l-to-named-foo-special-characters') - - await fooLink.click() - await page.waitForURL('/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80') - - expect(page.url()).toBe( - `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80`, - ) - - const headingEl = page.getByRole('heading', { name: 'ParamsNamedFoo' }) - await expect(headingEl).toBeVisible() - let paramsEl = page.getByTestId('params-output') - let paramsText = await paramsEl.innerText() - expect(paramsText).toEqual(JSON.stringify({ foo: 'foo%\\/🚀대' })) - - const barLink = page.getByTestId('params-foo-links-bar-special-characters') - - await barLink.click() - - await page.waitForURL( - '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80', - ) - - expect(page.url()).toBe( - `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80`, - ) - - paramsEl = page.getByTestId('foo-bar-value') - paramsText = await paramsEl.innerText() - expect(paramsText).toEqual('🚀%2F/abc대') - }) - - test.describe('should handle routes with non-latin paths and params correctly', () => { - const testCases = [ - { - name: 'named', - childPath: '🚀', - latinParams: 'foo', - unicodeParams: 'foo%\\/🚀대', - }, - { - name: 'wildcard', - childPath: 'wildcard', - latinParams: 'foo/bar', - unicodeParams: 'foo%\\/🚀대', - }, - ] - - testCases.forEach(({ name, childPath, latinParams, unicodeParams }) => { - test(`${name} params`, async ({ page, baseURL }) => { - const pascalCaseName = name.charAt(0).toUpperCase() + name.slice(1) - const routeParentPath = '/대한민국' - const encodedRouteParentPath = encodeURI(routeParentPath) - const childRoutePath = `${routeParentPath}/${childPath}` - const encodedChildRoutePath = encodeURI(childRoutePath) - - await page.goto(routeParentPath) - await page.waitForURL(encodedRouteParentPath) - - const headingRootEl = page.getByTestId('unicode-heading') - - expect(await headingRootEl.innerText()).toBe('Hello "/대한민국"!') - - const latinLink = page.getByTestId(`l-to-${name}-latin`) - const unicodeLink = page.getByTestId(`l-to-${name}-unicode`) - - await expect(latinLink).not.toContainClass('font-bold') - await expect(unicodeLink).not.toContainClass('font-bold') - - await latinLink.click() - - await page.waitForURL(`${encodedChildRoutePath}/${latinParams}`) - - expect(page.url()).toBe( - `${baseURL}${encodedChildRoutePath}/${latinParams}`, - ) - - await expect(latinLink).toContainClass('font-bold') - await expect(unicodeLink).not.toContainClass('font-bold') - - const headingEl = page.getByTestId(`unicode-${name}-heading`) - const paramsEl = page.getByTestId(`unicode-${name}-params`) - - expect(await headingEl.innerText()).toBe( - `Unicode ${pascalCaseName} Params`, - ) - expect(await paramsEl.innerText()).toBe(latinParams) - - await unicodeLink.click() - - const encodedParams = - name === 'wildcard' - ? encodeURI(unicodeParams) - : encodeURIComponent(unicodeParams) - - await page.waitForURL(`${encodedChildRoutePath}/${encodedParams}`) - - expect(page.url()).toBe( - `${baseURL}${encodedChildRoutePath}/${encodedParams}`, - ) - - await expect(latinLink).not.toContainClass('font-bold') - await expect(unicodeLink).toContainClass('font-bold') - - expect(await headingEl.innerText()).toBe( - `Unicode ${pascalCaseName} Params`, - ) - expect(await paramsEl.innerText()).toBe(unicodeParams) - }) - }) - }) -}) - -test.describe('useParams strict false uses parsed child params', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps') - }) - - test('parent receives parsed values after child navigation', async ({ - page, - }) => { - await page.getByTestId('strict-false-version-1').click() - await page.waitForURL('/params-ps/strict-false/1') - - await expect(page.getByTestId('strict-false-version-type')).toHaveText( - 'number', - ) - await expect(page.getByTestId('strict-false-version-value')).toHaveText('1') - - await page.getByTestId('strict-false-version-2').click() - await page.waitForURL('/params-ps/strict-false/2') - - await expect(page.getByTestId('strict-false-version-type')).toHaveText( - 'number', - ) - await expect(page.getByTestId('strict-false-version-value')).toHaveText('2') - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/redirect.spec.ts b/e2e/react-router/basic-file-based/tests/redirect.spec.ts deleted file mode 100644 index aaa9c1a6b6..0000000000 --- a/e2e/react-router/basic-file-based/tests/redirect.spec.ts +++ /dev/null @@ -1,272 +0,0 @@ -import queryString from 'node:querystring' -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import combinateImport from 'combinate' - -// somehow playwright does not correctly import default exports -const combinate = (combinateImport as any).default as typeof combinateImport - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const EXTERNAL_ORIGIN = `http://127.0.0.1:${PORT}` - -test.describe('redirects', () => { - const internalNavigationTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - preload: [false, true] as const, - }) - - internalNavigationTestMatrix.forEach( - ({ thrower, reloadDocument, preload }) => { - test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - await page.goto( - `/redirect/internal${preload === false ? '?preload=false' : ''}`, - ) - const link = page.getByTestId( - `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`, - ) - - await page.waitForLoadState('networkidle') - let requestHappened = false - - const requestPromise = new Promise((resolve) => { - page.on('request', (request) => { - if ( - request.url() === 'https://jsonplaceholder.typicode.com/posts' - ) { - requestHappened = true - resolve() - } - }) - }) - await link.focus() - - const expectRequestHappened = preload && !reloadDocument - const timeoutPromise = new Promise((resolve) => - setTimeout(resolve, expectRequestHappened ? 5000 : 500), - ) - await Promise.race([requestPromise, timeoutPromise]) - await page.waitForLoadState('networkidle') - expect(requestHappened).toBe(expectRequestHappened) - await link.click() - let fullPageLoad = false - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - - const url = `http://localhost:${PORT}/posts` - - await page.waitForURL(url) - if (reloadDocument) { - await page.waitForLoadState('domcontentloaded') - } - expect(page.url()).toBe(url) - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - expect(fullPageLoad).toBe(reloadDocument) - }) - }, - ) - - const internalDirectVisitTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - }) - - internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => { - test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - - await page.goto(`/redirect/internal/via-${thrower}`) - - const url = `http://localhost:${PORT}/posts` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - }) - }) - - const externalTestMatrix = combinate({ - scenario: ['navigate', 'direct_visit'] as const, - thrower: ['beforeLoad', 'loader'] as const, - }) - - externalTestMatrix.forEach(({ scenario, thrower }) => { - test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - }) - - if (scenario === 'navigate') { - await page.goto(`/redirect/external?${q}`) - await page.getByTestId(`via-${thrower}`).click() - } else { - await page.goto(`/redirect/external/via-${thrower}?${q}`) - } - - const url = `${EXTERNAL_ORIGIN}/` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - }) - }) - - test('regression test for #3097', async ({ page }) => { - await page.goto(`/redirect/preload/first`) - const link = page.getByTestId(`link`) - await link.focus() - await link.click() - await page.waitForURL('/redirect/preload/third') - await expect(page.getByTestId(`third`)).toBeInViewport() - }) - - // Tests for Route.redirect() method - tests relative redirects - test.describe('Route.redirect()', () => { - const routeRedirectInternalTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - }) - - // Test internal relative redirects (the key feature being tested) - routeRedirectInternalTestMatrix.forEach(({ thrower }) => { - test(`internal target (relative redirect), navigation: thrower: ${thrower}`, async ({ - page, - }) => { - await page.goto('/redirect/internal') - await page.waitForLoadState('networkidle') - - const link = page.getByTestId(`via-route-redirect-${thrower}`) - await link.click() - - // Should redirect to the relative ./destination route - const url = `http://localhost:${PORT}/redirect/internal/destination` - await page.waitForURL(url) - expect(page.url()).toBe(url) - await expect(page.getByTestId('redirect-destination')).toBeInViewport() - }) - }) - - routeRedirectInternalTestMatrix.forEach(({ thrower }) => { - test(`internal target (relative redirect), direct visit: thrower: ${thrower}`, async ({ - page, - }) => { - await page.goto(`/redirect/internal/via-route-redirect-${thrower}`) - - // Should redirect to the relative ./destination route - const url = `http://localhost:${PORT}/redirect/internal/destination` - await page.waitForURL(url) - expect(page.url()).toBe(url) - await expect(page.getByTestId('redirect-destination')).toBeInViewport() - }) - }) - - // Test external redirects still work with Route.redirect() - const externalRouteRedirectTestMatrix = combinate({ - scenario: ['navigate', 'direct_visit'] as const, - thrower: ['beforeLoad', 'loader'] as const, - }) - - externalRouteRedirectTestMatrix.forEach(({ scenario, thrower }) => { - test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({ - page, - }) => { - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - }) - - if (scenario === 'navigate') { - await page.goto(`/redirect/external?${q}`) - await page.waitForLoadState('networkidle') - await page.getByTestId(`via-route-redirect-${thrower}`).click() - } else { - await page.goto( - `/redirect/external/via-route-redirect-${thrower}?${q}`, - ) - } - - const url = `${EXTERNAL_ORIGIN}/` - await page.waitForURL(url) - expect(page.url()).toBe(url) - }) - }) - }) - - // Tests for getRouteApi().redirect() method - tests relative redirects - test.describe('getRouteApi().redirect()', () => { - const routeApiRedirectInternalTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - }) - - // Test internal relative redirects (the key feature being tested) - routeApiRedirectInternalTestMatrix.forEach(({ thrower }) => { - test(`internal target (relative redirect), navigation: thrower: ${thrower}`, async ({ - page, - }) => { - await page.goto('/redirect/internal') - await page.waitForLoadState('networkidle') - - const link = page.getByTestId(`via-routeApi-redirect-${thrower}`) - await link.click() - - // Should redirect to the relative ./destination route - const url = `http://localhost:${PORT}/redirect/internal/destination` - await page.waitForURL(url) - expect(page.url()).toBe(url) - await expect(page.getByTestId('redirect-destination')).toBeInViewport() - }) - }) - - routeApiRedirectInternalTestMatrix.forEach(({ thrower }) => { - test(`internal target (relative redirect), direct visit: thrower: ${thrower}`, async ({ - page, - }) => { - await page.goto(`/redirect/internal/via-routeApi-redirect-${thrower}`) - - // Should redirect to the relative ./destination route - const url = `http://localhost:${PORT}/redirect/internal/destination` - await page.waitForURL(url) - expect(page.url()).toBe(url) - await expect(page.getByTestId('redirect-destination')).toBeInViewport() - }) - }) - - // Test external redirects still work with getRouteApi().redirect() - const externalRouteApiRedirectTestMatrix = combinate({ - scenario: ['navigate', 'direct_visit'] as const, - thrower: ['beforeLoad', 'loader'] as const, - }) - - externalRouteApiRedirectTestMatrix.forEach(({ scenario, thrower }) => { - test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({ - page, - }) => { - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - }) - - if (scenario === 'navigate') { - await page.goto(`/redirect/external?${q}`) - await page.waitForLoadState('networkidle') - await page.getByTestId(`via-routeApi-redirect-${thrower}`).click() - } else { - await page.goto( - `/redirect/external/via-routeApi-redirect-${thrower}?${q}`, - ) - } - - const url = `${EXTERNAL_ORIGIN}/` - await page.waitForURL(url) - expect(page.url()).toBe(url) - }) - }) - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/relative.spec.ts b/e2e/react-router/basic-file-based/tests/relative.spec.ts deleted file mode 100644 index f62c248680..0000000000 --- a/e2e/react-router/basic-file-based/tests/relative.spec.ts +++ /dev/null @@ -1,272 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import combinateImport from 'combinate' - -// somehow playwright does not correctly import default exports -const combinate = (combinateImport as any).default as typeof combinateImport - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -test.describe('relative_routing', () => { - const internalNavigationTestMatrix = combinate({ - navigation: ['link', 'useNavigate'] as const, - }) - - internalNavigationTestMatrix.forEach(({ navigation }) => { - test(`simple relative navigation. navigation: ${navigation}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const indexLink = page.getByTestId(`relative-${navigation}-index`) - const backLink = page.getByTestId(`relative-${navigation}-back`) - const relativeRouteA = page.getByTestId(`relative-${navigation}-a`) - const relativeRouteB = page.getByTestId(`relative-${navigation}-b`) - - await relativeRouteA.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-a`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-a-header`), - ).toBeInViewport() - - await relativeRouteB.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-b`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-b-header`), - ).toBeInViewport() - - await indexLink.click() - - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-b-header`), - ).not.toBeInViewport() - - await backLink.click() - - await page.waitForURL(`http://localhost:${PORT}/relative`) - - await expect(page.getByTestId(`relative-routing-home`)).toBeInViewport() - }) - - test(`nested chilren. navigation: ${navigation}`, async ({ page }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const backLink = page.getByTestId(`relative-${navigation}-back`) - - const deeplyNestedChildRoute = page.getByTestId( - `relative-${navigation}-deeply-nested`, - ) - - await deeplyNestedChildRoute.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/nested/deep`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-nested-deep-header`), - ).toBeInViewport() - - await backLink.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/nested`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-nested-header`), - ).toBeInViewport() - }) - - test(`with path params. navigation: ${navigation}`, async ({ page }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const pathParamRoute = page.getByTestId(`relative-${navigation}-path`) - - await pathParamRoute.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/path/a`, - ) - - expect(page.url().endsWith('/path/a')).toBe(true) - - await expect( - page.getByTestId(`relative-${navigation}-path-param-header`), - ).toBeInViewport() - - const switchParamLink = page.getByTestId( - `relative-${navigation}-path-param-switchAB`, - ) - - await switchParamLink.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/path/b`, - ) - - expect(page.url().endsWith('/path/b')).toBe(true) - - await expect( - page.getByTestId(`relative-${navigation}-path-param-header`), - ).toBeInViewport() - }) - - test(`with search params. navigation: ${navigation}`, async ({ page }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const searchParamRoute = page.getByTestId( - `relative-${navigation}-withSearch`, - ) - - await searchParamRoute.click() - - let expectedUrl = new URL( - `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam="1"`, - ) - - await page.waitForLoadState('domcontentloaded') - - expect(page.url().toString()).toBe(expectedUrl.toString()) - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toContainText('searchParam: 1') - - const updateSearchLink = page.getByTestId( - `relative-${navigation}-withSearch-update-param`, - ) - - await updateSearchLink.click() - - await page.waitForLoadState('domcontentloaded') - - expectedUrl = new URL( - `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam="2"`, - ) - - expect(page.url().toString()).toBe(expectedUrl.toString()) - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toContainText('searchParam: 2') - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toBeInViewport() - }) - - test(`shouldn't cause excessive rendering. navigation: ${navigation}`, async ({ - page, - }) => { - let navigateMsgs = 0 - - page.on('console', (msg) => { - if (msg.text() === 'navigate') { - navigateMsgs++ - } - }) - - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - expect(navigateMsgs).toBe(1) - const indexLink = page.getByTestId(`relative-${navigation}-index`) - const backLink = page.getByTestId(`relative-${navigation}-back`) - const relativeRouteA = page.getByTestId(`relative-${navigation}-a`) - const relativeRouteB = page.getByTestId(`relative-${navigation}-b`) - const deeplyNestedChildRoute = page.getByTestId( - `relative-${navigation}-deeply-nested`, - ) - const pathParamRoute = page.getByTestId(`relative-${navigation}-path`) - const searchParamRoute = page.getByTestId( - `relative-${navigation}-withSearch`, - ) - - await relativeRouteA.click() - await page.waitForLoadState('domcontentloaded') - await relativeRouteB.click() - await page.waitForLoadState('domcontentloaded') - await deeplyNestedChildRoute.click() - await page.waitForLoadState('domcontentloaded') - await backLink.click() - await page.waitForLoadState('domcontentloaded') - await pathParamRoute.click() - await page.waitForLoadState('domcontentloaded') - const switchParamLink = page.getByTestId( - `relative-${navigation}-path-param-switchAB`, - ) - await switchParamLink.click() - await page.waitForLoadState('domcontentloaded') - await searchParamRoute.click() - await page.waitForLoadState('domcontentloaded') - - const updateSearchLink = page.getByTestId( - `relative-${navigation}-withSearch-update-param`, - ) - - await updateSearchLink.click() - await page.waitForLoadState('domcontentloaded') - - await indexLink.click() - await page.waitForLoadState('domcontentloaded') - - expect(navigateMsgs).toBe(1) - }) - }) -}) diff --git a/e2e/react-router/basic-file-based/tests/scroll-into-view.spec.ts b/e2e/react-router/basic-file-based/tests/scroll-into-view.spec.ts deleted file mode 100644 index 68dfededc2..0000000000 --- a/e2e/react-router/basic-file-based/tests/scroll-into-view.spec.ts +++ /dev/null @@ -1,229 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -const anchors = { - defaultAnchor: 'default-anchor', - noScrollIntoView: 'false-anchor', - smoothScroll: 'smooth-scroll', -} as const - -const formTestIds = { - targetAnchor: 'hash-select', - scrollIntoView: 'with-scroll', - behaviorSelect: 'behavior-select', - blockSelect: 'block-select', - inlineSelect: 'inline-select', - navigateButton: 'navigate-button', -} - -const shownSuffix = '(shown)' - -const activeClass = 'font-bold active' - -function getAnchorTarget(page: Page, anchor: string) { - return page.getByTestId(`heading-${anchor}`) -} - -function getAnchorLink(page: Page, anchor: string) { - return page.getByTestId(`link-${anchor}`) -} - -test.beforeEach(async ({ page }) => { - await page.goto('/anchor') -}) - -test('slash and backslash fragment data selects the matching anchor', async ({ - page, -}) => { - const link = page.getByRole('link', { name: 'Fragment with slashes' }) - const heading = page.getByRole('heading', { name: 'Fragment with slashes' }) - await link.click() - await expect(page).toHaveURL(/#\/\\section$/) - await expect(link).toHaveClass(activeClass) - await expect(heading).toBeInViewport() - - await page.reload() - await expect(link).toHaveClass(activeClass) - await expect(heading).toBeInViewport() -}) - -// Testing the `Link` component with the `hashScrollIntoView` prop -test('Navigating via anchor `Link` with default hash scrolling behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await getAnchorLink(page, anchors.defaultAnchor).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toBeVisible() - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.defaultAnchor)).toHaveClass( - activeClass, - ) -}) - -test('Navigating via anchor `Link` with hash scrolling disabled', async ({ - page, -}) => { - const initialScrollPosition = await page.evaluate(() => window.scrollY) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await getAnchorLink(page, anchors.noScrollIntoView).click() - - // The active anchor should have updated - await expect(getAnchorLink(page, anchors.noScrollIntoView)).toHaveClass( - activeClass, - ) - - // The anchor should not have been visible, because the scroll should not have been activated - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - // Expect the same scroll position as before - expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition) -}) - -test('Navigating via anchor `Link` with smooth hash scrolling behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - await getAnchorLink(page, anchors.smoothScroll).click() - await expect(getAnchorTarget(page, anchors.smoothScroll)).toBeVisible() - - // Smooth scrolling should activate the IntersectionObserver on all headings, making them all render "(shown)" - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText( - shownSuffix, - ) - await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText( - shownSuffix, - ) - await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) -}) - -// Testing the `useNavigate` hook with the `hashScrollIntoView` option -test('Navigating via `useNavigate` with instant scroll behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - // Scroll to the last anchor instantly, should not activate Intersection Observers for the other anchors - await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll') - await page.getByTestId(formTestIds.scrollIntoView).check() - await page.getByTestId(formTestIds.behaviorSelect).selectOption('instant') - await page.getByTestId(formTestIds.blockSelect).selectOption('start') - await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest') - await page.getByTestId(formTestIds.navigateButton).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toBeVisible() - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) -}) - -test('Navigating via `useNavigate` with scrollIntoView disabled', async ({ - page, -}) => { - const initialScrollPosition = await page.evaluate(() => window.scrollY) - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - // Navigate to the last anchor, but with scrollIntoView disabled should not activate Intersection Observers for any anchors - await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll') - await page.getByTestId(formTestIds.scrollIntoView).uncheck() - await page.getByTestId(formTestIds.navigateButton).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) - - // Expect the same scroll position as before - expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition) -}) - -test('Navigating via `useNavigate` with smooth scroll behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - // Scroll to the last anchor smoothly, should activate Intersection Observers for the other anchors, making them all render "(shown)" - await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll') - await page.getByTestId(formTestIds.scrollIntoView).check() - await page.getByTestId(formTestIds.behaviorSelect).selectOption('smooth') - await page.getByTestId(formTestIds.blockSelect).selectOption('start') - await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest') - await page.getByTestId(formTestIds.navigateButton).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText( - shownSuffix, - ) - - await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText( - shownSuffix, - ) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) -}) diff --git a/e2e/react-router/basic-file-based/tests/search-params.spec.ts b/e2e/react-router/basic-file-based/tests/search-params.spec.ts deleted file mode 100644 index a99488a47a..0000000000 --- a/e2e/react-router/basic-file-based/tests/search-params.spec.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.describe('/search-params/default', () => { - test('Directly visiting the route without search param set', async ({ - page, - }) => { - await page.goto('/search-params/default') - await page.waitForURL('/search-params/default?default=d1') - - await expect(page.getByTestId('search-default')).toContainText('d1') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d1'), - ).toBeTruthy() - }) - - test('Directly visiting the route with search param set', async ({ - page, - }) => { - await page.goto('/search-params/default/?default=d2') - await page.waitForURL('/search-params/default?default=d2') - - await expect(page.getByTestId('search-default')).toContainText('d2') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d2'), - ).toBeTruthy() - }) - - test('Directly visiting the route with special character search param set', async ({ - page, - }) => { - await page.goto('/search-params/default/?default=🚀대한민국') - await page.waitForURL( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - - await expect(page.getByTestId('search-default')).toContainText('🚀대한민국') - await expect(page.getByTestId('context-hello')).toContainText('world') - - expect( - page - .url() - .endsWith( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ), - ).toBeTruthy() - }) - - test('Directly visiting the route with encoded character search param set', async ({ - page, - }) => { - await page.goto( - '/search-params/default/?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ) - await page.waitForURL( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ) - - await expect(page.getByTestId('search-default')).toContainText( - '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - await expect(page.getByTestId('context-hello')).toContainText('world') - - expect( - page - .url() - .endsWith( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ), - ).toBeTruthy() - }) - - test('navigating to the route without search param set', async ({ page }) => { - await page.goto('/search-params/') - await page.getByTestId('link-to-default-without-search').click() - await page.waitForURL('/search-params/default?default=d1') - - await expect(page.getByTestId('search-default')).toContainText('d1') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d1'), - ).toBeTruthy() - }) - - test('navigating to the route with search param set', async ({ page }) => { - await page.goto('/search-params/') - await page.getByTestId('link-to-default-with-search').click() - await page.waitForURL('/search-params/default?default=d2') - - await expect(page.getByTestId('search-default')).toContainText('d2') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d2'), - ).toBeTruthy() - }) - - test('navigating to the route with special character search param set', async ({ - page, - }) => { - await page.goto('/search-params/') - await page - .getByTestId('link-to-default-with-search-special-characters') - .click() - await page.waitForURL( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - - await expect(page.getByTestId('search-default')).toContainText('🚀대한민국') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page - .url() - .endsWith( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ), - ).toBeTruthy() - }) - - test('navigating to the route with encoded character search param set', async ({ - page, - }) => { - await page.goto('/search-params/') - await page - .getByTestId('link-to-default-with-search-encoded-characters') - .click() - await page.waitForURL( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ) - - await expect(page.getByTestId('search-default')).toContainText( - '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page - .url() - .endsWith( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ), - ).toBeTruthy() - }) -}) diff --git a/e2e/react-router/basic-file-based/tsconfig.json b/e2e/react-router/basic-file-based/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basic-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-file-based/vite.config.js b/e2e/react-router/basic-file-based/vite.config.js deleted file mode 100644 index a3def84e28..0000000000 --- a/e2e/react-router/basic-file-based/vite.config.js +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'react', - }), - react(), - ], -}) diff --git a/e2e/react-router/basic-react-query-file-based/.devcontainer/devcontainer.json b/e2e/react-router/basic-react-query-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-react-query-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-react-query-file-based/.gitignore b/e2e/react-router/basic-react-query-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/basic-react-query-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/basic-react-query-file-based/index.html b/e2e/react-router/basic-react-query-file-based/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic-react-query-file-based/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic-react-query-file-based/package.json b/e2e/react-router/basic-react-query-file-based/package.json deleted file mode 100644 index 3a90a3cd6d..0000000000 --- a/e2e/react-router/basic-react-query-file-based/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-react-query-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-query": "^5.90.0", - "@tanstack/react-query-devtools": "^5.90.0", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic-react-query-file-based/playwright.config.ts b/e2e/react-router/basic-react-query-file-based/playwright.config.ts deleted file mode 100644 index fbda9bd451..0000000000 --- a/e2e/react-router/basic-react-query-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-react-query-file-based/src/main.tsx b/e2e/react-router/basic-react-query-file-based/src/main.tsx deleted file mode 100644 index 6793125293..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/main.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { QueryClient, QueryClientProvider } from '@tanstack/react-query' -import { routeTree } from './routeTree.gen' -import './styles.css' - -const queryClient = new QueryClient() - -// Set up a Router instance -const router = createRouter({ - routeTree, - context: { - queryClient, - }, - scrollRestoration: true, - defaultPreload: 'intent', - // Since we're using React Query, we don't want loader calls to ever be stale - // This will ensure that the loader is always called when the route is preloaded or visited - defaultPreloadStaleTime: 0, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render( - - - , - ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/postQueryOptions.tsx b/e2e/react-router/basic-react-query-file-based/src/postQueryOptions.tsx deleted file mode 100644 index f4dae09458..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/postQueryOptions.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { queryOptions } from '@tanstack/react-query' -import { fetchPost } from './posts' - -export const postQueryOptions = (postId: string) => - queryOptions({ - queryKey: ['posts', { postId }], - queryFn: () => fetchPost(postId), - }) diff --git a/e2e/react-router/basic-react-query-file-based/src/posts.tsx b/e2e/react-router/basic-react-query-file-based/src/posts.tsx deleted file mode 100644 index 1f6cb8e308..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/posts.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -export class PostNotFoundError extends Error {} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw new PostNotFoundError(`Post with id "${postId}" not found!`) - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/postsQueryOptions.tsx b/e2e/react-router/basic-react-query-file-based/src/postsQueryOptions.tsx deleted file mode 100644 index 6d96d627f3..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/postsQueryOptions.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { queryOptions } from '@tanstack/react-query' -import { fetchPosts } from './posts' - -export const postsQueryOptions = queryOptions({ - queryKey: ['posts'], - queryFn: () => fetchPosts(), -}) diff --git a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts deleted file mode 100644 index 115e4bce47..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,220 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/posts/$postId' - | '/posts/' - | '/layout-a' - | '/layout-b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b' - id: - | '__root__' - | '/' - | '/_layout' - | '/posts' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/posts/' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - PostsRoute: typeof PostsRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - } -} - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - PostsRoute: PostsRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/__root.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/__root.tsx deleted file mode 100644 index 7cdaed189d..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from 'react' -import { - Link, - Outlet, - createRootRouteWithContext, -} from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' -import { ReactQueryDevtools } from '@tanstack/react-query-devtools' -import type { QueryClient } from '@tanstack/react-query' - -export const Route = createRootRouteWithContext<{ - queryClient: QueryClient -}>()({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - This Route Does Not Exist - -
-
- - - - - ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/_layout.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/_layout.tsx deleted file mode 100644 index 0fcaac3a52..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 388d0b3b87..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index ed2dea8800..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 4799d403e9..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/index.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/index.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/posts.$postId.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index 9c7e89fbce..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { ErrorComponent, useRouter } from '@tanstack/react-router' -import { - useQueryErrorResetBoundary, - useSuspenseQuery, -} from '@tanstack/react-query' -import { PostNotFoundError } from '../posts' -import { postQueryOptions } from '../postQueryOptions' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: ({ context: { queryClient }, params: { postId } }) => { - return queryClient.ensureQueryData(postQueryOptions(postId)) - }, - errorComponent: PostErrorComponent, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - const router = useRouter() - if (error instanceof PostNotFoundError) { - return
{error.message}
- } - const queryErrorResetBoundary = useQueryErrorResetBoundary() - - React.useEffect(() => { - queryErrorResetBoundary.reset() - }, [queryErrorResetBoundary]) - - return ( -
- - -
- ) -} - -function PostComponent() { - const postId = Route.useParams().postId - const { data: post } = useSuspenseQuery(postQueryOptions(postId)) - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/posts.index.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/posts.index.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/basic-react-query-file-based/src/routes/posts.tsx b/e2e/react-router/basic-react-query-file-based/src/routes/posts.tsx deleted file mode 100644 index eed69e28aa..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' -import { useSuspenseQuery } from '@tanstack/react-query' -import { postsQueryOptions } from '../postsQueryOptions' - -export const Route = createFileRoute('/posts')({ - loader: ({ context: { queryClient } }) => - queryClient.ensureQueryData(postsQueryOptions), - component: PostsComponent, -}) - -function PostsComponent() { - const postsQuery = useSuspenseQuery(postsQueryOptions) - const posts = postsQuery.data - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/basic-react-query-file-based/src/styles.css b/e2e/react-router/basic-react-query-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-react-query-file-based/src/vite-env.d.ts b/e2e/react-router/basic-react-query-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-react-query-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-react-query-file-based/tests/app.spec.ts b/e2e/react-router/basic-react-query-file-based/tests/app.spec.ts deleted file mode 100644 index 2b42d6d589..0000000000 --- a/e2e/react-router/basic-react-query-file-based/tests/app.spec.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('GetPosts with networking disabled', async ({ page, context }) => { - await page.goto('about:blank') - await context.setOffline(true) - const { status, posts, post } = await page.evaluate(async () => { - const response = await fetch('https://jsonplaceholder.typicode.com/posts') - const posts = await response.json() - const post = await fetch( - 'https://jsonplaceholder.typicode.com/posts/1', - ).then((r) => r.json()) - return { status: response.status, posts, post } - }) - expect(status).toBe(200) - expect(posts.length).toBeGreaterThan(0) - expect(post).toEqual(posts[0]) -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/basic-react-query-file-based/tsconfig.json b/e2e/react-router/basic-react-query-file-based/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basic-react-query-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-react-query-file-based/vite.config.js b/e2e/react-router/basic-react-query-file-based/vite.config.js deleted file mode 100644 index ce5fc59483..0000000000 --- a/e2e/react-router/basic-react-query-file-based/vite.config.js +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ target: 'react', autoCodeSplitting: true }), - react(), - ], -}) diff --git a/e2e/react-router/basic-react-query/.devcontainer/devcontainer.json b/e2e/react-router/basic-react-query/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-react-query/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-react-query/.gitignore b/e2e/react-router/basic-react-query/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/basic-react-query/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/basic-react-query/index.html b/e2e/react-router/basic-react-query/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic-react-query/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic-react-query/package.json b/e2e/react-router/basic-react-query/package.json deleted file mode 100644 index 8f28340f56..0000000000 --- a/e2e/react-router/basic-react-query/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-react-query", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-query": "^5.90.0", - "@tanstack/react-query-devtools": "^5.90.0", - "@tanstack/react-router": "workspace:^", - "@tanstack/router-devtools": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic-react-query/playwright.config.ts b/e2e/react-router/basic-react-query/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/basic-react-query/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-react-query/src/main.tsx b/e2e/react-router/basic-react-query/src/main.tsx deleted file mode 100644 index cceaf946a1..0000000000 --- a/e2e/react-router/basic-react-query/src/main.tsx +++ /dev/null @@ -1,276 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { - ErrorComponent, - Link, - Outlet, - RouterProvider, - createRootRouteWithContext, - createRoute, - createRouter, - useRouter, -} from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/router-devtools' -import { ReactQueryDevtools } from '@tanstack/react-query-devtools' -import { - QueryClient, - QueryClientProvider, - useQueryErrorResetBoundary, - useSuspenseQuery, -} from '@tanstack/react-query' -import { NotFoundError, postQueryOptions, postsQueryOptions } from './posts' -import type { ErrorComponentProps } from '@tanstack/react-router' -import './styles.css' - -const rootRoute = createRootRouteWithContext<{ - queryClient: QueryClient -}>()({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - This Route Does Not Exist - -
-
- - - - - ) -} - -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - component: IndexRouteComponent, -}) - -function IndexRouteComponent() { - return ( -
-

Welcome Home!

-
- ) -} - -const postsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'posts', - loader: ({ context: { queryClient } }) => - queryClient.ensureQueryData(postsQueryOptions), -}).lazy(() => import('./posts.lazy').then((d) => d.Route)) - -const postsIndexRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '/', - component: PostsIndexRouteComponent, -}) - -function PostsIndexRouteComponent() { - return
Select a post.
-} - -const postRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '$postId', - errorComponent: PostErrorComponent, - loader: ({ context: { queryClient }, params: { postId } }) => - queryClient.ensureQueryData(postQueryOptions(postId)), - component: PostRouteComponent, -}) - -function PostErrorComponent({ error, reset }: ErrorComponentProps) { - const router = useRouter() - if (error instanceof NotFoundError) { - return
{error.message}
- } - const queryErrorResetBoundary = useQueryErrorResetBoundary() - - React.useEffect(() => { - queryErrorResetBoundary.reset() - }, [queryErrorResetBoundary]) - - return ( -
- - -
- ) -} - -function PostRouteComponent() { - const { postId } = postRoute.useParams() - const postQuery = useSuspenseQuery(postQueryOptions(postId)) - const post = postQuery.data - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} - -const layoutRoute = createRoute({ - getParentRoute: () => rootRoute, - id: '_layout', - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} - -const layout2Route = createRoute({ - getParentRoute: () => layoutRoute, - id: '_layout-2', - component: Layout2Component, -}) - -function Layout2Component() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} - -const layoutARoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-a', - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} - -const layoutBRoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-b', - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} - -const routeTree = rootRoute.addChildren([ - postsRoute.addChildren([postRoute, postsIndexRoute]), - layoutRoute.addChildren([ - layout2Route.addChildren([layoutARoute, layoutBRoute]), - ]), - indexRoute, -]) - -const queryClient = new QueryClient() - -// Set up a Router instance -const router = createRouter({ - routeTree, - scrollRestoration: true, - defaultPreload: 'intent', - // Since we're using React Query, we don't want loader calls to ever be stale - // This will ensure that the loader is always called when the route is preloaded or visited - defaultPreloadStaleTime: 0, - context: { - queryClient, - }, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - - root.render( - - - , - ) -} diff --git a/e2e/react-router/basic-react-query/src/posts.lazy.tsx b/e2e/react-router/basic-react-query/src/posts.lazy.tsx deleted file mode 100644 index b5ed92e4ac..0000000000 --- a/e2e/react-router/basic-react-query/src/posts.lazy.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createLazyRoute } from '@tanstack/react-router' -import { useSuspenseQuery } from '@tanstack/react-query' -import { postsQueryOptions } from './posts' - -export const Route = createLazyRoute('/posts')({ - component: PostsComponent, -}) - -function PostsComponent() { - const postsQuery = useSuspenseQuery(postsQueryOptions) - - const posts = postsQuery.data - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
- -
- ) -} diff --git a/e2e/react-router/basic-react-query/src/posts.ts b/e2e/react-router/basic-react-query/src/posts.ts deleted file mode 100644 index ffc5a274b7..0000000000 --- a/e2e/react-router/basic-react-query/src/posts.ts +++ /dev/null @@ -1,44 +0,0 @@ -import axios from 'redaxios' -import { queryOptions } from '@tanstack/react-query' - -export class NotFoundError extends Error {} - -type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} - -const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} - -export const postQueryOptions = (postId: string) => - queryOptions({ - queryKey: ['posts', { postId }], - queryFn: () => fetchPost(postId), - }) - -export const postsQueryOptions = queryOptions({ - queryKey: ['posts'], - queryFn: () => fetchPosts(), -}) diff --git a/e2e/react-router/basic-react-query/src/styles.css b/e2e/react-router/basic-react-query/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic-react-query/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-react-query/src/vite-env.d.ts b/e2e/react-router/basic-react-query/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-react-query/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-react-query/tests/app.spec.ts b/e2e/react-router/basic-react-query/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/react-router/basic-react-query/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/basic-react-query/tsconfig.json b/e2e/react-router/basic-react-query/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basic-react-query/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-react-query/vite.config.js b/e2e/react-router/basic-react-query/vite.config.js deleted file mode 100644 index 2764078e8b..0000000000 --- a/e2e/react-router/basic-react-query/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), react()], -}) diff --git a/e2e/react-router/basic-scroll-restoration/.devcontainer/devcontainer.json b/e2e/react-router/basic-scroll-restoration/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-scroll-restoration/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-scroll-restoration/.gitignore b/e2e/react-router/basic-scroll-restoration/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/react-router/basic-scroll-restoration/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/react-router/basic-scroll-restoration/index.html b/e2e/react-router/basic-scroll-restoration/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic-scroll-restoration/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic-scroll-restoration/package.json b/e2e/react-router/basic-scroll-restoration/package.json deleted file mode 100644 index c13e92cec8..0000000000 --- a/e2e/react-router/basic-scroll-restoration/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-scroll-restoration", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/react-virtual": "^3.13.0", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14", - "typescript": "~5.9.0" - } -} diff --git a/e2e/react-router/basic-scroll-restoration/playwright.config.ts b/e2e/react-router/basic-scroll-restoration/playwright.config.ts deleted file mode 100644 index 6a684ac89e..0000000000 --- a/e2e/react-router/basic-scroll-restoration/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-scroll-restoration/src/main.tsx b/e2e/react-router/basic-scroll-restoration/src/main.tsx deleted file mode 100644 index 8bc4c54c1c..0000000000 --- a/e2e/react-router/basic-scroll-restoration/src/main.tsx +++ /dev/null @@ -1,297 +0,0 @@ -import React, { useLayoutEffect } from 'react' -import ReactDOM from 'react-dom/client' -import { - Link, - Outlet, - RouterProvider, - createRootRoute, - createRoute, - createRouter, - useElementScrollRestoration, -} from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' -import { useVirtualizer } from '@tanstack/react-virtual' -import './styles.css' - -const rootRoute = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - About - - - About (No Reset) - - - By-Element - -
- - - - ) -} - -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: IndexComponent, -}) - -function IndexComponent() { - useLayoutEffect(() => { - window.invokeOrders.push('index-useLayoutEffect') - }, []) - - return ( -
-

- Welcome Home! -

-
-
- {Array.from({ length: 50 }).map((_, i) => ( -
- Home Item {i + 1} -
- ))} -
-
- ) -} - -const aboutRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/about', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: AboutComponent, -}) - -function AboutComponent() { - useLayoutEffect(() => { - window.invokeOrders.push('about-useLayoutEffect') - }, []) - return ( -
-

Hello from About!

-
- {Array.from({ length: 50 }).map((_, i) => ( -
- About Item {i + 1} -
- ))} -
-
- ) -} - -const byElementRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/by-element', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: ByElementComponent, -}) - -function ByElementComponent() { - // We need a unique ID for manual scroll restoration on a specific element - // It should be as unique as possible for this element across your app - const scrollRestorationId = 'myVirtualizedContent' - - // We use that ID to get the scroll entry for this element - const scrollEntry = useElementScrollRestoration({ - id: scrollRestorationId, - }) - - // Let's use TanStack Virtual to virtualize some content! - const virtualizerParentRef = React.useRef(null) - const virtualizer = useVirtualizer({ - count: 10000, - getScrollElement: () => virtualizerParentRef.current, - estimateSize: () => 100, - // We pass the scrollY from the scroll restoration entry to the virtualizer - // as the initial offset - initialOffset: scrollEntry?.scrollY, - }) - - return ( -
-
Hello from By-Element!
-
-
-
- First Regular List Item -
-
- {Array.from({ length: 50 }).map((_, i) => ( -
- Regular List Item {i + 1} -
- ))} -
-
- {Array.from({ length: 2 }).map((_, i) => ( -
-
- {Array.from({ length: 50 }).map((_, i) => ( -
- About Item {i + 1} -
- ))} -
-
- ))} -
-
Virtualized
-
-
- {virtualizer.getVirtualItems().map((item) => ( -
-
- Virtualized Item {item.index + 1} -
-
- ))} -
-
-
-
-
-
- ) -} - -const fooRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/foo', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: FooComponent, -}) - -function FooComponent() { - return ( -
-

Hello from Foo!

- - Go to Bar - -
- {Array.from({ length: 50 }).map((_, i) => ( -
- Foo Item {i + 1} -
- ))} -
-
- ) -} - -const barRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/bar', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: BarComponent, -}) - -function BarComponent() { - return ( -
-

Hello from Bar!

-
- {Array.from({ length: 50 }).map((_, i) => ( -
- Bar Item {i + 1} -
- ))} -
-
- ) -} - -const routeTree = rootRoute.addChildren([ - indexRoute, - aboutRoute, - byElementRoute, - fooRoute, - barRoute, -]) - -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - scrollRestoration: true, - getScrollRestorationKey: (location) => location.pathname, -}) - -declare global { - interface Window { - invokeOrders: Array - } -} -window.invokeOrders = [] -router.subscribe('onBeforeRouteMount', (event) => { - window.invokeOrders.push(event.type) -}) - -router.subscribe('onResolved', (event) => { - window.invokeOrders.push(event.type) -}) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basic-scroll-restoration/src/styles.css b/e2e/react-router/basic-scroll-restoration/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic-scroll-restoration/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-scroll-restoration/src/vite-env.d.ts b/e2e/react-router/basic-scroll-restoration/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-scroll-restoration/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-scroll-restoration/tests/app.spec.ts b/e2e/react-router/basic-scroll-restoration/tests/app.spec.ts deleted file mode 100644 index c7360ce8a4..0000000000 --- a/e2e/react-router/basic-scroll-restoration/tests/app.spec.ts +++ /dev/null @@ -1,117 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('restore scroll positions by page, home pages top message should not display on navigating back', async ({ - page, -}) => { - // Step 1: Navigate to the home page - await page.goto('/') - await page.waitForURL('/') - - await expect(page.locator('#greeting')).toContainText('Welcome Home!') - await expect(page.locator('#top-message')).toBeInViewport() - - // Step 2: Scroll to a position that hides the top - const targetScrollPosition = 1000 - await page.evaluate( - (scrollPos: number) => window.scrollTo(0, scrollPos), - targetScrollPosition, - ) - - // Verify initial scroll position - const scrollPosition = await page.evaluate(() => window.scrollY) - expect(scrollPosition).toBe(targetScrollPosition) - - await expect(page.locator('#top-message')).not.toBeInViewport() - await page.waitForTimeout(1000) - - // Step 3: Navigate to the about page - await page.getByRole('link', { name: 'About', exact: true }).click() - await expect(page.locator('#greeting')).toContainText('Hello from About!') - - // Step 4: Go back to the home page and immediately check the message - await page.goBack() - - // Wait for the home page to have rendered - await page.waitForSelector('#greeting') - await page.waitForTimeout(1000) - await expect(page.locator('#top-message')).not.toBeInViewport() - - // Confirm the scroll position was restored correctly - const restoredScrollPosition = await page.evaluate(() => window.scrollY) - expect(restoredScrollPosition).toBe(targetScrollPosition) -}) - -test('restore scroll positions by element, first regular list item should not display on navigating back', async ({ - page, -}) => { - // Step 1: Navigate to the by-element page - await page.goto('/by-element') - await page.waitForURL('/by-element') - - // Step 2: Scroll to a position that hides the first list item in regular list - const targetScrollPosition = 1000 - await page.waitForSelector('#RegularList') - await expect(page.locator('#first-regular-list-item')).toBeInViewport() - - await page.evaluate( - (scrollPos: number) => - document.querySelector('#RegularList')!.scrollTo(0, scrollPos), - targetScrollPosition, - ) - - // Verify initial scroll position - const scrollPosition = await page.evaluate( - () => document.querySelector('#RegularList')!.scrollTop, - ) - expect(scrollPosition).toBe(targetScrollPosition) - - await expect(page.locator('#first-regular-list-item')).not.toBeInViewport() - - // Step 3: Navigate to the about page - await page.getByRole('link', { name: 'About', exact: true }).click() - await expect(page.locator('#greeting')).toContainText('Hello from About!') - - // Step 4: Go back to the by-element page and immediately check the message - await page.goBack() - - // TODO: For some reason, this only works in headed mode. - // When someone can explain that to me, I'll fix this test. - - // Confirm the scroll position was restored correctly - // const restoredScrollPosition = await page.evaluate( - // () => document.querySelector('#RegularList')!.scrollTop, - // ) - // expect(restoredScrollPosition).toBe(targetScrollPosition) -}) - -test('scroll to top when not scrolled, regression test for #4782', async ({ - page, -}) => { - await page.goto('/foo') - await page.waitForURL('/foo') - - await expect(page.getByTestId('foo-route-component')).toBeVisible() - - let scrollPosition = await page.evaluate(() => window.scrollY) - expect(scrollPosition).toBe(0) - - // do not scroll, just navigate to /bar - await page.getByTestId('go-to-bar-link').click() - await expect(page.getByTestId('bar-route-component')).toBeVisible() - - const targetScrollPosition = 1000 - await page.evaluate( - (scrollPos: number) => window.scrollTo(0, scrollPos), - targetScrollPosition, - ) - scrollPosition = await page.evaluate(() => window.scrollY) - expect(scrollPosition).toBe(targetScrollPosition) - - // navigate back to /foo - await page.goBack() - await expect(page.getByTestId('foo-route-component')).toBeVisible() - - // check if scroll position is restored to 0 since we did not scroll on /foo - const restoredScrollPosition = await page.evaluate(() => window.scrollY) - expect(restoredScrollPosition).toBe(0) -}) diff --git a/e2e/react-router/basic-scroll-restoration/tests/router-events.spec.ts b/e2e/react-router/basic-scroll-restoration/tests/router-events.spec.ts deleted file mode 100644 index c5a51d46be..0000000000 --- a/e2e/react-router/basic-scroll-restoration/tests/router-events.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('after a navigation, should have emitted "onBeforeRouteMount","onResolved" and useLayoutEffect setup in the correct order', async ({ - page, -}) => { - // Navigate to the Home page - await page.goto('/') - await expect(page.locator('#greeting')).toContainText('Welcome Home!') - - let orders = await page.evaluate(() => window.invokeOrders) - - expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved') - expectItemOrder(orders, 'onBeforeRouteMount', 'index-useLayoutEffect') - - // Clear the invokeOrders array - orders = await page.evaluate(() => { - window.invokeOrders = [] - return window.invokeOrders - }) - - // Navigate to the About page - await page.getByRole('link', { name: 'About', exact: true }).click() - await expect(page.locator('#greeting')).toContainText('Hello from About!') - - orders = await page.evaluate(() => window.invokeOrders) - - expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved') - expectItemOrder(orders, 'onBeforeRouteMount', 'about-useLayoutEffect') -}) - -function expectItemOrder( - array: Array, - firstItem: TItem, - secondItem: TItem, -) { - const firstIndex = array.findIndex((item) => item === firstItem) - const secondIndex = array.findIndex((item) => item === secondItem) - - if (firstIndex === -1 || secondIndex === -1) { - throw new Error('One or both items were not found in the array ' + array) - } - - expect(firstIndex).toBeLessThan(secondIndex) -} diff --git a/e2e/react-router/basic-scroll-restoration/tsconfig.json b/e2e/react-router/basic-scroll-restoration/tsconfig.json deleted file mode 100644 index 5db3b20eba..0000000000 --- a/e2e/react-router/basic-scroll-restoration/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-scroll-restoration/vite.config.js b/e2e/react-router/basic-scroll-restoration/vite.config.js deleted file mode 100644 index 2764078e8b..0000000000 --- a/e2e/react-router/basic-scroll-restoration/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), react()], -}) diff --git a/e2e/react-router/basic-virtual-file-based/.devcontainer/devcontainer.json b/e2e/react-router/basic-virtual-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-virtual-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-virtual-file-based/.gitignore b/e2e/react-router/basic-virtual-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/basic-virtual-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/basic-virtual-file-based/index.html b/e2e/react-router/basic-virtual-file-based/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic-virtual-file-based/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic-virtual-file-based/package.json b/e2e/react-router/basic-virtual-file-based/package.json deleted file mode 100644 index 0343de0846..0000000000 --- a/e2e/react-router/basic-virtual-file-based/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-virtual-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/virtual-file-routes": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic-virtual-file-based/playwright.config.ts b/e2e/react-router/basic-virtual-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/basic-virtual-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-virtual-file-based/routes.ts b/e2e/react-router/basic-virtual-file-based/routes.ts deleted file mode 100644 index 6c2c144ec5..0000000000 --- a/e2e/react-router/basic-virtual-file-based/routes.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - index, - layout, - physical, - rootRoute, - route, -} from '@tanstack/virtual-file-routes' - -export const routes = rootRoute('root.tsx', [ - index('home.tsx'), - route('/posts', 'posts/posts.tsx', [ - index('posts/posts-home.tsx'), - route('$postId', 'posts/posts-detail.tsx'), - ]), - layout('first', 'layout/first-layout.tsx', [ - layout('second', 'layout/second-layout.tsx', [ - route('/layout-a', 'a.tsx'), - route('/layout-b', 'b.tsx'), - ]), - ]), - physical('/classic', 'file-based-subtree'), -]) diff --git a/e2e/react-router/basic-virtual-file-based/src/main.tsx b/e2e/react-router/basic-virtual-file-based/src/main.tsx deleted file mode 100644 index 3dc73ddd51..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/main.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basic-virtual-file-based/src/posts.tsx b/e2e/react-router/basic-virtual-file-based/src/posts.tsx deleted file mode 100644 index cc3cb0f9c8..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/posts.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts b/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts deleted file mode 100644 index eb98ba28c5..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,317 +0,0 @@ -/* 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 homeRouteImport } from './routes/home' -import { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout' -import { Route as postsPostsRouteImport } from './routes/posts/posts' -import { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout' -import { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route' -import { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home' -import { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail' -import { Route as aRouteImport } from './routes/a' -import { Route as bRouteImport } from './routes/b' -import { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index' -import { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe' -import { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world' - -const homeRoute = homeRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({ - id: '/_first', - getParentRoute: () => rootRouteImport, -} as any) -const postsPostsRoute = postsPostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({ - id: '/_second', - getParentRoute: () => layoutFirstLayoutRoute, -} as any) -const ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({ - id: '/classic/hello', - path: '/classic/hello', - getParentRoute: () => rootRouteImport, -} as any) -const postsPostsHomeRoute = postsPostsHomeRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => postsPostsRoute, -} as any) -const postsPostsDetailRoute = postsPostsDetailRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => postsPostsRoute, -} as any) -const aRoute = aRouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => layoutSecondLayoutRoute, -} as any) -const bRoute = bRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => layoutSecondLayoutRoute, -} as any) -const ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => ClassicHelloRouteRoute, -} as any) -const ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({ - id: '/universe', - path: '/universe', - getParentRoute: () => ClassicHelloRouteRoute, -} as any) -const ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({ - id: '/world', - path: '/world', - getParentRoute: () => ClassicHelloRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof homeRoute - '/posts': typeof postsPostsRouteWithChildren - '/classic/hello': typeof ClassicHelloRouteRouteWithChildren - '/posts/': typeof postsPostsHomeRoute - '/posts/$postId': typeof postsPostsDetailRoute - '/layout-a': typeof aRoute - '/layout-b': typeof bRoute - '/classic/hello/universe': typeof ClassicHelloUniverseRoute - '/classic/hello/world': typeof ClassicHelloWorldRoute - '/classic/hello/': typeof ClassicHelloIndexRoute -} -export interface FileRoutesByTo { - '/': typeof homeRoute - '/posts': typeof postsPostsHomeRoute - '/posts/$postId': typeof postsPostsDetailRoute - '/layout-a': typeof aRoute - '/layout-b': typeof bRoute - '/classic/hello/universe': typeof ClassicHelloUniverseRoute - '/classic/hello/world': typeof ClassicHelloWorldRoute - '/classic/hello': typeof ClassicHelloIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof homeRoute - '/_first': typeof layoutFirstLayoutRouteWithChildren - '/posts': typeof postsPostsRouteWithChildren - '/classic/hello': typeof ClassicHelloRouteRouteWithChildren - '/posts/': typeof postsPostsHomeRoute - '/_first/_second': typeof layoutSecondLayoutRouteWithChildren - '/posts/$postId': typeof postsPostsDetailRoute - '/_first/_second/layout-a': typeof aRoute - '/_first/_second/layout-b': typeof bRoute - '/classic/hello/universe': typeof ClassicHelloUniverseRoute - '/classic/hello/world': typeof ClassicHelloWorldRoute - '/classic/hello/': typeof ClassicHelloIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/classic/hello' - | '/posts/' - | '/posts/$postId' - | '/layout-a' - | '/layout-b' - | '/classic/hello/universe' - | '/classic/hello/world' - | '/classic/hello/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/posts' - | '/posts/$postId' - | '/layout-a' - | '/layout-b' - | '/classic/hello/universe' - | '/classic/hello/world' - | '/classic/hello' - id: - | '__root__' - | '/' - | '/_first' - | '/posts' - | '/classic/hello' - | '/posts/' - | '/_first/_second' - | '/posts/$postId' - | '/_first/_second/layout-a' - | '/_first/_second/layout-b' - | '/classic/hello/universe' - | '/classic/hello/world' - | '/classic/hello/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - homeRoute: typeof homeRoute - layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren - postsPostsRoute: typeof postsPostsRouteWithChildren - ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof homeRouteImport - parentRoute: typeof rootRouteImport - } - '/_first': { - id: '/_first' - path: '' - fullPath: '/' - preLoaderRoute: typeof layoutFirstLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof postsPostsRouteImport - parentRoute: typeof rootRouteImport - } - '/_first/_second': { - id: '/_first/_second' - path: '' - fullPath: '/' - preLoaderRoute: typeof layoutSecondLayoutRouteImport - parentRoute: typeof layoutFirstLayoutRoute - } - '/classic/hello': { - id: '/classic/hello' - path: '/classic/hello' - fullPath: '/classic/hello' - preLoaderRoute: typeof ClassicHelloRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof postsPostsHomeRouteImport - parentRoute: typeof postsPostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof postsPostsDetailRouteImport - parentRoute: typeof postsPostsRoute - } - '/_first/_second/layout-a': { - id: '/_first/_second/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof aRouteImport - parentRoute: typeof layoutSecondLayoutRoute - } - '/_first/_second/layout-b': { - id: '/_first/_second/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof bRouteImport - parentRoute: typeof layoutSecondLayoutRoute - } - '/classic/hello/': { - id: '/classic/hello/' - path: '/' - fullPath: '/classic/hello/' - preLoaderRoute: typeof ClassicHelloIndexRouteImport - parentRoute: typeof ClassicHelloRouteRoute - } - '/classic/hello/universe': { - id: '/classic/hello/universe' - path: '/universe' - fullPath: '/classic/hello/universe' - preLoaderRoute: typeof ClassicHelloUniverseRouteImport - parentRoute: typeof ClassicHelloRouteRoute - } - '/classic/hello/world': { - id: '/classic/hello/world' - path: '/world' - fullPath: '/classic/hello/world' - preLoaderRoute: typeof ClassicHelloWorldRouteImport - parentRoute: typeof ClassicHelloRouteRoute - } - } -} - -interface layoutSecondLayoutRouteChildren { - aRoute: typeof aRoute - bRoute: typeof bRoute -} - -const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = { - aRoute: aRoute, - bRoute: bRoute, -} - -const layoutSecondLayoutRouteWithChildren = - layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren) - -interface layoutFirstLayoutRouteChildren { - layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren -} - -const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = { - layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren, -} - -const layoutFirstLayoutRouteWithChildren = - layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren) - -interface postsPostsRouteChildren { - postsPostsHomeRoute: typeof postsPostsHomeRoute - postsPostsDetailRoute: typeof postsPostsDetailRoute -} - -const postsPostsRouteChildren: postsPostsRouteChildren = { - postsPostsHomeRoute: postsPostsHomeRoute, - postsPostsDetailRoute: postsPostsDetailRoute, -} - -const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren( - postsPostsRouteChildren, -) - -interface ClassicHelloRouteRouteChildren { - ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute - ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute - ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute -} - -const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = { - ClassicHelloUniverseRoute: ClassicHelloUniverseRoute, - ClassicHelloWorldRoute: ClassicHelloWorldRoute, - ClassicHelloIndexRoute: ClassicHelloIndexRoute, -} - -const ClassicHelloRouteRouteWithChildren = - ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - homeRoute: homeRoute, - layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren, - postsPostsRoute: postsPostsRouteWithChildren, - ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/a.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/a.tsx deleted file mode 100644 index b36784f0de..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_first/_second/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/b.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/b.tsx deleted file mode 100644 index eb440b9eb3..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_first/_second/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx deleted file mode 100644 index 0cc76f4a69..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/')({ - component: () =>
This is the index
, -}) diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx deleted file mode 100644 index 566efc8777..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/classic/hello')({ - component: () => ( -
- Hello! -
{' '} - - say hello to the universe - {' '} - - say hello to the world - - -
- ), -}) diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx deleted file mode 100644 index 5aaa7d4fa0..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/universe')({ - component: () =>
Hello /classic/hello/universe!
, -}) diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx deleted file mode 100644 index 790d33a838..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/world')({ - component: () =>
Hello /classic/hello/world!
, -}) diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/home.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/home.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/home.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx deleted file mode 100644 index d39e206f2d..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_first')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx deleted file mode 100644 index ef178a6e16..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_first/_second')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx deleted file mode 100644 index 948d52d6d6..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from 'react' -import { ErrorComponent, createFileRoute } from '@tanstack/react-router' -import { fetchPost } from '../../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts.tsx deleted file mode 100644 index a2ab1ee388..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/posts/posts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -import { fetchPosts } from '../../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/routes/root.tsx b/e2e/react-router/basic-virtual-file-based/src/routes/root.tsx deleted file mode 100644 index 9589d8dbc5..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/routes/root.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Subtree - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/basic-virtual-file-based/src/styles.css b/e2e/react-router/basic-virtual-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-virtual-file-based/src/vite-env.d.ts b/e2e/react-router/basic-virtual-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-virtual-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-virtual-file-based/tests/app.spec.ts b/e2e/react-router/basic-virtual-file-based/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/react-router/basic-virtual-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/basic-virtual-file-based/tsconfig.json b/e2e/react-router/basic-virtual-file-based/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basic-virtual-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-virtual-file-based/vite.config.ts b/e2e/react-router/basic-virtual-file-based/vite.config.ts deleted file mode 100644 index f1b329aa29..0000000000 --- a/e2e/react-router/basic-virtual-file-based/vite.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { routes } from './routes' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - virtualRouteConfig: routes, - }), - react(), - ], -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json b/e2e/react-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/.gitignore b/e2e/react-router/basic-virtual-named-export-config-file-based/.gitignore deleted file mode 100644 index 47bb41d43a..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ - -src/routeTree.gen.ts \ No newline at end of file diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/index.html b/e2e/react-router/basic-virtual-named-export-config-file-based/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/package.json b/e2e/react-router/basic-virtual-named-export-config-file-based/package.json deleted file mode 100644 index 6bdb1248f6..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic-virtual-named-export-config-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/virtual-file-routes": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/playwright.config.ts b/e2e/react-router/basic-virtual-named-export-config-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/routes.ts b/e2e/react-router/basic-virtual-named-export-config-file-based/routes.ts deleted file mode 100644 index 6c2c144ec5..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/routes.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - index, - layout, - physical, - rootRoute, - route, -} from '@tanstack/virtual-file-routes' - -export const routes = rootRoute('root.tsx', [ - index('home.tsx'), - route('/posts', 'posts/posts.tsx', [ - index('posts/posts-home.tsx'), - route('$postId', 'posts/posts-detail.tsx'), - ]), - layout('first', 'layout/first-layout.tsx', [ - layout('second', 'layout/second-layout.tsx', [ - route('/layout-a', 'a.tsx'), - route('/layout-b', 'b.tsx'), - ]), - ]), - physical('/classic', 'file-based-subtree'), -]) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/main.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/main.tsx deleted file mode 100644 index 3dc73ddd51..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/main.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/posts.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/posts.tsx deleted file mode 100644 index 97c96d77eb..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx deleted file mode 100644 index b36784f0de..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_first/_second/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx deleted file mode 100644 index eb440b9eb3..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_first/_second/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx deleted file mode 100644 index 0cc76f4a69..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/')({ - component: () =>
This is the index
, -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx deleted file mode 100644 index 566efc8777..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/classic/hello')({ - component: () => ( -
- Hello! -
{' '} - - say hello to the universe - {' '} - - say hello to the world - - -
- ), -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx deleted file mode 100644 index 5aaa7d4fa0..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/universe')({ - component: () =>
Hello /classic/hello/universe!
, -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx deleted file mode 100644 index 790d33a838..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/world')({ - component: () =>
Hello /classic/hello/world!
, -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx deleted file mode 100644 index d39e206f2d..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_first')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx deleted file mode 100644 index ef178a6e16..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/_first/_second')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx deleted file mode 100644 index 948d52d6d6..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import * as React from 'react' -import { ErrorComponent, createFileRoute } from '@tanstack/react-router' -import { fetchPost } from '../../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx deleted file mode 100644 index a2ab1ee388..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' -import { fetchPosts } from '../../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx b/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx deleted file mode 100644 index 9589d8dbc5..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Subtree - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/styles.css b/e2e/react-router/basic-virtual-named-export-config-file-based/src/styles.css deleted file mode 100644 index 0bd1287c82..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss' source('../'); - -@source './**/*.{js,jsx,ts,tsx}'; - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/src/vite-env.d.ts b/e2e/react-router/basic-virtual-named-export-config-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts b/e2e/react-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts deleted file mode 100644 index 7d2074182f..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.waitForURL('/') - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.waitForURL('/') - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.waitForURL('/') - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/tsconfig.json b/e2e/react-router/basic-virtual-named-export-config-file-based/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic-virtual-named-export-config-file-based/vite.config.ts b/e2e/react-router/basic-virtual-named-export-config-file-based/vite.config.ts deleted file mode 100644 index dd4f00f500..0000000000 --- a/e2e/react-router/basic-virtual-named-export-config-file-based/vite.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - virtualRouteConfig: './routes.ts', - }), - react(), - ], -}) diff --git a/e2e/react-router/basic/.devcontainer/devcontainer.json b/e2e/react-router/basic/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/basic/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/basic/.gitignore b/e2e/react-router/basic/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/react-router/basic/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/react-router/basic/index.html b/e2e/react-router/basic/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/basic/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/basic/package.json b/e2e/react-router/basic/package.json deleted file mode 100644 index 4ff68f5cda..0000000000 --- a/e2e/react-router/basic/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-basic", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "catalog:" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/basic/playwright.config.ts b/e2e/react-router/basic/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/basic/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/basic/src/main.tsx b/e2e/react-router/basic/src/main.tsx deleted file mode 100644 index 49fa054776..0000000000 --- a/e2e/react-router/basic/src/main.tsx +++ /dev/null @@ -1,512 +0,0 @@ -import { useState } from 'react' -import { createPortal } from 'react-dom' -import ReactDOM from 'react-dom/client' -import { - ErrorComponent, - Link, - Outlet, - RouterProvider, - createRootRoute, - createRoute, - createRouter, - redirect, -} from '@tanstack/react-router' -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 ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - const { devtools } = rootRoute.useSearch() - - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - View Transition - {' '} - - View Transition types - {' '} - - Layout - {' '} - - This Route Does Not Exist - {' '} -
- - Link in SVG - - - - -
-
- 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: '/', - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
-

Welcome Home!

-
- ) -} - -export const postsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'posts', - loader: () => fetchPosts(), -}).lazy(() => import('./posts.lazy').then((d) => d.Route)) - -const postsIndexRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '/', - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} - -const postRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '$postId', - errorComponent: PostErrorComponent, - loader: ({ params }) => fetchPost(params.postId), - component: PostComponent, -}) - -function PostErrorComponent({ error }: ErrorComponentProps) { - if (error instanceof NotFoundError) { - return
{error.message}
- } - - return -} - -function PostComponent() { - const post = postRoute.useLoaderData() - - return ( -
-

{post.title}

-
-
{post.body}
-
- ) -} - -const layoutRoute = createRoute({ - getParentRoute: () => rootRoute, - id: '_layout', - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} - -const layout2Route = createRoute({ - getParentRoute: () => layoutRoute, - id: '_layout-2', - component: Layout2Component, -}) - -function Layout2Component() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} - -const layoutARoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-a', - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} - -const layoutBRoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-b', - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} - -const paramsPsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/params-ps', -}) - -const paramsPsIndexRoute = createRoute({ - getParentRoute: () => paramsPsRoute, - path: '/', - component: function ParamsIndex() { - return ( -
-

Named path params

-
    -
  • - - /params-ps/named/$foo - -
  • -
  • - - /params-ps/named/{'prefix{$foo}'} - -
  • -
  • - - /params-ps/named/{'{$foo}suffix'} - -
  • -
-
-

Wildcard path params

-
    -
  • - - /params-ps/wildcard/$ - -
  • -
  • - - /params-ps/wildcard/{'prefix{$}'} - -
  • -
  • - - /params-ps/wildcard/{'{$}suffix'} - -
  • -
-
- ) - }, -}) - -const paramsPsNamedRoute = createRoute({ - getParentRoute: () => paramsPsRoute, - path: '/named', -}) - -const paramsPsNamedIndexRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/', - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) - -const paramsPsNamedFooRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/$foo', - component: function ParamsNamedFoo() { - const p = paramsPsNamedFooRoute.useParams() - return ( -
-

ParamsNamedFoo

-
{JSON.stringify(p)}
-
- ) - }, -}) - -const paramsPsNamedFooPrefixRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/prefix{$foo}', - component: function ParamsNamedFooMarkdown() { - const p = paramsPsNamedFooPrefixRoute.useParams() - return ( -
-

ParamsNamedFooPrefix

-
{JSON.stringify(p)}
-
- ) - }, -}) - -const paramsPsNamedFooSuffixRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/{$foo}suffix', - component: function ParamsNamedFooSuffix() { - const p = paramsPsNamedFooSuffixRoute.useParams() - return ( -
-

ParamsNamedFooSuffix

-
{JSON.stringify(p)}
-
- ) - }, -}) - -const paramsPsWildcardRoute = createRoute({ - getParentRoute: () => paramsPsRoute, - path: '/wildcard', -}) - -const paramsPsWildcardIndexRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: '/', - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) - -const paramsPsWildcardSplatRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: '$', - component: function ParamsWildcardSplat() { - const p = paramsPsWildcardSplatRoute.useParams() - return ( -
-

ParamsWildcardSplat

-
{JSON.stringify(p)}
-
- ) - }, -}) - -const paramsPsWildcardSplatPrefixRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: 'prefix{$}', - component: function ParamsWildcardSplatPrefix() { - const p = paramsPsWildcardSplatPrefixRoute.useParams() - return ( -
-

ParamsWildcardSplatPrefix

-
{JSON.stringify(p)}
-
- ) - }, -}) - -const paramsPsWildcardSplatSuffixRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: '{$}suffix', - component: function ParamsWildcardSplatSuffix() { - const p = paramsPsWildcardSplatSuffixRoute.useParams() - return ( -
-

ParamsWildcardSplatSuffix

-
{JSON.stringify(p)}
-
- ) - }, -}) - -const routeTree = rootRoute.addChildren([ - postsRoute.addChildren([postRoute, postsIndexRoute]), - layoutRoute.addChildren([ - layout2Route.addChildren([layoutARoute, layoutBRoute]), - ]), - paramsPsRoute.addChildren([ - paramsPsNamedRoute.addChildren([ - paramsPsNamedFooPrefixRoute, - paramsPsNamedFooSuffixRoute, - paramsPsNamedFooRoute, - paramsPsNamedIndexRoute, - ]), - paramsPsWildcardRoute.addChildren([ - paramsPsWildcardSplatRoute, - paramsPsWildcardSplatPrefixRoute, - paramsPsWildcardSplatSuffixRoute, - paramsPsWildcardIndexRoute, - ]), - paramsPsIndexRoute, - ]), - indexRoute, -]) - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - - root.render() -} diff --git a/e2e/react-router/basic/src/posts.lazy.tsx b/e2e/react-router/basic/src/posts.lazy.tsx deleted file mode 100644 index dd17e6b7db..0000000000 --- a/e2e/react-router/basic/src/posts.lazy.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createLazyRoute } from '@tanstack/react-router' - -export const Route = createLazyRoute('/posts')({ - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
- -
- ) -} diff --git a/e2e/react-router/basic/src/posts.ts b/e2e/react-router/basic/src/posts.ts deleted file mode 100644 index f72d16fee3..0000000000 --- a/e2e/react-router/basic/src/posts.ts +++ /dev/null @@ -1,32 +0,0 @@ -import axios from 'redaxios' - -export class NotFoundError extends Error {} - -type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} diff --git a/e2e/react-router/basic/src/styles.css b/e2e/react-router/basic/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/basic/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/basic/src/vite-env.d.ts b/e2e/react-router/basic/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/basic/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/basic/tests/app.spec.ts b/e2e/react-router/basic/tests/app.spec.ts deleted file mode 100644 index 9c0a6b6901..0000000000 --- a/e2e/react-router/basic/tests/app.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Navigating to a post page with viewTransition', async ({ page }) => { - await page.getByRole('link', { name: 'View Transition', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating to a post page with viewTransition types', async ({ - page, -}) => { - await page.getByRole('link', { name: 'View Transition types' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Link in SVG does not trigger a full page reload', async ({ page }) => { - let fullPageLoad = false - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - - await page.getByRole('link', { name: 'Open posts from SVG' }).click() - const url = `http://localhost:${PORT}/posts` - await page.waitForURL(url) - - expect(fullPageLoad).toBeFalsy() -}) diff --git a/e2e/react-router/basic/tests/devtools.spec.ts b/e2e/react-router/basic/tests/devtools.spec.ts deleted file mode 100644 index b8a7e803e6..0000000000 --- a/e2e/react-router/basic/tests/devtools.spec.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' - -for (const mode of ['panel', 'shadow', 'floating']) { - test(`devtools preserve typography and explorer indentation in ${mode} mode`, async ({ - page, - }) => { - await page.goto(mode === 'floating' ? '/' : `/?devtools=${mode}`) - if (mode === 'floating') { - await page - .getByRole('button', { name: 'Open TanStack Router Devtools' }) - .click() - } - - const panel = page.locator('.TanStackRouterDevtoolsPanel') - const router = panel.getByRole('button', { name: /^Router\s*\d+ items/ }) - const state = panel.getByRole('button', { name: /^state\s*\d+ items/ }) - await expect(router).toBeVisible() - await expect(state).toBeVisible() - await expect(router).toHaveCSS('font-size', '12px') - await expect(router).toHaveCSS('gap', '4px') - await expect( - panel.getByText('Pathname', { exact: true }).locator('..'), - ).toHaveCSS('padding-left', '8px') - - const routerBox = await router.boundingBox() - const stateBox = await state.boundingBox() - expect(stateBox!.x - routerBox!.x).toBe(18) - - if (mode !== 'floating') { - await page.addStyleTag({ content: ':root { font-size: 20px; }' }) - await expect(router).toHaveCSS('font-size', '15px') - await expect(router).toHaveCSS('gap', '5px') - - await page.addStyleTag({ - content: ':root { --tsrd-font-size: 24px; }', - }) - await expect(router).toHaveCSS('font-size', '18px') - await expect(router).toHaveCSS('gap', '6px') - } - }) -} diff --git a/e2e/react-router/basic/tests/params.spec.ts b/e2e/react-router/basic/tests/params.spec.ts deleted file mode 100644 index f673138047..0000000000 --- a/e2e/react-router/basic/tests/params.spec.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.describe('params operations + prefix/suffix', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps') - }) - - test.describe('named params', () => { - const NAMED_PARAMS_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-named-foo', - pathname: '/params-ps/named/foo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFoo', - }, - { - id: 'l-to-named-prefixfoo', - pathname: '/params-ps/named/prefixfoo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooPrefix', - }, - { - id: 'l-to-named-foosuffix', - pathname: '/params-ps/named/foosuffix', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooSuffix', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - }) - - test.describe('wildcard param', () => { - const WILDCARD_PARAM_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-wildcard-foo', - pathname: '/params-ps/wildcard/foo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplat', - }, - { - id: 'l-to-wildcard-prefixfoo', - pathname: '/params-ps/wildcard/prefixfoo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatPrefix', - }, - { - id: 'l-to-wildcard-foosuffix', - pathname: '/params-ps/wildcard/foosuffix', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatSuffix', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - }) -}) diff --git a/e2e/react-router/basic/tsconfig.json b/e2e/react-router/basic/tsconfig.json deleted file mode 100644 index 4f6089bc08..0000000000 --- a/e2e/react-router/basic/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/basic/vite.config.js b/e2e/react-router/basic/vite.config.js deleted file mode 100644 index 2764078e8b..0000000000 --- a/e2e/react-router/basic/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), react()], -}) diff --git a/e2e/react-router/escaped-special-strings/.devcontainer/devcontainer.json b/e2e/react-router/escaped-special-strings/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/escaped-special-strings/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/escaped-special-strings/.gitignore b/e2e/react-router/escaped-special-strings/.gitignore deleted file mode 100644 index 628d6fcc29..0000000000 --- a/e2e/react-router/escaped-special-strings/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -dist -port*.txt -test-results -playwright-report diff --git a/e2e/react-router/escaped-special-strings/index.html b/e2e/react-router/escaped-special-strings/index.html deleted file mode 100644 index dfa141d52a..0000000000 --- a/e2e/react-router/escaped-special-strings/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Escaped Special Strings E2E Test - - -
- - - diff --git a/e2e/react-router/escaped-special-strings/package.json b/e2e/react-router/escaped-special-strings/package.json deleted file mode 100644 index af401c49d3..0000000000 --- a/e2e/react-router/escaped-special-strings/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-escaped-special-strings", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "pnpm run test:e2e:default", - "test:e2e:default": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/escaped-special-strings/playwright.config.ts b/e2e/react-router/escaped-special-strings/playwright.config.ts deleted file mode 100644 index 629ddefccf..0000000000 --- a/e2e/react-router/escaped-special-strings/playwright.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -const command = `pnpm build && pnpm preview --port ${PORT}` - -console.info('Running with mode: ', process.env.MODE || 'default') - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - MODE: process.env.MODE || '', - VITE_MODE: process.env.MODE || '', - PORT: String(PORT), - }, - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/escaped-special-strings/src/main.tsx b/e2e/react-router/escaped-special-strings/src/main.tsx deleted file mode 100644 index 489ebafacf..0000000000 --- a/e2e/react-router/escaped-special-strings/src/main.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts b/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts deleted file mode 100644 index 50a5f8b305..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routeTree.gen.ts +++ /dev/null @@ -1,149 +0,0 @@ -/* 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 Char91indexChar93RouteImport } from './routes/[index]' -import { Route as IndexRouteImport } from './routes/index' -import { Route as LayoutRouteImport } from './routes/[_]layout' -import { Route as BlogRouteImport } from './routes/blog[_]' -import { Route as Char91lazyChar93RouteImport } from './routes/[lazy]' -import { Route as Char91routeChar93RouteImport } from './routes/[route]' - -const Char91indexChar93Route = Char91indexChar93RouteImport.update({ - id: '/index', - path: '/index', - getParentRoute: () => rootRouteImport, -} as any) -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - path: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const BlogRoute = BlogRouteImport.update({ - id: '/blog_', - path: '/blog_', - getParentRoute: () => rootRouteImport, -} as any) -const Char91lazyChar93Route = Char91lazyChar93RouteImport.update({ - id: '/lazy', - path: '/lazy', - getParentRoute: () => rootRouteImport, -} as any) -const Char91routeChar93Route = Char91routeChar93RouteImport.update({ - id: '/route', - path: '/route', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/_layout': typeof LayoutRoute - '/blog_': typeof BlogRoute - '/index': typeof Char91indexChar93Route - '/lazy': typeof Char91lazyChar93Route - '/route': typeof Char91routeChar93Route -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/_layout': typeof LayoutRoute - '/blog_': typeof BlogRoute - '/index': typeof Char91indexChar93Route - '/lazy': typeof Char91lazyChar93Route - '/route': typeof Char91routeChar93Route -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRoute - '/blog_': typeof BlogRoute - '/index': typeof Char91indexChar93Route - '/lazy': typeof Char91lazyChar93Route - '/route': typeof Char91routeChar93Route -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/_layout' | '/blog_' | '/index' | '/lazy' | '/route' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/_layout' | '/blog_' | '/index' | '/lazy' | '/route' - id: '__root__' | '/' | '/_layout' | '/blog_' | '/index' | '/lazy' | '/route' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRoute - BlogRoute: typeof BlogRoute - Char91indexChar93Route: typeof Char91indexChar93Route - Char91lazyChar93Route: typeof Char91lazyChar93Route - Char91routeChar93Route: typeof Char91routeChar93Route -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/index': { - id: '/index' - path: '/index' - fullPath: '/index' - preLoaderRoute: typeof Char91indexChar93RouteImport - parentRoute: typeof rootRouteImport - } - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '/_layout' - fullPath: '/_layout' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/blog_': { - id: '/blog_' - path: '/blog_' - fullPath: '/blog_' - preLoaderRoute: typeof BlogRouteImport - parentRoute: typeof rootRouteImport - } - '/lazy': { - id: '/lazy' - path: '/lazy' - fullPath: '/lazy' - preLoaderRoute: typeof Char91lazyChar93RouteImport - parentRoute: typeof rootRouteImport - } - '/route': { - id: '/route' - path: '/route' - fullPath: '/route' - preLoaderRoute: typeof Char91routeChar93RouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRoute, - BlogRoute: BlogRoute, - Char91indexChar93Route: Char91indexChar93Route, - Char91lazyChar93Route: Char91lazyChar93Route, - Char91routeChar93Route: Char91routeChar93Route, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/escaped-special-strings/src/routes/[_]layout.tsx b/e2e/react-router/escaped-special-strings/src/routes/[_]layout.tsx deleted file mode 100644 index 84e2826881..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/[_]layout.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// This file uses [_]layout escaping to create a literal /_layout path -// instead of being treated as a pathless layout route -export const Route = createFileRoute('/_layout')({ - component: EscapedUnderscoreLayoutComponent, -}) - -function EscapedUnderscoreLayoutComponent() { - return ( -
-

Escaped Underscore Layout Page

-

/_layout

-

- This route was created using [_]layout.tsx to escape the leading - underscore. It renders at the literal path /_layout instead of being a - pathless layout. -

-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/src/routes/[index].tsx b/e2e/react-router/escaped-special-strings/src/routes/[index].tsx deleted file mode 100644 index 64076bb343..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/[index].tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// This file uses [index] escaping to create a literal /index route -// instead of being treated as an index route for the parent -export const Route = createFileRoute('/index')({ - component: EscapedIndexComponent, -}) - -function EscapedIndexComponent() { - return ( -
-

Escaped Index Page

-

/index

-

- This route was created using [index].tsx to escape the special "index" - token. It renders at the literal path /index instead of being the index - route. -

-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/src/routes/[lazy].tsx b/e2e/react-router/escaped-special-strings/src/routes/[lazy].tsx deleted file mode 100644 index 486244c2ad..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/[lazy].tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// This file uses [lazy] escaping to create a literal /lazy path -// instead of being treated as a lazy-loaded route -export const Route = createFileRoute('/lazy')({ - component: EscapedLazyComponent, -}) - -function EscapedLazyComponent() { - return ( -
-

Escaped Lazy Page

-

/lazy

-

- This route was created using [lazy].tsx to escape the special "lazy" - token. It renders at the literal path /lazy instead of being a - lazy-loaded route. -

-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/src/routes/[route].tsx b/e2e/react-router/escaped-special-strings/src/routes/[route].tsx deleted file mode 100644 index f9e28fd87e..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/[route].tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// This file uses [route] escaping to create a literal /route path -// instead of being treated as a layout configuration file -export const Route = createFileRoute('/route')({ - component: EscapedRouteComponent, -}) - -function EscapedRouteComponent() { - return ( -
-

Escaped Route Page

-

/route

-

- This route was created using [route].tsx to escape the special "route" - token. It renders at the literal path /route instead of being a layout - configuration. -

-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/src/routes/__root.tsx b/e2e/react-router/escaped-special-strings/src/routes/__root.tsx deleted file mode 100644 index a3e7356c71..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/__root.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

Page not found

- Go to /index -
- ) - }, -}) - -function RootComponent() { - return ( -
-

Escaped Special Strings Test

- -
- -
-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/src/routes/blog[_].tsx b/e2e/react-router/escaped-special-strings/src/routes/blog[_].tsx deleted file mode 100644 index d3cbdf9d8c..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/blog[_].tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// This file uses blog[_] escaping to create a literal /blog_ path -// with the trailing underscore preserved in the URL -export const Route = createFileRoute('/blog_')({ - component: EscapedBlogUnderscoreComponent, -}) - -function EscapedBlogUnderscoreComponent() { - return ( -
-

Escaped Blog Underscore Page

-

/blog_

-

- This route was created using blog[_].tsx to escape the trailing - underscore. It renders at the literal path /blog_ with the underscore - preserved in the URL. -

-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/src/routes/index.tsx b/e2e/react-router/escaped-special-strings/src/routes/index.tsx deleted file mode 100644 index df68429b44..0000000000 --- a/e2e/react-router/escaped-special-strings/src/routes/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -// This is the standard index route for the root path / -// It coexists with [index].tsx which creates a literal /index route -export const Route = createFileRoute('/')({ - component: HomeComponent, -}) - -function HomeComponent() { - return ( -
-

Home Page

-

/

-

- This is the home/index route at /. It coexists with the escaped [index] - route at /index. -

-
- ) -} diff --git a/e2e/react-router/escaped-special-strings/tests/escaped-routes.spec.ts b/e2e/react-router/escaped-special-strings/tests/escaped-routes.spec.ts deleted file mode 100644 index 8aa6d91f82..0000000000 --- a/e2e/react-router/escaped-special-strings/tests/escaped-routes.spec.ts +++ /dev/null @@ -1,142 +0,0 @@ -import { expect, test } from '@playwright/test' - -test.describe('Escaped special strings routing', () => { - test('home index route renders at / path', async ({ page }) => { - await page.goto('/') - - await expect(page.getByTestId('page-title')).toContainText('Home Page') - await expect(page.getByTestId('page-path')).toContainText('/') - await expect(page.getByTestId('page-description')).toContainText( - 'home/index route at /', - ) - }) - - test('escaped [index] route renders at /index path', async ({ page }) => { - await page.goto('/index') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Index Page', - ) - await expect(page.getByTestId('page-path')).toContainText('/index') - await expect(page.getByTestId('page-description')).toContainText( - 'escape the special "index" token', - ) - }) - - test('escaped [route] route renders at /route path', async ({ page }) => { - await page.goto('/route') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Route Page', - ) - await expect(page.getByTestId('page-path')).toContainText('/route') - await expect(page.getByTestId('page-description')).toContainText( - 'escape the special "route" token', - ) - }) - - test('escaped [lazy] route renders at /lazy path', async ({ page }) => { - await page.goto('/lazy') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Lazy Page', - ) - await expect(page.getByTestId('page-path')).toContainText('/lazy') - await expect(page.getByTestId('page-description')).toContainText( - 'escape the special "lazy" token', - ) - }) - - test('escaped [_]layout route renders at /_layout path', async ({ page }) => { - await page.goto('/_layout') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Underscore Layout Page', - ) - await expect(page.getByTestId('page-path')).toContainText('/_layout') - await expect(page.getByTestId('page-description')).toContainText( - 'escape the leading underscore', - ) - }) - - test('escaped blog[_] route renders at /blog_ path', async ({ page }) => { - await page.goto('/blog_') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Blog Underscore Page', - ) - await expect(page.getByTestId('page-path')).toContainText('/blog_') - await expect(page.getByTestId('page-description')).toContainText( - 'escape the trailing underscore', - ) - }) - - test('client-side navigation to home / route', async ({ page }) => { - await page.goto('/index') - await page.getByTestId('link-home').click() - await page.waitForURL('/') - - await expect(page.getByTestId('page-title')).toContainText('Home Page') - }) - - test('client-side navigation to escaped /index route', async ({ page }) => { - await page.goto('/route') - await page.getByTestId('link-index').click() - await page.waitForURL('/index') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Index Page', - ) - }) - - test('client-side navigation to escaped /route route', async ({ page }) => { - await page.goto('/index') - await page.getByTestId('link-route').click() - await page.waitForURL('/route') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Route Page', - ) - }) - - test('client-side navigation to escaped /lazy route', async ({ page }) => { - await page.goto('/index') - await page.getByTestId('link-lazy').click() - await page.waitForURL('/lazy') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Lazy Page', - ) - }) - - test('client-side navigation to escaped /_layout route', async ({ page }) => { - await page.goto('/index') - await page.getByTestId('link-underscore-layout').click() - await page.waitForURL('/_layout') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Underscore Layout Page', - ) - }) - - test('client-side navigation to escaped /blog_ route', async ({ page }) => { - await page.goto('/index') - await page.getByTestId('link-blog-underscore').click() - await page.waitForURL('/blog_') - - await expect(page.getByTestId('page-title')).toContainText( - 'Escaped Blog Underscore Page', - ) - }) - - test('URL is correct for escaped routes with underscores', async ({ - page, - baseURL, - }) => { - await page.goto('/_layout') - expect(page.url()).toBe(`${baseURL}/_layout`) - - await page.goto('/blog_') - expect(page.url()).toBe(`${baseURL}/blog_`) - }) -}) diff --git a/e2e/react-router/escaped-special-strings/tsconfig.json b/e2e/react-router/escaped-special-strings/tsconfig.json deleted file mode 100644 index 82cf0bcd2c..0000000000 --- a/e2e/react-router/escaped-special-strings/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/escaped-special-strings/vite.config.js b/e2e/react-router/escaped-special-strings/vite.config.js deleted file mode 100644 index 940c8aa236..0000000000 --- a/e2e/react-router/escaped-special-strings/vite.config.js +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tanstackRouter({ - target: 'react', - }), - react(), - ], -}) diff --git a/e2e/react-router/generator-cli-only/.devcontainer/devcontainer.json b/e2e/react-router/generator-cli-only/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/generator-cli-only/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/generator-cli-only/.gitignore b/e2e/react-router/generator-cli-only/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/react-router/generator-cli-only/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/react-router/generator-cli-only/index.html b/e2e/react-router/generator-cli-only/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/generator-cli-only/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/generator-cli-only/package.json b/e2e/react-router/generator-cli-only/package.json deleted file mode 100644 index 159ba05500..0000000000 --- a/e2e/react-router/generator-cli-only/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-generator-cli-only", - "private": true, - "type": "module", - "scripts": { - "dev": "tsr generate && vite --port 3000", - "dev:e2e": "tsr generate && vite", - "build": "tsr generate && vite build && tsc --noEmit", - "preview": "vite preview", - "start": "tsr generate && vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-cli": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/generator-cli-only/playwright.config.ts b/e2e/react-router/generator-cli-only/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/generator-cli-only/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/generator-cli-only/src/main.tsx b/e2e/react-router/generator-cli-only/src/main.tsx deleted file mode 100644 index 41f4d64ec2..0000000000 --- a/e2e/react-router/generator-cli-only/src/main.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render( - - - , - ) -} diff --git a/e2e/react-router/generator-cli-only/src/posts.ts b/e2e/react-router/generator-cli-only/src/posts.ts deleted file mode 100644 index f72d16fee3..0000000000 --- a/e2e/react-router/generator-cli-only/src/posts.ts +++ /dev/null @@ -1,32 +0,0 @@ -import axios from 'redaxios' - -export class NotFoundError extends Error {} - -type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} diff --git a/e2e/react-router/generator-cli-only/src/routeTree.gen.ts b/e2e/react-router/generator-cli-only/src/routeTree.gen.ts deleted file mode 100644 index 9676858c7c..0000000000 --- a/e2e/react-router/generator-cli-only/src/routeTree.gen.ts +++ /dev/null @@ -1,230 +0,0 @@ -/* 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 PathlessLayoutRouteImport } from './routes/_pathlessLayout' -import { Route as PostsRouteRouteImport } from './routes/posts.route' -import { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a' -import { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PathlessLayoutRoute = PathlessLayoutRouteImport.update({ - id: '/_pathlessLayout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const PathlessLayoutNestedLayoutRoute = - PathlessLayoutNestedLayoutRouteImport.update({ - id: '/_nested-layout', - getParentRoute: () => PathlessLayoutRoute, - } as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRouteRoute, -} as any) -const PathlessLayoutNestedLayoutRouteARoute = - PathlessLayoutNestedLayoutRouteARouteImport.update({ - id: '/route-a', - path: '/route-a', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - } as any) -const PathlessLayoutNestedLayoutRouteBRoute = - PathlessLayoutNestedLayoutRouteBRouteImport.update({ - id: '/route-b', - path: '/route-b', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - } as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRouteRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute - '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute - '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/posts': typeof PostsRouteRouteWithChildren - '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren - '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute - '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/posts/$postId' - | '/posts/' - | '/route-a' - | '/route-b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b' - id: - | '__root__' - | '/' - | '/posts' - | '/_pathlessLayout' - | '/_pathlessLayout/_nested-layout' - | '/posts/$postId' - | '/posts/' - | '/_pathlessLayout/_nested-layout/route-a' - | '/_pathlessLayout/_nested-layout/route-b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PostsRouteRoute: typeof PostsRouteRouteWithChildren - PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_pathlessLayout': { - id: '/_pathlessLayout' - path: '' - fullPath: '/' - preLoaderRoute: typeof PathlessLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/_pathlessLayout/_nested-layout': { - id: '/_pathlessLayout/_nested-layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport - parentRoute: typeof PathlessLayoutRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRouteRoute - } - '/_pathlessLayout/_nested-layout/route-a': { - id: '/_pathlessLayout/_nested-layout/route-a' - path: '/route-a' - fullPath: '/route-a' - preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport - parentRoute: typeof PathlessLayoutNestedLayoutRoute - } - '/_pathlessLayout/_nested-layout/route-b': { - id: '/_pathlessLayout/_nested-layout/route-b' - path: '/route-b' - fullPath: '/route-b' - preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport - parentRoute: typeof PathlessLayoutNestedLayoutRoute - } - } -} - -interface PostsRouteRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteRouteChildren: PostsRouteRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -interface PathlessLayoutNestedLayoutRouteChildren { - PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute - PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute -} - -const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren = - { - PathlessLayoutNestedLayoutRouteARoute: - PathlessLayoutNestedLayoutRouteARoute, - PathlessLayoutNestedLayoutRouteBRoute: - PathlessLayoutNestedLayoutRouteBRoute, - } - -const PathlessLayoutNestedLayoutRouteWithChildren = - PathlessLayoutNestedLayoutRoute._addFileChildren( - PathlessLayoutNestedLayoutRouteChildren, - ) - -interface PathlessLayoutRouteChildren { - PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren -} - -const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = { - PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren, -} - -const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( - PathlessLayoutRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PostsRouteRoute: PostsRouteRouteWithChildren, - PathlessLayoutRoute: PathlessLayoutRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/generator-cli-only/src/routes/__root.tsx b/e2e/react-router/generator-cli-only/src/routes/__root.tsx deleted file mode 100644 index afe0580e37..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/__root.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Pathless Layout - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout.tsx b/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout.tsx deleted file mode 100644 index 1e1ef2ebe1..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_pathlessLayout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a pathless layout
-
- -
-
- ) -} diff --git a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx b/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx deleted file mode 100644 index 9c345694ab..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_pathlessLayout/_nested-layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested pathless layout
-
- - Go to route A - - - Go to route B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx b/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx deleted file mode 100644 index 6b59dbc46f..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')( - { - component: LayoutAComponent, - }, -) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx b/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx deleted file mode 100644 index 50f864f617..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')( - { - component: LayoutBComponent, - }, -) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/generator-cli-only/src/routes/index.tsx b/e2e/react-router/generator-cli-only/src/routes/index.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/generator-cli-only/src/routes/posts.$postId.tsx b/e2e/react-router/generator-cli-only/src/routes/posts.$postId.tsx deleted file mode 100644 index 956ca50ecd..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/generator-cli-only/src/routes/posts.index.tsx b/e2e/react-router/generator-cli-only/src/routes/posts.index.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/posts.index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/generator-cli-only/src/routes/posts.route.tsx b/e2e/react-router/generator-cli-only/src/routes/posts.route.tsx deleted file mode 100644 index ab5c2ac99f..0000000000 --- a/e2e/react-router/generator-cli-only/src/routes/posts.route.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsLayoutComponent, -}) - -function PostsLayoutComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/generator-cli-only/src/styles.css b/e2e/react-router/generator-cli-only/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/generator-cli-only/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/generator-cli-only/src/vite-env.d.ts b/e2e/react-router/generator-cli-only/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/generator-cli-only/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/generator-cli-only/tests/app.spec.ts b/e2e/react-router/generator-cli-only/tests/app.spec.ts deleted file mode 100644 index ced5ac9310..0000000000 --- a/e2e/react-router/generator-cli-only/tests/app.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested pathless layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a pathless layout") - await expect(page.locator('#app')).toContainText( - "I'm a nested pathless layout", - ) - - await page.getByRole('link', { name: 'Go to route A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Go to route B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/generator-cli-only/tsconfig.json b/e2e/react-router/generator-cli-only/tsconfig.json deleted file mode 100644 index 4f6089bc08..0000000000 --- a/e2e/react-router/generator-cli-only/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/generator-cli-only/vite.config.js b/e2e/react-router/generator-cli-only/vite.config.js deleted file mode 100644 index 2764078e8b..0000000000 --- a/e2e/react-router/generator-cli-only/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), react()], -}) diff --git a/e2e/react-router/i18n-paraglide/.devcontainer/devcontainer.json b/e2e/react-router/i18n-paraglide/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/i18n-paraglide/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/i18n-paraglide/.gitignore b/e2e/react-router/i18n-paraglide/.gitignore deleted file mode 100644 index 633517e72c..0000000000 --- a/e2e/react-router/i18n-paraglide/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -dist -src/routeTree.gen.ts -src/paraglide -*.local -port*.txt -test-results diff --git a/e2e/react-router/i18n-paraglide/index.html b/e2e/react-router/i18n-paraglide/index.html deleted file mode 100644 index 3292330d0b..0000000000 --- a/e2e/react-router/i18n-paraglide/index.html +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - TanStack Router i18n-paraglide e2e - - -
- - - diff --git a/e2e/react-router/i18n-paraglide/messages/de.json b/e2e/react-router/i18n-paraglide/messages/de.json deleted file mode 100644 index 11498bd8b6..0000000000 --- a/e2e/react-router/i18n-paraglide/messages/de.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://inlang.com/schema/inlang-message-format", - "example_message": "Guten Tag {username}", - "hello_about": "Hallo /ueber!", - "home_page": "Startseite", - "about_page": "Über uns" -} diff --git a/e2e/react-router/i18n-paraglide/messages/en.json b/e2e/react-router/i18n-paraglide/messages/en.json deleted file mode 100644 index 8a85ed03fc..0000000000 --- a/e2e/react-router/i18n-paraglide/messages/en.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "$schema": "https://inlang.com/schema/inlang-message-format", - "example_message": "Hello world {username}", - "hello_about": "Hello /about!", - "home_page": "Home page", - "about_page": "About page" -} diff --git a/e2e/react-router/i18n-paraglide/package.json b/e2e/react-router/i18n-paraglide/package.json deleted file mode 100644 index d1af160f10..0000000000 --- a/e2e/react-router/i18n-paraglide/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-i18n-paraglide", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@inlang/paraglide-js": "^2.4.0", - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@types/node": "^22.10.2", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14" - }, - "nx": { - "targets": { - "build": { - "outputs": [ - "...", - "{projectRoot}/src/paraglide", - "{projectRoot}/project.inlang/cache" - ] - }, - "test:e2e": { - "outputs": [ - "...", - "{projectRoot}/src/paraglide", - "{projectRoot}/project.inlang/cache" - ] - } - } - } -} diff --git a/e2e/react-router/i18n-paraglide/playwright.config.ts b/e2e/react-router/i18n-paraglide/playwright.config.ts deleted file mode 100644 index 8e94d5f9a1..0000000000 --- a/e2e/react-router/i18n-paraglide/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_SERVER_PORT=${PORT} pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/i18n-paraglide/project.inlang/.gitignore b/e2e/react-router/i18n-paraglide/project.inlang/.gitignore deleted file mode 100644 index 06cf65390f..0000000000 --- a/e2e/react-router/i18n-paraglide/project.inlang/.gitignore +++ /dev/null @@ -1 +0,0 @@ -cache diff --git a/e2e/react-router/i18n-paraglide/project.inlang/project_id b/e2e/react-router/i18n-paraglide/project.inlang/project_id deleted file mode 100644 index 203a95649e..0000000000 --- a/e2e/react-router/i18n-paraglide/project.inlang/project_id +++ /dev/null @@ -1 +0,0 @@ -apLjNFHNH2yAHYTN5d \ No newline at end of file diff --git a/e2e/react-router/i18n-paraglide/project.inlang/settings.json b/e2e/react-router/i18n-paraglide/project.inlang/settings.json deleted file mode 100644 index 9bdce4c8cc..0000000000 --- a/e2e/react-router/i18n-paraglide/project.inlang/settings.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "$schema": "https://inlang.com/schema/project-settings", - "baseLocale": "en", - "locales": ["en", "de"], - "modules": [ - "https://cdn.jsdelivr.net/npm/@inlang/plugin-message-format@4/dist/index.js", - "https://cdn.jsdelivr.net/npm/@inlang/plugin-m-function-matcher@2/dist/index.js" - ], - "plugin.inlang.messageFormat": { - "pathPattern": "./messages/{locale}.json" - } -} diff --git a/e2e/react-router/i18n-paraglide/src/main.tsx b/e2e/react-router/i18n-paraglide/src/main.tsx deleted file mode 100644 index b30558a947..0000000000 --- a/e2e/react-router/i18n-paraglide/src/main.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { StrictMode } from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import './styles.css' -// Import the generated route tree -import { routeTree } from './routeTree.gen' -import { deLocalizeUrl, localizeUrl } from './paraglide/runtime.js' - -// Create a new router instance -const router = createRouter({ - routeTree, - context: {}, - defaultPreload: 'intent', - scrollRestoration: true, - defaultStructuralSharing: true, - defaultPreloadStaleTime: 0, - - rewrite: { - input: ({ url }) => deLocalizeUrl(url), - output: ({ url }) => localizeUrl(url), - }, -}) - -// Register the router instance for type safety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -// Render the app -const rootElement = document.getElementById('app') -if (rootElement && !rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render( - - - , - ) -} diff --git a/e2e/react-router/i18n-paraglide/src/routes/__root.tsx b/e2e/react-router/i18n-paraglide/src/routes/__root.tsx deleted file mode 100644 index 6f50edef00..0000000000 --- a/e2e/react-router/i18n-paraglide/src/routes/__root.tsx +++ /dev/null @@ -1,68 +0,0 @@ -import { Link, Outlet, createRootRoute, redirect } from '@tanstack/react-router' -import { - getLocale, - locales, - setLocale, - shouldRedirect, -} from '@/paraglide/runtime' -import { m } from '@/paraglide/messages' - -export const Route = createRootRoute({ - beforeLoad: async () => { - document.documentElement.setAttribute('lang', getLocale()) - - const decision = await shouldRedirect({ url: window.location.href }) - - if (decision.redirectUrl) { - throw redirect({ href: decision.redirectUrl.href }) - } - }, - component: () => ( - <> -
-
- - {m.home_page()} - - - - {m.about_page()} - -
- -
- {locales.map((locale) => ( - - ))} -
-
- -
- -
- -
- - ), -}) diff --git a/e2e/react-router/i18n-paraglide/src/routes/about.tsx b/e2e/react-router/i18n-paraglide/src/routes/about.tsx deleted file mode 100644 index 93cfdb3bd7..0000000000 --- a/e2e/react-router/i18n-paraglide/src/routes/about.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { m } from '@/paraglide/messages' -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/about')({ - component: RouteComponent, -}) - -function RouteComponent() { - return
{m.hello_about()}
-} diff --git a/e2e/react-router/i18n-paraglide/src/routes/index.tsx b/e2e/react-router/i18n-paraglide/src/routes/index.tsx deleted file mode 100644 index accd04a1a1..0000000000 --- a/e2e/react-router/i18n-paraglide/src/routes/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { m } from '@/paraglide/messages' - -export const Route = createFileRoute('/')({ - component: App, -}) - -function App() { - return ( -
-

- {m.example_message({ - username: 'TanStack Router!', - })} -

-
- ) -} diff --git a/e2e/react-router/i18n-paraglide/src/styles.css b/e2e/react-router/i18n-paraglide/src/styles.css deleted file mode 100644 index 23fa2415ca..0000000000 --- a/e2e/react-router/i18n-paraglide/src/styles.css +++ /dev/null @@ -1 +0,0 @@ -@import 'tailwindcss' source('../'); diff --git a/e2e/react-router/i18n-paraglide/src/vite-env.d.ts b/e2e/react-router/i18n-paraglide/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/i18n-paraglide/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/i18n-paraglide/tests/navigation.spec.ts b/e2e/react-router/i18n-paraglide/tests/navigation.spec.ts deleted file mode 100644 index 8ec0d82292..0000000000 --- a/e2e/react-router/i18n-paraglide/tests/navigation.spec.ts +++ /dev/null @@ -1,246 +0,0 @@ -import { expect, test } from '@playwright/test' - -// These tests verify that client-side i18n rewrites work correctly in a pure SPA -// (no server-side rendering). The router uses the rewrite API to: -// - input: de-localize URLs for route matching (e.g., /de/ueber -> /about) -// - output: localize URLs for display (e.g., /about -> /de/ueber) - -test.describe('Client-side i18n navigation', () => { - test('should load the home page without redirect loops', async ({ page }) => { - // Navigate to root - should work without any redirect loop issues - await page.goto('/') - await page.waitForLoadState('networkidle') - - // Verify the page loaded successfully - await expect(page.getByTestId('home-content')).toBeVisible() - await expect(page.getByTestId('home-content')).toContainText('Hello world') - }) - - test('should load the German home page (/de)', async ({ page }) => { - await page.goto('/de') - await page.waitForLoadState('networkidle') - - // Verify we're on the German page - await expect(page.getByTestId('home-content')).toBeVisible() - await expect(page.getByTestId('home-content')).toContainText('Guten Tag') - - // URL should remain /de - expect(page.url()).toContain('/de') - }) - - test('should navigate to about page and update URL correctly', async ({ - page, - }) => { - await page.goto('/') - await page.waitForLoadState('networkidle') - - // Click on about link - await page.getByTestId('about-link').click() - await page.waitForLoadState('networkidle') - - // Verify we're on the about page - await expect(page.getByTestId('about-content')).toBeVisible() - await expect(page.getByTestId('about-content')).toContainText( - 'Hello /about!', - ) - - // URL should be /about (English) - expect(page.url()).toContain('/about') - }) - - test('should navigate to German about page with translated URL', async ({ - page, - }) => { - await page.goto('/de') - await page.waitForLoadState('networkidle') - - // Click on about link (should navigate to /de/ueber) - await page.getByTestId('about-link').click() - await page.waitForLoadState('networkidle') - - // Verify we're on the about page with German content - await expect(page.getByTestId('about-content')).toBeVisible() - await expect(page.getByTestId('about-content')).toContainText( - 'Hallo /ueber!', - ) - - // URL should be /de/ueber (German translated path) - expect(page.url()).toContain('/de/ueber') - }) - - test('should directly access German about page (/de/ueber)', async ({ - page, - }) => { - // Direct navigation to translated URL - await page.goto('/de/ueber') - await page.waitForLoadState('networkidle') - - // Verify the page loaded correctly - await expect(page.getByTestId('about-content')).toBeVisible() - await expect(page.getByTestId('about-content')).toContainText( - 'Hallo /ueber!', - ) - - // URL should stay /de/ueber - expect(page.url()).toContain('/de/ueber') - }) - - test('should switch locale and update URLs accordingly', async ({ page }) => { - // Start at English home page - await page.goto('/') - await page.waitForLoadState('networkidle') - - // Verify English content - await expect(page.getByTestId('home-content')).toContainText('Hello world') - - // Switch to German - await page.getByTestId('locale-de').click() - await page.waitForLoadState('networkidle') - - // Verify German content - await expect(page.getByTestId('home-content')).toContainText('Guten Tag') - - // URL should now include /de - expect(page.url()).toContain('/de') - }) - - test('should switch locale on about page and update translated URL', async ({ - page, - }) => { - // Start at English about page - await page.goto('/about') - await page.waitForLoadState('networkidle') - - // Verify English content - await expect(page.getByTestId('about-content')).toContainText( - 'Hello /about!', - ) - - // Switch to German - await page.getByTestId('locale-de').click() - await page.waitForLoadState('networkidle') - - // Verify German content - await expect(page.getByTestId('about-content')).toContainText( - 'Hallo /ueber!', - ) - - // URL should now be /de/ueber (translated path) - expect(page.url()).toContain('/de/ueber') - }) - - test('should maintain correct links after locale switch', async ({ - page, - }) => { - // Start at German home page - await page.goto('/de') - await page.waitForLoadState('networkidle') - - // Verify about link has German translated href - const aboutLink = page.getByTestId('about-link') - await expect(aboutLink).toHaveAttribute('href', '/de/ueber') - - // Switch to English - await page.getByTestId('locale-en').click() - await page.waitForLoadState('networkidle') - - // Verify about link now has English href - await expect(aboutLink).toHaveAttribute('href', '/about') - }) -}) - -test.describe('Client-side navigation without redirect loops', () => { - test('navigating back and forth should not cause issues', async ({ - page, - }) => { - await page.goto('/') - await page.waitForLoadState('networkidle') - - // Navigate to about - await page.getByTestId('about-link').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('about-content')).toBeVisible() - - // Navigate back to home - await page.getByTestId('home-link').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('home-content')).toBeVisible() - - // Navigate to about again - await page.getByTestId('about-link').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('about-content')).toBeVisible() - }) - - test('switching locales multiple times should work correctly', async ({ - page, - }) => { - await page.goto('/') - await page.waitForLoadState('networkidle') - - // Switch to German - await page.getByTestId('locale-de').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('home-content')).toContainText('Guten Tag') - - // Switch back to English - await page.getByTestId('locale-en').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('home-content')).toContainText('Hello world') - - // Switch to German again - await page.getByTestId('locale-de').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('home-content')).toContainText('Guten Tag') - }) - - test('browser back/forward should work with locale changes', async ({ - page, - }) => { - await page.goto('/') - await page.waitForLoadState('networkidle') - - // Navigate to about - await page.getByTestId('about-link').click() - await page.waitForLoadState('networkidle') - - // Switch to German - await page.getByTestId('locale-de').click() - await page.waitForLoadState('networkidle') - expect(page.url()).toContain('/de/ueber') - - // Go back - await page.goBack() - await page.waitForLoadState('networkidle') - - // Should be on about page (English or previous state) - await expect(page.getByTestId('about-content')).toBeVisible() - }) -}) - -test.describe('URL rewrite consistency', () => { - test('internal navigation should use rewritten URLs in links', async ({ - page, - }) => { - await page.goto('/de') - await page.waitForLoadState('networkidle') - - // Check that links are properly localized - const homeLink = page.getByTestId('home-link') - const aboutLink = page.getByTestId('about-link') - - await expect(homeLink).toHaveAttribute('href', '/de') - await expect(aboutLink).toHaveAttribute('href', '/de/ueber') - }) - - test('English links should not have locale prefix', async ({ page }) => { - await page.goto('/') - await page.waitForLoadState('networkidle') - - const homeLink = page.getByTestId('home-link') - const aboutLink = page.getByTestId('about-link') - - await expect(homeLink).toHaveAttribute('href', '/') - await expect(aboutLink).toHaveAttribute('href', '/about') - }) -}) diff --git a/e2e/react-router/i18n-paraglide/tsconfig.json b/e2e/react-router/i18n-paraglide/tsconfig.json deleted file mode 100644 index c478245689..0000000000 --- a/e2e/react-router/i18n-paraglide/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "noImplicitAny": false, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowSyntheticDefaultImports": true, - "skipLibCheck": true, - "allowJs": true, - "paths": { - "@/*": ["./src/*"] - } - }, - "include": ["src", "tests"] -} diff --git a/e2e/react-router/i18n-paraglide/vite.config.ts b/e2e/react-router/i18n-paraglide/vite.config.ts deleted file mode 100644 index 97e9dda7bc..0000000000 --- a/e2e/react-router/i18n-paraglide/vite.config.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { defineConfig } from 'vite' -import viteReact from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { resolve } from 'node:path' -import { paraglideVitePlugin } from '@inlang/paraglide-js' -import tailwindcss from '@tailwindcss/vite' - -export default defineConfig({ - plugins: [ - tailwindcss(), - paraglideVitePlugin({ - project: './project.inlang', - outdir: './src/paraglide', - outputStructure: 'message-modules', - cookieName: 'PARAGLIDE_LOCALE', - strategy: ['url', 'cookie', 'preferredLanguage', 'baseLocale'], - urlPatterns: [ - { - pattern: '/', - localized: [ - ['en', '/'], - ['de', '/de'], - ], - }, - { - pattern: '/about', - localized: [ - ['en', '/about'], - ['de', '/de/ueber'], - ], - }, - { - pattern: '/:path(.*)?', - localized: [ - ['en', '/:path(.*)?'], - ['de', '/de/:path(.*)?'], - ], - }, - ], - }), - tanstackRouter({ autoCodeSplitting: true }), - viteReact(), - ], - resolve: { - alias: { - '@': resolve(__dirname, './src'), - }, - }, -}) diff --git a/e2e/react-router/issue-4759/index.html b/e2e/react-router/issue-4759/index.html deleted file mode 100644 index 9609ea710b..0000000000 --- a/e2e/react-router/issue-4759/index.html +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - Issue 4759 - - - -
-
HTML fallback
-
- - - - diff --git a/e2e/react-router/issue-4759/package.json b/e2e/react-router/issue-4759/package.json deleted file mode 100644 index ee6a105ad5..0000000000 --- a/e2e/react-router/issue-4759/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-issue-4759", - "private": true, - "type": "module", - "scripts": { - "build": "vite build && tsc --noEmit", - "dev": "vite --port 3000", - "dev:e2e": "vite", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/issue-4759/playwright.config.ts b/e2e/react-router/issue-4759/playwright.config.ts deleted file mode 100644 index a301f62881..0000000000 --- a/e2e/react-router/issue-4759/playwright.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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: `VITE_SERVER_PORT=${PORT} pnpm dev:e2e --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/issue-4759/src/main.tsx b/e2e/react-router/issue-4759/src/main.tsx deleted file mode 100644 index e251178045..0000000000 --- a/e2e/react-router/issue-4759/src/main.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import { - Outlet, - RouterProvider, - createRootRoute, - createRoute, - createRouter, -} from '@tanstack/react-router' - -const rootRoute = createRootRoute({ - context: () => ({ locale: 'en' }), - component: RootComponent, -}) -function RootComponent() { - const { locale } = rootRoute.useRouteContext() - return ( -
- -
- ) -} -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - loader: () => new Promise((resolve) => setTimeout(resolve, 1_000)), - component: () =>
loaded
, -}) -const routePendingRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/route-pending', - pendingMs: 0, - pendingMinMs: 0, - pendingComponent: RoutePending, - loader: () => new Promise((resolve) => setTimeout(resolve, 1_000)), - component: () =>
loaded
, -}) -function RoutePending() { - const { locale } = routePendingRoute.useRouteContext() - return ( -
- route pending -
- ) -} -const router = createRouter({ - routeTree: rootRoute.addChildren([indexRoute, routePendingRoute]), -}) -const usesRoutePending = window.location.pathname === '/route-pending' -function DefaultPending() { - const { locale } = indexRoute.useRouteContext() - return ( -
- default pending -
- ) -} - -createRoot(document.getElementById('app')!).render( - -
- -
-
, -) diff --git a/e2e/react-router/issue-4759/tests/issue-4759.spec.ts b/e2e/react-router/issue-4759/tests/issue-4759.spec.ts deleted file mode 100644 index 95689010c8..0000000000 --- a/e2e/react-router/issue-4759/tests/issue-4759.spec.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { expect, test } from '@playwright/test' -import type { Page } from '@playwright/test' - -async function expectNoBlankFrame( - page: Page, - pendingSource: 'default' | 'route', -) { - const pending = page.locator( - `[data-state="pending"][data-pending-source="${pendingSource}"]`, - ) - await expect(pending).toBeVisible() - await expect(pending).toHaveAttribute('data-locale', 'en') - await expect(page.locator('[data-root-locale="en"]')).toBeVisible() - - const paintStates = await page.evaluate( - () => - (globalThis as typeof globalThis & { __paintStates: Array }) - .__paintStates, - ) - - expect(paintStates).toContain('pending') - expect(paintStates).not.toContain('shell') - expect(paintStates).not.toContain('empty') - await expect(page.locator('[data-state="loaded"]')).toBeVisible() -} - -test('#4759: the initial default pending component has no blank frame before it', async ({ - page, -}) => { - await page.goto('/') - await expectNoBlankFrame(page, 'default') -}) - -test('an initial route pending component has no blank frame before it', async ({ - page, -}) => { - await page.goto('/route-pending') - await expectNoBlankFrame(page, 'route') -}) diff --git a/e2e/react-router/issue-4759/tsconfig.json b/e2e/react-router/issue-4759/tsconfig.json deleted file mode 100644 index e4ba4788a3..0000000000 --- a/e2e/react-router/issue-4759/tsconfig.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/issue-4759/vite.config.ts b/e2e/react-router/issue-4759/vite.config.ts deleted file mode 100644 index 9ffcc67574..0000000000 --- a/e2e/react-router/issue-4759/vite.config.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' - -export default defineConfig({ - plugins: [react()], -}) diff --git a/e2e/react-router/issue-7120/index.html b/e2e/react-router/issue-7120/index.html deleted file mode 100644 index 04a3530c9d..0000000000 --- a/e2e/react-router/issue-7120/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - Issues 7120 and 7367 - - - - diff --git a/e2e/react-router/issue-7120/package.json b/e2e/react-router/issue-7120/package.json deleted file mode 100644 index 979b32556c..0000000000 --- a/e2e/react-router/issue-7120/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-issue-7120", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/issue-7120/playwright.config.ts b/e2e/react-router/issue-7120/playwright.config.ts deleted file mode 100644 index a8ba116fb4..0000000000 --- a/e2e/react-router/issue-7120/playwright.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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: `VITE_NODE_ENV="test" VITE_SERVER_PORT=${PORT} pnpm dev:e2e --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/issue-7120/src/main.tsx b/e2e/react-router/issue-7120/src/main.tsx deleted file mode 100644 index 0c983251af..0000000000 --- a/e2e/react-router/issue-7120/src/main.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -const router = createRouter({ - routeTree, - defaultViewTransition: true, -}) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -createRoot(document.getElementById('root')!).render( - - - , -) diff --git a/e2e/react-router/issue-7120/src/redirectGate.ts b/e2e/react-router/issue-7120/src/redirectGate.ts deleted file mode 100644 index 399d303aac..0000000000 --- a/e2e/react-router/issue-7120/src/redirectGate.ts +++ /dev/null @@ -1,35 +0,0 @@ -type RedirectGate = { - waiting: boolean - released: boolean - release: () => void -} - -declare global { - interface Window { - redirectGate: RedirectGate - } -} - -let releasePromise!: () => void -const promise = new Promise((resolve) => { - releasePromise = resolve -}) - -const redirectGate: RedirectGate = { - waiting: false, - released: false, - release: () => { - if (!redirectGate.released) { - redirectGate.released = true - releasePromise() - } - }, -} - -window.redirectGate = redirectGate - -export async function waitForRedirectGate() { - redirectGate.waiting = true - await promise - redirectGate.waiting = false -} diff --git a/e2e/react-router/issue-7120/src/routeTree.gen.ts b/e2e/react-router/issue-7120/src/routeTree.gen.ts deleted file mode 100644 index e8c6d92110..0000000000 --- a/e2e/react-router/issue-7120/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 PostsRouteImport } from './routes/posts' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any).lazy(() => import('./routes/posts.lazy').then((d) => d.Route)) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/posts': typeof PostsRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/posts': typeof PostsRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/posts' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/posts' - id: '__root__' | '/' | '/posts' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PostsRoute: typeof PostsRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PostsRoute: PostsRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/issue-7120/src/routes/__root.tsx b/e2e/react-router/issue-7120/src/routes/__root.tsx deleted file mode 100644 index 2f01516a55..0000000000 --- a/e2e/react-router/issue-7120/src/routes/__root.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Outlet, createRootRoute, redirect } from '@tanstack/react-router' -import { waitForRedirectGate } from '../redirectGate' - -let shouldRedirect = true - -export const Route = createRootRoute({ - pendingMs: 0, - pendingMinMs: 500, - pendingComponent: RootPendingComponent, - beforeLoad: async ({ location }) => { - if (location.pathname !== '/' || !shouldRedirect) { - return - } - - await waitForRedirectGate() - - if (!shouldRedirect) { - return - } - - shouldRedirect = false - throw redirect({ to: '/posts', replace: true }) - }, - component: () => , -}) - -function RootPendingComponent() { - return ( -
- Loading route -
- ) -} diff --git a/e2e/react-router/issue-7120/src/routes/index.tsx b/e2e/react-router/issue-7120/src/routes/index.tsx deleted file mode 100644 index 1626ce706b..0000000000 --- a/e2e/react-router/issue-7120/src/routes/index.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - component: () =>
Home
, -}) diff --git a/e2e/react-router/issue-7120/src/routes/posts.lazy.tsx b/e2e/react-router/issue-7120/src/routes/posts.lazy.tsx deleted file mode 100644 index dc0b0cfd7f..0000000000 --- a/e2e/react-router/issue-7120/src/routes/posts.lazy.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/react-router' - -export const Route = createLazyFileRoute('/posts')({ - component: PostsComponent, -}) - -function PostsComponent() { - return ( -
-

Posts loaded

-

The redirected lazy route rendered.

-
- ) -} diff --git a/e2e/react-router/issue-7120/src/routes/posts.tsx b/e2e/react-router/issue-7120/src/routes/posts.tsx deleted file mode 100644 index cc0519b74e..0000000000 --- a/e2e/react-router/issue-7120/src/routes/posts.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts')({}) diff --git a/e2e/react-router/issue-7120/src/vite-env.d.ts b/e2e/react-router/issue-7120/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/issue-7120/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/issue-7120/tests/issue-7120.repro.spec.ts b/e2e/react-router/issue-7120/tests/issue-7120.repro.spec.ts deleted file mode 100644 index 081ae73691..0000000000 --- a/e2e/react-router/issue-7120/tests/issue-7120.repro.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('#7120 / #7367: a root redirect cannot commit a stale match during a view transition', async ({ - page, -}) => { - const pageErrors: Array = [] - const consoleErrors: Array = [] - - page.on('pageerror', (error) => { - pageErrors.push(error.message || String(error)) - }) - page.on('console', (message) => { - if (message.type() === 'error') { - consoleErrors.push(message.text()) - } - }) - - await page.goto('/') - - const pending = page.getByTestId('root-pending') - await expect(pending).toBeVisible() - expect(await page.evaluate(() => window.redirectGate.waiting)).toBe(true) - - await page.evaluate(() => window.redirectGate.release()) - - await expect(page).toHaveURL(/\/posts$/) - await expect( - page.getByRole('heading', { name: 'Posts loaded' }), - ).toBeVisible() - await expect(pending).not.toBeVisible() - expect(pageErrors).toEqual([]) - expect(consoleErrors).toEqual([]) -}) diff --git a/e2e/react-router/issue-7120/tsconfig.json b/e2e/react-router/issue-7120/tsconfig.json deleted file mode 100644 index 4f6089bc08..0000000000 --- a/e2e/react-router/issue-7120/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/issue-7120/vite.config.ts b/e2e/react-router/issue-7120/vite.config.ts deleted file mode 100644 index 5b1c613906..0000000000 --- a/e2e/react-router/issue-7120/vite.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [tanstackRouter({ target: 'react' }), react()], -}) diff --git a/e2e/react-router/issue-7457/index.html b/e2e/react-router/issue-7457/index.html deleted file mode 100644 index 76369b5957..0000000000 --- a/e2e/react-router/issue-7457/index.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - Issue 7457 - - - - diff --git a/e2e/react-router/issue-7457/package.json b/e2e/react-router/issue-7457/package.json deleted file mode 100644 index 838f5173e2..0000000000 --- a/e2e/react-router/issue-7457/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-issue-7457", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-query": "^5.99.0", - "@tanstack/react-router": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/issue-7457/playwright.config.ts b/e2e/react-router/issue-7457/playwright.config.ts deleted file mode 100644 index a8ba116fb4..0000000000 --- a/e2e/react-router/issue-7457/playwright.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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: `VITE_NODE_ENV="test" VITE_SERVER_PORT=${PORT} pnpm dev:e2e --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/issue-7457/src/main.tsx b/e2e/react-router/issue-7457/src/main.tsx deleted file mode 100644 index 1b6805edc0..0000000000 --- a/e2e/react-router/issue-7457/src/main.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { StrictMode, useEffect } from 'react' -import { createRoot } from 'react-dom/client' -import { QueryClient } from '@tanstack/react-query' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -const queryClient = new QueryClient() -const router = createRouter({ - routeTree, - context: { queryClient }, - defaultPendingComponent: DefaultPendingComponent, - defaultPreloadStaleTime: 0, -}) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -function DefaultPendingComponent() { - useEffect(() => { - ;(globalThis as any).__pendingSeen = true - }, []) - return
loading
-} - -createRoot(document.body).render( - - - , -) diff --git a/e2e/react-router/issue-7457/src/routeTree.gen.ts b/e2e/react-router/issue-7457/src/routeTree.gen.ts deleted file mode 100644 index 04a2c94ce8..0000000000 --- a/e2e/react-router/issue-7457/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 AnotherRouteImport } from './routes/another' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AnotherRoute = AnotherRouteImport.update({ - id: '/another', - path: '/another', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/another': typeof AnotherRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/another': typeof AnotherRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/another': typeof AnotherRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/another' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/another' - id: '__root__' | '/' | '/another' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AnotherRoute: typeof AnotherRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/another': { - id: '/another' - path: '/another' - fullPath: '/another' - preLoaderRoute: typeof AnotherRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AnotherRoute: AnotherRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/issue-7457/src/routes/__root.tsx b/e2e/react-router/issue-7457/src/routes/__root.tsx deleted file mode 100644 index 988ba76263..0000000000 --- a/e2e/react-router/issue-7457/src/routes/__root.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Outlet, createRootRouteWithContext } from '@tanstack/react-router' -import type { QueryClient } from '@tanstack/react-query' - -export const Route = createRootRouteWithContext<{ - queryClient: QueryClient -}>()({ - beforeLoad: async ({ context }) => { - await context.queryClient.ensureQueryData({ - queryKey: ['issue-7457-root'], - queryFn: async () => { - await new Promise((resolve) => setTimeout(resolve, 1_500)) - return true - }, - }) - }, - component: RootComponent, -}) - -function RootComponent() { - return ( -
- -
- ) -} diff --git a/e2e/react-router/issue-7457/src/routes/another.tsx b/e2e/react-router/issue-7457/src/routes/another.tsx deleted file mode 100644 index 6b6caa55b3..0000000000 --- a/e2e/react-router/issue-7457/src/routes/another.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/another')({ - component: () =>
Hello "/another"!
, -}) diff --git a/e2e/react-router/issue-7457/src/routes/index.tsx b/e2e/react-router/issue-7457/src/routes/index.tsx deleted file mode 100644 index daaae2aeed..0000000000 --- a/e2e/react-router/issue-7457/src/routes/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/react-router' - -export const Route = createFileRoute('/')({ - beforeLoad: () => { - throw redirect({ to: '/another', replace: true }) - }, - component: () =>
You should never see this!
, -}) diff --git a/e2e/react-router/issue-7457/src/vite-env.d.ts b/e2e/react-router/issue-7457/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/issue-7457/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts b/e2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts deleted file mode 100644 index 8b20fac1eb..0000000000 --- a/e2e/react-router/issue-7457/tests/issue-7457.repro.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('#7457: initial child redirect after async root beforeLoad does not blank', async ({ - page, -}) => { - const pageErrors: Array = [] - const consoleErrors: Array = [] - page.on('pageerror', (error) => - pageErrors.push(error.message || String(error)), - ) - page.on('console', (message) => { - if (message.type() === 'error') { - consoleErrors.push(message.text()) - } - }) - - await page.goto('/') - - await expect(page).toHaveURL(/\/another$/) - const target = page.getByText('Hello "/another"!') - await expect - .poll(async () => ({ - targetCount: await target.count(), - pageErrors: [...pageErrors], - consoleErrors: [...consoleErrors], - })) - .toEqual({ targetCount: 1, pageErrors: [], consoleErrors: [] }) - await expect(target).toBeVisible() - await expect - .poll(() => page.evaluate(() => (globalThis as any).__pendingSeen)) - .toBe(true) - await expect(page.getByTestId('app-pending')).not.toBeVisible() - expect(pageErrors).toEqual([]) - expect(consoleErrors).toEqual([]) -}) diff --git a/e2e/react-router/issue-7457/tsconfig.json b/e2e/react-router/issue-7457/tsconfig.json deleted file mode 100644 index 4f6089bc08..0000000000 --- a/e2e/react-router/issue-7457/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/issue-7457/vite.config.js b/e2e/react-router/issue-7457/vite.config.js deleted file mode 100644 index 9e39ea83d9..0000000000 --- a/e2e/react-router/issue-7457/vite.config.js +++ /dev/null @@ -1,10 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -export default defineConfig({ - plugins: [ - tanstackRouter({ target: 'react', autoCodeSplitting: true }), - react(), - ], -}) diff --git a/e2e/react-router/js-only-file-based/.devcontainer/devcontainer.json b/e2e/react-router/js-only-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/js-only-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/js-only-file-based/.gitignore b/e2e/react-router/js-only-file-based/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/react-router/js-only-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/react-router/js-only-file-based/index.html b/e2e/react-router/js-only-file-based/index.html deleted file mode 100644 index 5f9851cdc9..0000000000 --- a/e2e/react-router/js-only-file-based/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/js-only-file-based/package.json b/e2e/react-router/js-only-file-based/package.json deleted file mode 100644 index 39742d9c84..0000000000 --- a/e2e/react-router/js-only-file-based/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-js-only-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/js-only-file-based/playwright.config.ts b/e2e/react-router/js-only-file-based/playwright.config.ts deleted file mode 100644 index 0925936d55..0000000000 --- a/e2e/react-router/js-only-file-based/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/js-only-file-based/src/main.jsx b/e2e/react-router/js-only-file-based/src/main.jsx deleted file mode 100644 index 8145753dce..0000000000 --- a/e2e/react-router/js-only-file-based/src/main.jsx +++ /dev/null @@ -1,24 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { RouterProvider, createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -const rootElement = document.getElementById('app') - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render( - - - , - ) -} diff --git a/e2e/react-router/js-only-file-based/src/posts.js b/e2e/react-router/js-only-file-based/src/posts.js deleted file mode 100644 index 36c1c281f6..0000000000 --- a/e2e/react-router/js-only-file-based/src/posts.js +++ /dev/null @@ -1,23 +0,0 @@ -import axios from 'redaxios' - -export class NotFoundError extends Error {} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios.get(`${queryURL}/posts`).then((r) => r.data.slice(0, 10)) -} - -export const fetchPost = async (postId) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} diff --git a/e2e/react-router/js-only-file-based/src/routeTree.gen.js b/e2e/react-router/js-only-file-based/src/routeTree.gen.js deleted file mode 100644 index 80683abb30..0000000000 --- a/e2e/react-router/js-only-file-based/src/routeTree.gen.js +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 PathlessLayoutRouteImport } from './routes/_pathlessLayout' -import { Route as PostsRouteRouteImport } from './routes/posts.route' -import { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a' -import { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -}) -const PathlessLayoutRoute = PathlessLayoutRouteImport.update({ - id: '/_pathlessLayout', - getParentRoute: () => rootRouteImport, -}) -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -}) -const PathlessLayoutNestedLayoutRoute = - PathlessLayoutNestedLayoutRouteImport.update({ - id: '/_nested-layout', - getParentRoute: () => PathlessLayoutRoute, - }) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -}) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRouteRoute, -}) -const PathlessLayoutNestedLayoutRouteARoute = - PathlessLayoutNestedLayoutRouteARouteImport.update({ - id: '/route-a', - path: '/route-a', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - }) -const PathlessLayoutNestedLayoutRouteBRoute = - PathlessLayoutNestedLayoutRouteBRouteImport.update({ - id: '/route-b', - path: '/route-b', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - }) - -const PostsRouteRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -const PathlessLayoutNestedLayoutRouteChildren = { - PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute, - PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute, -} - -const PathlessLayoutNestedLayoutRouteWithChildren = - PathlessLayoutNestedLayoutRoute._addFileChildren( - PathlessLayoutNestedLayoutRouteChildren, - ) - -const PathlessLayoutRouteChildren = { - PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren, -} - -const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( - PathlessLayoutRouteChildren, -) - -const rootRouteChildren = { - IndexRoute: IndexRoute, - PostsRouteRoute: PostsRouteRouteWithChildren, - PathlessLayoutRoute: PathlessLayoutRouteWithChildren, -} -export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren) diff --git a/e2e/react-router/js-only-file-based/src/routes/__root.jsx b/e2e/react-router/js-only-file-based/src/routes/__root.jsx deleted file mode 100644 index afe0580e37..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/__root.jsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Pathless Layout - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout.jsx b/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout.jsx deleted file mode 100644 index 1e1ef2ebe1..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_pathlessLayout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a pathless layout
-
- -
-
- ) -} diff --git a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx b/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx deleted file mode 100644 index 9c345694ab..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_pathlessLayout/_nested-layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested pathless layout
-
- - Go to route A - - - Go to route B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx b/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx deleted file mode 100644 index 6b59dbc46f..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')( - { - component: LayoutAComponent, - }, -) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx b/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx deleted file mode 100644 index 50f864f617..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')( - { - component: LayoutBComponent, - }, -) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/js-only-file-based/src/routes/index.jsx b/e2e/react-router/js-only-file-based/src/routes/index.jsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/index.jsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/js-only-file-based/src/routes/posts.$postId.jsx b/e2e/react-router/js-only-file-based/src/routes/posts.$postId.jsx deleted file mode 100644 index 0d4b989053..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/posts.$postId.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' -import { fetchPost } from '../posts' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/js-only-file-based/src/routes/posts.index.jsx b/e2e/react-router/js-only-file-based/src/routes/posts.index.jsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/posts.index.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/js-only-file-based/src/routes/posts.route.jsx b/e2e/react-router/js-only-file-based/src/routes/posts.route.jsx deleted file mode 100644 index ab5c2ac99f..0000000000 --- a/e2e/react-router/js-only-file-based/src/routes/posts.route.jsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsLayoutComponent, -}) - -function PostsLayoutComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/js-only-file-based/src/styles.css b/e2e/react-router/js-only-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/react-router/js-only-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/js-only-file-based/src/vite-env.d.ts b/e2e/react-router/js-only-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/js-only-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/js-only-file-based/tests/app.spec.ts b/e2e/react-router/js-only-file-based/tests/app.spec.ts deleted file mode 100644 index ced5ac9310..0000000000 --- a/e2e/react-router/js-only-file-based/tests/app.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested pathless layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a pathless layout") - await expect(page.locator('#app')).toContainText( - "I'm a nested pathless layout", - ) - - await page.getByRole('link', { name: 'Go to route A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Go to route B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/js-only-file-based/tsconfig.json b/e2e/react-router/js-only-file-based/tsconfig.json deleted file mode 100644 index ad08d6c2bc..0000000000 --- a/e2e/react-router/js-only-file-based/tsconfig.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/js-only-file-based/vite.config.js b/e2e/react-router/js-only-file-based/vite.config.js deleted file mode 100644 index db4a4f7edf..0000000000 --- a/e2e/react-router/js-only-file-based/vite.config.js +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'vite' -import react from '@vitejs/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'react', - disableTypes: true, - }), - react(), - ], -}) diff --git a/e2e/react-router/match-params/.gitignore b/e2e/react-router/match-params/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/react-router/match-params/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/match-params/index.html b/e2e/react-router/match-params/index.html deleted file mode 100644 index cee534dbdb..0000000000 --- a/e2e/react-router/match-params/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Match Params - - -
- - - diff --git a/e2e/react-router/match-params/package.json b/e2e/react-router/match-params/package.json deleted file mode 100644 index 908be67a9d..0000000000 --- a/e2e/react-router/match-params/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-match-params", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/match-params/playwright.config.ts b/e2e/react-router/match-params/playwright.config.ts deleted file mode 100644 index 9e8c1fab2b..0000000000 --- a/e2e/react-router/match-params/playwright.config.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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 build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/match-params/src/main.tsx b/e2e/react-router/match-params/src/main.tsx deleted file mode 100644 index 33709cfcc2..0000000000 --- a/e2e/react-router/match-params/src/main.tsx +++ /dev/null @@ -1,229 +0,0 @@ -import ReactDOM from 'react-dom/client' -import { - Link, - Outlet, - RouterProvider, - createRootRoute, - createRoute, - createRouter, -} from '@tanstack/react-router' - -const rootRoute = createRootRoute({ - component: RootComponent, - notFoundComponent: () =>

Root not found

, -}) - -function RootComponent() { - return ( - <> - - - - ) -} - -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - component: () =>

Match params e2e

, -}) - -const matchLanguageRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/match/{$language}', - params: { - parse: ({ language }) => { - if (language === 'en') return { language: 'en-US' as const } - if (language === 'pl') return { language: 'pl-PL' as const } - return false - }, - stringify: ({ language }) => { - if (language === 'en-US') return { language: 'en' } - if (language === 'pl-PL') return { language: 'pl' } - return { language } - }, - }, - component: MatchLanguageComponent, -}) - -function MatchLanguageComponent() { - const params = matchLanguageRoute.useParams() - return

Match language {params.language}

-} - -const usersRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/users', -}) - -const numericUserRoute = createRoute({ - getParentRoute: () => usersRoute, - path: '$userId', - params: { - parse: ({ userId }) => { - const parsed = Number(userId) - if (!Number.isInteger(parsed)) return false - return { userId: parsed } - }, - stringify: ({ userId }) => ({ userId: String(userId) }), - }, - component: NumericUserComponent, -}) - -function NumericUserComponent() { - const params = numericUserRoute.useParams() - return

Numeric user {params.userId}

-} - -const usernameRoute = createRoute({ - getParentRoute: () => usersRoute, - path: '$username', - component: UsernameComponent, -}) - -function UsernameComponent() { - const params = usernameRoute.useParams() - return

Username {params.username}

-} - -const numericOrgRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/orgs/$orgId', - params: { - parse: ({ orgId }) => { - const parsed = Number(orgId) - if (!Number.isInteger(parsed)) return false - return { orgId: parsed } - }, - stringify: ({ orgId }) => ({ orgId: String(orgId) }), - }, -}) - -const orgSettingsRoute = createRoute({ - getParentRoute: () => numericOrgRoute, - path: 'settings', - component: OrgSettingsComponent, -}) - -function OrgSettingsComponent() { - const params = orgSettingsRoute.useParams() - return

Org settings {params.orgId}

-} - -const orgAboutRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/orgs/$slug/about', - component: OrgAboutComponent, -}) - -function OrgAboutComponent() { - const params = orgAboutRoute.useParams() - return

Org about {params.slug}

-} - -const ambiguousRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/ambiguous', -}) - -const ambiguousDollarRoute = createRoute({ - getParentRoute: () => ambiguousRoute, - path: '$value', - params: { - parse: ({ value }) => { - if (!value.startsWith('dollar-')) return false - return { value: value.slice(7) } - }, - stringify: ({ value }) => ({ value: `dollar-${value}` }), - }, - component: AmbiguousDollarComponent, -}) - -function AmbiguousDollarComponent() { - const params = ambiguousDollarRoute.useParams() - return

Dollar {params.value}

-} - -const ambiguousCurlyRoute = createRoute({ - getParentRoute: () => ambiguousRoute, - path: '{$value}', - params: { - parse: ({ value }) => { - if (!value.startsWith('curly-')) return false - return { value: value.slice(6) } - }, - stringify: ({ value }) => ({ value: `curly-${value}` }), - }, - component: AmbiguousCurlyComponent, -}) - -function AmbiguousCurlyComponent() { - const params = ambiguousCurlyRoute.useParams() - return

Curly {params.value}

-} - -const routeTree = rootRoute.addChildren([ - indexRoute, - matchLanguageRoute, - usersRoute.addChildren([numericUserRoute, usernameRoute]), - numericOrgRoute.addChildren([orgSettingsRoute]), - orgAboutRoute, - ambiguousRoute.addChildren([ambiguousDollarRoute, ambiguousCurlyRoute]), -]) - -const router = createRouter({ routeTree }) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - ReactDOM.createRoot(rootElement).render() -} diff --git a/e2e/react-router/match-params/tests/match-params.spec.ts b/e2e/react-router/match-params/tests/match-params.spec.ts deleted file mode 100644 index 9b57061911..0000000000 --- a/e2e/react-router/match-params/tests/match-params.spec.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { expect, test } from '@playwright/test' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('params.parse stringifies links and parses concrete params', async ({ - page, -}) => { - await expect(page.getByTestId('match-en-link')).toHaveAttribute( - 'href', - '/match/en', - ) - - await page.getByTestId('match-en-link').click() - await expect(page.getByTestId('match-language')).toHaveText( - 'Match language en-US', - ) - - await page.goto('/match/pl') - await expect(page.getByTestId('match-language')).toHaveText( - 'Match language pl-PL', - ) - - await page.goto('/match/en-US') - await expect(page.getByTestId('not-found')).toHaveText('Root not found') -}) - -test('params.parse can fall through to sibling dynamic routes', async ({ - page, -}) => { - await expect(page.getByTestId('numeric-user-link')).toHaveAttribute( - 'href', - '/users/456', - ) - await expect(page.getByTestId('username-link')).toHaveAttribute( - 'href', - '/users/alice', - ) - - await page.goto('/users/123') - await expect(page.getByTestId('numeric-user')).toHaveText('Numeric user 123') - - await page.goto('/users/alice') - await expect(page.getByTestId('username')).toHaveText('Username alice') -}) - -test('params.parse can gate child routes', async ({ page }) => { - await expect(page.getByTestId('org-settings-link')).toHaveAttribute( - 'href', - '/orgs/42/settings', - ) - - await page.goto('/orgs/42/settings') - await expect(page.getByTestId('org-settings')).toHaveText('Org settings 42') - - await page.goto('/orgs/acme/about') - await expect(page.getByTestId('org-about')).toHaveText('Org about acme') - - await page.goto('/orgs/acme/settings') - await expect(page.getByTestId('not-found')).toHaveText('Root not found') -}) - -test('buildLocation uses exact route templates before matching paths', async ({ - page, -}) => { - await expect(page.getByTestId('ambiguous-dollar-link')).toHaveAttribute( - 'href', - '/ambiguous/dollar-alpha', - ) - await expect(page.getByTestId('ambiguous-curly-link')).toHaveAttribute( - 'href', - '/ambiguous/curly-alpha', - ) - - await page.getByTestId('ambiguous-dollar-link').click() - await expect(page.getByTestId('ambiguous-dollar')).toHaveText('Dollar alpha') - - await page.getByTestId('ambiguous-curly-link').click() - await expect(page.getByTestId('ambiguous-curly')).toHaveText('Curly alpha') -}) diff --git a/e2e/react-router/match-params/tsconfig.json b/e2e/react-router/match-params/tsconfig.json deleted file mode 100644 index 4f6089bc08..0000000000 --- a/e2e/react-router/match-params/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/match-params/vite.config.js b/e2e/react-router/match-params/vite.config.js deleted file mode 100644 index 4f1b25a0c3..0000000000 --- a/e2e/react-router/match-params/vite.config.js +++ /dev/null @@ -1,3 +0,0 @@ -import { defineConfig } from 'vite' - -export default defineConfig({}) diff --git a/e2e/react-router/react-compiler/index.html b/e2e/react-router/react-compiler/index.html deleted file mode 100644 index 0c5b6b471c..0000000000 --- a/e2e/react-router/react-compiler/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - React Compiler useMatchRoute test - - -
- - - diff --git a/e2e/react-router/react-compiler/package.json b/e2e/react-router/react-compiler/package.json deleted file mode 100644 index 82e6fbf86b..0000000000 --- a/e2e/react-router/react-compiler/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-compiler", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@babel/core": "^7.29.0", - "@playwright/test": "^1.61.0", - "@rolldown/plugin-babel": "^0.2.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "babel-plugin-react-compiler": "^1.0.0", - "vite": "^8.0.14" - } -} diff --git a/e2e/react-router/react-compiler/playwright.config.ts b/e2e/react-router/react-compiler/playwright.config.ts deleted file mode 100644 index a8ba116fb4..0000000000 --- a/e2e/react-router/react-compiler/playwright.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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: `VITE_NODE_ENV="test" VITE_SERVER_PORT=${PORT} pnpm dev:e2e --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/react-compiler/src/main.tsx b/e2e/react-router/react-compiler/src/main.tsx deleted file mode 100644 index e6e549da83..0000000000 --- a/e2e/react-router/react-compiler/src/main.tsx +++ /dev/null @@ -1,73 +0,0 @@ -import { StrictMode } from 'react' -import { createRoot } from 'react-dom/client' -import { - Link, - Outlet, - RouterProvider, - createRootRoute, - createRoute, - createRouter, - linkOptions, - useMatchRoute, -} from '@tanstack/react-router' - -const links = linkOptions([ - { to: '/home', label: 'Home' }, - { to: '/about', label: 'About' }, -]) - -function useRouteName() { - const matchRoute = useMatchRoute() - - return links.find((link) => matchRoute(link))?.label ?? 'Unknown' -} - -function RootComponent() { - const matchedRoute = useRouteName() - - return ( - <> - -

- Matched route: {matchedRoute} -

- - - ) -} - -const rootRoute = createRootRoute({ component: RootComponent }) -const homeRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/home', -}) -const aboutRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/about', -}) -const router = createRouter({ - routeTree: rootRoute.addChildren([homeRoute, aboutRoute]), -}) - -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app') -if (!rootElement) { - throw new Error('Root element not found') -} - -createRoot(rootElement).render( - - - , -) diff --git a/e2e/react-router/react-compiler/tests/use-match-route.spec.ts b/e2e/react-router/react-compiler/tests/use-match-route.spec.ts deleted file mode 100644 index b800e3c908..0000000000 --- a/e2e/react-router/react-compiler/tests/use-match-route.spec.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('useMatchRoute updates after navigation with React Compiler', async ({ - page, -}) => { - await page.goto('/home') - await expect(page.getByTestId('matched-route')).toHaveText('Home') - - await page.getByRole('link', { name: 'About' }).click() - await expect(page).toHaveURL(/\/about$/) - await expect(page.getByTestId('matched-route')).toHaveText('About') - - await page.getByRole('link', { name: 'Home' }).click() - await expect(page).toHaveURL(/\/home$/) - await expect(page.getByTestId('matched-route')).toHaveText('Home') -}) diff --git a/e2e/react-router/react-compiler/tsconfig.json b/e2e/react-router/react-compiler/tsconfig.json deleted file mode 100644 index 4f6089bc08..0000000000 --- a/e2e/react-router/react-compiler/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/react-compiler/vite.config.js b/e2e/react-router/react-compiler/vite.config.js deleted file mode 100644 index b4478aced4..0000000000 --- a/e2e/react-router/react-compiler/vite.config.js +++ /dev/null @@ -1,7 +0,0 @@ -import { defineConfig } from 'vite' -import react, { reactCompilerPreset } from '@vitejs/plugin-react' -import babel from '@rolldown/plugin-babel' - -export default defineConfig({ - plugins: [react(), babel({ presets: [reactCompilerPreset()] })], -}) diff --git a/e2e/react-router/rspack-basic-file-based/.devcontainer/devcontainer.json b/e2e/react-router/rspack-basic-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/rspack-basic-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/rspack-basic-file-based/.gitignore b/e2e/react-router/rspack-basic-file-based/.gitignore deleted file mode 100644 index e826cc86e8..0000000000 --- a/e2e/react-router/rspack-basic-file-based/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# Local -.DS_Store -*.local -*.log* - -# Dist -node_modules -dist/ -dist-hash/ - -# IDE -.vscode/* -!.vscode/extensions.json -.idea - -# E2E -src/routeTree.gen.ts -test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/rspack-basic-file-based/README.md b/e2e/react-router/rspack-basic-file-based/README.md deleted file mode 100644 index 93f18812e1..0000000000 --- a/e2e/react-router/rspack-basic-file-based/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Example - -To run this example: - -- `pnpm install` -- `pnpm dev` diff --git a/e2e/react-router/rspack-basic-file-based/package.json b/e2e/react-router/rspack-basic-file-based/package.json deleted file mode 100644 index 5ec9ed9862..0000000000 --- a/e2e/react-router/rspack-basic-file-based/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-rspack-basic-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "rsbuild dev --port 3000", - "build": "rsbuild build && tsc --noEmit", - "preview": "rsbuild preview", - "start": "rsbuild preview", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-react": "^2.0.0", - "@tailwindcss/postcss": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "postcss": "^8.5.1", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2" - } -} diff --git a/e2e/react-router/rspack-basic-file-based/playwright.config.ts b/e2e/react-router/rspack-basic-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/react-router/rspack-basic-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/rspack-basic-file-based/postcss.config.mjs b/e2e/react-router/rspack-basic-file-based/postcss.config.mjs deleted file mode 100644 index a7f73a2d1d..0000000000 --- a/e2e/react-router/rspack-basic-file-based/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export default { - plugins: { - '@tailwindcss/postcss': {}, - }, -} diff --git a/e2e/react-router/rspack-basic-file-based/rsbuild.config.ts b/e2e/react-router/rspack-basic-file-based/rsbuild.config.ts deleted file mode 100644 index f52856821e..0000000000 --- a/e2e/react-router/rspack-basic-file-based/rsbuild.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginReact } from '@rsbuild/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/rspack' - -export default defineConfig({ - plugins: [pluginReact()], - tools: { - rspack: { - plugins: [ - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - }), - ], - }, - }, -}) diff --git a/e2e/react-router/rspack-basic-file-based/src/app.tsx b/e2e/react-router/rspack-basic-file-based/src/app.tsx deleted file mode 100644 index a44d5c0977..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/app.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from 'react' -import { RouterProvider, createRouter } from '@tanstack/react-router' - -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} -const App = () => { - return -} - -export default App diff --git a/e2e/react-router/rspack-basic-file-based/src/env.d.ts b/e2e/react-router/rspack-basic-file-based/src/env.d.ts deleted file mode 100644 index b0ac762b09..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/rspack-basic-file-based/src/index.tsx b/e2e/react-router/rspack-basic-file-based/src/index.tsx deleted file mode 100644 index f56cadf11c..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './app' - -const rootEl = document.getElementById('root') - -if (rootEl) { - const root = ReactDOM.createRoot(rootEl) - root.render( - - - , - ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/posts.tsx b/e2e/react-router/rspack-basic-file-based/src/posts.tsx deleted file mode 100644 index 97c96d77eb..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/__root.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/__root.tsx deleted file mode 100644 index a5f2720e32..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/_layout.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/_layout.tsx deleted file mode 100644 index 0fcaac3a52..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 388d0b3b87..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index ed2dea8800..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 4799d403e9..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/index.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/index.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/posts.$postId.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index 956ca50ecd..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/posts.index.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/posts.index.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/rspack-basic-file-based/src/routes/posts.tsx b/e2e/react-router/rspack-basic-file-based/src/routes/posts.tsx deleted file mode 100644 index 295205ac1c..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/rspack-basic-file-based/src/styles.css b/e2e/react-router/rspack-basic-file-based/src/styles.css deleted file mode 100644 index 0bd1287c82..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss' source('../'); - -@source './**/*.{js,jsx,ts,tsx}'; - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/rspack-basic-file-based/src/vite-env.d.ts b/e2e/react-router/rspack-basic-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/rspack-basic-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/rspack-basic-file-based/tests/app.spec.ts b/e2e/react-router/rspack-basic-file-based/tests/app.spec.ts deleted file mode 100644 index d230263bfe..0000000000 --- a/e2e/react-router/rspack-basic-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#root')).toContainText("I'm a layout") - await expect(page.locator('#root')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#root')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#root')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/rspack-basic-file-based/tsconfig.json b/e2e/react-router/rspack-basic-file-based/tsconfig.json deleted file mode 100644 index 2f5f67eac7..0000000000 --- a/e2e/react-router/rspack-basic-file-based/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "module": "ESNext", - "jsx": "react-jsx", - "strict": true, - "skipLibCheck": true, - "isolatedModules": true, - "resolveJsonModule": true, - "useDefineForClassFields": true, - "allowJs": true - }, - "include": ["src", "tests"], - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.gitignore b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.gitignore deleted file mode 100644 index e826cc86e8..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# Local -.DS_Store -*.local -*.log* - -# Dist -node_modules -dist/ -dist-hash/ - -# IDE -.vscode/* -!.vscode/extensions.json -.idea - -# E2E -src/routeTree.gen.ts -test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/README.md b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/README.md deleted file mode 100644 index 93f18812e1..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Example - -To run this example: - -- `pnpm install` -- `pnpm dev` 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 deleted file mode 100644 index 30c62d0af1..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-rspack-basic-virtual-named-export-config-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "rsbuild dev --port 3000", - "build": "rsbuild build && tsc --noEmit", - "preview": "rsbuild preview", - "start": "rsbuild preview", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-react": "^2.0.0", - "@tailwindcss/postcss": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/virtual-file-routes": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "postcss": "^8.5.1", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2" - } -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts deleted file mode 100644 index 1c1d021f2f..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm start --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs deleted file mode 100644 index a7f73a2d1d..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export default { - plugins: { - '@tailwindcss/postcss': {}, - }, -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/routes.ts b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/routes.ts deleted file mode 100644 index 6c2c144ec5..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/routes.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - index, - layout, - physical, - rootRoute, - route, -} from '@tanstack/virtual-file-routes' - -export const routes = rootRoute('root.tsx', [ - index('home.tsx'), - route('/posts', 'posts/posts.tsx', [ - index('posts/posts-home.tsx'), - route('$postId', 'posts/posts-detail.tsx'), - ]), - layout('first', 'layout/first-layout.tsx', [ - layout('second', 'layout/second-layout.tsx', [ - route('/layout-a', 'a.tsx'), - route('/layout-b', 'b.tsx'), - ]), - ]), - physical('/classic', 'file-based-subtree'), -]) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts deleted file mode 100644 index 61be0d3631..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginReact } from '@rsbuild/plugin-react' -import { tanstackRouter } from '@tanstack/router-plugin/rspack' - -export default defineConfig({ - plugins: [pluginReact()], - tools: { - rspack: { - plugins: [ - tanstackRouter({ - target: 'react', - autoCodeSplitting: true, - virtualRouteConfig: './routes.ts', - }), - ], - }, - }, -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx deleted file mode 100644 index a44d5c0977..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as React from 'react' -import { RouterProvider, createRouter } from '@tanstack/react-router' - -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} -const App = () => { - return -} - -export default App diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts deleted file mode 100644 index b0ac762b09..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx deleted file mode 100644 index f56cadf11c..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import App from './app' - -const rootEl = document.getElementById('root') - -if (rootEl) { - const root = ReactDOM.createRoot(rootEl) - root.render( - - - , - ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx deleted file mode 100644 index cc3cb0f9c8..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { notFound } from '@tanstack/react-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx deleted file mode 100644 index b36784f0de..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_first/_second/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx deleted file mode 100644 index eb440b9eb3..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/_first/_second/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx deleted file mode 100644 index 0cc76f4a69..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/')({ - component: () =>
This is the index
, -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx deleted file mode 100644 index 9485ec5954..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/classic/hello')({ - component: () => ( -
- Hello! -
{' '} - - say hello to the universe - {' '} - - say hello to the world - - -
- ), -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx deleted file mode 100644 index 5aaa7d4fa0..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/universe')({ - component: () =>
Hello /classic/hello/universe!
, -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx deleted file mode 100644 index 790d33a838..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/classic/hello/world')({ - component: () =>
Hello /classic/hello/world!
, -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx deleted file mode 100644 index 0a5b7572ba..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx deleted file mode 100644 index b9551e996d..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_first')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx deleted file mode 100644 index 7c058919b1..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { Link, Outlet } from '@tanstack/react-router' - -export const Route = createFileRoute('/_first/_second')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx deleted file mode 100644 index d955b379fb..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { ErrorComponent } from '@tanstack/react-router' -import { fetchPost } from '../../posts' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post.title}

-
{post.body}
-
- ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx deleted file mode 100644 index c6b65f1892..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx deleted file mode 100644 index 3ebc75f079..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' -import { Link, Outlet } from '@tanstack/react-router' -import { fetchPosts } from '../../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts, { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx deleted file mode 100644 index 9589d8dbc5..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import * as React from 'react' -import { Link, Outlet, createRootRoute } from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Subtree - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css deleted file mode 100644 index 0bd1287c82..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss' source('../'); - -@source './**/*.{js,jsx,ts,tsx}'; - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/vite-env.d.ts b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts deleted file mode 100644 index 8b808782f6..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.waitForURL('/') - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.waitForURL('/') - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#root')).toContainText("I'm a layout") - await expect(page.locator('#root')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#root')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#root')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.waitForURL('/') - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json deleted file mode 100644 index a32f07a8ef..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "module": "ESNext", - "jsx": "react-jsx", - "strict": true, - "skipLibCheck": true, - "isolatedModules": true, - "resolveJsonModule": true, - "useDefineForClassFields": true, - "allowJs": true - }, - "include": ["src", "tests", "./routes.ts"], - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsr.config.json b/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsr.config.json deleted file mode 100644 index 2759341ba2..0000000000 --- a/e2e/react-router/rspack-basic-virtual-named-export-config-file-based/tsr.config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "routesDirectory": "./src/routes", - "generatedRouteTree": "./src/routeTree.gen.ts", - "virtualRouteConfig": "./routes.ts" -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json b/e2e/react-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/.gitignore b/e2e/react-router/scroll-restoration-sandbox-vite/.gitignore deleted file mode 100644 index 0a3fb8351b..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -.DS_Store -dist -dist-ssr -dist-hash -*.local -test-results diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/README.md b/e2e/react-router/scroll-restoration-sandbox-vite/README.md deleted file mode 100644 index 31385a5005..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Scroll Restoration Testing Sandbox with Vite - -To run this example: - -- `npm install` -- `npm start` - -This sandbox is for testing the scroll restoration behavior. - -## Setup - -- Create your files in `src/routes` directory. -- Make sure you update the arrays in the following files with the expected routes - - `tests/app.spec.ts` > routes array - - `src/routes/__root.tsx` > Nav component, routes array - - `src/routes/index.tsx` > Navigation test suite, routes array diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/index.html b/e2e/react-router/scroll-restoration-sandbox-vite/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/package.json b/e2e/react-router/scroll-restoration-sandbox-vite/package.json deleted file mode 100644 index 51e9e70cc5..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "tanstack-router-e2e-react-scroll-restoration-sandbox-vite", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:hash": "VITE_APP_HISTORY=hash vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e:browser": "VITE_APP_HISTORY=browser playwright test --config=playwright.browser.config.ts --project=chromium", - "test:e2e:hash": "VITE_APP_HISTORY=hash playwright test --config=playwright.hash.config.ts --project=chromium", - "test:e2e": "pnpm run test:e2e:browser && pnpm run test:e2e:hash" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "vite": "^8.0.14" - }, - "nx": { - "targets": { - "test:e2e": { - "outputs": [ - "...", - "{projectRoot}/dist-hash" - ] - } - } - } -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts b/e2e/react-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts deleted file mode 100644 index eb31d94080..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_APP_HISTORY=browser pnpm build && VITE_APP_HISTORY=browser pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], - - quiet: false, -}) diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts b/e2e/react-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts deleted file mode 100644 index 6b160e3908..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_APP_HISTORY=hash vite build --outDir dist-hash && VITE_APP_HISTORY=hash pnpm preview --port ${PORT} --outDir dist-hash`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/main.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/main.tsx deleted file mode 100644 index 3462b1db9a..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/main.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import React from 'react' -import ReactDOM from 'react-dom/client' -import { - RouterProvider, - createHashHistory, - createRouter, -} from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import type { RouterHistory } from '@tanstack/react-router' -import './styles.css' - -let history: RouterHistory | undefined - -if (import.meta.env.VITE_APP_HISTORY === 'hash') { - history = createHashHistory() -} - -// Set up a Router instance -const router = createRouter({ - routeTree, - history, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/react-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - const root = ReactDOM.createRoot(rootElement) - root.render() -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/posts.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/posts.tsx deleted file mode 100644 index c4a2d0dcca..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/posts.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import axios from 'redaxios' - -export function sleep(ms: number) { - return new Promise((r) => setTimeout(r, ms)) -} - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export class PostNotFoundError extends Error {} - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw new PostNotFoundError(`Post with id "${postId}" not found!`) - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts b/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts deleted file mode 100644 index 0c6823c368..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts +++ /dev/null @@ -1,223 +0,0 @@ -/* 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 { createFileRoute } from '@tanstack/react-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as IndexRouteImport } from './routes/index' -import { Route as testsIssue7040SourceRouteImport } from './routes/(tests)/issue-7040-source' -import { Route as testsIssue7040TargetRouteImport } from './routes/(tests)/issue-7040-target' -import { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page' -import { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/lazy-with-loader-page' -import { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page' -import { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search' - -const testsVirtualPageLazyRouteImport = createFileRoute( - '/(tests)/virtual-page', -)() - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const testsIssue7040SourceRoute = testsIssue7040SourceRouteImport.update({ - id: '/(tests)/issue-7040-source', - path: '/issue-7040-source', - getParentRoute: () => rootRouteImport, -} as any) -const testsIssue7040TargetRoute = testsIssue7040TargetRouteImport.update({ - id: '/(tests)/issue-7040-target', - path: '/issue-7040-target', - getParentRoute: () => rootRouteImport, -} as any) -const testsLazyPageRoute = testsLazyPageRouteImport - .update({ - id: '/(tests)/lazy-page', - path: '/lazy-page', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route)) -const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport - .update({ - id: '/(tests)/lazy-with-loader-page', - path: '/lazy-with-loader-page', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => - import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route), - ) -const testsNormalPageRoute = testsNormalPageRouteImport.update({ - id: '/(tests)/normal-page', - path: '/normal-page', - getParentRoute: () => rootRouteImport, -} as any) -const testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({ - id: '/(tests)/page-with-search', - path: '/page-with-search', - getParentRoute: () => rootRouteImport, -} as any) -const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport - .update({ - id: '/(tests)/virtual-page', - path: '/virtual-page', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route)) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/issue-7040-source': typeof testsIssue7040SourceRoute - '/issue-7040-target': typeof testsIssue7040TargetRoute - '/lazy-page': typeof testsLazyPageRoute - '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute - '/normal-page': typeof testsNormalPageRoute - '/page-with-search': typeof testsPageWithSearchRoute - '/virtual-page': typeof testsVirtualPageLazyRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/issue-7040-source': typeof testsIssue7040SourceRoute - '/issue-7040-target': typeof testsIssue7040TargetRoute - '/lazy-page': typeof testsLazyPageRoute - '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute - '/normal-page': typeof testsNormalPageRoute - '/page-with-search': typeof testsPageWithSearchRoute - '/virtual-page': typeof testsVirtualPageLazyRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/(tests)/issue-7040-source': typeof testsIssue7040SourceRoute - '/(tests)/issue-7040-target': typeof testsIssue7040TargetRoute - '/(tests)/lazy-page': typeof testsLazyPageRoute - '/(tests)/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute - '/(tests)/normal-page': typeof testsNormalPageRoute - '/(tests)/page-with-search': typeof testsPageWithSearchRoute - '/(tests)/virtual-page': typeof testsVirtualPageLazyRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/issue-7040-source' - | '/issue-7040-target' - | '/lazy-page' - | '/lazy-with-loader-page' - | '/normal-page' - | '/page-with-search' - | '/virtual-page' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/issue-7040-source' - | '/issue-7040-target' - | '/lazy-page' - | '/lazy-with-loader-page' - | '/normal-page' - | '/page-with-search' - | '/virtual-page' - id: - | '__root__' - | '/' - | '/(tests)/issue-7040-source' - | '/(tests)/issue-7040-target' - | '/(tests)/lazy-page' - | '/(tests)/lazy-with-loader-page' - | '/(tests)/normal-page' - | '/(tests)/page-with-search' - | '/(tests)/virtual-page' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - testsIssue7040SourceRoute: typeof testsIssue7040SourceRoute - testsIssue7040TargetRoute: typeof testsIssue7040TargetRoute - testsLazyPageRoute: typeof testsLazyPageRoute - testsLazyWithLoaderPageRoute: typeof testsLazyWithLoaderPageRoute - testsNormalPageRoute: typeof testsNormalPageRoute - testsPageWithSearchRoute: typeof testsPageWithSearchRoute - testsVirtualPageLazyRoute: typeof testsVirtualPageLazyRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/issue-7040-source': { - id: '/(tests)/issue-7040-source' - path: '/issue-7040-source' - fullPath: '/issue-7040-source' - preLoaderRoute: typeof testsIssue7040SourceRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/issue-7040-target': { - id: '/(tests)/issue-7040-target' - path: '/issue-7040-target' - fullPath: '/issue-7040-target' - preLoaderRoute: typeof testsIssue7040TargetRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/lazy-page': { - id: '/(tests)/lazy-page' - path: '/lazy-page' - fullPath: '/lazy-page' - preLoaderRoute: typeof testsLazyPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/lazy-with-loader-page': { - id: '/(tests)/lazy-with-loader-page' - path: '/lazy-with-loader-page' - fullPath: '/lazy-with-loader-page' - preLoaderRoute: typeof testsLazyWithLoaderPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/normal-page': { - id: '/(tests)/normal-page' - path: '/normal-page' - fullPath: '/normal-page' - preLoaderRoute: typeof testsNormalPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/page-with-search': { - id: '/(tests)/page-with-search' - path: '/page-with-search' - fullPath: '/page-with-search' - preLoaderRoute: typeof testsPageWithSearchRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/virtual-page': { - id: '/(tests)/virtual-page' - path: '/virtual-page' - fullPath: '/virtual-page' - preLoaderRoute: typeof testsVirtualPageLazyRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - testsIssue7040SourceRoute: testsIssue7040SourceRoute, - testsIssue7040TargetRoute: testsIssue7040TargetRoute, - testsLazyPageRoute: testsLazyPageRoute, - testsLazyWithLoaderPageRoute: testsLazyWithLoaderPageRoute, - testsNormalPageRoute: testsNormalPageRoute, - testsPageWithSearchRoute: testsPageWithSearchRoute, - testsVirtualPageLazyRoute: testsVirtualPageLazyRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/issue-7040-source.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/issue-7040-source.tsx deleted file mode 100644 index 3c1702a942..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/issue-7040-source.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import * as React from 'react' -import { Link, createFileRoute } from '@tanstack/react-router' - -export const Route = createFileRoute('/(tests)/issue-7040-source')({ - component: Component, -}) - -const sectionCount = 180 - -function Component() { - return ( -
-
-

issue-7040-source

-

- Tall page for reproducing the scroll restoration race. -

-
- - - Go to issue-7040-target - - -
- {Array.from({ length: sectionCount }).map((_, index) => ( -
-

Section {index + 1}

-

- This section adds vertical space so the page can be scrolled far - enough to reproduce issue #7040. -

-
- ))} -
- -
- Bottom of issue-7040-source -
-
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/issue-7040-target.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/issue-7040-target.tsx deleted file mode 100644 index df541c6dbb..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/issue-7040-target.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import * as React from 'react' -import { createFileRoute } from '@tanstack/react-router' -import { sleep } from '../../posts' - -export const Route = createFileRoute('/(tests)/issue-7040-target')({ - loader: async () => { - await sleep(250) - return null - }, - component: Component, -}) - -function Component() { - return ( -
-
-

issue-7040-target

-

- Short page that should reset to top on navigation. -

-
- -
- {Array.from({ length: 18 }).map((_, index) => ( -
-

Target section {index + 1}

-

This page is intentionally much shorter than the source page.

-
- ))} -
- -
- Bottom of issue-7040-target -
-
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx deleted file mode 100644 index e3125409c0..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createLazyFileRoute('/(tests)/lazy-page')({ - component: Component, -}) - -function Component() { - return ( -
-

lazy-page

-
- -
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx deleted file mode 100644 index 29e40169bb..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx +++ /dev/null @@ -1,2 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/(tests)/lazy-page')({}) diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx deleted file mode 100644 index 8311f36f45..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/react-router' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createLazyFileRoute('/(tests)/lazy-with-loader-page')({ - component: Component, -}) - -function Component() { - return ( -
-

lazy-with-loader-page

-
- -
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx deleted file mode 100644 index 3fdc078569..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { sleep } from '../../posts' - -export const Route = createFileRoute('/(tests)/lazy-with-loader-page')({ - loader: async () => { - await sleep(1000) - return { foo: 'bar' } - }, -}) diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx deleted file mode 100644 index e8fc66cad9..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/normal-page')({ - component: Component, -}) - -function Component() { - return ( -
-

normal-page

-
- -
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx deleted file mode 100644 index 427b6f12b0..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -import { z } from 'zod' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/page-with-search')({ - validateSearch: z.object({ where: z.string() }), - component: Component, -}) - -function Component() { - return ( -
-

page-with-search

-
- -
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx deleted file mode 100644 index ae144463e8..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/react-router' -import * as React from 'react' - -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createLazyFileRoute('/(tests)/virtual-page')({ - component: Component, -}) - -function Component() { - return ( -
-

virtual-page

-
- -
- ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx deleted file mode 100644 index d4a22718ec..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx +++ /dev/null @@ -1,16 +0,0 @@ -export const atTheTopId = 'at-the-top' -export const atTheBottomId = 'at-the-bottom' - -export function ScrollBlock({ number = 100 }: { number?: number }) { - return ( - <> -
- {Array.from({ length: number }).map((_, i) => ( -
{i}
- ))} -
- At the bottom -
- - ) -} diff --git a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx b/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx deleted file mode 100644 index ed80300a68..0000000000 --- a/e2e/react-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import * as React from 'react' -import { - Link, - Outlet, - createRootRoute, - linkOptions, -} from '@tanstack/react-router' -import { TanStackRouterDevtools } from '@tanstack/react-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> -
- ) -} diff --git a/e2e/react-start/basic-react-query/src/routes/transition/count/query.tsx b/e2e/react-start/basic-react-query/src/routes/transition/count/query.tsx deleted file mode 100644 index 5bd2ff4341..0000000000 --- a/e2e/react-start/basic-react-query/src/routes/transition/count/query.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/react-router' -import { Suspense } from 'react' -import { queryOptions, useQuery } from '@tanstack/react-query' -import { z } from 'zod' - -const searchSchema = z.object({ - n: z.number().default(1), -}) - -const doubleQueryOptions = (n: number) => - queryOptions({ - queryKey: ['transition-double', n], - queryFn: async () => { - await new Promise((resolve) => setTimeout(resolve, 1000)) - return { n, double: n * 2 } - }, - placeholderData: (oldData) => oldData, - }) - -export const Route = createFileRoute('/transition/count/query')({ - validateSearch: searchSchema, - loader: ({ context: { queryClient }, location }) => { - const { n } = searchSchema.parse(location.search) - return queryClient.ensureQueryData(doubleQueryOptions(n)) - }, - component: TransitionPage, -}) - -function TransitionPage() { - const search = Route.useSearch() - - const doubleQuery = useQuery(doubleQueryOptions(search.n)) - - return ( - -
- ({ n: s.n + 1 })} - > - Increase - - -
-
n: {doubleQuery.data?.n}
-
- double: {doubleQuery.data?.double} -
-
-
-
- ) -} diff --git a/e2e/react-start/basic-react-query/src/routes/users.$userId.tsx b/e2e/react-start/basic-react-query/src/routes/users.$userId.tsx deleted file mode 100644 index 656fb6dbb8..0000000000 --- a/e2e/react-start/basic-react-query/src/routes/users.$userId.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { useSuspenseQuery } from '@tanstack/react-query' -import { ErrorComponent, createFileRoute } from '@tanstack/react-router' -import type { ErrorComponentProps } from '@tanstack/react-router' - -import { NotFound } from '~/components/NotFound' -import { userQueryOptions } from '~/utils/users' - -export const Route = createFileRoute('/users/$userId')({ - loader: async ({ context, params: { userId } }) => { - await context.queryClient.ensureQueryData(userQueryOptions(userId)) - }, - errorComponent: UserErrorComponent, - component: UserComponent, - notFoundComponent: () => { - return User not found - }, -}) - -export function UserErrorComponent({ error }: ErrorComponentProps) { - return -} - -function UserComponent() { - const params = Route.useParams() - const userQuery = useSuspenseQuery(userQueryOptions(params.userId)) - const user = userQuery.data - - return ( -
-

{user.name}

-
{user.email}
-
- ) -} diff --git a/e2e/react-start/basic-react-query/src/routes/users.index.tsx b/e2e/react-start/basic-react-query/src/routes/users.index.tsx deleted file mode 100644 index ea814e2cbf..0000000000 --- a/e2e/react-start/basic-react-query/src/routes/users.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/react-router' -export const Route = createFileRoute('/users/')({ - component: UsersIndexComponent, -}) - -function UsersIndexComponent() { - return
Select a user.
-} diff --git a/e2e/react-start/basic-react-query/src/routes/users.tsx b/e2e/react-start/basic-react-query/src/routes/users.tsx deleted file mode 100644 index 1b56bb9890..0000000000 --- a/e2e/react-start/basic-react-query/src/routes/users.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { useSuspenseQuery } from '@tanstack/react-query' -import { Link, Outlet, createFileRoute } from '@tanstack/react-router' - -import { usersQueryOptions } from '~/utils/users' - -export const Route = createFileRoute('/users')({ - loader: async ({ context }) => { - await context.queryClient.ensureQueryData(usersQueryOptions()) - }, - component: UsersComponent, -}) - -function UsersComponent() { - const usersQuery = useSuspenseQuery(usersQueryOptions()) - - return ( -
-
    - {[ - ...usersQuery.data, - { id: 'i-do-not-exist', name: 'Non-existent User', email: '' }, - ].map((user) => { - return ( -
  • - -
    {user.name}
    - -
  • - ) - })} -
-
- -
- ) -} diff --git a/e2e/react-start/basic-react-query/src/styles/app.css b/e2e/react-start/basic-react-query/src/styles/app.css deleted file mode 100644 index 37c1f5a6e2..0000000000 --- a/e2e/react-start/basic-react-query/src/styles/app.css +++ /dev/null @@ -1,30 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -@layer base { - html { - color-scheme: light dark; - } - - * { - @apply border-gray-200 dark:border-gray-800; - } - - html, - body { - @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200; - } - - .using-mouse * { - outline: none !important; - } -} diff --git a/e2e/react-start/basic-react-query/src/utils/posts.tsx b/e2e/react-start/basic-react-query/src/utils/posts.tsx deleted file mode 100644 index abb6e95b92..0000000000 --- a/e2e/react-start/basic-react-query/src/utils/posts.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { queryOptions } from '@tanstack/react-query' -import { notFound } from '@tanstack/react-router' -import { createServerFn } from '@tanstack/react-start' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = createServerFn({ method: 'GET' }).handler( - async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) - }, -) - -export const postsQueryOptions = () => - queryOptions({ - queryKey: ['posts'], - queryFn: () => fetchPosts(), - }) - -export const fetchPost = createServerFn({ method: 'GET' }) - .validator((postId: string) => postId) - .handler(async ({ data: postId }) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - console.error(err) - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post - }) - -export const postQueryOptions = (postId: string) => - queryOptions({ - queryKey: ['post', postId], - queryFn: () => fetchPost({ data: postId }), - }) diff --git a/e2e/react-start/basic-react-query/src/utils/users.tsx b/e2e/react-start/basic-react-query/src/utils/users.tsx deleted file mode 100644 index 15216680e9..0000000000 --- a/e2e/react-start/basic-react-query/src/utils/users.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { queryOptions } from '@tanstack/react-query' -import { createIsomorphicFn } from '@tanstack/react-start' -import { getRequestUrl } from '@tanstack/react-start/server' -import axios from 'redaxios' - -export type User = { - id: number - name: string - email: string -} - -const getOrigin = createIsomorphicFn() - .server(() => getRequestUrl().origin) - .client(() => window.location.origin) - -export const usersQueryOptions = () => - queryOptions({ - queryKey: ['users'], - queryFn: () => - axios - .get>(getOrigin() + '/api/users') - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch users') - }), - }) - -export const userQueryOptions = (id: string) => - queryOptions({ - queryKey: ['users', id], - queryFn: () => - axios - .get(getOrigin() + '/api/users/' + id) - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch user') - }), - }) diff --git a/e2e/react-start/basic-react-query/tests/app.spec.ts b/e2e/react-start/basic-react-query/tests/app.spec.ts deleted file mode 100644 index ab2469f68d..0000000000 --- a/e2e/react-start/basic-react-query/tests/app.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('Navigating to post', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await page.getByRole('link', { name: 'Deep View' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating to user', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Users' }).click() - await page.getByRole('link', { name: 'Leanne Graham' }).click() - await expect(page.getByRole('heading')).toContainText('Leanne Graham') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Layout', exact: true }).click() - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('body')).toContainText("I'm A!") - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('body')).toContainText("I'm B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Manual Suspense boundaries should transition on navigation', async ({ - page, -}) => { - // Navigate to the suspense transition test page - await page.goto('/suspense-transition') - - // Wait for initial content to load - await expect(page.getByTestId('n-value')).toHaveText('1') - await expect(page.getByTestId('double-value')).toHaveText('2') - - // Click the increase button to trigger navigation with search params change - await page.getByTestId('increase-button').click() - - // During the transition, the old content should remain visible - // and the fallback should NOT be shown - await expect(page.getByTestId('suspense-fallback')).not.toBeVisible({ - timeout: 100, - }) - - // The old content should still be visible during transition - await expect(page.getByTestId('suspense-content')).toBeVisible() - - // After transition completes, new content should be visible - await expect(page.getByTestId('n-value')).toHaveText('2') - await expect(page.getByTestId('double-value')).toHaveText('4') -}) diff --git a/e2e/react-start/basic-react-query/tests/transition.spec.ts b/e2e/react-start/basic-react-query/tests/transition.spec.ts deleted file mode 100644 index 2c28fc72a2..0000000000 --- a/e2e/react-start/basic-react-query/tests/transition.spec.ts +++ /dev/null @@ -1,95 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('transitions/count/query should keep old values visible during navigation', async ({ - page, -}) => { - await page.goto('/transition/count/query') - - await expect(page.getByTestId('n-value')).toContainText('n: 1') - await expect(page.getByTestId('double-value')).toContainText('double: 2') - - const bodyTexts: Array = [] - - const pollInterval = setInterval(async () => { - const text = await page - .locator('body') - .textContent() - .catch(() => '') - if (text) bodyTexts.push(text) - }, 50) - - // 1 click - - page.getByTestId('increase-button').click() - - await expect(page.getByTestId('n-value')).toContainText('n: 1', { - timeout: 2_000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 2', { - timeout: 2_000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 2', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 4', { - timeout: 2000, - }) - - // 2 clicks - - // page.getByTestId('increase-button').click() - // page.getByTestId('increase-button').click() - - // await expect(page.getByTestId('n-value')).toContainText('n: 2', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 4', { - // timeout: 2000, - // }) - - // await page.waitForTimeout(200) - - // await expect(page.getByTestId('n-value')).toContainText('n: 4', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 8', { - // timeout: 2000, - // }) - - // // 3 clicks - - // page.getByTestId('increase-button').click() - // page.getByTestId('increase-button').click() - // page.getByTestId('increase-button').click() - - // await expect(page.getByTestId('n-value')).toContainText('n: 4', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 8', { - // timeout: 2000, - // }) - - // await page.waitForTimeout(200) - - // await expect(page.getByTestId('n-value')).toContainText('n: 7', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 14', { - // timeout: 2000, - // }) - - clearInterval(pollInterval) - - // With proper transitions, old values should remain visible until new ones arrive - const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...')) - - if (hasLoadingText) { - throw new Error( - 'FAILED: "Loading..." appeared during navigation. ' + - 'Solid Router should use transitions to keep old values visible.', - ) - } -}) diff --git a/e2e/react-start/basic-react-query/tsconfig.json b/e2e/react-start/basic-react-query/tsconfig.json deleted file mode 100644 index c7a0597e4b..0000000000 --- a/e2e/react-start/basic-react-query/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/react-start/basic-react-query/vite.config.ts b/e2e/react-start/basic-react-query/vite.config.ts deleted file mode 100644 index 6c9a4c347a..0000000000 --- a/e2e/react-start/basic-react-query/vite.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' -import viteReact from '@vitejs/plugin-react' -import tailwindcss from '@tailwindcss/vite' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - plugins: [tailwindcss(), tanstackStart(), viteReact()], -}) diff --git a/e2e/react-start/basic-tsr-config/.devcontainer/devcontainer.json b/e2e/react-start/basic-tsr-config/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-start/basic-tsr-config/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-start/basic-tsr-config/.gitignore b/e2e/react-start/basic-tsr-config/.gitignore deleted file mode 100644 index 08eba9e706..0000000000 --- a/e2e/react-start/basic-tsr-config/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -node_modules -package-lock.json -yarn.lock - -.DS_Store -.cache -.env -.vercel -.output -/build/ -/api/ -/server/build -/public/build# Sentry Config File -.env.sentry-build-plugin -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ - -count.txt diff --git a/e2e/react-start/basic-tsr-config/.prettierignore b/e2e/react-start/basic-tsr-config/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/react-start/basic-tsr-config/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/react-start/basic-tsr-config/README.md b/e2e/react-start/basic-tsr-config/README.md deleted file mode 100644 index 90cba4aac1..0000000000 --- a/e2e/react-start/basic-tsr-config/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Welcome to TanStack.com! - -This site is built with TanStack Router! - -- [TanStack Router Docs](https://tanstack.com/router) - -It's deployed automagically with Netlify! - -- [Netlify](https://netlify.com/) - -## Development - -From your terminal: - -```sh -pnpm install -pnpm dev -``` - -This starts your app in development mode, rebuilding assets on file changes. - -## Editing and previewing the docs of TanStack projects locally - -The documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app. -In production, the markdown doc pages are fetched from the GitHub repos of the projects, but in development they are read from the local file system. - -Follow these steps if you want to edit the doc pages of a project (in these steps we'll assume it's [`TanStack/form`](https://github.com/tanstack/form)) and preview them locally : - -1. Create a new directory called `tanstack`. - -```sh -mkdir tanstack -``` - -2. Enter the directory and clone this repo and the repo of the project there. - -```sh -cd tanstack -git clone git@github.com:TanStack/tanstack.com.git -git clone git@github.com:TanStack/form.git -``` - -> [!NOTE] -> Your `tanstack` directory should look like this: -> -> ``` -> tanstack/ -> | -> +-- form/ -> | -> +-- tanstack.com/ -> ``` - -> [!WARNING] -> Make sure the name of the directory in your local file system matches the name of the project's repo. For example, `tanstack/form` must be cloned into `form` (this is the default) instead of `some-other-name`, because that way, the doc pages won't be found. - -3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode: - -```sh -cd tanstack.com -pnpm i -# The app will run on https://localhost:3000 by default -pnpm dev -``` - -4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`. - -> [!NOTE] -> The updated pages need to be manually reloaded in the browser. - -> [!WARNING] -> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page! diff --git a/e2e/react-start/basic-tsr-config/package.json b/e2e/react-start/basic-tsr-config/package.json deleted file mode 100644 index 99e681ac9d..0000000000 --- a/e2e/react-start/basic-tsr-config/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "tanstack-react-start-e2e-basic-tsr-config", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev", - "build": "rimraf ./count.txt && vite build && tsc --noEmit", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-start": "workspace:^", - "react": "^19.0.0", - "react-dom": "^19.0.0" - }, - "devDependencies": { - "@tanstack/router-e2e-utils": "workspace:^", - "@types/node": "^22.10.2", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "srvx": "^1.0.0", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "rimraf": "catalog:" - } -} diff --git a/e2e/react-start/basic-tsr-config/playwright.config.ts b/e2e/react-start/basic-tsr-config/playwright.config.ts deleted file mode 100644 index 82678ac00b..0000000000 --- a/e2e/react-start/basic-tsr-config/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts b/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts deleted file mode 100644 index dceedffdc1..0000000000 --- a/e2e/react-start/basic-tsr-config/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' - fileRoutesByTo: FileRoutesByTo - to: '/' - id: '__root__' | '/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/react-start/basic-tsr-config/src/router.tsx b/e2e/react-start/basic-tsr-config/src/router.tsx deleted file mode 100644 index 82a730704a..0000000000 --- a/e2e/react-start/basic-tsr-config/src/router.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - const router = createRouter({ - routeTree, - scrollRestoration: true, - }) - - return router -} diff --git a/e2e/react-start/basic-tsr-config/src/routes/__root.tsx b/e2e/react-start/basic-tsr-config/src/routes/__root.tsx deleted file mode 100644 index fd039a743a..0000000000 --- a/e2e/react-start/basic-tsr-config/src/routes/__root.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import * as React from 'react' -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/react-router' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { - charSet: 'utf-8', - }, - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - { - title: 'TanStack Start Starter', - }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - ) -} - -function RootDocument({ children }: { children: React.ReactNode }) { - return ( - - - - - - {children} - - - - ) -} diff --git a/e2e/react-start/basic-tsr-config/src/routes/index.tsx b/e2e/react-start/basic-tsr-config/src/routes/index.tsx deleted file mode 100644 index aaa4bdfdb3..0000000000 --- a/e2e/react-start/basic-tsr-config/src/routes/index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import fs from 'node:fs' -import { createFileRoute, useRouter } from '@tanstack/react-router' -import { createServerFn } from '@tanstack/react-start' - -const filePath = 'count.txt' - -const getCount = createServerFn({ - method: 'GET', -}).handler(async () => { - const number = await fs.promises.readFile(filePath, 'utf-8').catch(() => '0') - return parseInt(number || '0') -}) - -const updateCount = createServerFn({ method: 'POST' }) - .validator((d: number) => d) - .handler(async ({ data }) => { - const count = await getCount() - await fs.promises.writeFile(filePath, `${count + data}`) - }) -export const Route = createFileRoute('/')({ - component: Home, - loader: async () => await getCount(), -}) - -function Home() { - const router = useRouter() - const state = Route.useLoaderData() - - return ( - - ) -} diff --git a/e2e/react-start/basic-tsr-config/tests/app.spec.ts b/e2e/react-start/basic-tsr-config/tests/app.spec.ts deleted file mode 100644 index 07a562fcb3..0000000000 --- a/e2e/react-start/basic-tsr-config/tests/app.spec.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('opening the app', async ({ page }) => { - await page.goto('/') - await page.waitForLoadState('networkidle') - - const button = page.getByTestId('add-button') - - await expect(button).toContainText('Add 1 to 0?') - - await button.click() - await page.waitForLoadState('networkidle') - - await expect(button).toContainText('Add 1 to 1?') -}) diff --git a/e2e/react-start/basic-tsr-config/tsconfig.json b/e2e/react-start/basic-tsr-config/tsconfig.json deleted file mode 100644 index f3895f6eb1..0000000000 --- a/e2e/react-start/basic-tsr-config/tsconfig.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "react-jsx", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/app/*"] - }, - "noEmit": true - } -} diff --git a/e2e/react-start/basic-tsr-config/vite.config.ts b/e2e/react-start/basic-tsr-config/vite.config.ts deleted file mode 100644 index 8bb2daf505..0000000000 --- a/e2e/react-start/basic-tsr-config/vite.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/react-start/plugin/vite' - -export default defineConfig({ - server: { - port: 3000, - }, - plugins: [ - tanstackStart({ - srcDirectory: './src/app', - router: { - entry: '../router.tsx', - routesDirectory: '../routes', - generatedRouteTree: '../routeTree.gen.ts', - }, - }), - ], -}) diff --git a/e2e/react-start/basic/.devcontainer/devcontainer.json b/e2e/react-start/basic/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/react-start/basic/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/react-start/basic/.gitignore b/e2e/react-start/basic/.gitignore deleted file mode 100644 index a5f07919aa..0000000000 --- a/e2e/react-start/basic/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -node_modules -package-lock.json -yarn.lock - -.DS_Store -.cache -.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-vite-*/ -/dist-rsbuild-*/ \ No newline at end of file diff --git a/e2e/react-start/basic/.prettierignore b/e2e/react-start/basic/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/react-start/basic/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/react-start/basic/package.json b/e2e/react-start/basic/package.json deleted file mode 100644 index 3a1a4ea9c8..0000000000 --- a/e2e/react-start/basic/package.json +++ /dev/null @@ -1,132 +0,0 @@ -{ - "name": "tanstack-react-start-e2e-basic", - "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", - "preview:rsbuild": "rsbuild preview", - "start": "node server.js", - "test:e2e:local": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/react-router": "workspace:^", - "@tanstack/react-router-devtools": "workspace:^", - "@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", - "redaxios": "catalog:", - "tailwind-merge": "^3.6.0" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-react": "^2.0.0", - "@tailwindcss/postcss": "^4.2.2", - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/js-cookie": "^3.0.6", - "@types/node": "^22.10.2", - "@types/react": "^19.0.8", - "@types/react-dom": "^19.0.3", - "@vitejs/plugin-react": "^6.0.1", - "combinate": "^1.1.11", - "srvx": "^1.0.0", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "zod": "^4.4.3" - }, - "nx": { - "targets": { - "test:e2e--vite-spa--dev": { - "dependsOn": [ - "^build" - ] - }, - "test:e2e--rsbuild-spa--dev": { - "dependsOn": [ - "^build" - ] - } - }, - "metadata": { - "playwrightModes": [ - { - "toolchain": "vite", - "mode": "ssr" - }, - { - "toolchain": "vite", - "mode": "spa" - }, - { - "toolchain": "vite", - "mode": "spa", - "name": "dev", - "env": { - "E2E_DEV_SERVER": "true" - } - }, - { - "toolchain": "vite", - "mode": "prerender", - "env": { - "NODE_OPTIONS": "--import=@tanstack/router-e2e-utils/mock-api" - } - }, - { - "toolchain": "vite", - "mode": "preview" - }, - { - "toolchain": "rsbuild", - "mode": "ssr" - }, - { - "toolchain": "rsbuild", - "mode": "ssr", - "name": "iife", - "env": { - "TSS_RSB_CLIENT_OUTPUT": "iife" - } - }, - { - "toolchain": "rsbuild", - "mode": "spa" - }, - { - "toolchain": "rsbuild", - "mode": "spa", - "name": "dev", - "env": { - "E2E_DEV_SERVER": "true" - } - }, - { - "toolchain": "rsbuild", - "mode": "prerender", - "env": { - "NODE_OPTIONS": "--import=@tanstack/router-e2e-utils/mock-api" - } - }, - { - "toolchain": "rsbuild", - "mode": "preview" - } - ] - } - } -} diff --git a/e2e/react-start/basic/playwright.config.ts b/e2e/react-start/basic/playwright.config.ts deleted file mode 100644 index bb4c2cb761..0000000000 --- a/e2e/react-start/basic/playwright.config.ts +++ /dev/null @@ -1,71 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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}` -const previewCommand = - toolchain === 'rsbuild' - ? `pnpm preview:rsbuild --host 0.0.0.0 --port ${PORT}` - : `pnpm preview --host 0.0.0.0 --outDir ${distDir} --port ${PORT}` -const devCommand = - toolchain === 'rsbuild' - ? `pnpm dev:rsbuild --port ${PORT}` - : `pnpm dev:vite --port ${PORT}` -const commandByMode = devServer - ? devCommand - : mode === 'preview' - ? previewCommand - : 'pnpm start' -/** - * 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']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: commandByMode, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ''} --import=@tanstack/router-e2e-utils/mock-api`, - MODE: mode, - E2E_TOOLCHAIN: toolchain, - START_PORT: '0', - PORT: String(PORT), - E2E_DIST_DIR: distDir, - ...(process.env.TSS_RSB_CLIENT_OUTPUT - ? { TSS_RSB_CLIENT_OUTPUT: process.env.TSS_RSB_CLIENT_OUTPUT } - : {}), - }, - }, - - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], -}) diff --git a/e2e/react-start/basic/postcss.config.mjs b/e2e/react-start/basic/postcss.config.mjs deleted file mode 100644 index a7f73a2d1d..0000000000 --- a/e2e/react-start/basic/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export default { - plugins: { - '@tailwindcss/postcss': {}, - }, -} diff --git a/e2e/react-start/basic/public/android-chrome-192x192.png b/e2e/react-start/basic/public/android-chrome-192x192.png deleted file mode 100644 index 09c8324f8c..0000000000 Binary files a/e2e/react-start/basic/public/android-chrome-192x192.png and /dev/null differ diff --git a/e2e/react-start/basic/public/android-chrome-512x512.png b/e2e/react-start/basic/public/android-chrome-512x512.png deleted file mode 100644 index 11d626ea3d..0000000000 Binary files a/e2e/react-start/basic/public/android-chrome-512x512.png and /dev/null differ diff --git a/e2e/react-start/basic/public/apple-touch-icon.png b/e2e/react-start/basic/public/apple-touch-icon.png deleted file mode 100644 index 5a9423cc02..0000000000 Binary files a/e2e/react-start/basic/public/apple-touch-icon.png and /dev/null differ diff --git a/e2e/react-start/basic/public/async-user-script.js b/e2e/react-start/basic/public/async-user-script.js deleted file mode 100644 index 34f4c034c0..0000000000 --- a/e2e/react-start/basic/public/async-user-script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('ASYNC_USER_SCRIPT loaded') -window.ASYNC_USER_SCRIPT = true diff --git a/e2e/react-start/basic/public/before-scripts-async-script.js b/e2e/react-start/basic/public/before-scripts-async-script.js deleted file mode 100644 index 7d082fea1c..0000000000 --- a/e2e/react-start/basic/public/before-scripts-async-script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('BEFORE_SCRIPTS_ASYNC_SCRIPT loaded') -window.BEFORE_SCRIPTS_ASYNC_SCRIPT = true diff --git a/e2e/react-start/basic/public/before-scripts-script.js b/e2e/react-start/basic/public/before-scripts-script.js deleted file mode 100644 index 7150d19d40..0000000000 --- a/e2e/react-start/basic/public/before-scripts-script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('BEFORE_SCRIPTS_SCRIPT loaded') -window.BEFORE_SCRIPTS_SCRIPT = true diff --git a/e2e/react-start/basic/public/favicon-16x16.png b/e2e/react-start/basic/public/favicon-16x16.png deleted file mode 100644 index e3389b0044..0000000000 Binary files a/e2e/react-start/basic/public/favicon-16x16.png and /dev/null differ diff --git a/e2e/react-start/basic/public/favicon-32x32.png b/e2e/react-start/basic/public/favicon-32x32.png deleted file mode 100644 index 900c77d444..0000000000 Binary files a/e2e/react-start/basic/public/favicon-32x32.png and /dev/null differ diff --git a/e2e/react-start/basic/public/favicon.ico b/e2e/react-start/basic/public/favicon.ico deleted file mode 100644 index 1a1751676f..0000000000 Binary files a/e2e/react-start/basic/public/favicon.ico and /dev/null differ diff --git a/e2e/react-start/basic/public/favicon.png b/e2e/react-start/basic/public/favicon.png deleted file mode 100644 index 1e77bc0609..0000000000 Binary files a/e2e/react-start/basic/public/favicon.png and /dev/null differ diff --git a/e2e/react-start/basic/public/head-async-script.js b/e2e/react-start/basic/public/head-async-script.js deleted file mode 100644 index 3da8a928cd..0000000000 --- a/e2e/react-start/basic/public/head-async-script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('HEAD_ASYNC_SCRIPT loaded') -window.HEAD_ASYNC_SCRIPT = true diff --git a/e2e/react-start/basic/public/head-script.js b/e2e/react-start/basic/public/head-script.js deleted file mode 100644 index 3a64b23438..0000000000 --- a/e2e/react-start/basic/public/head-script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('HEAD_SCRIPT loaded') -window.HEAD_SCRIPT = true diff --git a/e2e/react-start/basic/public/script.js b/e2e/react-start/basic/public/script.js deleted file mode 100644 index 897477e7d0..0000000000 --- a/e2e/react-start/basic/public/script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_1 loaded') -window.SCRIPT_1 = true diff --git a/e2e/react-start/basic/public/script2.js b/e2e/react-start/basic/public/script2.js deleted file mode 100644 index 819af30daf..0000000000 --- a/e2e/react-start/basic/public/script2.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_2 loaded') -window.SCRIPT_2 = true diff --git a/e2e/react-start/basic/public/site.webmanifest b/e2e/react-start/basic/public/site.webmanifest deleted file mode 100644 index fa99de77db..0000000000 --- a/e2e/react-start/basic/public/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/e2e/react-start/basic/public/user-script.js b/e2e/react-start/basic/public/user-script.js deleted file mode 100644 index 8d06a610c0..0000000000 --- a/e2e/react-start/basic/public/user-script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('USER_SCRIPT loaded') -window.USER_SCRIPT = true diff --git a/e2e/react-start/basic/rsbuild.config.ts b/e2e/react-start/basic/rsbuild.config.ts deleted file mode 100644 index 23072b6c1b..0000000000 --- a/e2e/react-start/basic/rsbuild.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginReact } from '@rsbuild/plugin-react' -import { tanstackStart } from '@tanstack/react-start/plugin/rsbuild' -import { getStartModeConfig } from './start-mode-config' - -const outDir = process.env.E2E_DIST_DIR ?? 'dist' -const startModeConfig = getStartModeConfig() - -export default defineConfig({ - plugins: [pluginReact(), tanstackStart(startModeConfig)], - output: { - distPath: { - root: outDir, - }, - }, -}) diff --git a/e2e/react-start/basic/server.js b/e2e/react-start/basic/server.js deleted file mode 100644 index 3e1ddab400..0000000000 --- a/e2e/react-start/basic/server.js +++ /dev/null @@ -1,98 +0,0 @@ -import fs from 'node:fs' -import path from 'node:path' -import { toNodeHandler } from 'srvx/node' -import express from 'express' -import { createProxyMiddleware } from 'http-proxy-middleware' - -const port = Number(process.env.PORT ?? 3000) - -const startPort = Number(process.env.START_PORT ?? 0) - -const isSpaMode = process.env.MODE === 'spa' -const isPrerender = process.env.MODE === 'prerender' -const distDir = process.env.E2E_DIST_DIR || 'dist' -const distClientDir = path.resolve(distDir, 'client') - -function resolveDistServerEntryPath() { - 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 async function createStartServer() { - const distServerEntryPath = resolveDistServerEntryPath() - const server = (await import(distServerEntryPath)).default - const nodeHandler = toNodeHandler(server.fetch) - - const app = express() - - // to keep testing uniform stop express from redirecting /posts to /posts/ - // when serving pre-rendered pages - app.use(express.static(distClientDir, { redirect: !isPrerender })) - - app.use(async (req, res, next) => { - try { - await nodeHandler(req, res) - } catch (error) { - next(error) - } - }) - - return { app } -} - -export async function createSpaServer(backendPort) { - const app = express() - - app.use( - '/api', - createProxyMiddleware({ - target: `http://localhost:${backendPort}/api`, // Replace with your target server's URL - changeOrigin: false, // Needed for virtual hosted sites, - }), - ) - - app.use( - '/_serverFn', - createProxyMiddleware({ - target: `http://localhost:${backendPort}/_serverFn`, // Replace with your target server's URL - changeOrigin: false, // Needed for virtual hosted sites, - }), - ) - - app.use(express.static(distClientDir)) - - app.get('/{*splat}', (req, res) => { - res.sendFile('index.html', { root: distClientDir }) - }) - - return { app } -} - -// Bind the backend first so the SPA proxy receives the port actually held by it. -const { app: startApp } = await createStartServer() -const backend = startApp.listen(isSpaMode ? startPort : port, async (error) => { - if (error) { - throw error - } - const backendPort = backend.address().port - if (isSpaMode) { - const { app } = await createSpaServer(backendPort) - const frontend = app.listen(port, (frontendError) => { - if (frontendError) { - throw frontendError - } - console.info(`E2E app: http://localhost:${frontend.address().port}`) - }) - } else { - console.info(`E2E app: http://localhost:${backendPort}`) - } -}) diff --git a/e2e/react-start/basic/src/client.tsx b/e2e/react-start/basic/src/client.tsx deleted file mode 100644 index fdfbde8677..0000000000 --- a/e2e/react-start/basic/src/client.tsx +++ /dev/null @@ -1,16 +0,0 @@ -// DO NOT DELETE THIS FILE!!! -// This file is a good smoke test to make sure the custom client entry is working -import { StrictMode, startTransition } from 'react' -import { hydrateRoot } from 'react-dom/client' -import { StartClient } from '@tanstack/react-start/client' - -console.log("[client-entry]: using custom client entry in 'src/client.tsx'") - -startTransition(() => { - hydrateRoot( - document, - - - , - ) -}) diff --git a/e2e/react-start/basic/src/components/CustomMessage.tsx b/e2e/react-start/basic/src/components/CustomMessage.tsx deleted file mode 100644 index d00e4eac60..0000000000 --- a/e2e/react-start/basic/src/components/CustomMessage.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import * as React from 'react' - -export function CustomMessage({ message }: { message: string }) { - return ( -
-
This is a custom message:
-

{message}

-
- ) -} diff --git a/e2e/react-start/basic/src/components/DefaultCatchBoundary.tsx b/e2e/react-start/basic/src/components/DefaultCatchBoundary.tsx deleted file mode 100644 index 405fb5f4a7..0000000000 --- a/e2e/react-start/basic/src/components/DefaultCatchBoundary.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - ErrorComponent, - Link, - useLocation, - useRouter, -} from '@tanstack/react-router' -import type { ErrorComponentProps } from '@tanstack/react-router' - -export function DefaultCatchBoundary({ error }: ErrorComponentProps) { - const router = useRouter() - const isRoot = useLocation({ - select: (location) => location.pathname === '/', - }) - - console.error(error) - - return ( -
- -
- - {isRoot ? ( - - Home - - ) : ( - { - e.preventDefault() - window.history.back() - }} - > - Go Back - - )} -
-
- ) -} diff --git a/e2e/react-start/basic/src/components/NotFound.tsx b/e2e/react-start/basic/src/components/NotFound.tsx deleted file mode 100644 index 4e84e3f8e0..0000000000 --- a/e2e/react-start/basic/src/components/NotFound.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Link } from '@tanstack/react-router' - -export function NotFound({ children }: { children?: any }) { - return ( -
-
- {children ||

The page you are looking for does not exist.

} -
-

- - - Start Over - -

-
- ) -} diff --git a/e2e/react-start/basic/src/components/RedirectOnClick.tsx b/e2e/react-start/basic/src/components/RedirectOnClick.tsx deleted file mode 100644 index 37b434c2e7..0000000000 --- a/e2e/react-start/basic/src/components/RedirectOnClick.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useServerFn } from '@tanstack/react-start' -import { throwRedirect } from './throwRedirect' - -interface RedirectOnClickProps { - target: 'internal' | 'external' - reloadDocument?: boolean - externalHost?: string -} - -export function RedirectOnClick({ - target, - reloadDocument, - externalHost, -}: RedirectOnClickProps) { - const execute = useServerFn(throwRedirect) - return ( - - ) -} diff --git a/e2e/react-start/basic/src/components/WindowSize.tsx b/e2e/react-start/basic/src/components/WindowSize.tsx deleted file mode 100644 index 5365cec5c9..0000000000 --- a/e2e/react-start/basic/src/components/WindowSize.tsx +++ /dev/null @@ -1,19 +0,0 @@ -/** - * This component accesses `window` at module scope, which would throw - * if this module is ever imported on the server. The compiler optimization - * for ensures this module is DCE'd from the server bundle - * entirely, preventing the error. - */ - -// This throws at module import time on the server since `window` doesn't exist -const initialWidth = window.innerWidth -const initialHeight = window.innerHeight - -export function WindowSize() { - return ( -
-

Window width: {initialWidth}

-

Window height: {initialHeight}

-
- ) -} diff --git a/e2e/react-start/basic/src/components/throwRedirect.ts b/e2e/react-start/basic/src/components/throwRedirect.ts deleted file mode 100644 index 6a7a011912..0000000000 --- a/e2e/react-start/basic/src/components/throwRedirect.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { redirect } from '@tanstack/react-router' -import { createServerFn } from '@tanstack/react-start' - -export const throwRedirect = createServerFn() - .validator( - (opts: { - target: 'internal' | 'external' - reloadDocument?: boolean - externalHost?: string - }) => opts, - ) - .handler((ctx) => { - if (ctx.data.target === 'internal') { - throw redirect({ - to: '/posts', - reloadDocument: ctx.data.reloadDocument, - }) - } - const href = ctx.data.externalHost ?? 'http://example.com' - throw redirect({ - href, - }) - }) diff --git a/e2e/react-start/basic/src/raw-stream-fns.ts b/e2e/react-start/basic/src/raw-stream-fns.ts deleted file mode 100644 index 912837c218..0000000000 --- a/e2e/react-start/basic/src/raw-stream-fns.ts +++ /dev/null @@ -1,567 +0,0 @@ -import { createServerFn, RawStream } from '@tanstack/react-start' - -// Helper to create a delayed Uint8Array stream -function createDelayedStream( - chunks: Array, - delayMs: number, -): ReadableStream { - return new ReadableStream({ - async start(controller) { - for (const chunk of chunks) { - await new Promise((resolve) => setTimeout(resolve, delayMs)) - controller.enqueue(chunk) - } - controller.close() - }, - }) -} - -// Helper to create a stream with variable delays per chunk -// Each entry is [chunk, delayBeforeMs] - delay happens BEFORE enqueueing the chunk -function createVariableDelayStream( - chunksWithDelays: Array<[Uint8Array, number]>, -): ReadableStream { - return new ReadableStream({ - async start(controller) { - for (const [chunk, delayMs] of chunksWithDelays) { - await new Promise((resolve) => setTimeout(resolve, delayMs)) - controller.enqueue(chunk) - } - controller.close() - }, - }) -} - -// Helper to encode text to Uint8Array -function encode(text: string): Uint8Array { - return new TextEncoder().encode(text) -} - -// Export helpers for use in components and SSR routes -export { encode, createDelayedStream, concatBytes } - -// Expected data for hint tests - defined here for both server and client verification -// Test 7: Text hint with pure text -export const TEST7_CHUNKS = [ - encode('Hello, '), - encode('World! '), - encode('This is text.'), -] -export const TEST7_EXPECTED = concatBytes(TEST7_CHUNKS) - -// Test 8: Text hint with pure binary (invalid UTF-8) -export const TEST8_CHUNKS = [ - new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]), - new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]), -] -export const TEST8_EXPECTED = concatBytes(TEST8_CHUNKS) - -// Test 9: Text hint with mixed content -export const TEST9_CHUNKS = [ - encode('Valid UTF-8 text'), - new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8 - encode(' More text'), -] -export const TEST9_EXPECTED = concatBytes(TEST9_CHUNKS) - -// Test 10: Binary hint with text data -export const TEST10_CHUNKS = [encode('This is text but using binary hint')] -export const TEST10_EXPECTED = concatBytes(TEST10_CHUNKS) - -// Test 11: Binary hint with pure binary -export const TEST11_CHUNKS = [ - new Uint8Array([0x00, 0x01, 0x02, 0xff, 0xfe, 0xfd]), -] -export const TEST11_EXPECTED = concatBytes(TEST11_CHUNKS) - -// Helper to concatenate byte arrays -function concatBytes(chunks: Array): Uint8Array { - const totalLength = chunks.reduce((acc, c) => acc + c.length, 0) - const result = new Uint8Array(totalLength) - let offset = 0 - for (const chunk of chunks) { - result.set(chunk, offset) - offset += chunk.length - } - return result -} - -// Test 1: Simple single raw stream -export const singleRawStreamFn = createServerFn().handler(async () => { - const stream = createDelayedStream( - [encode('chunk1'), encode('chunk2'), encode('chunk3')], - 50, - ) - return { - message: 'Single stream test', - data: new RawStream(stream), - } -}) - -// Test 2: Multiple raw streams -export const multipleRawStreamsFn = createServerFn().handler(async () => { - const stream1 = createDelayedStream( - [encode('stream1-a'), encode('stream1-b')], - 30, - ) - const stream2 = createDelayedStream( - [encode('stream2-a'), encode('stream2-b')], - 50, - ) - return { - message: 'Multiple streams test', - first: new RawStream(stream1), - second: new RawStream(stream2), - } -}) - -// Test 3: JSON streaming ends before raw stream -export const jsonEndsFirstFn = createServerFn().handler(async () => { - // Slow raw stream (takes 500ms total) - const slowStream = createDelayedStream( - [encode('slow-1'), encode('slow-2'), encode('slow-3'), encode('slow-4')], - 125, - ) - return { - message: 'JSON ends first test', - timestamp: Date.now(), - slowData: new RawStream(slowStream), - } -}) - -// Test 4: Raw stream ends before JSON streaming (fast stream, deferred JSON) -export const rawEndsFirstFn = createServerFn().handler(async () => { - // Fast raw stream (completes quickly) - const fastStream = createDelayedStream([encode('fast-done')], 10) - - // Deferred promise - NOT awaited, so it streams as deferred JSON - const deferredData = new Promise((resolve) => - setTimeout(() => resolve('deferred-json-data'), 200), - ) - - return { - message: 'Raw ends first test', - deferredData, - fastData: new RawStream(fastStream), - } -}) - -// Test 5: Large binary data -export const largeBinaryFn = createServerFn().handler(async () => { - // Create 1KB chunks - const chunk = new Uint8Array(1024) - for (let i = 0; i < chunk.length; i++) { - chunk[i] = i % 256 - } - - const stream = createDelayedStream([chunk, chunk, chunk], 20) - - return { - message: 'Large binary test', - size: 3072, - binary: new RawStream(stream), - } -}) - -// Test 6: Mixed streaming (promise + raw stream) -export const mixedStreamingFn = createServerFn().handler(async () => { - const rawStream = createDelayedStream( - [encode('mixed-raw-1'), encode('mixed-raw-2')], - 50, - ) - - return { - immediate: 'immediate-value', - deferred: new Promise((resolve) => - setTimeout(() => resolve('deferred-value'), 100), - ), - raw: new RawStream(rawStream), - } -}) - -// Test 7: Text hint with pure text data (should use UTF-8 encoding) -export const textHintPureTextFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST7_CHUNKS, 30) - return { - message: 'Text hint with pure text', - data: new RawStream(stream, { hint: 'text' }), - } -}) - -// Test 8: Text hint with pure binary data (should fallback to base64) -export const textHintPureBinaryFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST8_CHUNKS, 30) - return { - message: 'Text hint with pure binary', - data: new RawStream(stream, { hint: 'text' }), - } -}) - -// Test 9: Text hint with mixed content (some UTF-8, some binary) -export const textHintMixedFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST9_CHUNKS, 30) - return { - message: 'Text hint with mixed content', - data: new RawStream(stream, { hint: 'text' }), - } -}) - -// Test 10: Binary hint with text data (should still use base64) -export const binaryHintTextFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST10_CHUNKS, 30) - return { - message: 'Binary hint with text data', - data: new RawStream(stream, { hint: 'binary' }), - } -}) - -// Test 11: Binary hint with pure binary data -export const binaryHintBinaryFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST11_CHUNKS, 30) - return { - message: 'Binary hint with binary data', - data: new RawStream(stream, { hint: 'binary' }), - } -}) - -// ============================================================================ -// MULTIPLEXING TESTS - Verify correct interleaving of multiple streams -// ============================================================================ - -// Expected data for multiplexing tests -// Test 12: Two streams with interleaved timing -// Stream A: sends at 0ms, 150ms, 200ms (3 chunks with pauses) -// Stream B: sends at 50ms, 100ms, 250ms (3 chunks, different rhythm) -export const TEST12_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('A1-first'), 0], // immediate - [encode('A2-after-pause'), 150], // 150ms pause - [encode('A3-quick'), 50], // 50ms after A2 -] -export const TEST12_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('B1-start'), 50], // 50ms after start - [encode('B2-continue'), 50], // 50ms after B1 - [encode('B3-final'), 150], // 150ms pause then final -] -export const TEST12_STREAM_A_EXPECTED = concatBytes( - TEST12_STREAM_A_CHUNKS.map(([chunk]) => chunk), -) -export const TEST12_STREAM_B_EXPECTED = concatBytes( - TEST12_STREAM_B_CHUNKS.map(([chunk]) => chunk), -) - -// Test 13: Burst-pause-burst pattern (single stream) -// 3 chunks quickly, long pause, 3 more chunks quickly -export const TEST13_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('burst1-a'), 10], - [encode('burst1-b'), 10], - [encode('burst1-c'), 10], - [encode('pause-then-burst2-a'), 200], // long pause - [encode('burst2-b'), 10], - [encode('burst2-c'), 10], -] -export const TEST13_EXPECTED = concatBytes( - TEST13_CHUNKS.map(([chunk]) => chunk), -) - -// Test 14: Three concurrent streams with different patterns -// Stream A: fast steady (every 30ms) -// Stream B: slow steady (every 100ms) -// Stream C: burst pattern (quick-pause-quick) -export const TEST14_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('A1'), 30], - [encode('A2'), 30], - [encode('A3'), 30], - [encode('A4'), 30], -] -export const TEST14_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('B1-slow'), 100], - [encode('B2-slow'), 100], -] -export const TEST14_STREAM_C_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('C1-burst'), 20], - [encode('C2-burst'), 20], - [encode('C3-after-pause'), 150], -] -export const TEST14_STREAM_A_EXPECTED = concatBytes( - TEST14_STREAM_A_CHUNKS.map(([chunk]) => chunk), -) -export const TEST14_STREAM_B_EXPECTED = concatBytes( - TEST14_STREAM_B_CHUNKS.map(([chunk]) => chunk), -) -export const TEST14_STREAM_C_EXPECTED = concatBytes( - TEST14_STREAM_C_CHUNKS.map(([chunk]) => chunk), -) - -// Test 12: Interleaved multiplexing - two streams with variable delays -export const interleavedStreamsFn = createServerFn().handler(async () => { - const streamA = createVariableDelayStream(TEST12_STREAM_A_CHUNKS) - const streamB = createVariableDelayStream(TEST12_STREAM_B_CHUNKS) - - return { - message: 'Interleaved streams test', - streamA: new RawStream(streamA), - streamB: new RawStream(streamB), - } -}) - -// Test 13: Burst-pause-burst pattern -export const burstPauseBurstFn = createServerFn().handler(async () => { - const stream = createVariableDelayStream(TEST13_CHUNKS) - - return { - message: 'Burst-pause-burst test', - data: new RawStream(stream), - } -}) - -// Test 14: Three concurrent streams -export const threeStreamsFn = createServerFn().handler(async () => { - const streamA = createVariableDelayStream(TEST14_STREAM_A_CHUNKS) - const streamB = createVariableDelayStream(TEST14_STREAM_B_CHUNKS) - const streamC = createVariableDelayStream(TEST14_STREAM_C_CHUNKS) - - return { - message: 'Three concurrent streams test', - fast: new RawStream(streamA), - slow: new RawStream(streamB), - burst: new RawStream(streamC), - } -}) - -// ============================================================================ -// EDGE CASE TESTS -// ============================================================================ - -// Test 15: Empty stream (zero bytes) -export const emptyStreamFn = createServerFn().handler(async () => { - // Stream that immediately closes with no data - const stream = new ReadableStream({ - start(controller) { - controller.close() - }, - }) - - return { - message: 'Empty stream test', - data: new RawStream(stream), - } -}) - -// Test 16: Stream that errors mid-flight -export const errorStreamFn = createServerFn().handler(async () => { - // Stream that sends some data then errors - const stream = new ReadableStream({ - async start(controller) { - controller.enqueue(encode('chunk-before-error')) - await new Promise((resolve) => setTimeout(resolve, 50)) - controller.error(new Error('Intentional stream error')) - }, - }) - - return { - message: 'Error stream test', - data: new RawStream(stream), - } -}) - -// ============================================================================ -// LATE RAWSTREAM TESTS - RawStream inside Promise (discovered after initial serialization) -// ============================================================================ - -// Expected data for late stream tests -export const LATE_STREAM_CHUNKS = [ - encode('late-1'), - encode('late-2'), - encode('late-3'), -] -export const LATE_STREAM_EXPECTED = concatBytes(LATE_STREAM_CHUNKS) - -export const LATE_STREAM_A_CHUNKS = [encode('lateA-1'), encode('lateA-2')] -export const LATE_STREAM_A_EXPECTED = concatBytes(LATE_STREAM_A_CHUNKS) - -export const LATE_STREAM_B_CHUNKS = [encode('lateB-1'), encode('lateB-2')] -export const LATE_STREAM_B_EXPECTED = concatBytes(LATE_STREAM_B_CHUNKS) - -export const IMMEDIATE_STREAM_CHUNKS = [ - encode('immediate-1'), - encode('immediate-2'), -] -export const IMMEDIATE_STREAM_EXPECTED = concatBytes(IMMEDIATE_STREAM_CHUNKS) - -// Test 17: Single late RawStream (Promise) -// The RawStream is wrapped in a Promise, so it's not discovered during initial serialization -export const lateRawStreamFn = createServerFn().handler(async () => { - // Promise that resolves to a RawStream after a delay - const lateStream = new Promise((resolve) => { - setTimeout(() => { - const stream = createDelayedStream(LATE_STREAM_CHUNKS, 30) - resolve(new RawStream(stream)) - }, 100) - }) - - return { - message: 'Late stream test', - lateData: lateStream, - } -}) - -// Test 18: Multiple late RawStreams with different delays -export const multipleLateStreamsFn = createServerFn().handler(async () => { - // Two Promises resolving to RawStreams at different times - const lateStreamA = new Promise((resolve) => { - setTimeout(() => { - const stream = createDelayedStream(LATE_STREAM_A_CHUNKS, 20) - resolve(new RawStream(stream)) - }, 50) - }) - - const lateStreamB = new Promise((resolve) => { - setTimeout(() => { - const stream = createDelayedStream(LATE_STREAM_B_CHUNKS, 20) - resolve(new RawStream(stream)) - }, 150) - }) - - return { - message: 'Multiple late streams test', - streamA: lateStreamA, - streamB: lateStreamB, - } -}) - -// Test 19: Mixed immediate and late RawStreams -// One RawStream is immediate (discovered during initial serialization) -// One is wrapped in Promise (discovered after initial serialization) -export const mixedImmediateLateFn = createServerFn().handler(async () => { - // Immediate RawStream - discovered during initial serialization - const immediateStream = createDelayedStream(IMMEDIATE_STREAM_CHUNKS, 30) - - // Late RawStream - wrapped in Promise, discovered after initial serialization - const lateStream = new Promise((resolve) => { - setTimeout(() => { - const stream = createDelayedStream(LATE_STREAM_CHUNKS, 30) - resolve(new RawStream(stream)) - }, 100) - }) - - return { - message: 'Mixed immediate and late test', - immediate: new RawStream(immediateStream), - late: lateStream, - } -}) - -// Helpers for consuming streams (exported for use in components) -// Note: RawStream is the marker class used in loaders/server functions, -// but after SSR deserialization it becomes ReadableStream. -// We accept both types to handle the TypeScript mismatch. -export function createStreamConsumer() { - const decoder = new TextDecoder() - - return async function consumeStream( - stream: ReadableStream | RawStream, - ): Promise { - // Handle both RawStream (from type system) and ReadableStream (runtime) - const actualStream = - stream instanceof RawStream - ? stream.stream - : (stream as ReadableStream) - const reader = actualStream.getReader() - const chunks: Array = [] - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - while (true) { - const { done, value } = await reader.read() - if (done) break - chunks.push(decoder.decode(value, { stream: true })) - } - - return chunks.join('') - } -} - -export async function consumeBinaryStream( - stream: ReadableStream | RawStream, -): Promise { - // Handle both RawStream (from type system) and ReadableStream (runtime) - const actualStream = - stream instanceof RawStream - ? stream.stream - : (stream as ReadableStream) - const reader = actualStream.getReader() - let totalBytes = 0 - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - while (true) { - const { done, value } = await reader.read() - if (done) break - totalBytes += value.length - } - - return totalBytes -} - -// Helper to collect all bytes from a stream -export async function collectBytes( - stream: ReadableStream | RawStream, -): Promise { - const actualStream = - stream instanceof RawStream - ? stream.stream - : (stream as ReadableStream) - const reader = actualStream.getReader() - const chunks: Array = [] - let totalLength = 0 - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - while (true) { - const { done, value } = await reader.read() - if (done) break - chunks.push(value) - totalLength += value.length - } - - const result = new Uint8Array(totalLength) - let pos = 0 - for (const chunk of chunks) { - result.set(chunk, pos) - pos += chunk.length - } - return result -} - -// Compare two Uint8Arrays byte-by-byte -export function compareBytes( - actual: Uint8Array, - expected: Uint8Array, -): { - match: boolean - mismatchIndex: number | null - actualLength: number - expectedLength: number -} { - if (actual.length !== expected.length) { - return { - match: false, - mismatchIndex: -1, // -1 indicates length mismatch - actualLength: actual.length, - expectedLength: expected.length, - } - } - for (let i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) { - return { - match: false, - mismatchIndex: i, - actualLength: actual.length, - expectedLength: expected.length, - } - } - } - return { - match: true, - mismatchIndex: null, - actualLength: actual.length, - expectedLength: expected.length, - } -} diff --git a/e2e/react-start/basic/src/routeTree.gen.ts b/e2e/react-start/basic/src/routeTree.gen.ts deleted file mode 100644 index b6603dd01d..0000000000 --- a/e2e/react-start/basic/src/routeTree.gen.ts +++ /dev/null @@ -1,1805 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -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' -import { Route as PlainTsTypeAssertionRouteImport } from './routes/plain-ts-type-assertion' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as PrimitiveBeforeloadErrorRouteImport } from './routes/primitive-beforeload-error' -import { Route as RawStreamRouteImport } from './routes/raw-stream' -import { Route as ScriptsRouteImport } from './routes/scripts' -import { Route as SearchParamsRouteRouteImport } from './routes/search-params/route' -import { Route as SpecialCharsRouteRouteImport } from './routes/specialChars/route' -import { Route as StreamRouteImport } from './routes/stream' -import { Route as TypeOnlyReexportRouteImport } from './routes/type-only-reexport' -import { Route as UsersRouteImport } from './routes/users' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as ApiUsersRouteImport } from './routes/api.users' -import { Route as AuthDocsPrivateRouteImport } from './routes/auth-docs.private' -import { Route as Issue6221DashboardRouteImport } from './routes/issue-6221.dashboard' -import { Route as MultiCookieRedirectIndexRouteImport } from './routes/multi-cookie-redirect/index' -import { Route as MultiCookieRedirectTargetRouteImport } from './routes/multi-cookie-redirect/target' -import { Route as NotFoundIndexRouteImport } from './routes/not-found/index' -import { Route as NotFoundDeepRouteRouteImport } from './routes/not-found/deep/route' -import { Route as NotFoundParentBoundaryRouteRouteImport } from './routes/not-found/parent-boundary/route' -import { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad' -import { Route as NotFoundViaBeforeLoadTargetRootRouteImport } from './routes/not-found/via-beforeLoad-target-root' -import { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as RawStreamIndexRouteImport } from './routes/raw-stream/index' -import { Route as RawStreamClientCallRouteImport } from './routes/raw-stream/client-call' -import { Route as RawStreamSsrBinaryHintRouteImport } from './routes/raw-stream/ssr-binary-hint' -import { Route as RawStreamSsrMixedRouteImport } from './routes/raw-stream/ssr-mixed' -import { Route as RawStreamSsrMultipleRouteImport } from './routes/raw-stream/ssr-multiple' -import { Route as RawStreamSsrSingleRouteImport } from './routes/raw-stream/ssr-single' -import { Route as RawStreamSsrTextHintRouteImport } from './routes/raw-stream/ssr-text-hint' -import { Route as RedirectIndexRouteImport } from './routes/redirect/index' -import { Route as RedirectTargetRouteImport } from './routes/redirect/$target' -import { Route as SearchParamsIndexRouteImport } from './routes/search-params/index' -import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default' -import { Route as SearchParamsLoaderThrowsRedirectRouteImport } from './routes/search-params/loader-throws-redirect' -import { Route as SpecialCharsParamRouteImport } from './routes/specialChars/$param' -import { Route as SpecialCharsHashRouteImport } from './routes/specialChars/hash' -import { Route as SpecialCharsMalformedRouteRouteImport } from './routes/specialChars/malformed/route' -import { Route as SpecialCharsSearchRouteImport } from './routes/specialChars/search' -import { Route as SpecialCharsChar45824Char54620Char48124Char44397RouteImport } from './routes/specialChars/대한민국' -import { Route as UsersIndexRouteImport } from './routes/users.index' -import { Route as UsersUserIdRouteImport } from './routes/users.$userId' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' -import { Route as ApiUsersIdRouteImport } from './routes/api/users.$id' -import { Route as Issue6221ArticleIdRouteImport } from './routes/issue-6221.article.$id' -import { Route as NotFoundDeepIndexRouteImport } from './routes/not-found/deep/index' -import { Route as NotFoundDeepBRouteRouteImport } from './routes/not-found/deep/b/route' -import { Route as NotFoundParentBoundaryIndexRouteImport } from './routes/not-found/parent-boundary/index' -import { Route as NotFoundParentBoundaryViaBeforeLoadRouteImport } from './routes/not-found/parent-boundary/via-beforeLoad' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep' -import { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index' -import { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad' -import { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader' -import { Route as SpecialCharsMalformedParamRouteImport } from './routes/specialChars/malformed/$param' -import { Route as SpecialCharsMalformedSearchRouteImport } from './routes/specialChars/malformed/search' -import { Route as FooBarQuxHereRouteImport } from './routes/foo/$bar/$qux/_here' -import { Route as NotFoundDeepBCRouteRouteImport } from './routes/not-found/deep/b/c/route' -import { Route as RedirectTargetServerFnIndexRouteImport } from './routes/redirect/$target/serverFn/index' -import { Route as RedirectTargetServerFnViaBeforeLoadRouteImport } from './routes/redirect/$target/serverFn/via-beforeLoad' -import { Route as RedirectTargetServerFnViaLoaderRouteImport } from './routes/redirect/$target/serverFn/via-loader' -import { Route as RedirectTargetServerFnViaUseServerFnRouteImport } from './routes/redirect/$target/serverFn/via-useServerFn' -import { Route as FooBarQuxHereIndexRouteImport } from './routes/foo/$bar/$qux/_here/index' -import { Route as NotFoundDeepBCDRouteImport } from './routes/not-found/deep/b/c/d' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const AsyncScriptsRoute = AsyncScriptsRouteImport.update({ - id: '/async-scripts', - path: '/async-scripts', - getParentRoute: () => rootRouteImport, -} as any) -const AuthDocsRoute = AuthDocsRouteImport.update({ - id: '/auth-docs', - path: '/auth-docs', - getParentRoute: () => rootRouteImport, -} as any) -const ClientOnlyRoute = ClientOnlyRouteImport.update({ - id: '/client-only', - path: '/client-only', - getParentRoute: () => rootRouteImport, -} as any) -const DeferredRoute = DeferredRouteImport.update({ - id: '/deferred', - 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', - getParentRoute: () => rootRouteImport, -} as any) -const LinksRoute = LinksRouteImport.update({ - id: '/links', - path: '/links', - getParentRoute: () => rootRouteImport, -} as any) -const NotFoundRouteRoute = NotFoundRouteRouteImport.update({ - id: '/not-found', - path: '/not-found', - getParentRoute: () => rootRouteImport, -} as any) -const PlainTsTypeAssertionRoute = PlainTsTypeAssertionRouteImport.update({ - id: '/plain-ts-type-assertion', - path: '/plain-ts-type-assertion', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const PrimitiveBeforeloadErrorRoute = - PrimitiveBeforeloadErrorRouteImport.update({ - id: '/primitive-beforeload-error', - path: '/primitive-beforeload-error', - getParentRoute: () => rootRouteImport, - } as any) -const RawStreamRoute = RawStreamRouteImport.update({ - id: '/raw-stream', - path: '/raw-stream', - getParentRoute: () => rootRouteImport, -} as any) -const ScriptsRoute = ScriptsRouteImport.update({ - id: '/scripts', - path: '/scripts', - getParentRoute: () => rootRouteImport, -} as any) -const SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({ - id: '/search-params', - path: '/search-params', - getParentRoute: () => rootRouteImport, -} as any) -const SpecialCharsRouteRoute = SpecialCharsRouteRouteImport.update({ - id: '/specialChars', - path: '/specialChars', - getParentRoute: () => rootRouteImport, -} as any) -const StreamRoute = StreamRouteImport.update({ - id: '/stream', - path: '/stream', - getParentRoute: () => rootRouteImport, -} as any) -const TypeOnlyReexportRoute = TypeOnlyReexportRouteImport.update({ - id: '/type-only-reexport', - path: '/type-only-reexport', - getParentRoute: () => rootRouteImport, -} as any) -const UsersRoute = UsersRouteImport.update({ - id: '/users', - path: '/users', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const ApiUsersRoute = ApiUsersRouteImport.update({ - id: '/api/users', - path: '/api/users', - getParentRoute: () => rootRouteImport, -} as any) -const AuthDocsPrivateRoute = AuthDocsPrivateRouteImport.update({ - id: '/private', - path: '/private', - getParentRoute: () => AuthDocsRoute, -} as any) -const Issue6221DashboardRoute = Issue6221DashboardRouteImport.update({ - id: '/issue-6221/dashboard', - path: '/issue-6221/dashboard', - getParentRoute: () => rootRouteImport, -} as any) -const MultiCookieRedirectIndexRoute = - MultiCookieRedirectIndexRouteImport.update({ - id: '/multi-cookie-redirect/', - path: '/multi-cookie-redirect/', - getParentRoute: () => rootRouteImport, - } as any) -const MultiCookieRedirectTargetRoute = - MultiCookieRedirectTargetRouteImport.update({ - id: '/multi-cookie-redirect/target', - path: '/multi-cookie-redirect/target', - getParentRoute: () => rootRouteImport, - } as any) -const NotFoundIndexRoute = NotFoundIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const NotFoundDeepRouteRoute = NotFoundDeepRouteRouteImport.update({ - id: '/deep', - path: '/deep', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const NotFoundParentBoundaryRouteRoute = - NotFoundParentBoundaryRouteRouteImport.update({ - id: '/parent-boundary', - path: '/parent-boundary', - getParentRoute: () => NotFoundRouteRoute, - } as any) -const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const NotFoundViaBeforeLoadTargetRootRoute = - NotFoundViaBeforeLoadTargetRootRouteImport.update({ - id: '/via-beforeLoad-target-root', - path: '/via-beforeLoad-target-root', - getParentRoute: () => NotFoundRouteRoute, - } as any) -const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({ - id: '/via-loader', - path: '/via-loader', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const RawStreamIndexRoute = RawStreamIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamClientCallRoute = RawStreamClientCallRouteImport.update({ - id: '/client-call', - path: '/client-call', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrBinaryHintRoute = RawStreamSsrBinaryHintRouteImport.update({ - id: '/ssr-binary-hint', - path: '/ssr-binary-hint', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrMixedRoute = RawStreamSsrMixedRouteImport.update({ - id: '/ssr-mixed', - path: '/ssr-mixed', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrMultipleRoute = RawStreamSsrMultipleRouteImport.update({ - id: '/ssr-multiple', - path: '/ssr-multiple', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrSingleRoute = RawStreamSsrSingleRouteImport.update({ - id: '/ssr-single', - path: '/ssr-single', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrTextHintRoute = RawStreamSsrTextHintRouteImport.update({ - id: '/ssr-text-hint', - path: '/ssr-text-hint', - getParentRoute: () => RawStreamRoute, -} as any) -const RedirectIndexRoute = RedirectIndexRouteImport.update({ - id: '/redirect/', - path: '/redirect/', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetRoute = RedirectTargetRouteImport.update({ - id: '/redirect/$target', - path: '/redirect/$target', - getParentRoute: () => rootRouteImport, -} as any) -const SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({ - id: '/default', - path: '/default', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const SearchParamsLoaderThrowsRedirectRoute = - SearchParamsLoaderThrowsRedirectRouteImport.update({ - id: '/loader-throws-redirect', - path: '/loader-throws-redirect', - getParentRoute: () => SearchParamsRouteRoute, - } as any) -const SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({ - id: '/$param', - path: '/$param', - getParentRoute: () => SpecialCharsRouteRoute, -} as any) -const SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({ - id: '/hash', - path: '/hash', - getParentRoute: () => SpecialCharsRouteRoute, -} as any) -const SpecialCharsMalformedRouteRoute = - SpecialCharsMalformedRouteRouteImport.update({ - id: '/malformed', - path: '/malformed', - getParentRoute: () => SpecialCharsRouteRoute, - } as any) -const SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({ - id: '/search', - path: '/search', - getParentRoute: () => SpecialCharsRouteRoute, -} as any) -const SpecialCharsChar45824Char54620Char48124Char44397Route = - SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({ - id: '/대한민국', - path: '/대한민국', - getParentRoute: () => SpecialCharsRouteRoute, - } as any) -const UsersIndexRoute = UsersIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => UsersRoute, -} as any) -const UsersUserIdRoute = UsersUserIdRouteImport.update({ - id: '/$userId', - path: '/$userId', - getParentRoute: () => UsersRoute, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) -const ApiUsersIdRoute = ApiUsersIdRouteImport.update({ - id: '/$id', - path: '/$id', - getParentRoute: () => ApiUsersRoute, -} as any) -const Issue6221ArticleIdRoute = Issue6221ArticleIdRouteImport.update({ - id: '/issue-6221/article/$id', - path: '/issue-6221/article/$id', - getParentRoute: () => rootRouteImport, -} as any) -const NotFoundDeepIndexRoute = NotFoundDeepIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NotFoundDeepRouteRoute, -} as any) -const NotFoundDeepBRouteRoute = NotFoundDeepBRouteRouteImport.update({ - id: '/b', - path: '/b', - getParentRoute: () => NotFoundDeepRouteRoute, -} as any) -const NotFoundParentBoundaryIndexRoute = - NotFoundParentBoundaryIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NotFoundParentBoundaryRouteRoute, - } as any) -const NotFoundParentBoundaryViaBeforeLoadRoute = - NotFoundParentBoundaryViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => NotFoundParentBoundaryRouteRoute, - } as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/posts_/$postId/deep', - path: '/posts/$postId/deep', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => RedirectTargetRoute, -} as any) -const RedirectTargetViaBeforeLoadRoute = - RedirectTargetViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({ - id: '/via-loader', - path: '/via-loader', - getParentRoute: () => RedirectTargetRoute, -} as any) -const SpecialCharsMalformedParamRoute = - SpecialCharsMalformedParamRouteImport.update({ - id: '/$param', - path: '/$param', - getParentRoute: () => SpecialCharsMalformedRouteRoute, - } as any) -const SpecialCharsMalformedSearchRoute = - SpecialCharsMalformedSearchRouteImport.update({ - id: '/search', - path: '/search', - getParentRoute: () => SpecialCharsMalformedRouteRoute, - } as any) -const FooBarQuxHereRoute = FooBarQuxHereRouteImport.update({ - id: '/foo/$bar/$qux/_here', - path: '/foo/$bar/$qux', - getParentRoute: () => rootRouteImport, -} as any) -const NotFoundDeepBCRouteRoute = NotFoundDeepBCRouteRouteImport.update({ - id: '/c', - path: '/c', - getParentRoute: () => NotFoundDeepBRouteRoute, -} as any) -const RedirectTargetServerFnIndexRoute = - RedirectTargetServerFnIndexRouteImport.update({ - id: '/serverFn/', - path: '/serverFn/', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetServerFnViaBeforeLoadRoute = - RedirectTargetServerFnViaBeforeLoadRouteImport.update({ - id: '/serverFn/via-beforeLoad', - path: '/serverFn/via-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetServerFnViaLoaderRoute = - RedirectTargetServerFnViaLoaderRouteImport.update({ - id: '/serverFn/via-loader', - path: '/serverFn/via-loader', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetServerFnViaUseServerFnRoute = - RedirectTargetServerFnViaUseServerFnRouteImport.update({ - id: '/serverFn/via-useServerFn', - path: '/serverFn/via-useServerFn', - getParentRoute: () => RedirectTargetRoute, - } as any) -const FooBarQuxHereIndexRoute = FooBarQuxHereIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => FooBarQuxHereRoute, -} as any) -const NotFoundDeepBCDRoute = NotFoundDeepBCDRouteImport.update({ - id: '/d', - path: '/d', - getParentRoute: () => NotFoundDeepBCRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/not-found': typeof NotFoundRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/specialChars': typeof SpecialCharsRouteRouteWithChildren - '/async-scripts': typeof AsyncScriptsRoute - '/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 - '/posts': typeof PostsRouteWithChildren - '/primitive-beforeload-error': typeof PrimitiveBeforeloadErrorRoute - '/raw-stream': typeof RawStreamRouteWithChildren - '/scripts': typeof ScriptsRoute - '/stream': typeof StreamRoute - '/type-only-reexport': typeof TypeOnlyReexportRoute - '/users': typeof UsersRouteWithChildren - '/not-found/deep': typeof NotFoundDeepRouteRouteWithChildren - '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren - '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/auth-docs/private': typeof AuthDocsPrivateRoute - '/issue-6221/dashboard': typeof Issue6221DashboardRoute - '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute - '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute - '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute - '/not-found/via-loader': typeof NotFoundViaLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/raw-stream/client-call': typeof RawStreamClientCallRoute - '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute - '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute - '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute - '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute - '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute - '/specialChars/$param': typeof SpecialCharsParamRoute - '/specialChars/hash': typeof SpecialCharsHashRoute - '/specialChars/search': typeof SpecialCharsSearchRoute - '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route - '/users/$userId': typeof UsersUserIdRoute - '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute - '/not-found/': typeof NotFoundIndexRoute - '/posts/': typeof PostsIndexRoute - '/raw-stream/': typeof RawStreamIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/users/': typeof UsersIndexRoute - '/not-found/deep/b': typeof NotFoundDeepBRouteRouteWithChildren - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/api/users/$id': typeof ApiUsersIdRoute - '/issue-6221/article/$id': typeof Issue6221ArticleIdRoute - '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute - '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute - '/not-found/deep/': typeof NotFoundDeepIndexRoute - '/not-found/parent-boundary/': typeof NotFoundParentBoundaryIndexRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/not-found/deep/b/c': typeof NotFoundDeepBCRouteRouteWithChildren - '/foo/$bar/$qux': typeof FooBarQuxHereRouteWithChildren - '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute - '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute - '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute - '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute - '/not-found/deep/b/c/d': typeof NotFoundDeepBCDRoute - '/foo/$bar/$qux/': typeof FooBarQuxHereIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/specialChars': typeof SpecialCharsRouteRouteWithChildren - '/async-scripts': typeof AsyncScriptsRoute - '/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 - '/primitive-beforeload-error': typeof PrimitiveBeforeloadErrorRoute - '/scripts': typeof ScriptsRoute - '/stream': typeof StreamRoute - '/type-only-reexport': typeof TypeOnlyReexportRoute - '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/auth-docs/private': typeof AuthDocsPrivateRoute - '/issue-6221/dashboard': typeof Issue6221DashboardRoute - '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute - '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute - '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute - '/not-found/via-loader': typeof NotFoundViaLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/raw-stream/client-call': typeof RawStreamClientCallRoute - '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute - '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute - '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute - '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute - '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute - '/search-params/default': typeof SearchParamsDefaultRoute - '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute - '/specialChars/$param': typeof SpecialCharsParamRoute - '/specialChars/hash': typeof SpecialCharsHashRoute - '/specialChars/search': typeof SpecialCharsSearchRoute - '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route - '/users/$userId': typeof UsersUserIdRoute - '/multi-cookie-redirect': typeof MultiCookieRedirectIndexRoute - '/not-found': typeof NotFoundIndexRoute - '/posts': typeof PostsIndexRoute - '/raw-stream': typeof RawStreamIndexRoute - '/redirect': typeof RedirectIndexRoute - '/search-params': typeof SearchParamsIndexRoute - '/users': typeof UsersIndexRoute - '/not-found/deep/b': typeof NotFoundDeepBRouteRouteWithChildren - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/api/users/$id': typeof ApiUsersIdRoute - '/issue-6221/article/$id': typeof Issue6221ArticleIdRoute - '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute - '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute - '/not-found/deep': typeof NotFoundDeepIndexRoute - '/not-found/parent-boundary': typeof NotFoundParentBoundaryIndexRoute - '/redirect/$target': typeof RedirectTargetIndexRoute - '/not-found/deep/b/c': typeof NotFoundDeepBCRouteRouteWithChildren - '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute - '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute - '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute - '/redirect/$target/serverFn': typeof RedirectTargetServerFnIndexRoute - '/not-found/deep/b/c/d': typeof NotFoundDeepBCDRoute - '/foo/$bar/$qux': typeof FooBarQuxHereIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/not-found': typeof NotFoundRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/specialChars': typeof SpecialCharsRouteRouteWithChildren - '/_layout': typeof LayoutRouteWithChildren - '/async-scripts': typeof AsyncScriptsRoute - '/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 - '/posts': typeof PostsRouteWithChildren - '/primitive-beforeload-error': typeof PrimitiveBeforeloadErrorRoute - '/raw-stream': typeof RawStreamRouteWithChildren - '/scripts': typeof ScriptsRoute - '/stream': typeof StreamRoute - '/type-only-reexport': typeof TypeOnlyReexportRoute - '/users': typeof UsersRouteWithChildren - '/not-found/deep': typeof NotFoundDeepRouteRouteWithChildren - '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren - '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/auth-docs/private': typeof AuthDocsPrivateRoute - '/issue-6221/dashboard': typeof Issue6221DashboardRoute - '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute - '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute - '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute - '/not-found/via-loader': typeof NotFoundViaLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/raw-stream/client-call': typeof RawStreamClientCallRoute - '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute - '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute - '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute - '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute - '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute - '/specialChars/$param': typeof SpecialCharsParamRoute - '/specialChars/hash': typeof SpecialCharsHashRoute - '/specialChars/search': typeof SpecialCharsSearchRoute - '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route - '/users/$userId': typeof UsersUserIdRoute - '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute - '/not-found/': typeof NotFoundIndexRoute - '/posts/': typeof PostsIndexRoute - '/raw-stream/': typeof RawStreamIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/users/': typeof UsersIndexRoute - '/not-found/deep/b': typeof NotFoundDeepBRouteRouteWithChildren - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/api/users/$id': typeof ApiUsersIdRoute - '/issue-6221/article/$id': typeof Issue6221ArticleIdRoute - '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute - '/posts_/$postId/deep': typeof PostsPostIdDeepRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute - '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute - '/not-found/deep/': typeof NotFoundDeepIndexRoute - '/not-found/parent-boundary/': typeof NotFoundParentBoundaryIndexRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/not-found/deep/b/c': typeof NotFoundDeepBCRouteRouteWithChildren - '/foo/$bar/$qux/_here': typeof FooBarQuxHereRouteWithChildren - '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute - '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute - '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute - '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute - '/not-found/deep/b/c/d': typeof NotFoundDeepBCDRoute - '/foo/$bar/$qux/_here/': typeof FooBarQuxHereIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/not-found' - | '/search-params' - | '/specialChars' - | '/async-scripts' - | '/auth-docs' - | '/client-only' - | '/deferred' - | '/execution-local' - | '/execution-rpc' - | '/inline-scripts' - | '/links' - | '/plain-ts-type-assertion' - | '/posts' - | '/primitive-beforeload-error' - | '/raw-stream' - | '/scripts' - | '/stream' - | '/type-only-reexport' - | '/users' - | '/not-found/deep' - | '/not-found/parent-boundary' - | '/specialChars/malformed' - | '/api/users' - | '/auth-docs/private' - | '/issue-6221/dashboard' - | '/multi-cookie-redirect/target' - | '/not-found/via-beforeLoad' - | '/not-found/via-beforeLoad-target-root' - | '/not-found/via-loader' - | '/posts/$postId' - | '/raw-stream/client-call' - | '/raw-stream/ssr-binary-hint' - | '/raw-stream/ssr-mixed' - | '/raw-stream/ssr-multiple' - | '/raw-stream/ssr-single' - | '/raw-stream/ssr-text-hint' - | '/redirect/$target' - | '/search-params/default' - | '/search-params/loader-throws-redirect' - | '/specialChars/$param' - | '/specialChars/hash' - | '/specialChars/search' - | '/specialChars/대한민국' - | '/users/$userId' - | '/multi-cookie-redirect/' - | '/not-found/' - | '/posts/' - | '/raw-stream/' - | '/redirect/' - | '/search-params/' - | '/users/' - | '/not-found/deep/b' - | '/layout-a' - | '/layout-b' - | '/api/users/$id' - | '/issue-6221/article/$id' - | '/not-found/parent-boundary/via-beforeLoad' - | '/posts/$postId/deep' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/specialChars/malformed/$param' - | '/specialChars/malformed/search' - | '/not-found/deep/' - | '/not-found/parent-boundary/' - | '/redirect/$target/' - | '/not-found/deep/b/c' - | '/foo/$bar/$qux' - | '/redirect/$target/serverFn/via-beforeLoad' - | '/redirect/$target/serverFn/via-loader' - | '/redirect/$target/serverFn/via-useServerFn' - | '/redirect/$target/serverFn/' - | '/not-found/deep/b/c/d' - | '/foo/$bar/$qux/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/specialChars' - | '/async-scripts' - | '/auth-docs' - | '/client-only' - | '/deferred' - | '/execution-local' - | '/execution-rpc' - | '/inline-scripts' - | '/links' - | '/plain-ts-type-assertion' - | '/primitive-beforeload-error' - | '/scripts' - | '/stream' - | '/type-only-reexport' - | '/specialChars/malformed' - | '/api/users' - | '/auth-docs/private' - | '/issue-6221/dashboard' - | '/multi-cookie-redirect/target' - | '/not-found/via-beforeLoad' - | '/not-found/via-beforeLoad-target-root' - | '/not-found/via-loader' - | '/posts/$postId' - | '/raw-stream/client-call' - | '/raw-stream/ssr-binary-hint' - | '/raw-stream/ssr-mixed' - | '/raw-stream/ssr-multiple' - | '/raw-stream/ssr-single' - | '/raw-stream/ssr-text-hint' - | '/search-params/default' - | '/search-params/loader-throws-redirect' - | '/specialChars/$param' - | '/specialChars/hash' - | '/specialChars/search' - | '/specialChars/대한민국' - | '/users/$userId' - | '/multi-cookie-redirect' - | '/not-found' - | '/posts' - | '/raw-stream' - | '/redirect' - | '/search-params' - | '/users' - | '/not-found/deep/b' - | '/layout-a' - | '/layout-b' - | '/api/users/$id' - | '/issue-6221/article/$id' - | '/not-found/parent-boundary/via-beforeLoad' - | '/posts/$postId/deep' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/specialChars/malformed/$param' - | '/specialChars/malformed/search' - | '/not-found/deep' - | '/not-found/parent-boundary' - | '/redirect/$target' - | '/not-found/deep/b/c' - | '/redirect/$target/serverFn/via-beforeLoad' - | '/redirect/$target/serverFn/via-loader' - | '/redirect/$target/serverFn/via-useServerFn' - | '/redirect/$target/serverFn' - | '/not-found/deep/b/c/d' - | '/foo/$bar/$qux' - id: - | '__root__' - | '/' - | '/not-found' - | '/search-params' - | '/specialChars' - | '/_layout' - | '/async-scripts' - | '/auth-docs' - | '/client-only' - | '/deferred' - | '/execution-local' - | '/execution-rpc' - | '/inline-scripts' - | '/links' - | '/plain-ts-type-assertion' - | '/posts' - | '/primitive-beforeload-error' - | '/raw-stream' - | '/scripts' - | '/stream' - | '/type-only-reexport' - | '/users' - | '/not-found/deep' - | '/not-found/parent-boundary' - | '/specialChars/malformed' - | '/_layout/_layout-2' - | '/api/users' - | '/auth-docs/private' - | '/issue-6221/dashboard' - | '/multi-cookie-redirect/target' - | '/not-found/via-beforeLoad' - | '/not-found/via-beforeLoad-target-root' - | '/not-found/via-loader' - | '/posts/$postId' - | '/raw-stream/client-call' - | '/raw-stream/ssr-binary-hint' - | '/raw-stream/ssr-mixed' - | '/raw-stream/ssr-multiple' - | '/raw-stream/ssr-single' - | '/raw-stream/ssr-text-hint' - | '/redirect/$target' - | '/search-params/default' - | '/search-params/loader-throws-redirect' - | '/specialChars/$param' - | '/specialChars/hash' - | '/specialChars/search' - | '/specialChars/대한민국' - | '/users/$userId' - | '/multi-cookie-redirect/' - | '/not-found/' - | '/posts/' - | '/raw-stream/' - | '/redirect/' - | '/search-params/' - | '/users/' - | '/not-found/deep/b' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - | '/api/users/$id' - | '/issue-6221/article/$id' - | '/not-found/parent-boundary/via-beforeLoad' - | '/posts_/$postId/deep' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/specialChars/malformed/$param' - | '/specialChars/malformed/search' - | '/not-found/deep/' - | '/not-found/parent-boundary/' - | '/redirect/$target/' - | '/not-found/deep/b/c' - | '/foo/$bar/$qux/_here' - | '/redirect/$target/serverFn/via-beforeLoad' - | '/redirect/$target/serverFn/via-loader' - | '/redirect/$target/serverFn/via-useServerFn' - | '/redirect/$target/serverFn/' - | '/not-found/deep/b/c/d' - | '/foo/$bar/$qux/_here/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - NotFoundRouteRoute: typeof NotFoundRouteRouteWithChildren - SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren - SpecialCharsRouteRoute: typeof SpecialCharsRouteRouteWithChildren - LayoutRoute: typeof LayoutRouteWithChildren - AsyncScriptsRoute: typeof AsyncScriptsRoute - AuthDocsRoute: typeof AuthDocsRouteWithChildren - ClientOnlyRoute: typeof ClientOnlyRoute - DeferredRoute: typeof DeferredRoute - ExecutionLocalRoute: typeof ExecutionLocalRoute - ExecutionRpcRoute: typeof ExecutionRpcRoute - InlineScriptsRoute: typeof InlineScriptsRoute - LinksRoute: typeof LinksRoute - PlainTsTypeAssertionRoute: typeof PlainTsTypeAssertionRoute - PostsRoute: typeof PostsRouteWithChildren - PrimitiveBeforeloadErrorRoute: typeof PrimitiveBeforeloadErrorRoute - RawStreamRoute: typeof RawStreamRouteWithChildren - ScriptsRoute: typeof ScriptsRoute - StreamRoute: typeof StreamRoute - TypeOnlyReexportRoute: typeof TypeOnlyReexportRoute - UsersRoute: typeof UsersRouteWithChildren - ApiUsersRoute: typeof ApiUsersRouteWithChildren - Issue6221DashboardRoute: typeof Issue6221DashboardRoute - MultiCookieRedirectTargetRoute: typeof MultiCookieRedirectTargetRoute - RedirectTargetRoute: typeof RedirectTargetRouteWithChildren - MultiCookieRedirectIndexRoute: typeof MultiCookieRedirectIndexRoute - RedirectIndexRoute: typeof RedirectIndexRoute - Issue6221ArticleIdRoute: typeof Issue6221ArticleIdRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute - FooBarQuxHereRoute: typeof FooBarQuxHereRouteWithChildren -} - -declare module '@tanstack/react-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/async-scripts': { - id: '/async-scripts' - path: '/async-scripts' - fullPath: '/async-scripts' - preLoaderRoute: typeof AsyncScriptsRouteImport - parentRoute: typeof rootRouteImport - } - '/auth-docs': { - id: '/auth-docs' - path: '/auth-docs' - fullPath: '/auth-docs' - preLoaderRoute: typeof AuthDocsRouteImport - parentRoute: typeof rootRouteImport - } - '/client-only': { - id: '/client-only' - path: '/client-only' - fullPath: '/client-only' - preLoaderRoute: typeof ClientOnlyRouteImport - parentRoute: typeof rootRouteImport - } - '/deferred': { - id: '/deferred' - path: '/deferred' - fullPath: '/deferred' - 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' - fullPath: '/inline-scripts' - preLoaderRoute: typeof InlineScriptsRouteImport - parentRoute: typeof rootRouteImport - } - '/links': { - id: '/links' - path: '/links' - fullPath: '/links' - preLoaderRoute: typeof LinksRouteImport - parentRoute: typeof rootRouteImport - } - '/not-found': { - id: '/not-found' - path: '/not-found' - fullPath: '/not-found' - preLoaderRoute: typeof NotFoundRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/plain-ts-type-assertion': { - id: '/plain-ts-type-assertion' - path: '/plain-ts-type-assertion' - fullPath: '/plain-ts-type-assertion' - preLoaderRoute: typeof PlainTsTypeAssertionRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/primitive-beforeload-error': { - id: '/primitive-beforeload-error' - path: '/primitive-beforeload-error' - fullPath: '/primitive-beforeload-error' - preLoaderRoute: typeof PrimitiveBeforeloadErrorRouteImport - parentRoute: typeof rootRouteImport - } - '/raw-stream': { - id: '/raw-stream' - path: '/raw-stream' - fullPath: '/raw-stream' - preLoaderRoute: typeof RawStreamRouteImport - parentRoute: typeof rootRouteImport - } - '/scripts': { - id: '/scripts' - path: '/scripts' - fullPath: '/scripts' - preLoaderRoute: typeof ScriptsRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params': { - id: '/search-params' - path: '/search-params' - fullPath: '/search-params' - preLoaderRoute: typeof SearchParamsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/specialChars': { - id: '/specialChars' - path: '/specialChars' - fullPath: '/specialChars' - preLoaderRoute: typeof SpecialCharsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/stream': { - id: '/stream' - path: '/stream' - fullPath: '/stream' - preLoaderRoute: typeof StreamRouteImport - parentRoute: typeof rootRouteImport - } - '/type-only-reexport': { - id: '/type-only-reexport' - path: '/type-only-reexport' - fullPath: '/type-only-reexport' - preLoaderRoute: typeof TypeOnlyReexportRouteImport - parentRoute: typeof rootRouteImport - } - '/users': { - id: '/users' - path: '/users' - fullPath: '/users' - preLoaderRoute: typeof UsersRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/api/users': { - id: '/api/users' - path: '/api/users' - fullPath: '/api/users' - preLoaderRoute: typeof ApiUsersRouteImport - parentRoute: typeof rootRouteImport - } - '/auth-docs/private': { - id: '/auth-docs/private' - path: '/private' - fullPath: '/auth-docs/private' - preLoaderRoute: typeof AuthDocsPrivateRouteImport - parentRoute: typeof AuthDocsRoute - } - '/issue-6221/dashboard': { - id: '/issue-6221/dashboard' - path: '/issue-6221/dashboard' - fullPath: '/issue-6221/dashboard' - preLoaderRoute: typeof Issue6221DashboardRouteImport - parentRoute: typeof rootRouteImport - } - '/multi-cookie-redirect/': { - id: '/multi-cookie-redirect/' - path: '/multi-cookie-redirect' - fullPath: '/multi-cookie-redirect/' - preLoaderRoute: typeof MultiCookieRedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/multi-cookie-redirect/target': { - id: '/multi-cookie-redirect/target' - path: '/multi-cookie-redirect/target' - fullPath: '/multi-cookie-redirect/target' - preLoaderRoute: typeof MultiCookieRedirectTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/not-found/': { - id: '/not-found/' - path: '/' - fullPath: '/not-found/' - preLoaderRoute: typeof NotFoundIndexRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/deep': { - id: '/not-found/deep' - path: '/deep' - fullPath: '/not-found/deep' - preLoaderRoute: typeof NotFoundDeepRouteRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/parent-boundary': { - id: '/not-found/parent-boundary' - path: '/parent-boundary' - fullPath: '/not-found/parent-boundary' - preLoaderRoute: typeof NotFoundParentBoundaryRouteRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/via-beforeLoad': { - id: '/not-found/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/not-found/via-beforeLoad' - preLoaderRoute: typeof NotFoundViaBeforeLoadRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/via-beforeLoad-target-root': { - id: '/not-found/via-beforeLoad-target-root' - path: '/via-beforeLoad-target-root' - fullPath: '/not-found/via-beforeLoad-target-root' - preLoaderRoute: typeof NotFoundViaBeforeLoadTargetRootRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/via-loader': { - id: '/not-found/via-loader' - path: '/via-loader' - fullPath: '/not-found/via-loader' - preLoaderRoute: typeof NotFoundViaLoaderRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/raw-stream/': { - id: '/raw-stream/' - path: '/' - fullPath: '/raw-stream/' - preLoaderRoute: typeof RawStreamIndexRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/client-call': { - id: '/raw-stream/client-call' - path: '/client-call' - fullPath: '/raw-stream/client-call' - preLoaderRoute: typeof RawStreamClientCallRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-binary-hint': { - id: '/raw-stream/ssr-binary-hint' - path: '/ssr-binary-hint' - fullPath: '/raw-stream/ssr-binary-hint' - preLoaderRoute: typeof RawStreamSsrBinaryHintRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-mixed': { - id: '/raw-stream/ssr-mixed' - path: '/ssr-mixed' - fullPath: '/raw-stream/ssr-mixed' - preLoaderRoute: typeof RawStreamSsrMixedRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-multiple': { - id: '/raw-stream/ssr-multiple' - path: '/ssr-multiple' - fullPath: '/raw-stream/ssr-multiple' - preLoaderRoute: typeof RawStreamSsrMultipleRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-single': { - id: '/raw-stream/ssr-single' - path: '/ssr-single' - fullPath: '/raw-stream/ssr-single' - preLoaderRoute: typeof RawStreamSsrSingleRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-text-hint': { - id: '/raw-stream/ssr-text-hint' - path: '/ssr-text-hint' - fullPath: '/raw-stream/ssr-text-hint' - preLoaderRoute: typeof RawStreamSsrTextHintRouteImport - parentRoute: typeof RawStreamRoute - } - '/redirect/': { - id: '/redirect/' - path: '/redirect' - fullPath: '/redirect/' - preLoaderRoute: typeof RedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target': { - id: '/redirect/$target' - path: '/redirect/$target' - fullPath: '/redirect/$target' - preLoaderRoute: typeof RedirectTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params/': { - id: '/search-params/' - path: '/' - fullPath: '/search-params/' - preLoaderRoute: typeof SearchParamsIndexRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/search-params/default': { - id: '/search-params/default' - path: '/default' - fullPath: '/search-params/default' - preLoaderRoute: typeof SearchParamsDefaultRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/search-params/loader-throws-redirect': { - id: '/search-params/loader-throws-redirect' - path: '/loader-throws-redirect' - fullPath: '/search-params/loader-throws-redirect' - preLoaderRoute: typeof SearchParamsLoaderThrowsRedirectRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/specialChars/$param': { - id: '/specialChars/$param' - path: '/$param' - fullPath: '/specialChars/$param' - preLoaderRoute: typeof SpecialCharsParamRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/hash': { - id: '/specialChars/hash' - path: '/hash' - fullPath: '/specialChars/hash' - preLoaderRoute: typeof SpecialCharsHashRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/malformed': { - id: '/specialChars/malformed' - path: '/malformed' - fullPath: '/specialChars/malformed' - preLoaderRoute: typeof SpecialCharsMalformedRouteRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/search': { - id: '/specialChars/search' - path: '/search' - fullPath: '/specialChars/search' - preLoaderRoute: typeof SpecialCharsSearchRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/대한민국': { - id: '/specialChars/대한민국' - path: '/대한민국' - fullPath: '/specialChars/대한민국' - preLoaderRoute: typeof SpecialCharsChar45824Char54620Char48124Char44397RouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/users/': { - id: '/users/' - path: '/' - fullPath: '/users/' - preLoaderRoute: typeof UsersIndexRouteImport - parentRoute: typeof UsersRoute - } - '/users/$userId': { - id: '/users/$userId' - path: '/$userId' - fullPath: '/users/$userId' - preLoaderRoute: typeof UsersUserIdRouteImport - parentRoute: typeof UsersRoute - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - '/api/users/$id': { - id: '/api/users/$id' - path: '/$id' - fullPath: '/api/users/$id' - preLoaderRoute: typeof ApiUsersIdRouteImport - parentRoute: typeof ApiUsersRoute - } - '/issue-6221/article/$id': { - id: '/issue-6221/article/$id' - path: '/issue-6221/article/$id' - fullPath: '/issue-6221/article/$id' - preLoaderRoute: typeof Issue6221ArticleIdRouteImport - parentRoute: typeof rootRouteImport - } - '/not-found/deep/': { - id: '/not-found/deep/' - path: '/' - fullPath: '/not-found/deep/' - preLoaderRoute: typeof NotFoundDeepIndexRouteImport - parentRoute: typeof NotFoundDeepRouteRoute - } - '/not-found/deep/b': { - id: '/not-found/deep/b' - path: '/b' - fullPath: '/not-found/deep/b' - preLoaderRoute: typeof NotFoundDeepBRouteRouteImport - parentRoute: typeof NotFoundDeepRouteRoute - } - '/not-found/parent-boundary/': { - id: '/not-found/parent-boundary/' - path: '/' - fullPath: '/not-found/parent-boundary/' - preLoaderRoute: typeof NotFoundParentBoundaryIndexRouteImport - parentRoute: typeof NotFoundParentBoundaryRouteRoute - } - '/not-found/parent-boundary/via-beforeLoad': { - id: '/not-found/parent-boundary/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/not-found/parent-boundary/via-beforeLoad' - preLoaderRoute: typeof NotFoundParentBoundaryViaBeforeLoadRouteImport - parentRoute: typeof NotFoundParentBoundaryRouteRoute - } - '/posts_/$postId/deep': { - id: '/posts_/$postId/deep' - path: '/posts/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target/': { - id: '/redirect/$target/' - path: '/' - fullPath: '/redirect/$target/' - preLoaderRoute: typeof RedirectTargetIndexRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-beforeLoad': { - id: '/redirect/$target/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/redirect/$target/via-beforeLoad' - preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-loader': { - id: '/redirect/$target/via-loader' - path: '/via-loader' - fullPath: '/redirect/$target/via-loader' - preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/specialChars/malformed/$param': { - id: '/specialChars/malformed/$param' - path: '/$param' - fullPath: '/specialChars/malformed/$param' - preLoaderRoute: typeof SpecialCharsMalformedParamRouteImport - parentRoute: typeof SpecialCharsMalformedRouteRoute - } - '/specialChars/malformed/search': { - id: '/specialChars/malformed/search' - path: '/search' - fullPath: '/specialChars/malformed/search' - preLoaderRoute: typeof SpecialCharsMalformedSearchRouteImport - parentRoute: typeof SpecialCharsMalformedRouteRoute - } - '/foo/$bar/$qux/_here': { - id: '/foo/$bar/$qux/_here' - path: '/foo/$bar/$qux' - fullPath: '/foo/$bar/$qux' - preLoaderRoute: typeof FooBarQuxHereRouteImport - parentRoute: typeof rootRouteImport - } - '/not-found/deep/b/c': { - id: '/not-found/deep/b/c' - path: '/c' - fullPath: '/not-found/deep/b/c' - preLoaderRoute: typeof NotFoundDeepBCRouteRouteImport - parentRoute: typeof NotFoundDeepBRouteRoute - } - '/redirect/$target/serverFn/': { - id: '/redirect/$target/serverFn/' - path: '/serverFn' - fullPath: '/redirect/$target/serverFn/' - preLoaderRoute: typeof RedirectTargetServerFnIndexRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/serverFn/via-beforeLoad': { - id: '/redirect/$target/serverFn/via-beforeLoad' - path: '/serverFn/via-beforeLoad' - fullPath: '/redirect/$target/serverFn/via-beforeLoad' - preLoaderRoute: typeof RedirectTargetServerFnViaBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/serverFn/via-loader': { - id: '/redirect/$target/serverFn/via-loader' - path: '/serverFn/via-loader' - fullPath: '/redirect/$target/serverFn/via-loader' - preLoaderRoute: typeof RedirectTargetServerFnViaLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/serverFn/via-useServerFn': { - id: '/redirect/$target/serverFn/via-useServerFn' - path: '/serverFn/via-useServerFn' - fullPath: '/redirect/$target/serverFn/via-useServerFn' - preLoaderRoute: typeof RedirectTargetServerFnViaUseServerFnRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/foo/$bar/$qux/_here/': { - id: '/foo/$bar/$qux/_here/' - path: '/' - fullPath: '/foo/$bar/$qux/' - preLoaderRoute: typeof FooBarQuxHereIndexRouteImport - parentRoute: typeof FooBarQuxHereRoute - } - '/not-found/deep/b/c/d': { - id: '/not-found/deep/b/c/d' - path: '/d' - fullPath: '/not-found/deep/b/c/d' - preLoaderRoute: typeof NotFoundDeepBCDRouteImport - parentRoute: typeof NotFoundDeepBCRouteRoute - } - } -} - -interface NotFoundDeepBCRouteRouteChildren { - NotFoundDeepBCDRoute: typeof NotFoundDeepBCDRoute -} - -const NotFoundDeepBCRouteRouteChildren: NotFoundDeepBCRouteRouteChildren = { - NotFoundDeepBCDRoute: NotFoundDeepBCDRoute, -} - -const NotFoundDeepBCRouteRouteWithChildren = - NotFoundDeepBCRouteRoute._addFileChildren(NotFoundDeepBCRouteRouteChildren) - -interface NotFoundDeepBRouteRouteChildren { - NotFoundDeepBCRouteRoute: typeof NotFoundDeepBCRouteRouteWithChildren -} - -const NotFoundDeepBRouteRouteChildren: NotFoundDeepBRouteRouteChildren = { - NotFoundDeepBCRouteRoute: NotFoundDeepBCRouteRouteWithChildren, -} - -const NotFoundDeepBRouteRouteWithChildren = - NotFoundDeepBRouteRoute._addFileChildren(NotFoundDeepBRouteRouteChildren) - -interface NotFoundDeepRouteRouteChildren { - NotFoundDeepBRouteRoute: typeof NotFoundDeepBRouteRouteWithChildren - NotFoundDeepIndexRoute: typeof NotFoundDeepIndexRoute -} - -const NotFoundDeepRouteRouteChildren: NotFoundDeepRouteRouteChildren = { - NotFoundDeepBRouteRoute: NotFoundDeepBRouteRouteWithChildren, - NotFoundDeepIndexRoute: NotFoundDeepIndexRoute, -} - -const NotFoundDeepRouteRouteWithChildren = - NotFoundDeepRouteRoute._addFileChildren(NotFoundDeepRouteRouteChildren) - -interface NotFoundParentBoundaryRouteRouteChildren { - NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute - NotFoundParentBoundaryIndexRoute: typeof NotFoundParentBoundaryIndexRoute -} - -const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren = - { - NotFoundParentBoundaryViaBeforeLoadRoute: - NotFoundParentBoundaryViaBeforeLoadRoute, - NotFoundParentBoundaryIndexRoute: NotFoundParentBoundaryIndexRoute, - } - -const NotFoundParentBoundaryRouteRouteWithChildren = - NotFoundParentBoundaryRouteRoute._addFileChildren( - NotFoundParentBoundaryRouteRouteChildren, - ) - -interface NotFoundRouteRouteChildren { - NotFoundDeepRouteRoute: typeof NotFoundDeepRouteRouteWithChildren - NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren - NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute - NotFoundViaBeforeLoadTargetRootRoute: typeof NotFoundViaBeforeLoadTargetRootRoute - NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute - NotFoundIndexRoute: typeof NotFoundIndexRoute -} - -const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = { - NotFoundDeepRouteRoute: NotFoundDeepRouteRouteWithChildren, - NotFoundParentBoundaryRouteRoute: - NotFoundParentBoundaryRouteRouteWithChildren, - NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute, - NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute, - NotFoundViaLoaderRoute: NotFoundViaLoaderRoute, - NotFoundIndexRoute: NotFoundIndexRoute, -} - -const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren( - NotFoundRouteRouteChildren, -) - -interface SearchParamsRouteRouteChildren { - SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute - SearchParamsLoaderThrowsRedirectRoute: typeof SearchParamsLoaderThrowsRedirectRoute - SearchParamsIndexRoute: typeof SearchParamsIndexRoute -} - -const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = { - SearchParamsDefaultRoute: SearchParamsDefaultRoute, - SearchParamsLoaderThrowsRedirectRoute: SearchParamsLoaderThrowsRedirectRoute, - SearchParamsIndexRoute: SearchParamsIndexRoute, -} - -const SearchParamsRouteRouteWithChildren = - SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren) - -interface SpecialCharsMalformedRouteRouteChildren { - SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute - SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute -} - -const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren = - { - SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute, - SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute, - } - -const SpecialCharsMalformedRouteRouteWithChildren = - SpecialCharsMalformedRouteRoute._addFileChildren( - SpecialCharsMalformedRouteRouteChildren, - ) - -interface SpecialCharsRouteRouteChildren { - SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren - SpecialCharsParamRoute: typeof SpecialCharsParamRoute - SpecialCharsHashRoute: typeof SpecialCharsHashRoute - SpecialCharsSearchRoute: typeof SpecialCharsSearchRoute - SpecialCharsChar45824Char54620Char48124Char44397Route: typeof SpecialCharsChar45824Char54620Char48124Char44397Route -} - -const SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = { - SpecialCharsMalformedRouteRoute: SpecialCharsMalformedRouteRouteWithChildren, - SpecialCharsParamRoute: SpecialCharsParamRoute, - SpecialCharsHashRoute: SpecialCharsHashRoute, - SpecialCharsSearchRoute: SpecialCharsSearchRoute, - SpecialCharsChar45824Char54620Char48124Char44397Route: - SpecialCharsChar45824Char54620Char48124Char44397Route, -} - -const SpecialCharsRouteRouteWithChildren = - SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren) - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface AuthDocsRouteChildren { - AuthDocsPrivateRoute: typeof AuthDocsPrivateRoute -} - -const AuthDocsRouteChildren: AuthDocsRouteChildren = { - AuthDocsPrivateRoute: AuthDocsPrivateRoute, -} - -const AuthDocsRouteWithChildren = AuthDocsRoute._addFileChildren( - AuthDocsRouteChildren, -) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface RawStreamRouteChildren { - RawStreamClientCallRoute: typeof RawStreamClientCallRoute - RawStreamSsrBinaryHintRoute: typeof RawStreamSsrBinaryHintRoute - RawStreamSsrMixedRoute: typeof RawStreamSsrMixedRoute - RawStreamSsrMultipleRoute: typeof RawStreamSsrMultipleRoute - RawStreamSsrSingleRoute: typeof RawStreamSsrSingleRoute - RawStreamSsrTextHintRoute: typeof RawStreamSsrTextHintRoute - RawStreamIndexRoute: typeof RawStreamIndexRoute -} - -const RawStreamRouteChildren: RawStreamRouteChildren = { - RawStreamClientCallRoute: RawStreamClientCallRoute, - RawStreamSsrBinaryHintRoute: RawStreamSsrBinaryHintRoute, - RawStreamSsrMixedRoute: RawStreamSsrMixedRoute, - RawStreamSsrMultipleRoute: RawStreamSsrMultipleRoute, - RawStreamSsrSingleRoute: RawStreamSsrSingleRoute, - RawStreamSsrTextHintRoute: RawStreamSsrTextHintRoute, - RawStreamIndexRoute: RawStreamIndexRoute, -} - -const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren( - RawStreamRouteChildren, -) - -interface UsersRouteChildren { - UsersUserIdRoute: typeof UsersUserIdRoute - UsersIndexRoute: typeof UsersIndexRoute -} - -const UsersRouteChildren: UsersRouteChildren = { - UsersUserIdRoute: UsersUserIdRoute, - UsersIndexRoute: UsersIndexRoute, -} - -const UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren) - -interface ApiUsersRouteChildren { - ApiUsersIdRoute: typeof ApiUsersIdRoute -} - -const ApiUsersRouteChildren: ApiUsersRouteChildren = { - ApiUsersIdRoute: ApiUsersIdRoute, -} - -const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren( - ApiUsersRouteChildren, -) - -interface RedirectTargetRouteChildren { - RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute - RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute - RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute - RedirectTargetServerFnViaBeforeLoadRoute: typeof RedirectTargetServerFnViaBeforeLoadRoute - RedirectTargetServerFnViaLoaderRoute: typeof RedirectTargetServerFnViaLoaderRoute - RedirectTargetServerFnViaUseServerFnRoute: typeof RedirectTargetServerFnViaUseServerFnRoute - RedirectTargetServerFnIndexRoute: typeof RedirectTargetServerFnIndexRoute -} - -const RedirectTargetRouteChildren: RedirectTargetRouteChildren = { - RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute, - RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute, - RedirectTargetIndexRoute: RedirectTargetIndexRoute, - RedirectTargetServerFnViaBeforeLoadRoute: - RedirectTargetServerFnViaBeforeLoadRoute, - RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute, - RedirectTargetServerFnViaUseServerFnRoute: - RedirectTargetServerFnViaUseServerFnRoute, - RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute, -} - -const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren( - RedirectTargetRouteChildren, -) - -interface FooBarQuxHereRouteChildren { - FooBarQuxHereIndexRoute: typeof FooBarQuxHereIndexRoute -} - -const FooBarQuxHereRouteChildren: FooBarQuxHereRouteChildren = { - FooBarQuxHereIndexRoute: FooBarQuxHereIndexRoute, -} - -const FooBarQuxHereRouteWithChildren = FooBarQuxHereRoute._addFileChildren( - FooBarQuxHereRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - NotFoundRouteRoute: NotFoundRouteRouteWithChildren, - SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren, - SpecialCharsRouteRoute: SpecialCharsRouteRouteWithChildren, - LayoutRoute: LayoutRouteWithChildren, - AsyncScriptsRoute: AsyncScriptsRoute, - AuthDocsRoute: AuthDocsRouteWithChildren, - ClientOnlyRoute: ClientOnlyRoute, - DeferredRoute: DeferredRoute, - ExecutionLocalRoute: ExecutionLocalRoute, - ExecutionRpcRoute: ExecutionRpcRoute, - InlineScriptsRoute: InlineScriptsRoute, - LinksRoute: LinksRoute, - PlainTsTypeAssertionRoute: PlainTsTypeAssertionRoute, - PostsRoute: PostsRouteWithChildren, - PrimitiveBeforeloadErrorRoute: PrimitiveBeforeloadErrorRoute, - RawStreamRoute: RawStreamRouteWithChildren, - ScriptsRoute: ScriptsRoute, - StreamRoute: StreamRoute, - TypeOnlyReexportRoute: TypeOnlyReexportRoute, - UsersRoute: UsersRouteWithChildren, - ApiUsersRoute: ApiUsersRouteWithChildren, - Issue6221DashboardRoute: Issue6221DashboardRoute, - MultiCookieRedirectTargetRoute: MultiCookieRedirectTargetRoute, - RedirectTargetRoute: RedirectTargetRouteWithChildren, - MultiCookieRedirectIndexRoute: MultiCookieRedirectIndexRoute, - RedirectIndexRoute: RedirectIndexRoute, - Issue6221ArticleIdRoute: Issue6221ArticleIdRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, - FooBarQuxHereRoute: FooBarQuxHereRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/react-start' -declare module '@tanstack/react-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/react-start/basic/src/router.tsx b/e2e/react-start/basic/src/router.tsx deleted file mode 100644 index fef35c9e06..0000000000 --- a/e2e/react-start/basic/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/react-router' -import { routeTree } from './routeTree.gen' -import { DefaultCatchBoundary } from './components/DefaultCatchBoundary' -import { NotFound } from './components/NotFound' - -export function getRouter() { - const router = createRouter({ - routeTree, - scrollRestoration: true, - defaultPreload: 'intent', - defaultErrorComponent: DefaultCatchBoundary, - defaultNotFoundComponent: () => , - }) - - return router -} diff --git a/e2e/react-start/basic/src/routes/__root.tsx b/e2e/react-start/basic/src/routes/__root.tsx deleted file mode 100644 index ed521817d6..0000000000 --- a/e2e/react-start/basic/src/routes/__root.tsx +++ /dev/null @@ -1,241 +0,0 @@ -/// -import * as React from 'react' -import { - ClientOnly, - HeadContent, - Link, - Outlet, - Scripts, - createRootRoute, - useRouterState, -} from '@tanstack/react-router' - -import { DefaultCatchBoundary } from '~/components/DefaultCatchBoundary' -import { NotFound } from '~/components/NotFound' -import '~/styles/app.css' -import { seo } from '~/utils/seo' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { - charSet: 'utf-8', - }, - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - ...seo({ - title: - 'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework', - description: `TanStack Start is a type-safe, client-first, full-stack React framework. `, - }), - ], - links: [ - { - rel: 'apple-touch-icon', - sizes: '180x180', - href: '/apple-touch-icon.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '32x32', - href: '/favicon-32x32.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '16x16', - href: '/favicon-16x16.png', - }, - { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' }, - { rel: 'icon', href: '/favicon.ico' }, - ], - styles: [ - { - media: 'all and (min-width: 500px)', - children: ` - .inline-div { - color: white; - background-color: gray; - max-width: 250px; - }`, - }, - ], - }), - errorComponent: (props) => { - return ( - - - - ) - }, - notFoundComponent: () => , - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - ) -} - -const RouterDevtools = - process.env.NODE_ENV === 'production' - ? () => null // Render nothing in production - : React.lazy(() => - // Lazy load in development - import('@tanstack/react-router-devtools').then((res) => ({ - default: res.TanStackRouterDevtools, - })), - ) - -function RootDocument({ children }: { children: React.ReactNode }) { - const { isLoading, status } = useRouterState({ - select: (state) => ({ isLoading: state.isLoading, status: state.status }), - structuralSharing: true, - }) - - return ( - - - - - - diff --git a/e2e/solid-router/basepath-file-based/package.json b/e2e/solid-router/basepath-file-based/package.json deleted file mode 100644 index bc54799989..0000000000 --- a/e2e/solid-router/basepath-file-based/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basepath-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite-plugin-solid": "^2.11.11", - "vite": "^8.0.14" - } -} diff --git a/e2e/solid-router/basepath-file-based/playwright.config.ts b/e2e/solid-router/basepath-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/basepath-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basepath-file-based/src/main.tsx b/e2e/solid-router/basepath-file-based/src/main.tsx deleted file mode 100644 index 23304bb732..0000000000 --- a/e2e/solid-router/basepath-file-based/src/main.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { routeTree } from './routeTree.gen' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, - basepath: '/app', -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts b/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts deleted file mode 100644 index 98df1e83d8..0000000000 --- a/e2e/solid-router/basepath-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,77 +0,0 @@ -/* 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 AboutRouteImport } from './routes/about' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const AboutRoute = AboutRouteImport.update({ - id: '/about', - path: '/about', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/about': typeof AboutRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/about': typeof AboutRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/about': typeof AboutRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/about' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/about' - id: '__root__' | '/' | '/about' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - AboutRoute: typeof AboutRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/about': { - id: '/about' - path: '/about' - fullPath: '/about' - preLoaderRoute: typeof AboutRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - AboutRoute: AboutRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/basepath-file-based/src/routes/__root.tsx b/e2e/solid-router/basepath-file-based/src/routes/__root.tsx deleted file mode 100644 index ec0a00b1a9..0000000000 --- a/e2e/solid-router/basepath-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { createRootRoute } from '@tanstack/solid-router' - -export const Route = createRootRoute() diff --git a/e2e/solid-router/basepath-file-based/src/routes/about.tsx b/e2e/solid-router/basepath-file-based/src/routes/about.tsx deleted file mode 100644 index 30eead09d9..0000000000 --- a/e2e/solid-router/basepath-file-based/src/routes/about.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/about')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = Route.useNavigate() - - return ( -
- -
- ) -} diff --git a/e2e/solid-router/basepath-file-based/src/routes/index.tsx b/e2e/solid-router/basepath-file-based/src/routes/index.tsx deleted file mode 100644 index 13923f844e..0000000000 --- a/e2e/solid-router/basepath-file-based/src/routes/index.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: App, -}) - -function App() { - const navigate = Route.useNavigate() - - return ( -
- {' '} - {' '} - -
- ) -} diff --git a/e2e/solid-router/basepath-file-based/tests/reload-document.test.ts b/e2e/solid-router/basepath-file-based/tests/reload-document.test.ts deleted file mode 100644 index a50d133115..0000000000 --- a/e2e/solid-router/basepath-file-based/tests/reload-document.test.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('navigate() respects basepath for when reloadDocument=true', async ({ - page, -}) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const aboutBtn = page.getByTestId(`to-about-btn`) - await aboutBtn.click() - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() - - const homeBtn = page.getByTestId(`to-home-btn`) - await homeBtn.click() - await page.waitForURL('/app/') - await expect(page.getByTestId(`home-component`)).toBeInViewport() -}) - -test('navigate() with href containing basepath', async ({ page }) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const aboutBtn = page.getByTestId(`to-about-href-with-basepath-btn`) - await aboutBtn.click() - // Should navigate to /app/about, NOT /app/app/about - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() -}) - -test('navigate() with href containing basepath and reloadDocument=true', async ({ - page, -}) => { - await page.goto(`/app/`) - await expect(page.getByTestId(`home-component`)).toBeInViewport() - - const aboutBtn = page.getByTestId(`to-about-href-with-basepath-reload-btn`) - await aboutBtn.click() - // Should navigate to /app/about, NOT stay on current page - await page.waitForURL('/app/about') - await expect(page.getByTestId(`about-component`)).toBeInViewport() -}) diff --git a/e2e/solid-router/basepath-file-based/tsconfig.json b/e2e/solid-router/basepath-file-based/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basepath-file-based/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basepath-file-based/vite.config.js b/e2e/solid-router/basepath-file-based/vite.config.js deleted file mode 100644 index 29470dc9e4..0000000000 --- a/e2e/solid-router/basepath-file-based/vite.config.js +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - base: '/app/', - plugins: [tanstackRouter({ target: 'solid' }), solid()], -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/basic-esbuild-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-esbuild-file-based/.gitignore b/e2e/solid-router/basic-esbuild-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/basic-esbuild-file-based/index.html b/e2e/solid-router/basic-esbuild-file-based/index.html deleted file mode 100644 index 18251e4c38..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/index.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-esbuild-file-based/package.json b/e2e/solid-router/basic-esbuild-file-based/package.json deleted file mode 100644 index e2448db01b..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-esbuild-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "esbuild src/main.tsx --jsx=preserve --jsx-import-source=solid-js --serve=5601 --bundle --outfile=dist/main.js --watch --servedir=.", - "build": "esbuild src/main.tsx --jsx=preserve --jsx-import-source=solid-js --bundle --outfile=dist/main.js && tsc --noEmit", - "serve": "esbuild src/main.tsx --jsx=preserve --jsx-import-source=solid-js --bundle --outfile=dist/main.js --servedir=.", - "start": "dev", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "esbuild": "^0.27.4", - "esbuild-plugin-solid": "^0.6.0" - } -} diff --git a/e2e/solid-router/basic-esbuild-file-based/playwright.config.ts b/e2e/solid-router/basic-esbuild-file-based/playwright.config.ts deleted file mode 100644 index 972dd66d72..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm run build && pnpm run serve --serve=${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/src/esbuild.config.js b/e2e/solid-router/basic-esbuild-file-based/src/esbuild.config.js deleted file mode 100644 index 68d31fe754..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/esbuild.config.js +++ /dev/null @@ -1,12 +0,0 @@ -import { tanstackRouter } from '@tanstack/router-plugin/esbuild' -import { solidPlugin } from 'esbuild-plugin-solid' - -export default { - // ... - plugins: [ - tanstackRouter({ - target: 'solid', - }), - solidPlugin(), - ], -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/main.tsx b/e2e/solid-router/basic-esbuild-file-based/src/main.tsx deleted file mode 100644 index 0eebff3ea9..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/main.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/posts.tsx b/e2e/solid-router/basic-esbuild-file-based/src/posts.tsx deleted file mode 100644 index a42cb8d24e..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - const post = await axios - .get(`https://jsonplaceholder.typicode.com/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>('https://jsonplaceholder.typicode.com/posts') - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-esbuild-file-based/src/routeTree.gen.ts deleted file mode 100644 index 4d5b165a87..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,424 +0,0 @@ -/* prettier-ignore-start */ - -/* eslint-disable */ - -// @ts-nocheck - -// noinspection JSUnusedGlobalSymbols - -// This file is auto-generated by TanStack Router - -import { createFileRoute } from '@tanstack/solid-router' - -// Import Routes - -import { Route as rootRoute } from './routes/__root' -import { Route as PostsImport } from './routes/posts' -import { Route as LayoutImport } from './routes/_layout' -import { Route as IndexImport } from './routes/index' -import { Route as PostsIndexImport } from './routes/posts.index' -import { Route as PostsPostIdImport } from './routes/posts.$postId' -import { Route as LayoutLayout2Import } from './routes/_layout/_layout-2' -import { Route as groupLazyinsideImport } from './routes/(group)/lazyinside' -import { Route as groupLayoutImport } from './routes/(group)/_layout' -import { Route as LayoutLayout2LayoutBImport } from './routes/_layout/_layout-2/layout-b' -import { Route as LayoutLayout2LayoutAImport } from './routes/_layout/_layout-2/layout-a' -import { Route as groupLayoutInsideImport } from './routes/(group)/_layout.inside' - -// Create Virtual Routes - -const groupImport = createFileRoute('/(group)')() - -// Create/Update Routes - -const groupRoute = groupImport.update({ - id: '/(group)', - getParentRoute: () => rootRoute, -} as any) - -const PostsRoute = PostsImport.update({ - path: '/posts', - getParentRoute: () => rootRoute, -} as any) - -const LayoutRoute = LayoutImport.update({ - id: '/_layout', - getParentRoute: () => rootRoute, -} as any) - -const IndexRoute = IndexImport.update({ - path: '/', - getParentRoute: () => rootRoute, -} as any) - -const PostsIndexRoute = PostsIndexImport.update({ - path: '/', - getParentRoute: () => PostsRoute, -} as any) - -const PostsPostIdRoute = PostsPostIdImport.update({ - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) - -const LayoutLayout2Route = LayoutLayout2Import.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) - -const groupLazyinsideRoute = groupLazyinsideImport - .update({ - path: '/lazyinside', - getParentRoute: () => groupRoute, - } as any) - .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route)) - -const groupLayoutRoute = groupLayoutImport.update({ - id: '/_layout', - getParentRoute: () => groupRoute, -} as any) - -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBImport.update({ - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) - -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutAImport.update({ - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) - -const groupLayoutInsideRoute = groupLayoutInsideImport.update({ - path: '/inside', - getParentRoute: () => groupLayoutRoute, -} as any) - -// Populate the FileRoutesByPath interface - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexImport - parentRoute: typeof rootRoute - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '' - preLoaderRoute: typeof LayoutImport - parentRoute: typeof rootRoute - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsImport - parentRoute: typeof rootRoute - } - '/(group)': { - id: '/(group)' - path: '/' - fullPath: '/' - preLoaderRoute: typeof groupImport - parentRoute: typeof rootRoute - } - '/(group)/_layout': { - id: '/(group)/_layout' - path: '/' - fullPath: '/' - preLoaderRoute: typeof groupLayoutImport - parentRoute: typeof groupRoute - } - '/(group)/lazyinside': { - id: '/(group)/lazyinside' - path: '/lazyinside' - fullPath: '/lazyinside' - preLoaderRoute: typeof groupLazyinsideImport - parentRoute: typeof groupImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '' - preLoaderRoute: typeof LayoutLayout2Import - parentRoute: typeof LayoutImport - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdImport - parentRoute: typeof PostsImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexImport - parentRoute: typeof PostsImport - } - '/(group)/_layout/inside': { - id: '/(group)/_layout/inside' - path: '/inside' - fullPath: '/inside' - preLoaderRoute: typeof groupLayoutInsideImport - parentRoute: typeof groupLayoutImport - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutAImport - parentRoute: typeof LayoutLayout2Import - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBImport - parentRoute: typeof LayoutLayout2Import - } - } -} - -// Create and export the route tree - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface groupLayoutRouteChildren { - groupLayoutInsideRoute: typeof groupLayoutInsideRoute -} - -const groupLayoutRouteChildren: groupLayoutRouteChildren = { - groupLayoutInsideRoute: groupLayoutInsideRoute, -} - -const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren( - groupLayoutRouteChildren, -) - -interface groupRouteChildren { - groupLayoutRoute: typeof groupLayoutRouteWithChildren - groupLazyinsideRoute: typeof groupLazyinsideRoute -} - -const groupRouteChildren: groupRouteChildren = { - groupLayoutRoute: groupLayoutRouteWithChildren, - groupLazyinsideRoute: groupLazyinsideRoute, -} - -const groupRouteWithChildren = groupRoute._addFileChildren(groupRouteChildren) - -export interface FileRoutesByFullPath { - '/': typeof groupLayoutRouteWithChildren - '': typeof LayoutLayout2RouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/inside': typeof groupLayoutInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} - -export interface FileRoutesByTo { - '/': typeof groupLayoutRouteWithChildren - '': typeof LayoutLayout2RouteWithChildren - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/inside': typeof groupLayoutInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} - -export interface FileRoutesById { - __root__: typeof rootRoute - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/(group)': typeof groupRouteWithChildren - '/(group)/_layout': typeof groupLayoutRouteWithChildren - '/(group)/lazyinside': typeof groupLazyinsideRoute - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/(group)/_layout/inside': typeof groupLayoutInsideRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute -} - -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '' - | '/posts' - | '/lazyinside' - | '/posts/$postId' - | '/posts/' - | '/inside' - | '/layout-a' - | '/layout-b' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '' - | '/lazyinside' - | '/posts/$postId' - | '/posts' - | '/inside' - | '/layout-a' - | '/layout-b' - id: - | '__root__' - | '/' - | '/_layout' - | '/posts' - | '/(group)' - | '/(group)/_layout' - | '/(group)/lazyinside' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/posts/' - | '/(group)/_layout/inside' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - fileRoutesById: FileRoutesById -} - -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - PostsRoute: typeof PostsRouteWithChildren - groupRoute: typeof groupRouteWithChildren -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - PostsRoute: PostsRouteWithChildren, - groupRoute: groupRouteWithChildren, -} - -export const routeTree = rootRoute - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -/* prettier-ignore-end */ - -/* ROUTE_MANIFEST_START -{ - "routes": { - "__root__": { - "filePath": "__root.tsx", - "children": [ - "/", - "/_layout", - "/posts", - "/(group)" - ] - }, - "/": { - "filePath": "index.tsx" - }, - "/_layout": { - "filePath": "_layout.tsx", - "children": [ - "/_layout/_layout-2" - ] - }, - "/posts": { - "filePath": "posts.tsx", - "children": [ - "/posts/$postId", - "/posts/" - ] - }, - "/(group)": { - "filePath": "(group)", - "children": [ - "/(group)/_layout", - "/(group)/lazyinside" - ] - }, - "/(group)/_layout": { - "filePath": "(group)/_layout.tsx", - "parent": "/(group)", - "children": [ - "/(group)/_layout/inside" - ] - }, - "/(group)/lazyinside": { - "filePath": "(group)/lazyinside.tsx", - "parent": "/(group)" - }, - "/_layout/_layout-2": { - "filePath": "_layout/_layout-2.tsx", - "parent": "/_layout", - "children": [ - "/_layout/_layout-2/layout-a", - "/_layout/_layout-2/layout-b" - ] - }, - "/posts/$postId": { - "filePath": "posts.$postId.tsx", - "parent": "/posts" - }, - "/posts/": { - "filePath": "posts.index.tsx", - "parent": "/posts" - }, - "/(group)/_layout/inside": { - "filePath": "(group)/_layout.inside.tsx", - "parent": "/(group)/_layout" - }, - "/_layout/_layout-2/layout-a": { - "filePath": "_layout/_layout-2/layout-a.tsx", - "parent": "/_layout/_layout-2" - }, - "/_layout/_layout-2/layout-b": { - "filePath": "_layout/_layout-2/layout-b.tsx", - "parent": "/_layout/_layout-2" - } - } -} -ROUTE_MANIFEST_END */ diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx deleted file mode 100644 index cb1d7cccd8..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.inside.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute, getRouteApi, useSearch } from '@tanstack/solid-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/_layout/inside') - -export const Route = createFileRoute('/(group)/_layout/inside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/_layout/inside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx deleted file mode 100644 index 660cfb70e6..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/_layout.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/(group)/_layout')({ - component: () => ( - <> -
/(group)/_layout!
- - - ), -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx deleted file mode 100644 index a68febeadd..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.lazy.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { - createLazyFileRoute, - getRouteApi, - useSearch, -} from '@tanstack/solid-router' - -const routeApi = getRouteApi('/(group)/lazyinside') - -export const Route = createLazyFileRoute('/(group)/lazyinside')({ - component: () => { - const searchViaHook = useSearch({ from: '/(group)/lazyinside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx deleted file mode 100644 index 2a055aee9b..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/(group)/lazyinside.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/(group)/lazyinside')({ - validateSearch: z.object({ hello: z.string().optional() }), -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/__root.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/__root.tsx deleted file mode 100644 index c8609541b5..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Inside Group - {' '} - - Lazy Inside Group - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout.tsx deleted file mode 100644 index d43b4ef5f5..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 7a5a3623a0..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index b69951b246..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 30dbcce90f..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/index.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/index.tsx deleted file mode 100644 index bdfb4c7676..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index 55f8871d03..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.index.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.index.tsx deleted file mode 100644 index 33d0386c19..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.tsx b/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.tsx deleted file mode 100644 index 11a999f50a..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-esbuild-file-based/tests/app.spec.ts b/e2e/solid-router/basic-esbuild-file-based/tests/app.spec.ts deleted file mode 100644 index f9f8e88860..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/tests/app.spec.ts +++ /dev/null @@ -1,50 +0,0 @@ -import { expect, test } from '@playwright/test' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test.skip('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test.skip('Navigating nested layouts', async ({ page }) => { - await page.goto('/') - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test.skip('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test.skip('Navigating to a route inside a route group', async ({ page }) => { - await page.getByTestId('link-to-route-inside-group').click() - await expect(page.getByTestId('search-via-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-api')).toContainText('world') -}) - -test.skip('Navigating to a lazy route inside a route group', async ({ - page, -}) => { - await page.getByTestId('link-to-lazy-route-inside-group').click() - await expect(page.getByTestId('search-via-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-api')).toContainText('world') -}) diff --git a/e2e/solid-router/basic-esbuild-file-based/tsconfig.json b/e2e/solid-router/basic-esbuild-file-based/tsconfig.json deleted file mode 100644 index 98f8016075..0000000000 --- a/e2e/solid-router/basic-esbuild-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json b/e2e/solid-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/.gitignore b/e2e/solid-router/basic-file-based-code-splitting/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/basic-file-based-code-splitting/index.html b/e2e/solid-router/basic-file-based-code-splitting/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-file-based-code-splitting/package.json b/e2e/solid-router/basic-file-based-code-splitting/package.json deleted file mode 100644 index bb4cc2291e..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-file-based-code-splitting", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/playwright.config.ts b/e2e/solid-router/basic-file-based-code-splitting/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/main.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/main.tsx deleted file mode 100644 index 8128384193..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/main.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/posts.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/posts.tsx deleted file mode 100644 index d5f0ce903d..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts deleted file mode 100644 index 17076d5404..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routeTree.gen.ts +++ /dev/null @@ -1,267 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as ViewportTestRouteImport } from './routes/viewport-test' -import { Route as WithoutLoaderRouteImport } from './routes/without-loader' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const ViewportTestRoute = ViewportTestRouteImport.update({ - id: '/viewport-test', - path: '/viewport-test', - getParentRoute: () => rootRouteImport, -} as any) -const WithoutLoaderRoute = WithoutLoaderRouteImport.update({ - id: '/without-loader', - path: '/without-loader', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRouteWithChildren - '/viewport-test': typeof ViewportTestRoute - '/without-loader': typeof WithoutLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/viewport-test': typeof ViewportTestRoute - '/without-loader': typeof WithoutLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/viewport-test': typeof ViewportTestRoute - '/without-loader': typeof WithoutLoaderRoute - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/viewport-test' - | '/without-loader' - | '/posts/$postId' - | '/posts/' - | '/layout-a' - | '/layout-b' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/viewport-test' - | '/without-loader' - | '/posts/$postId' - | '/posts' - | '/layout-a' - | '/layout-b' - id: - | '__root__' - | '/' - | '/_layout' - | '/posts' - | '/viewport-test' - | '/without-loader' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/posts/' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - PostsRoute: typeof PostsRouteWithChildren - ViewportTestRoute: typeof ViewportTestRoute - WithoutLoaderRoute: typeof WithoutLoaderRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/viewport-test': { - id: '/viewport-test' - path: '/viewport-test' - fullPath: '/viewport-test' - preLoaderRoute: typeof ViewportTestRouteImport - parentRoute: typeof rootRouteImport - } - '/without-loader': { - id: '/without-loader' - path: '/without-loader' - fullPath: '/without-loader' - preLoaderRoute: typeof WithoutLoaderRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - } -} - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - PostsRoute: PostsRouteWithChildren, - ViewportTestRoute: ViewportTestRoute, - WithoutLoaderRoute: WithoutLoaderRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/__root.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/__root.tsx deleted file mode 100644 index 53acd0a923..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/__root.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - without-loader - {' '} - - This Route Does Not Exist - -
-
-
- - viewport-test - - - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx deleted file mode 100644 index d43b4ef5f5..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 7a5a3623a0..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index 997e6caf80..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 70135c5809..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx deleted file mode 100644 index 105f08d64e..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, - codeSplitGroupings: [ - ['component'], - ['pendingComponent', 'errorComponent', 'notFoundComponent'], - ], -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx deleted file mode 100644 index 812b581e0a..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx deleted file mode 100644 index 11a999f50a..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/posts.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx deleted file mode 100644 index c199bc56e0..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/viewport-test.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/viewport-test')({ - component: () =>
Hello /viewport-test!
, -}) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx b/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx deleted file mode 100644 index a7bf51fafb..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/routes/without-loader.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/without-loader')({ - component: () =>
Hello /without-loader!
, -}) diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/styles.css b/e2e/solid-router/basic-file-based-code-splitting/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/src/vite-env.d.ts b/e2e/solid-router/basic-file-based-code-splitting/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-file-based-code-splitting/tests/app.spec.ts b/e2e/solid-router/basic-file-based-code-splitting/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/basic-file-based-code-splitting/tests/preload.spec.ts b/e2e/solid-router/basic-file-based-code-splitting/tests/preload.spec.ts deleted file mode 100644 index fd17fcc47b..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/tests/preload.spec.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('hovering a link with preload=intent to a route without a loader should preload route', async ({ - page, -}) => { - await page.waitForLoadState('networkidle') - - const requestPromise = new Promise((resolve) => { - page.on('request', (request) => { - resolve(request.url()) - }) - }) - - await page.getByRole('link', { name: 'without-loader' }).hover() - const url = await requestPromise - const expectedString = - process.env.NODE_ENV === 'development' - ? 'without-loader.tsx?tsr-split' - : '/assets/without-loader' - expect(url).toContain(expectedString) -}) - -test('scrolling into viewport a link with preload=viewport to a route should preload route', async ({ - page, -}) => { - await page.waitForLoadState('networkidle') - - const [request] = await Promise.all([ - page.waitForRequest(() => true), - page.getByRole('link', { name: 'viewport-test' }).scrollIntoViewIfNeeded(), - ]) - - const expectedString = - process.env.NODE_ENV === 'development' - ? 'viewport-test.tsx?tsr-split' - : '/assets/viewport-test' - expect(request.url()).toEqual(expect.stringContaining(expectedString)) -}) diff --git a/e2e/solid-router/basic-file-based-code-splitting/tsconfig.json b/e2e/solid-router/basic-file-based-code-splitting/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-file-based-code-splitting/vite.config.ts b/e2e/solid-router/basic-file-based-code-splitting/vite.config.ts deleted file mode 100644 index b5efb3bfad..0000000000 --- a/e2e/solid-router/basic-file-based-code-splitting/vite.config.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'solid', - autoCodeSplitting: true, - codeSplittingOptions: { - splitBehavior: ({ routeId }) => { - if (routeId === '/posts') { - return [ - ['loader'], - ['component'], - ['pendingComponent', 'notFoundComponent', 'errorComponent'], - ] - } - }, - }, - }), - solid(), - ], -}) diff --git a/e2e/solid-router/basic-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/basic-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-file-based/.gitignore b/e2e/solid-router/basic-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/solid-router/basic-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/basic-file-based/index.html b/e2e/solid-router/basic-file-based/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-file-based/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-file-based/package.json b/e2e/solid-router/basic-file-based/package.json deleted file mode 100644 index bb882e2786..0000000000 --- a/e2e/solid-router/basic-file-based/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "pnpm run test:e2e:default", - "test:e2e:default": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "combinate": "^1.1.11", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic-file-based/playwright.config.ts b/e2e/solid-router/basic-file-based/playwright.config.ts deleted file mode 100644 index ea3ef9ffec..0000000000 --- a/e2e/solid-router/basic-file-based/playwright.config.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -const command = `pnpm build && pnpm preview --host 0.0.0.0 --port ${PORT}` - -console.info('Running with mode: ', process.env.MODE || 'default') - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - MODE: process.env.MODE || '', - VITE_MODE: process.env.MODE || '', - PORT: String(PORT), - }, - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-file-based/src/main.tsx b/e2e/solid-router/basic-file-based/src/main.tsx deleted file mode 100644 index 2ca59d07e8..0000000000 --- a/e2e/solid-router/basic-file-based/src/main.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { - RouterProvider, - createRouteMask, - createRouter, -} from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { routeTree } from './routeTree.gen' -import './styles.css' - -const mask = createRouteMask({ - routeTree, - from: '/masks/admin/$userId', - to: '/masks/public/$username', - params: (prev) => ({ - username: `user-${prev.userId}`, - }), -}) - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, - routeMasks: [mask], -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic-file-based/src/posts.tsx b/e2e/solid-router/basic-file-based/src/posts.tsx deleted file mode 100644 index 6df270c619..0000000000 --- a/e2e/solid-router/basic-file-based/src/posts.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/basic-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-file-based/src/routeTree.gen.ts deleted file mode 100644 index 7601b581cc..0000000000 --- a/e2e/solid-router/basic-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,2559 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as AnchorRouteImport } from './routes/anchor' -import { Route as ComponentTypesTestRouteImport } from './routes/component-types-test' -import { Route as EditingARouteImport } from './routes/editing-a' -import { Route as EditingBRouteImport } from './routes/editing-b' -import { Route as HoverPreloadHashRouteImport } from './routes/hover-preload-hash' -import { Route as MasksRouteImport } from './routes/masks' -import { Route as NonNestedRouteRouteImport } from './routes/non-nested/route' -import { Route as NotRemountDepsRouteImport } from './routes/notRemountDeps' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as RemountDepsRouteImport } from './routes/remountDeps' -import { Route as SearchParamsRouteRouteImport } from './routes/search-params/route' -import { Route as Char45824Char54620Char48124Char44397RouteRouteImport } from './routes/대한민국/route' -import { Route as anotherGroupOnlyrouteinsideRouteImport } from './routes/(another-group)/onlyrouteinside' -import { Route as groupLayoutRouteImport } from './routes/(group)/_layout' -import { Route as groupInsideRouteImport } from './routes/(group)/inside' -import { Route as groupLazyinsideRouteImport } from './routes/(group)/lazyinside' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as NonNestedDeepRouteRouteImport } from './routes/non-nested/deep/route' -import { Route as NonNestedNamedRouteRouteImport } from './routes/non-nested/named/route' -import { Route as NonNestedPathRouteRouteImport } from './routes/non-nested/path/route' -import { Route as NonNestedPrefixRouteRouteImport } from './routes/non-nested/prefix/route' -import { Route as NonNestedSuffixRouteRouteImport } from './routes/non-nested/suffix/route' -import { Route as ParamsPsIndexRouteImport } from './routes/params-ps/index' -import { Route as ParamsPsNonNestedRouteRouteImport } from './routes/params-ps/non-nested/route' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as RedirectIndexRouteImport } from './routes/redirect/index' -import { Route as RedirectTargetRouteImport } from './routes/redirect/$target' -import { Route as RelativeIndexRouteImport } from './routes/relative/index' -import { Route as RelativeLinkRouteRouteImport } from './routes/relative/link/route' -import { Route as RelativeUseNavigateRouteRouteImport } from './routes/relative/useNavigate/route' -import { Route as SearchParamsIndexRouteImport } from './routes/search-params/index' -import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default' -import { Route as groupLayoutInsidelayoutRouteImport } from './routes/(group)/_layout.insidelayout' -import { Route as groupSubfolderInsideRouteImport } from './routes/(group)/subfolder/inside' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' -import { Route as MasksAdminUserIdRouteImport } from './routes/masks.admin.$userId' -import { Route as MasksPublicUsernameRouteImport } from './routes/masks.public.$username' -import { Route as NonNestedDeepBazRouteRouteImport } from './routes/non-nested/deep/$baz.route' -import { Route as NonNestedNamedBazRouteRouteImport } from './routes/non-nested/named/$baz.route' -import { Route as NonNestedPathBazRouteRouteImport } from './routes/non-nested/path/baz.route' -import { Route as NonNestedPrefixPrefixChar123bazChar125RouteRouteImport } from './routes/non-nested/prefix/prefix{$baz}.route' -import { Route as NonNestedSuffixChar123bazChar125suffixRouteRouteImport } from './routes/non-nested/suffix/{$baz}suffix.route' -import { Route as ParamsPsNamedIndexRouteImport } from './routes/params-ps/named/index' -import { Route as ParamsPsNamedFooRouteRouteImport } from './routes/params-ps/named/$foo/route' -import { Route as ParamsPsNamedPrefixChar123fooChar125RouteImport } from './routes/params-ps/named/prefix{$foo}' -import { Route as ParamsPsNamedChar123fooChar125suffixRouteImport } from './routes/params-ps/named/{$foo}suffix' -import { Route as ParamsPsNonNestedFooRouteRouteImport } from './routes/params-ps/non-nested/$foo_/route' -import { Route as ParamsPsWildcardIndexRouteImport } from './routes/params-ps/wildcard/index' -import { Route as ParamsPsWildcardSplatRouteImport } from './routes/params-ps/wildcard/$' -import { Route as ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport } from './routes/params-ps/wildcard/prefix@대{$}' -import { Route as ParamsPsWildcardPrefixChar123Char125RouteImport } from './routes/params-ps/wildcard/prefix{$}' -import { Route as ParamsPsWildcardChar123Char125suffixRouteImport } from './routes/params-ps/wildcard/{$}suffix' -import { Route as ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport } from './routes/params-ps/wildcard/{$}suffix@대' -import { Route as ParamsSingleValueRouteImport } from './routes/params.single.$value' -import { Route as PostsPostIdEditRouteImport } from './routes/posts_.$postId.edit' -import { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index' -import { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad' -import { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader' -import { Route as RedirectPreloadFirstRouteImport } from './routes/redirect/preload/first' -import { Route as RedirectPreloadSecondRouteImport } from './routes/redirect/preload/second' -import { Route as RedirectPreloadThirdRouteImport } from './routes/redirect/preload/third' -import { Route as RelativeLinkRelativeLinkARouteImport } from './routes/relative/link/relative-link-a' -import { Route as RelativeLinkRelativeLinkBRouteImport } from './routes/relative/link/relative-link-b' -import { Route as RelativeUseNavigateRelativeUseNavigateARouteImport } from './routes/relative/useNavigate/relative-useNavigate-a' -import { Route as RelativeUseNavigateRelativeUseNavigateBRouteImport } from './routes/relative/useNavigate/relative-useNavigate-b' -import { Route as TransitionCountCreateResourceRouteImport } from './routes/transition/count/create-resource' -import { Route as TransitionTypingCreateResourceRouteImport } from './routes/transition/typing/create-resource' -import { Route as Char45824Char54620Char48124Char44397WildcardSplatRouteImport } from './routes/대한민국/wildcard.$' -import { Route as Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport } from './routes/대한민국/🚀.$id' -import { Route as NonNestedDeepBazIndexRouteImport } from './routes/non-nested/deep/$baz.index' -import { Route as NonNestedDeepBazBarRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.route' -import { Route as NonNestedNamedBazIndexRouteImport } from './routes/non-nested/named/$baz.index' -import { Route as NonNestedNamedBazFooRouteImport } from './routes/non-nested/named/$baz.foo' -import { Route as NonNestedNamedBazBarRouteImport } from './routes/non-nested/named/$baz_.bar' -import { Route as NonNestedPathBazIndexRouteImport } from './routes/non-nested/path/baz.index' -import { Route as NonNestedPathBazFooRouteImport } from './routes/non-nested/path/baz.foo' -import { Route as NonNestedPathBazBarRouteImport } from './routes/non-nested/path/baz_.bar' -import { Route as NonNestedPrefixPrefixChar123bazChar125IndexRouteImport } from './routes/non-nested/prefix/prefix{$baz}.index' -import { Route as NonNestedPrefixPrefixChar123bazChar125FooRouteImport } from './routes/non-nested/prefix/prefix{$baz}.foo' -import { Route as NonNestedPrefixPrefixChar123bazChar125BarRouteImport } from './routes/non-nested/prefix/prefix{$baz}_.bar' -import { Route as NonNestedSuffixChar123bazChar125suffixIndexRouteImport } from './routes/non-nested/suffix/{$baz}suffix.index' -import { Route as NonNestedSuffixChar123bazChar125suffixFooRouteImport } from './routes/non-nested/suffix/{$baz}suffix.foo' -import { Route as NonNestedSuffixChar123bazChar125suffixBarRouteImport } from './routes/non-nested/suffix/{$baz}suffix_.bar' -import { Route as ParamsPsNamedFooBarRouteRouteImport } from './routes/params-ps/named/$foo/$bar.route' -import { Route as ParamsPsNonNestedFooBarRouteImport } from './routes/params-ps/non-nested/$foo_/$bar' -import { Route as RelativeLinkNestedIndexRouteImport } from './routes/relative/link/nested/index' -import { Route as RelativeLinkPathIndexRouteImport } from './routes/relative/link/path/index' -import { Route as RelativeLinkWithSearchIndexRouteImport } from './routes/relative/link/with-search/index' -import { Route as RelativeUseNavigateNestedIndexRouteImport } from './routes/relative/useNavigate/nested/index' -import { Route as RelativeUseNavigatePathIndexRouteImport } from './routes/relative/useNavigate/path/index' -import { Route as RelativeUseNavigateWithSearchIndexRouteImport } from './routes/relative/useNavigate/with-search/index' -import { Route as NonNestedDeepBazBarIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.index' -import { Route as NonNestedDeepBazBarFooRouteRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.route' -import { Route as NonNestedDeepBazBarQuxRouteImport } from './routes/non-nested/deep/$baz_.bar_.qux' -import { Route as ParamsPsNamedFooBarBazRouteImport } from './routes/params-ps/named/$foo/$bar.$baz' -import { Route as RelativeLinkNestedDeepIndexRouteImport } from './routes/relative/link/nested/deep/index' -import { Route as RelativeLinkPathPathIndexRouteImport } from './routes/relative/link/path/$path/index' -import { Route as RelativeUseNavigateNestedDeepIndexRouteImport } from './routes/relative/useNavigate/nested/deep/index' -import { Route as RelativeUseNavigatePathPathIndexRouteImport } from './routes/relative/useNavigate/path/$path/index' -import { Route as NonNestedDeepBazBarFooIndexRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo.index' -import { Route as NonNestedDeepBazBarFooQuxRouteImport } from './routes/non-nested/deep/$baz_.bar.$foo_.qux' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const AnchorRoute = AnchorRouteImport.update({ - id: '/anchor', - path: '/anchor', - getParentRoute: () => rootRouteImport, -} as any) -const ComponentTypesTestRoute = ComponentTypesTestRouteImport.update({ - id: '/component-types-test', - path: '/component-types-test', - getParentRoute: () => rootRouteImport, -} as any) -const EditingARoute = EditingARouteImport.update({ - id: '/editing-a', - path: '/editing-a', - getParentRoute: () => rootRouteImport, -} as any) -const EditingBRoute = EditingBRouteImport.update({ - id: '/editing-b', - path: '/editing-b', - getParentRoute: () => rootRouteImport, -} as any) -const HoverPreloadHashRoute = HoverPreloadHashRouteImport.update({ - id: '/hover-preload-hash', - path: '/hover-preload-hash', - getParentRoute: () => rootRouteImport, -} as any) -const MasksRoute = MasksRouteImport.update({ - id: '/masks', - path: '/masks', - getParentRoute: () => rootRouteImport, -} as any) -const NonNestedRouteRoute = NonNestedRouteRouteImport.update({ - id: '/non-nested', - path: '/non-nested', - getParentRoute: () => rootRouteImport, -} as any) -const NotRemountDepsRoute = NotRemountDepsRouteImport.update({ - id: '/notRemountDeps', - path: '/notRemountDeps', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const RemountDepsRoute = RemountDepsRouteImport.update({ - id: '/remountDeps', - path: '/remountDeps', - getParentRoute: () => rootRouteImport, -} as any) -const SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({ - id: '/search-params', - path: '/search-params', - getParentRoute: () => rootRouteImport, -} as any) -const Char45824Char54620Char48124Char44397RouteRoute = - Char45824Char54620Char48124Char44397RouteRouteImport.update({ - id: '/대한민국', - path: '/대한민국', - getParentRoute: () => rootRouteImport, - } as any) -const anotherGroupOnlyrouteinsideRoute = - anotherGroupOnlyrouteinsideRouteImport.update({ - id: '/(another-group)/onlyrouteinside', - path: '/onlyrouteinside', - getParentRoute: () => rootRouteImport, - } as any) -const groupLayoutRoute = groupLayoutRouteImport.update({ - id: '/(group)/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const groupInsideRoute = groupInsideRouteImport.update({ - id: '/(group)/inside', - path: '/inside', - getParentRoute: () => rootRouteImport, -} as any) -const groupLazyinsideRoute = groupLazyinsideRouteImport - .update({ - id: '/(group)/lazyinside', - path: '/lazyinside', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(group)/lazyinside.lazy').then((d) => d.Route)) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const NonNestedDeepRouteRoute = NonNestedDeepRouteRouteImport.update({ - id: '/deep', - path: '/deep', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedNamedRouteRoute = NonNestedNamedRouteRouteImport.update({ - id: '/named', - path: '/named', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedPathRouteRoute = NonNestedPathRouteRouteImport.update({ - id: '/path', - path: '/path', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedPrefixRouteRoute = NonNestedPrefixRouteRouteImport.update({ - id: '/prefix', - path: '/prefix', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const NonNestedSuffixRouteRoute = NonNestedSuffixRouteRouteImport.update({ - id: '/suffix', - path: '/suffix', - getParentRoute: () => NonNestedRouteRoute, -} as any) -const ParamsPsIndexRoute = ParamsPsIndexRouteImport.update({ - id: '/params-ps/', - path: '/params-ps/', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsNonNestedRouteRoute = ParamsPsNonNestedRouteRouteImport.update({ - id: '/params-ps/non-nested', - path: '/params-ps/non-nested', - getParentRoute: () => rootRouteImport, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const RedirectIndexRoute = RedirectIndexRouteImport.update({ - id: '/redirect/', - path: '/redirect/', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetRoute = RedirectTargetRouteImport.update({ - id: '/redirect/$target', - path: '/redirect/$target', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeIndexRoute = RelativeIndexRouteImport.update({ - id: '/relative/', - path: '/relative/', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeLinkRouteRoute = RelativeLinkRouteRouteImport.update({ - id: '/relative/link', - path: '/relative/link', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeUseNavigateRouteRoute = - RelativeUseNavigateRouteRouteImport.update({ - id: '/relative/useNavigate', - path: '/relative/useNavigate', - getParentRoute: () => rootRouteImport, - } as any) -const SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({ - id: '/default', - path: '/default', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const groupLayoutInsidelayoutRoute = groupLayoutInsidelayoutRouteImport.update({ - id: '/insidelayout', - path: '/insidelayout', - getParentRoute: () => groupLayoutRoute, -} as any) -const groupSubfolderInsideRoute = groupSubfolderInsideRouteImport.update({ - id: '/(group)/subfolder/inside', - path: '/subfolder/inside', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) -const MasksAdminUserIdRoute = MasksAdminUserIdRouteImport.update({ - id: '/admin/$userId', - path: '/admin/$userId', - getParentRoute: () => MasksRoute, -} as any) -const MasksPublicUsernameRoute = MasksPublicUsernameRouteImport.update({ - id: '/public/$username', - path: '/public/$username', - getParentRoute: () => MasksRoute, -} as any) -const NonNestedDeepBazRouteRoute = NonNestedDeepBazRouteRouteImport.update({ - id: '/$baz', - path: '/$baz', - getParentRoute: () => NonNestedDeepRouteRoute, -} as any) -const NonNestedNamedBazRouteRoute = NonNestedNamedBazRouteRouteImport.update({ - id: '/$baz', - path: '/$baz', - getParentRoute: () => NonNestedNamedRouteRoute, -} as any) -const NonNestedPathBazRouteRoute = NonNestedPathBazRouteRouteImport.update({ - id: '/baz', - path: '/baz', - getParentRoute: () => NonNestedPathRouteRoute, -} as any) -const NonNestedPrefixPrefixChar123bazChar125RouteRoute = - NonNestedPrefixPrefixChar123bazChar125RouteRouteImport.update({ - id: '/prefix{$baz}', - path: '/prefix{$baz}', - getParentRoute: () => NonNestedPrefixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixRouteRoute = - NonNestedSuffixChar123bazChar125suffixRouteRouteImport.update({ - id: '/{$baz}suffix', - path: '/{$baz}suffix', - getParentRoute: () => NonNestedSuffixRouteRoute, - } as any) -const ParamsPsNamedIndexRoute = ParamsPsNamedIndexRouteImport.update({ - id: '/params-ps/named/', - path: '/params-ps/named/', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsNamedFooRouteRoute = ParamsPsNamedFooRouteRouteImport.update({ - id: '/params-ps/named/$foo', - path: '/params-ps/named/$foo', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsNamedPrefixChar123fooChar125Route = - ParamsPsNamedPrefixChar123fooChar125RouteImport.update({ - id: '/params-ps/named/prefix{$foo}', - path: '/params-ps/named/prefix{$foo}', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsNamedChar123fooChar125suffixRoute = - ParamsPsNamedChar123fooChar125suffixRouteImport.update({ - id: '/params-ps/named/{$foo}suffix', - path: '/params-ps/named/{$foo}suffix', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsNonNestedFooRouteRoute = - ParamsPsNonNestedFooRouteRouteImport.update({ - id: '/$foo_', - path: '/$foo', - getParentRoute: () => ParamsPsNonNestedRouteRoute, - } as any) -const ParamsPsWildcardIndexRoute = ParamsPsWildcardIndexRouteImport.update({ - id: '/params-ps/wildcard/', - path: '/params-ps/wildcard/', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsWildcardSplatRoute = ParamsPsWildcardSplatRouteImport.update({ - id: '/params-ps/wildcard/$', - path: '/params-ps/wildcard/$', - getParentRoute: () => rootRouteImport, -} as any) -const ParamsPsWildcardPrefixAtChar45824Char123Char125Route = - ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport.update({ - id: '/params-ps/wildcard/prefix@대{$}', - path: '/params-ps/wildcard/prefix@대{$}', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsWildcardPrefixChar123Char125Route = - ParamsPsWildcardPrefixChar123Char125RouteImport.update({ - id: '/params-ps/wildcard/prefix{$}', - path: '/params-ps/wildcard/prefix{$}', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsWildcardChar123Char125suffixRoute = - ParamsPsWildcardChar123Char125suffixRouteImport.update({ - id: '/params-ps/wildcard/{$}suffix', - path: '/params-ps/wildcard/{$}suffix', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsPsWildcardChar123Char125suffixAtChar45824Route = - ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport.update({ - id: '/params-ps/wildcard/{$}suffix@대', - path: '/params-ps/wildcard/{$}suffix@대', - getParentRoute: () => rootRouteImport, - } as any) -const ParamsSingleValueRoute = ParamsSingleValueRouteImport.update({ - id: '/params/single/$value', - path: '/params/single/$value', - getParentRoute: () => rootRouteImport, -} as any) -const PostsPostIdEditRoute = PostsPostIdEditRouteImport.update({ - id: '/posts_/$postId/edit', - path: '/posts/$postId/edit', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => RedirectTargetRoute, -} as any) -const RedirectTargetViaBeforeLoadRoute = - RedirectTargetViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({ - id: '/via-loader', - path: '/via-loader', - getParentRoute: () => RedirectTargetRoute, -} as any) -const RedirectPreloadFirstRoute = RedirectPreloadFirstRouteImport.update({ - id: '/redirect/preload/first', - path: '/redirect/preload/first', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectPreloadSecondRoute = RedirectPreloadSecondRouteImport.update({ - id: '/redirect/preload/second', - path: '/redirect/preload/second', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectPreloadThirdRoute = RedirectPreloadThirdRouteImport.update({ - id: '/redirect/preload/third', - path: '/redirect/preload/third', - getParentRoute: () => rootRouteImport, -} as any) -const RelativeLinkRelativeLinkARoute = - RelativeLinkRelativeLinkARouteImport.update({ - id: '/relative-link-a', - path: '/relative-link-a', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeLinkRelativeLinkBRoute = - RelativeLinkRelativeLinkBRouteImport.update({ - id: '/relative-link-b', - path: '/relative-link-b', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeUseNavigateRelativeUseNavigateARoute = - RelativeUseNavigateRelativeUseNavigateARouteImport.update({ - id: '/relative-useNavigate-a', - path: '/relative-useNavigate-a', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigateRelativeUseNavigateBRoute = - RelativeUseNavigateRelativeUseNavigateBRouteImport.update({ - id: '/relative-useNavigate-b', - path: '/relative-useNavigate-b', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const TransitionCountCreateResourceRoute = - TransitionCountCreateResourceRouteImport.update({ - id: '/transition/count/create-resource', - path: '/transition/count/create-resource', - getParentRoute: () => rootRouteImport, - } as any) -const TransitionTypingCreateResourceRoute = - TransitionTypingCreateResourceRouteImport.update({ - id: '/transition/typing/create-resource', - path: '/transition/typing/create-resource', - getParentRoute: () => rootRouteImport, - } as any) -const Char45824Char54620Char48124Char44397WildcardSplatRoute = - Char45824Char54620Char48124Char44397WildcardSplatRouteImport.update({ - id: '/wildcard/$', - path: '/wildcard/$', - getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute, - } as any) -const Char45824Char54620Char48124Char44397Char55357Char56960IdRoute = - Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport.update({ - id: '/🚀/$id', - path: '/🚀/$id', - getParentRoute: () => Char45824Char54620Char48124Char44397RouteRoute, - } as any) -const NonNestedDeepBazIndexRoute = NonNestedDeepBazIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedDeepBazRouteRoute, -} as any) -const NonNestedDeepBazBarRouteRoute = - NonNestedDeepBazBarRouteRouteImport.update({ - id: '/$baz_/bar', - path: '/$baz/bar', - getParentRoute: () => NonNestedDeepRouteRoute, - } as any) -const NonNestedNamedBazIndexRoute = NonNestedNamedBazIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedNamedBazRouteRoute, -} as any) -const NonNestedNamedBazFooRoute = NonNestedNamedBazFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedNamedBazRouteRoute, -} as any) -const NonNestedNamedBazBarRoute = NonNestedNamedBazBarRouteImport.update({ - id: '/$baz_/bar', - path: '/$baz/bar', - getParentRoute: () => NonNestedNamedRouteRoute, -} as any) -const NonNestedPathBazIndexRoute = NonNestedPathBazIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedPathBazRouteRoute, -} as any) -const NonNestedPathBazFooRoute = NonNestedPathBazFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedPathBazRouteRoute, -} as any) -const NonNestedPathBazBarRoute = NonNestedPathBazBarRouteImport.update({ - id: '/baz_/bar', - path: '/baz/bar', - getParentRoute: () => NonNestedPathRouteRoute, -} as any) -const NonNestedPrefixPrefixChar123bazChar125IndexRoute = - NonNestedPrefixPrefixChar123bazChar125IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute, - } as any) -const NonNestedPrefixPrefixChar123bazChar125FooRoute = - NonNestedPrefixPrefixChar123bazChar125FooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedPrefixPrefixChar123bazChar125RouteRoute, - } as any) -const NonNestedPrefixPrefixChar123bazChar125BarRoute = - NonNestedPrefixPrefixChar123bazChar125BarRouteImport.update({ - id: '/prefix{$baz}_/bar', - path: '/prefix{$baz}/bar', - getParentRoute: () => NonNestedPrefixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixIndexRoute = - NonNestedSuffixChar123bazChar125suffixIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixFooRoute = - NonNestedSuffixChar123bazChar125suffixFooRouteImport.update({ - id: '/foo', - path: '/foo', - getParentRoute: () => NonNestedSuffixChar123bazChar125suffixRouteRoute, - } as any) -const NonNestedSuffixChar123bazChar125suffixBarRoute = - NonNestedSuffixChar123bazChar125suffixBarRouteImport.update({ - id: '/{$baz}suffix_/bar', - path: '/{$baz}suffix/bar', - getParentRoute: () => NonNestedSuffixRouteRoute, - } as any) -const ParamsPsNamedFooBarRouteRoute = - ParamsPsNamedFooBarRouteRouteImport.update({ - id: '/$bar', - path: '/$bar', - getParentRoute: () => ParamsPsNamedFooRouteRoute, - } as any) -const ParamsPsNonNestedFooBarRoute = ParamsPsNonNestedFooBarRouteImport.update({ - id: '/$bar', - path: '/$bar', - getParentRoute: () => ParamsPsNonNestedFooRouteRoute, -} as any) -const RelativeLinkNestedIndexRoute = RelativeLinkNestedIndexRouteImport.update({ - id: '/nested/', - path: '/nested/', - getParentRoute: () => RelativeLinkRouteRoute, -} as any) -const RelativeLinkPathIndexRoute = RelativeLinkPathIndexRouteImport.update({ - id: '/path/', - path: '/path/', - getParentRoute: () => RelativeLinkRouteRoute, -} as any) -const RelativeLinkWithSearchIndexRoute = - RelativeLinkWithSearchIndexRouteImport.update({ - id: '/with-search/', - path: '/with-search/', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeUseNavigateNestedIndexRoute = - RelativeUseNavigateNestedIndexRouteImport.update({ - id: '/nested/', - path: '/nested/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigatePathIndexRoute = - RelativeUseNavigatePathIndexRouteImport.update({ - id: '/path/', - path: '/path/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigateWithSearchIndexRoute = - RelativeUseNavigateWithSearchIndexRouteImport.update({ - id: '/with-search/', - path: '/with-search/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const NonNestedDeepBazBarIndexRoute = - NonNestedDeepBazBarIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedDeepBazBarRouteRoute, - } as any) -const NonNestedDeepBazBarFooRouteRoute = - NonNestedDeepBazBarFooRouteRouteImport.update({ - id: '/$foo', - path: '/$foo', - getParentRoute: () => NonNestedDeepBazBarRouteRoute, - } as any) -const NonNestedDeepBazBarQuxRoute = NonNestedDeepBazBarQuxRouteImport.update({ - id: '/$baz_/bar_/qux', - path: '/$baz/bar/qux', - getParentRoute: () => NonNestedDeepRouteRoute, -} as any) -const ParamsPsNamedFooBarBazRoute = ParamsPsNamedFooBarBazRouteImport.update({ - id: '/$baz', - path: '/$baz', - getParentRoute: () => ParamsPsNamedFooBarRouteRoute, -} as any) -const RelativeLinkNestedDeepIndexRoute = - RelativeLinkNestedDeepIndexRouteImport.update({ - id: '/nested/deep/', - path: '/nested/deep/', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeLinkPathPathIndexRoute = - RelativeLinkPathPathIndexRouteImport.update({ - id: '/path/$path/', - path: '/path/$path/', - getParentRoute: () => RelativeLinkRouteRoute, - } as any) -const RelativeUseNavigateNestedDeepIndexRoute = - RelativeUseNavigateNestedDeepIndexRouteImport.update({ - id: '/nested/deep/', - path: '/nested/deep/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const RelativeUseNavigatePathPathIndexRoute = - RelativeUseNavigatePathPathIndexRouteImport.update({ - id: '/path/$path/', - path: '/path/$path/', - getParentRoute: () => RelativeUseNavigateRouteRoute, - } as any) -const NonNestedDeepBazBarFooIndexRoute = - NonNestedDeepBazBarFooIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NonNestedDeepBazBarFooRouteRoute, - } as any) -const NonNestedDeepBazBarFooQuxRoute = - NonNestedDeepBazBarFooQuxRouteImport.update({ - id: '/$foo_/qux', - path: '/$foo/qux', - getParentRoute: () => NonNestedDeepBazBarRouteRoute, - } as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/non-nested': typeof NonNestedRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - '/anchor': typeof AnchorRoute - '/component-types-test': typeof ComponentTypesTestRoute - '/editing-a': typeof EditingARoute - '/editing-b': typeof EditingBRoute - '/hover-preload-hash': typeof HoverPreloadHashRoute - '/masks': typeof MasksRouteWithChildren - '/notRemountDeps': typeof NotRemountDepsRoute - '/posts': typeof PostsRouteWithChildren - '/remountDeps': typeof RemountDepsRoute - '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren - '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren - '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren - '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren - '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren - '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren - '/relative/link': typeof RelativeLinkRouteRouteWithChildren - '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren - '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute - '/inside': typeof groupInsideRoute - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/params-ps/': typeof ParamsPsIndexRoute - '/posts/': typeof PostsIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/relative/': typeof RelativeIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren - '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren - '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren - '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren - '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren - '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren - '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren - '/insidelayout': typeof groupLayoutInsidelayoutRoute - '/subfolder/inside': typeof groupSubfolderInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/masks/admin/$userId': typeof MasksAdminUserIdRoute - '/masks/public/$username': typeof MasksPublicUsernameRoute - '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route - '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute - '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute - '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route - '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute - '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - '/params/single/$value': typeof ParamsSingleValueRoute - '/posts/$postId/edit': typeof PostsPostIdEditRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/redirect/preload/first': typeof RedirectPreloadFirstRoute - '/redirect/preload/second': typeof RedirectPreloadSecondRoute - '/redirect/preload/third': typeof RedirectPreloadThirdRoute - '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute - '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute - '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute - '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute - '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute - '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute - '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute - '/params-ps/named/': typeof ParamsPsNamedIndexRoute - '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren - '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren - '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute - '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute - '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute - '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute - '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute - '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute - '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute - '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute - '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute - '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute - '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute - '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute - '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute - '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute - '/relative/link/path/': typeof RelativeLinkPathIndexRoute - '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute - '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute - '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute - '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute - '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren - '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute - '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute - '/non-nested/deep/$baz/bar/': typeof NonNestedDeepBazBarIndexRoute - '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute - '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute - '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute - '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute - '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute - '/non-nested/deep/$baz/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/non-nested': typeof NonNestedRouteRouteWithChildren - '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - '/anchor': typeof AnchorRoute - '/component-types-test': typeof ComponentTypesTestRoute - '/editing-a': typeof EditingARoute - '/editing-b': typeof EditingBRoute - '/hover-preload-hash': typeof HoverPreloadHashRoute - '/masks': typeof MasksRouteWithChildren - '/notRemountDeps': typeof NotRemountDepsRoute - '/remountDeps': typeof RemountDepsRoute - '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren - '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren - '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren - '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren - '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren - '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren - '/relative/link': typeof RelativeLinkRouteRouteWithChildren - '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren - '/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute - '/inside': typeof groupInsideRoute - '/lazyinside': typeof groupLazyinsideRoute - '/posts/$postId': typeof PostsPostIdRoute - '/search-params/default': typeof SearchParamsDefaultRoute - '/params-ps': typeof ParamsPsIndexRoute - '/posts': typeof PostsIndexRoute - '/redirect': typeof RedirectIndexRoute - '/relative': typeof RelativeIndexRoute - '/search-params': typeof SearchParamsIndexRoute - '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren - '/params-ps/non-nested/$foo': typeof ParamsPsNonNestedFooRouteRouteWithChildren - '/insidelayout': typeof groupLayoutInsidelayoutRoute - '/subfolder/inside': typeof groupSubfolderInsideRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/masks/admin/$userId': typeof MasksAdminUserIdRoute - '/masks/public/$username': typeof MasksPublicUsernameRoute - '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route - '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute - '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute - '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route - '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute - '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - '/params/single/$value': typeof ParamsSingleValueRoute - '/posts/$postId/edit': typeof PostsPostIdEditRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/redirect/preload/first': typeof RedirectPreloadFirstRoute - '/redirect/preload/second': typeof RedirectPreloadSecondRoute - '/redirect/preload/third': typeof RedirectPreloadThirdRoute - '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute - '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute - '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute - '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute - '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute - '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute - '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute - '/params-ps/named': typeof ParamsPsNamedIndexRoute - '/params-ps/wildcard': typeof ParamsPsWildcardIndexRoute - '/redirect/$target': typeof RedirectTargetIndexRoute - '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren - '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute - '/non-nested/named/$baz/bar': typeof NonNestedNamedBazBarRoute - '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute - '/non-nested/path/baz/bar': typeof NonNestedPathBazBarRoute - '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - '/non-nested/prefix/prefix{$baz}/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute - '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute - '/non-nested/suffix/{$baz}suffix/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute - '/params-ps/non-nested/$foo/$bar': typeof ParamsPsNonNestedFooBarRoute - '/non-nested/deep/$baz': typeof NonNestedDeepBazIndexRoute - '/non-nested/named/$baz': typeof NonNestedNamedBazIndexRoute - '/non-nested/path/baz': typeof NonNestedPathBazIndexRoute - '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute - '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute - '/relative/link/nested': typeof RelativeLinkNestedIndexRoute - '/relative/link/path': typeof RelativeLinkPathIndexRoute - '/relative/link/with-search': typeof RelativeLinkWithSearchIndexRoute - '/relative/useNavigate/nested': typeof RelativeUseNavigateNestedIndexRoute - '/relative/useNavigate/path': typeof RelativeUseNavigatePathIndexRoute - '/relative/useNavigate/with-search': typeof RelativeUseNavigateWithSearchIndexRoute - '/non-nested/deep/$baz/bar/qux': typeof NonNestedDeepBazBarQuxRoute - '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute - '/non-nested/deep/$baz/bar': typeof NonNestedDeepBazBarIndexRoute - '/relative/link/nested/deep': typeof RelativeLinkNestedDeepIndexRoute - '/relative/link/path/$path': typeof RelativeLinkPathPathIndexRoute - '/relative/useNavigate/nested/deep': typeof RelativeUseNavigateNestedDeepIndexRoute - '/relative/useNavigate/path/$path': typeof RelativeUseNavigatePathPathIndexRoute - '/non-nested/deep/$baz/bar/$foo/qux': typeof NonNestedDeepBazBarFooQuxRoute - '/non-nested/deep/$baz/bar/$foo': typeof NonNestedDeepBazBarFooIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/non-nested': typeof NonNestedRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/대한민국': typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - '/_layout': typeof LayoutRouteWithChildren - '/anchor': typeof AnchorRoute - '/component-types-test': typeof ComponentTypesTestRoute - '/editing-a': typeof EditingARoute - '/editing-b': typeof EditingBRoute - '/hover-preload-hash': typeof HoverPreloadHashRoute - '/masks': typeof MasksRouteWithChildren - '/notRemountDeps': typeof NotRemountDepsRoute - '/posts': typeof PostsRouteWithChildren - '/remountDeps': typeof RemountDepsRoute - '/non-nested/deep': typeof NonNestedDeepRouteRouteWithChildren - '/non-nested/named': typeof NonNestedNamedRouteRouteWithChildren - '/non-nested/path': typeof NonNestedPathRouteRouteWithChildren - '/non-nested/prefix': typeof NonNestedPrefixRouteRouteWithChildren - '/non-nested/suffix': typeof NonNestedSuffixRouteRouteWithChildren - '/params-ps/non-nested': typeof ParamsPsNonNestedRouteRouteWithChildren - '/relative/link': typeof RelativeLinkRouteRouteWithChildren - '/relative/useNavigate': typeof RelativeUseNavigateRouteRouteWithChildren - '/(another-group)/onlyrouteinside': typeof anotherGroupOnlyrouteinsideRoute - '/(group)/_layout': typeof groupLayoutRouteWithChildren - '/(group)/inside': typeof groupInsideRoute - '/(group)/lazyinside': typeof groupLazyinsideRoute - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/params-ps/': typeof ParamsPsIndexRoute - '/posts/': typeof PostsIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/relative/': typeof RelativeIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/non-nested/deep/$baz': typeof NonNestedDeepBazRouteRouteWithChildren - '/non-nested/named/$baz': typeof NonNestedNamedBazRouteRouteWithChildren - '/non-nested/path/baz': typeof NonNestedPathBazRouteRouteWithChildren - '/non-nested/prefix/prefix{$baz}': typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren - '/non-nested/suffix/{$baz}suffix': typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren - '/params-ps/named/$foo': typeof ParamsPsNamedFooRouteRouteWithChildren - '/params-ps/non-nested/$foo_': typeof ParamsPsNonNestedFooRouteRouteWithChildren - '/(group)/_layout/insidelayout': typeof groupLayoutInsidelayoutRoute - '/(group)/subfolder/inside': typeof groupSubfolderInsideRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/masks/admin/$userId': typeof MasksAdminUserIdRoute - '/masks/public/$username': typeof MasksPublicUsernameRoute - '/params-ps/named/prefix{$foo}': typeof ParamsPsNamedPrefixChar123fooChar125Route - '/params-ps/named/{$foo}suffix': typeof ParamsPsNamedChar123fooChar125suffixRoute - '/params-ps/wildcard/$': typeof ParamsPsWildcardSplatRoute - '/params-ps/wildcard/prefix@대{$}': typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - '/params-ps/wildcard/prefix{$}': typeof ParamsPsWildcardPrefixChar123Char125Route - '/params-ps/wildcard/{$}suffix': typeof ParamsPsWildcardChar123Char125suffixRoute - '/params-ps/wildcard/{$}suffix@대': typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - '/params/single/$value': typeof ParamsSingleValueRoute - '/posts_/$postId/edit': typeof PostsPostIdEditRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/redirect/preload/first': typeof RedirectPreloadFirstRoute - '/redirect/preload/second': typeof RedirectPreloadSecondRoute - '/redirect/preload/third': typeof RedirectPreloadThirdRoute - '/relative/link/relative-link-a': typeof RelativeLinkRelativeLinkARoute - '/relative/link/relative-link-b': typeof RelativeLinkRelativeLinkBRoute - '/relative/useNavigate/relative-useNavigate-a': typeof RelativeUseNavigateRelativeUseNavigateARoute - '/relative/useNavigate/relative-useNavigate-b': typeof RelativeUseNavigateRelativeUseNavigateBRoute - '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute - '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute - '/대한민국/wildcard/$': typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - '/대한민국/🚀/$id': typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute - '/params-ps/named/': typeof ParamsPsNamedIndexRoute - '/params-ps/wildcard/': typeof ParamsPsWildcardIndexRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/non-nested/deep/$baz_/bar': typeof NonNestedDeepBazBarRouteRouteWithChildren - '/params-ps/named/$foo/$bar': typeof ParamsPsNamedFooBarRouteRouteWithChildren - '/non-nested/named/$baz/foo': typeof NonNestedNamedBazFooRoute - '/non-nested/named/$baz_/bar': typeof NonNestedNamedBazBarRoute - '/non-nested/path/baz/foo': typeof NonNestedPathBazFooRoute - '/non-nested/path/baz_/bar': typeof NonNestedPathBazBarRoute - '/non-nested/prefix/prefix{$baz}/foo': typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - '/non-nested/prefix/prefix{$baz}_/bar': typeof NonNestedPrefixPrefixChar123bazChar125BarRoute - '/non-nested/suffix/{$baz}suffix/foo': typeof NonNestedSuffixChar123bazChar125suffixFooRoute - '/non-nested/suffix/{$baz}suffix_/bar': typeof NonNestedSuffixChar123bazChar125suffixBarRoute - '/params-ps/non-nested/$foo_/$bar': typeof ParamsPsNonNestedFooBarRoute - '/non-nested/deep/$baz/': typeof NonNestedDeepBazIndexRoute - '/non-nested/named/$baz/': typeof NonNestedNamedBazIndexRoute - '/non-nested/path/baz/': typeof NonNestedPathBazIndexRoute - '/non-nested/prefix/prefix{$baz}/': typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute - '/non-nested/suffix/{$baz}suffix/': typeof NonNestedSuffixChar123bazChar125suffixIndexRoute - '/relative/link/nested/': typeof RelativeLinkNestedIndexRoute - '/relative/link/path/': typeof RelativeLinkPathIndexRoute - '/relative/link/with-search/': typeof RelativeLinkWithSearchIndexRoute - '/relative/useNavigate/nested/': typeof RelativeUseNavigateNestedIndexRoute - '/relative/useNavigate/path/': typeof RelativeUseNavigatePathIndexRoute - '/relative/useNavigate/with-search/': typeof RelativeUseNavigateWithSearchIndexRoute - '/non-nested/deep/$baz_/bar/$foo': typeof NonNestedDeepBazBarFooRouteRouteWithChildren - '/non-nested/deep/$baz_/bar_/qux': typeof NonNestedDeepBazBarQuxRoute - '/params-ps/named/$foo/$bar/$baz': typeof ParamsPsNamedFooBarBazRoute - '/non-nested/deep/$baz_/bar/': typeof NonNestedDeepBazBarIndexRoute - '/relative/link/nested/deep/': typeof RelativeLinkNestedDeepIndexRoute - '/relative/link/path/$path/': typeof RelativeLinkPathPathIndexRoute - '/relative/useNavigate/nested/deep/': typeof RelativeUseNavigateNestedDeepIndexRoute - '/relative/useNavigate/path/$path/': typeof RelativeUseNavigatePathPathIndexRoute - '/non-nested/deep/$baz_/bar/$foo_/qux': typeof NonNestedDeepBazBarFooQuxRoute - '/non-nested/deep/$baz_/bar/$foo/': typeof NonNestedDeepBazBarFooIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/non-nested' - | '/search-params' - | '/대한민국' - | '/anchor' - | '/component-types-test' - | '/editing-a' - | '/editing-b' - | '/hover-preload-hash' - | '/masks' - | '/notRemountDeps' - | '/posts' - | '/remountDeps' - | '/non-nested/deep' - | '/non-nested/named' - | '/non-nested/path' - | '/non-nested/prefix' - | '/non-nested/suffix' - | '/params-ps/non-nested' - | '/relative/link' - | '/relative/useNavigate' - | '/onlyrouteinside' - | '/inside' - | '/lazyinside' - | '/posts/$postId' - | '/redirect/$target' - | '/search-params/default' - | '/params-ps/' - | '/posts/' - | '/redirect/' - | '/relative/' - | '/search-params/' - | '/non-nested/deep/$baz' - | '/non-nested/named/$baz' - | '/non-nested/path/baz' - | '/non-nested/prefix/prefix{$baz}' - | '/non-nested/suffix/{$baz}suffix' - | '/params-ps/named/$foo' - | '/params-ps/non-nested/$foo' - | '/insidelayout' - | '/subfolder/inside' - | '/layout-a' - | '/layout-b' - | '/masks/admin/$userId' - | '/masks/public/$username' - | '/params-ps/named/prefix{$foo}' - | '/params-ps/named/{$foo}suffix' - | '/params-ps/wildcard/$' - | '/params-ps/wildcard/prefix@대{$}' - | '/params-ps/wildcard/prefix{$}' - | '/params-ps/wildcard/{$}suffix' - | '/params-ps/wildcard/{$}suffix@대' - | '/params/single/$value' - | '/posts/$postId/edit' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/redirect/preload/first' - | '/redirect/preload/second' - | '/redirect/preload/third' - | '/relative/link/relative-link-a' - | '/relative/link/relative-link-b' - | '/relative/useNavigate/relative-useNavigate-a' - | '/relative/useNavigate/relative-useNavigate-b' - | '/transition/count/create-resource' - | '/transition/typing/create-resource' - | '/대한민국/wildcard/$' - | '/대한민국/🚀/$id' - | '/params-ps/named/' - | '/params-ps/wildcard/' - | '/redirect/$target/' - | '/non-nested/deep/$baz/bar' - | '/params-ps/named/$foo/$bar' - | '/non-nested/named/$baz/foo' - | '/non-nested/named/$baz/bar' - | '/non-nested/path/baz/foo' - | '/non-nested/path/baz/bar' - | '/non-nested/prefix/prefix{$baz}/foo' - | '/non-nested/prefix/prefix{$baz}/bar' - | '/non-nested/suffix/{$baz}suffix/foo' - | '/non-nested/suffix/{$baz}suffix/bar' - | '/params-ps/non-nested/$foo/$bar' - | '/non-nested/deep/$baz/' - | '/non-nested/named/$baz/' - | '/non-nested/path/baz/' - | '/non-nested/prefix/prefix{$baz}/' - | '/non-nested/suffix/{$baz}suffix/' - | '/relative/link/nested/' - | '/relative/link/path/' - | '/relative/link/with-search/' - | '/relative/useNavigate/nested/' - | '/relative/useNavigate/path/' - | '/relative/useNavigate/with-search/' - | '/non-nested/deep/$baz/bar/$foo' - | '/non-nested/deep/$baz/bar/qux' - | '/params-ps/named/$foo/$bar/$baz' - | '/non-nested/deep/$baz/bar/' - | '/relative/link/nested/deep/' - | '/relative/link/path/$path/' - | '/relative/useNavigate/nested/deep/' - | '/relative/useNavigate/path/$path/' - | '/non-nested/deep/$baz/bar/$foo/qux' - | '/non-nested/deep/$baz/bar/$foo/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/non-nested' - | '/대한민국' - | '/anchor' - | '/component-types-test' - | '/editing-a' - | '/editing-b' - | '/hover-preload-hash' - | '/masks' - | '/notRemountDeps' - | '/remountDeps' - | '/non-nested/deep' - | '/non-nested/named' - | '/non-nested/path' - | '/non-nested/prefix' - | '/non-nested/suffix' - | '/params-ps/non-nested' - | '/relative/link' - | '/relative/useNavigate' - | '/onlyrouteinside' - | '/inside' - | '/lazyinside' - | '/posts/$postId' - | '/search-params/default' - | '/params-ps' - | '/posts' - | '/redirect' - | '/relative' - | '/search-params' - | '/params-ps/named/$foo' - | '/params-ps/non-nested/$foo' - | '/insidelayout' - | '/subfolder/inside' - | '/layout-a' - | '/layout-b' - | '/masks/admin/$userId' - | '/masks/public/$username' - | '/params-ps/named/prefix{$foo}' - | '/params-ps/named/{$foo}suffix' - | '/params-ps/wildcard/$' - | '/params-ps/wildcard/prefix@대{$}' - | '/params-ps/wildcard/prefix{$}' - | '/params-ps/wildcard/{$}suffix' - | '/params-ps/wildcard/{$}suffix@대' - | '/params/single/$value' - | '/posts/$postId/edit' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/redirect/preload/first' - | '/redirect/preload/second' - | '/redirect/preload/third' - | '/relative/link/relative-link-a' - | '/relative/link/relative-link-b' - | '/relative/useNavigate/relative-useNavigate-a' - | '/relative/useNavigate/relative-useNavigate-b' - | '/transition/count/create-resource' - | '/transition/typing/create-resource' - | '/대한민국/wildcard/$' - | '/대한민국/🚀/$id' - | '/params-ps/named' - | '/params-ps/wildcard' - | '/redirect/$target' - | '/params-ps/named/$foo/$bar' - | '/non-nested/named/$baz/foo' - | '/non-nested/named/$baz/bar' - | '/non-nested/path/baz/foo' - | '/non-nested/path/baz/bar' - | '/non-nested/prefix/prefix{$baz}/foo' - | '/non-nested/prefix/prefix{$baz}/bar' - | '/non-nested/suffix/{$baz}suffix/foo' - | '/non-nested/suffix/{$baz}suffix/bar' - | '/params-ps/non-nested/$foo/$bar' - | '/non-nested/deep/$baz' - | '/non-nested/named/$baz' - | '/non-nested/path/baz' - | '/non-nested/prefix/prefix{$baz}' - | '/non-nested/suffix/{$baz}suffix' - | '/relative/link/nested' - | '/relative/link/path' - | '/relative/link/with-search' - | '/relative/useNavigate/nested' - | '/relative/useNavigate/path' - | '/relative/useNavigate/with-search' - | '/non-nested/deep/$baz/bar/qux' - | '/params-ps/named/$foo/$bar/$baz' - | '/non-nested/deep/$baz/bar' - | '/relative/link/nested/deep' - | '/relative/link/path/$path' - | '/relative/useNavigate/nested/deep' - | '/relative/useNavigate/path/$path' - | '/non-nested/deep/$baz/bar/$foo/qux' - | '/non-nested/deep/$baz/bar/$foo' - id: - | '__root__' - | '/' - | '/non-nested' - | '/search-params' - | '/대한민국' - | '/_layout' - | '/anchor' - | '/component-types-test' - | '/editing-a' - | '/editing-b' - | '/hover-preload-hash' - | '/masks' - | '/notRemountDeps' - | '/posts' - | '/remountDeps' - | '/non-nested/deep' - | '/non-nested/named' - | '/non-nested/path' - | '/non-nested/prefix' - | '/non-nested/suffix' - | '/params-ps/non-nested' - | '/relative/link' - | '/relative/useNavigate' - | '/(another-group)/onlyrouteinside' - | '/(group)/_layout' - | '/(group)/inside' - | '/(group)/lazyinside' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/redirect/$target' - | '/search-params/default' - | '/params-ps/' - | '/posts/' - | '/redirect/' - | '/relative/' - | '/search-params/' - | '/non-nested/deep/$baz' - | '/non-nested/named/$baz' - | '/non-nested/path/baz' - | '/non-nested/prefix/prefix{$baz}' - | '/non-nested/suffix/{$baz}suffix' - | '/params-ps/named/$foo' - | '/params-ps/non-nested/$foo_' - | '/(group)/_layout/insidelayout' - | '/(group)/subfolder/inside' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - | '/masks/admin/$userId' - | '/masks/public/$username' - | '/params-ps/named/prefix{$foo}' - | '/params-ps/named/{$foo}suffix' - | '/params-ps/wildcard/$' - | '/params-ps/wildcard/prefix@대{$}' - | '/params-ps/wildcard/prefix{$}' - | '/params-ps/wildcard/{$}suffix' - | '/params-ps/wildcard/{$}suffix@대' - | '/params/single/$value' - | '/posts_/$postId/edit' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/redirect/preload/first' - | '/redirect/preload/second' - | '/redirect/preload/third' - | '/relative/link/relative-link-a' - | '/relative/link/relative-link-b' - | '/relative/useNavigate/relative-useNavigate-a' - | '/relative/useNavigate/relative-useNavigate-b' - | '/transition/count/create-resource' - | '/transition/typing/create-resource' - | '/대한민국/wildcard/$' - | '/대한민국/🚀/$id' - | '/params-ps/named/' - | '/params-ps/wildcard/' - | '/redirect/$target/' - | '/non-nested/deep/$baz_/bar' - | '/params-ps/named/$foo/$bar' - | '/non-nested/named/$baz/foo' - | '/non-nested/named/$baz_/bar' - | '/non-nested/path/baz/foo' - | '/non-nested/path/baz_/bar' - | '/non-nested/prefix/prefix{$baz}/foo' - | '/non-nested/prefix/prefix{$baz}_/bar' - | '/non-nested/suffix/{$baz}suffix/foo' - | '/non-nested/suffix/{$baz}suffix_/bar' - | '/params-ps/non-nested/$foo_/$bar' - | '/non-nested/deep/$baz/' - | '/non-nested/named/$baz/' - | '/non-nested/path/baz/' - | '/non-nested/prefix/prefix{$baz}/' - | '/non-nested/suffix/{$baz}suffix/' - | '/relative/link/nested/' - | '/relative/link/path/' - | '/relative/link/with-search/' - | '/relative/useNavigate/nested/' - | '/relative/useNavigate/path/' - | '/relative/useNavigate/with-search/' - | '/non-nested/deep/$baz_/bar/$foo' - | '/non-nested/deep/$baz_/bar_/qux' - | '/params-ps/named/$foo/$bar/$baz' - | '/non-nested/deep/$baz_/bar/' - | '/relative/link/nested/deep/' - | '/relative/link/path/$path/' - | '/relative/useNavigate/nested/deep/' - | '/relative/useNavigate/path/$path/' - | '/non-nested/deep/$baz_/bar/$foo_/qux' - | '/non-nested/deep/$baz_/bar/$foo/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - NonNestedRouteRoute: typeof NonNestedRouteRouteWithChildren - SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren - Char45824Char54620Char48124Char44397RouteRoute: typeof Char45824Char54620Char48124Char44397RouteRouteWithChildren - LayoutRoute: typeof LayoutRouteWithChildren - AnchorRoute: typeof AnchorRoute - ComponentTypesTestRoute: typeof ComponentTypesTestRoute - EditingARoute: typeof EditingARoute - EditingBRoute: typeof EditingBRoute - HoverPreloadHashRoute: typeof HoverPreloadHashRoute - MasksRoute: typeof MasksRouteWithChildren - NotRemountDepsRoute: typeof NotRemountDepsRoute - PostsRoute: typeof PostsRouteWithChildren - RemountDepsRoute: typeof RemountDepsRoute - ParamsPsNonNestedRouteRoute: typeof ParamsPsNonNestedRouteRouteWithChildren - RelativeLinkRouteRoute: typeof RelativeLinkRouteRouteWithChildren - RelativeUseNavigateRouteRoute: typeof RelativeUseNavigateRouteRouteWithChildren - anotherGroupOnlyrouteinsideRoute: typeof anotherGroupOnlyrouteinsideRoute - groupLayoutRoute: typeof groupLayoutRouteWithChildren - groupInsideRoute: typeof groupInsideRoute - groupLazyinsideRoute: typeof groupLazyinsideRoute - RedirectTargetRoute: typeof RedirectTargetRouteWithChildren - ParamsPsIndexRoute: typeof ParamsPsIndexRoute - RedirectIndexRoute: typeof RedirectIndexRoute - RelativeIndexRoute: typeof RelativeIndexRoute - ParamsPsNamedFooRouteRoute: typeof ParamsPsNamedFooRouteRouteWithChildren - groupSubfolderInsideRoute: typeof groupSubfolderInsideRoute - ParamsPsNamedPrefixChar123fooChar125Route: typeof ParamsPsNamedPrefixChar123fooChar125Route - ParamsPsNamedChar123fooChar125suffixRoute: typeof ParamsPsNamedChar123fooChar125suffixRoute - ParamsPsWildcardSplatRoute: typeof ParamsPsWildcardSplatRoute - ParamsPsWildcardPrefixAtChar45824Char123Char125Route: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125Route - ParamsPsWildcardPrefixChar123Char125Route: typeof ParamsPsWildcardPrefixChar123Char125Route - ParamsPsWildcardChar123Char125suffixRoute: typeof ParamsPsWildcardChar123Char125suffixRoute - ParamsPsWildcardChar123Char125suffixAtChar45824Route: typeof ParamsPsWildcardChar123Char125suffixAtChar45824Route - ParamsSingleValueRoute: typeof ParamsSingleValueRoute - PostsPostIdEditRoute: typeof PostsPostIdEditRoute - RedirectPreloadFirstRoute: typeof RedirectPreloadFirstRoute - RedirectPreloadSecondRoute: typeof RedirectPreloadSecondRoute - RedirectPreloadThirdRoute: typeof RedirectPreloadThirdRoute - TransitionCountCreateResourceRoute: typeof TransitionCountCreateResourceRoute - TransitionTypingCreateResourceRoute: typeof TransitionTypingCreateResourceRoute - ParamsPsNamedIndexRoute: typeof ParamsPsNamedIndexRoute - ParamsPsWildcardIndexRoute: typeof ParamsPsWildcardIndexRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/anchor': { - id: '/anchor' - path: '/anchor' - fullPath: '/anchor' - preLoaderRoute: typeof AnchorRouteImport - parentRoute: typeof rootRouteImport - } - '/component-types-test': { - id: '/component-types-test' - path: '/component-types-test' - fullPath: '/component-types-test' - preLoaderRoute: typeof ComponentTypesTestRouteImport - parentRoute: typeof rootRouteImport - } - '/editing-a': { - id: '/editing-a' - path: '/editing-a' - fullPath: '/editing-a' - preLoaderRoute: typeof EditingARouteImport - parentRoute: typeof rootRouteImport - } - '/editing-b': { - id: '/editing-b' - path: '/editing-b' - fullPath: '/editing-b' - preLoaderRoute: typeof EditingBRouteImport - parentRoute: typeof rootRouteImport - } - '/hover-preload-hash': { - id: '/hover-preload-hash' - path: '/hover-preload-hash' - fullPath: '/hover-preload-hash' - preLoaderRoute: typeof HoverPreloadHashRouteImport - parentRoute: typeof rootRouteImport - } - '/masks': { - id: '/masks' - path: '/masks' - fullPath: '/masks' - preLoaderRoute: typeof MasksRouteImport - parentRoute: typeof rootRouteImport - } - '/non-nested': { - id: '/non-nested' - path: '/non-nested' - fullPath: '/non-nested' - preLoaderRoute: typeof NonNestedRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/notRemountDeps': { - id: '/notRemountDeps' - path: '/notRemountDeps' - fullPath: '/notRemountDeps' - preLoaderRoute: typeof NotRemountDepsRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/remountDeps': { - id: '/remountDeps' - path: '/remountDeps' - fullPath: '/remountDeps' - preLoaderRoute: typeof RemountDepsRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params': { - id: '/search-params' - path: '/search-params' - fullPath: '/search-params' - preLoaderRoute: typeof SearchParamsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/대한민국': { - id: '/대한민국' - path: '/대한민국' - fullPath: '/대한민국' - preLoaderRoute: typeof Char45824Char54620Char48124Char44397RouteRouteImport - parentRoute: typeof rootRouteImport - } - '/(another-group)/onlyrouteinside': { - id: '/(another-group)/onlyrouteinside' - path: '/onlyrouteinside' - fullPath: '/onlyrouteinside' - preLoaderRoute: typeof anotherGroupOnlyrouteinsideRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/_layout': { - id: '/(group)/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof groupLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/inside': { - id: '/(group)/inside' - path: '/inside' - fullPath: '/inside' - preLoaderRoute: typeof groupInsideRouteImport - parentRoute: typeof rootRouteImport - } - '/(group)/lazyinside': { - id: '/(group)/lazyinside' - path: '/lazyinside' - fullPath: '/lazyinside' - preLoaderRoute: typeof groupLazyinsideRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/non-nested/deep': { - id: '/non-nested/deep' - path: '/deep' - fullPath: '/non-nested/deep' - preLoaderRoute: typeof NonNestedDeepRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/named': { - id: '/non-nested/named' - path: '/named' - fullPath: '/non-nested/named' - preLoaderRoute: typeof NonNestedNamedRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/path': { - id: '/non-nested/path' - path: '/path' - fullPath: '/non-nested/path' - preLoaderRoute: typeof NonNestedPathRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/prefix': { - id: '/non-nested/prefix' - path: '/prefix' - fullPath: '/non-nested/prefix' - preLoaderRoute: typeof NonNestedPrefixRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/non-nested/suffix': { - id: '/non-nested/suffix' - path: '/suffix' - fullPath: '/non-nested/suffix' - preLoaderRoute: typeof NonNestedSuffixRouteRouteImport - parentRoute: typeof NonNestedRouteRoute - } - '/params-ps/': { - id: '/params-ps/' - path: '/params-ps' - fullPath: '/params-ps/' - preLoaderRoute: typeof ParamsPsIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/non-nested': { - id: '/params-ps/non-nested' - path: '/params-ps/non-nested' - fullPath: '/params-ps/non-nested' - preLoaderRoute: typeof ParamsPsNonNestedRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/redirect/': { - id: '/redirect/' - path: '/redirect' - fullPath: '/redirect/' - preLoaderRoute: typeof RedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target': { - id: '/redirect/$target' - path: '/redirect/$target' - fullPath: '/redirect/$target' - preLoaderRoute: typeof RedirectTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/': { - id: '/relative/' - path: '/relative' - fullPath: '/relative/' - preLoaderRoute: typeof RelativeIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/link': { - id: '/relative/link' - path: '/relative/link' - fullPath: '/relative/link' - preLoaderRoute: typeof RelativeLinkRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/useNavigate': { - id: '/relative/useNavigate' - path: '/relative/useNavigate' - fullPath: '/relative/useNavigate' - preLoaderRoute: typeof RelativeUseNavigateRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params/': { - id: '/search-params/' - path: '/' - fullPath: '/search-params/' - preLoaderRoute: typeof SearchParamsIndexRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/search-params/default': { - id: '/search-params/default' - path: '/default' - fullPath: '/search-params/default' - preLoaderRoute: typeof SearchParamsDefaultRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/(group)/_layout/insidelayout': { - id: '/(group)/_layout/insidelayout' - path: '/insidelayout' - fullPath: '/insidelayout' - preLoaderRoute: typeof groupLayoutInsidelayoutRouteImport - parentRoute: typeof groupLayoutRoute - } - '/(group)/subfolder/inside': { - id: '/(group)/subfolder/inside' - path: '/subfolder/inside' - fullPath: '/subfolder/inside' - preLoaderRoute: typeof groupSubfolderInsideRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - '/masks/admin/$userId': { - id: '/masks/admin/$userId' - path: '/admin/$userId' - fullPath: '/masks/admin/$userId' - preLoaderRoute: typeof MasksAdminUserIdRouteImport - parentRoute: typeof MasksRoute - } - '/masks/public/$username': { - id: '/masks/public/$username' - path: '/public/$username' - fullPath: '/masks/public/$username' - preLoaderRoute: typeof MasksPublicUsernameRouteImport - parentRoute: typeof MasksRoute - } - '/non-nested/deep/$baz': { - id: '/non-nested/deep/$baz' - path: '/$baz' - fullPath: '/non-nested/deep/$baz' - preLoaderRoute: typeof NonNestedDeepBazRouteRouteImport - parentRoute: typeof NonNestedDeepRouteRoute - } - '/non-nested/named/$baz': { - id: '/non-nested/named/$baz' - path: '/$baz' - fullPath: '/non-nested/named/$baz' - preLoaderRoute: typeof NonNestedNamedBazRouteRouteImport - parentRoute: typeof NonNestedNamedRouteRoute - } - '/non-nested/path/baz': { - id: '/non-nested/path/baz' - path: '/baz' - fullPath: '/non-nested/path/baz' - preLoaderRoute: typeof NonNestedPathBazRouteRouteImport - parentRoute: typeof NonNestedPathRouteRoute - } - '/non-nested/prefix/prefix{$baz}': { - id: '/non-nested/prefix/prefix{$baz}' - path: '/prefix{$baz}' - fullPath: '/non-nested/prefix/prefix{$baz}' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteImport - parentRoute: typeof NonNestedPrefixRouteRoute - } - '/non-nested/suffix/{$baz}suffix': { - id: '/non-nested/suffix/{$baz}suffix' - path: '/{$baz}suffix' - fullPath: '/non-nested/suffix/{$baz}suffix' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteImport - parentRoute: typeof NonNestedSuffixRouteRoute - } - '/params-ps/named/': { - id: '/params-ps/named/' - path: '/params-ps/named' - fullPath: '/params-ps/named/' - preLoaderRoute: typeof ParamsPsNamedIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/named/$foo': { - id: '/params-ps/named/$foo' - path: '/params-ps/named/$foo' - fullPath: '/params-ps/named/$foo' - preLoaderRoute: typeof ParamsPsNamedFooRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/named/prefix{$foo}': { - id: '/params-ps/named/prefix{$foo}' - path: '/params-ps/named/prefix{$foo}' - fullPath: '/params-ps/named/prefix{$foo}' - preLoaderRoute: typeof ParamsPsNamedPrefixChar123fooChar125RouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/named/{$foo}suffix': { - id: '/params-ps/named/{$foo}suffix' - path: '/params-ps/named/{$foo}suffix' - fullPath: '/params-ps/named/{$foo}suffix' - preLoaderRoute: typeof ParamsPsNamedChar123fooChar125suffixRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/non-nested/$foo_': { - id: '/params-ps/non-nested/$foo_' - path: '/$foo' - fullPath: '/params-ps/non-nested/$foo' - preLoaderRoute: typeof ParamsPsNonNestedFooRouteRouteImport - parentRoute: typeof ParamsPsNonNestedRouteRoute - } - '/params-ps/wildcard/': { - id: '/params-ps/wildcard/' - path: '/params-ps/wildcard' - fullPath: '/params-ps/wildcard/' - preLoaderRoute: typeof ParamsPsWildcardIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/$': { - id: '/params-ps/wildcard/$' - path: '/params-ps/wildcard/$' - fullPath: '/params-ps/wildcard/$' - preLoaderRoute: typeof ParamsPsWildcardSplatRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/prefix@대{$}': { - id: '/params-ps/wildcard/prefix@대{$}' - path: '/params-ps/wildcard/prefix@대{$}' - fullPath: '/params-ps/wildcard/prefix@대{$}' - preLoaderRoute: typeof ParamsPsWildcardPrefixAtChar45824Char123Char125RouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/prefix{$}': { - id: '/params-ps/wildcard/prefix{$}' - path: '/params-ps/wildcard/prefix{$}' - fullPath: '/params-ps/wildcard/prefix{$}' - preLoaderRoute: typeof ParamsPsWildcardPrefixChar123Char125RouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/{$}suffix': { - id: '/params-ps/wildcard/{$}suffix' - path: '/params-ps/wildcard/{$}suffix' - fullPath: '/params-ps/wildcard/{$}suffix' - preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixRouteImport - parentRoute: typeof rootRouteImport - } - '/params-ps/wildcard/{$}suffix@대': { - id: '/params-ps/wildcard/{$}suffix@대' - path: '/params-ps/wildcard/{$}suffix@대' - fullPath: '/params-ps/wildcard/{$}suffix@대' - preLoaderRoute: typeof ParamsPsWildcardChar123Char125suffixAtChar45824RouteImport - parentRoute: typeof rootRouteImport - } - '/params/single/$value': { - id: '/params/single/$value' - path: '/params/single/$value' - fullPath: '/params/single/$value' - preLoaderRoute: typeof ParamsSingleValueRouteImport - parentRoute: typeof rootRouteImport - } - '/posts_/$postId/edit': { - id: '/posts_/$postId/edit' - path: '/posts/$postId/edit' - fullPath: '/posts/$postId/edit' - preLoaderRoute: typeof PostsPostIdEditRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target/': { - id: '/redirect/$target/' - path: '/' - fullPath: '/redirect/$target/' - preLoaderRoute: typeof RedirectTargetIndexRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-beforeLoad': { - id: '/redirect/$target/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/redirect/$target/via-beforeLoad' - preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-loader': { - id: '/redirect/$target/via-loader' - path: '/via-loader' - fullPath: '/redirect/$target/via-loader' - preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/preload/first': { - id: '/redirect/preload/first' - path: '/redirect/preload/first' - fullPath: '/redirect/preload/first' - preLoaderRoute: typeof RedirectPreloadFirstRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/preload/second': { - id: '/redirect/preload/second' - path: '/redirect/preload/second' - fullPath: '/redirect/preload/second' - preLoaderRoute: typeof RedirectPreloadSecondRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/preload/third': { - id: '/redirect/preload/third' - path: '/redirect/preload/third' - fullPath: '/redirect/preload/third' - preLoaderRoute: typeof RedirectPreloadThirdRouteImport - parentRoute: typeof rootRouteImport - } - '/relative/link/relative-link-a': { - id: '/relative/link/relative-link-a' - path: '/relative-link-a' - fullPath: '/relative/link/relative-link-a' - preLoaderRoute: typeof RelativeLinkRelativeLinkARouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/relative-link-b': { - id: '/relative/link/relative-link-b' - path: '/relative-link-b' - fullPath: '/relative/link/relative-link-b' - preLoaderRoute: typeof RelativeLinkRelativeLinkBRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/useNavigate/relative-useNavigate-a': { - id: '/relative/useNavigate/relative-useNavigate-a' - path: '/relative-useNavigate-a' - fullPath: '/relative/useNavigate/relative-useNavigate-a' - preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateARouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/relative-useNavigate-b': { - id: '/relative/useNavigate/relative-useNavigate-b' - path: '/relative-useNavigate-b' - fullPath: '/relative/useNavigate/relative-useNavigate-b' - preLoaderRoute: typeof RelativeUseNavigateRelativeUseNavigateBRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/transition/count/create-resource': { - id: '/transition/count/create-resource' - path: '/transition/count/create-resource' - fullPath: '/transition/count/create-resource' - preLoaderRoute: typeof TransitionCountCreateResourceRouteImport - parentRoute: typeof rootRouteImport - } - '/transition/typing/create-resource': { - id: '/transition/typing/create-resource' - path: '/transition/typing/create-resource' - fullPath: '/transition/typing/create-resource' - preLoaderRoute: typeof TransitionTypingCreateResourceRouteImport - parentRoute: typeof rootRouteImport - } - '/대한민국/wildcard/$': { - id: '/대한민국/wildcard/$' - path: '/wildcard/$' - fullPath: '/대한민국/wildcard/$' - preLoaderRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRouteImport - parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute - } - '/대한민국/🚀/$id': { - id: '/대한민국/🚀/$id' - path: '/🚀/$id' - fullPath: '/대한민국/🚀/$id' - preLoaderRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRouteImport - parentRoute: typeof Char45824Char54620Char48124Char44397RouteRoute - } - '/non-nested/deep/$baz/': { - id: '/non-nested/deep/$baz/' - path: '/' - fullPath: '/non-nested/deep/$baz/' - preLoaderRoute: typeof NonNestedDeepBazIndexRouteImport - parentRoute: typeof NonNestedDeepBazRouteRoute - } - '/non-nested/deep/$baz_/bar': { - id: '/non-nested/deep/$baz_/bar' - path: '/$baz/bar' - fullPath: '/non-nested/deep/$baz/bar' - preLoaderRoute: typeof NonNestedDeepBazBarRouteRouteImport - parentRoute: typeof NonNestedDeepRouteRoute - } - '/non-nested/named/$baz/': { - id: '/non-nested/named/$baz/' - path: '/' - fullPath: '/non-nested/named/$baz/' - preLoaderRoute: typeof NonNestedNamedBazIndexRouteImport - parentRoute: typeof NonNestedNamedBazRouteRoute - } - '/non-nested/named/$baz/foo': { - id: '/non-nested/named/$baz/foo' - path: '/foo' - fullPath: '/non-nested/named/$baz/foo' - preLoaderRoute: typeof NonNestedNamedBazFooRouteImport - parentRoute: typeof NonNestedNamedBazRouteRoute - } - '/non-nested/named/$baz_/bar': { - id: '/non-nested/named/$baz_/bar' - path: '/$baz/bar' - fullPath: '/non-nested/named/$baz/bar' - preLoaderRoute: typeof NonNestedNamedBazBarRouteImport - parentRoute: typeof NonNestedNamedRouteRoute - } - '/non-nested/path/baz/': { - id: '/non-nested/path/baz/' - path: '/' - fullPath: '/non-nested/path/baz/' - preLoaderRoute: typeof NonNestedPathBazIndexRouteImport - parentRoute: typeof NonNestedPathBazRouteRoute - } - '/non-nested/path/baz/foo': { - id: '/non-nested/path/baz/foo' - path: '/foo' - fullPath: '/non-nested/path/baz/foo' - preLoaderRoute: typeof NonNestedPathBazFooRouteImport - parentRoute: typeof NonNestedPathBazRouteRoute - } - '/non-nested/path/baz_/bar': { - id: '/non-nested/path/baz_/bar' - path: '/baz/bar' - fullPath: '/non-nested/path/baz/bar' - preLoaderRoute: typeof NonNestedPathBazBarRouteImport - parentRoute: typeof NonNestedPathRouteRoute - } - '/non-nested/prefix/prefix{$baz}/': { - id: '/non-nested/prefix/prefix{$baz}/' - path: '/' - fullPath: '/non-nested/prefix/prefix{$baz}/' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRouteImport - parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute - } - '/non-nested/prefix/prefix{$baz}/foo': { - id: '/non-nested/prefix/prefix{$baz}/foo' - path: '/foo' - fullPath: '/non-nested/prefix/prefix{$baz}/foo' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRouteImport - parentRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRoute - } - '/non-nested/prefix/prefix{$baz}_/bar': { - id: '/non-nested/prefix/prefix{$baz}_/bar' - path: '/prefix{$baz}/bar' - fullPath: '/non-nested/prefix/prefix{$baz}/bar' - preLoaderRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRouteImport - parentRoute: typeof NonNestedPrefixRouteRoute - } - '/non-nested/suffix/{$baz}suffix/': { - id: '/non-nested/suffix/{$baz}suffix/' - path: '/' - fullPath: '/non-nested/suffix/{$baz}suffix/' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRouteImport - parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute - } - '/non-nested/suffix/{$baz}suffix/foo': { - id: '/non-nested/suffix/{$baz}suffix/foo' - path: '/foo' - fullPath: '/non-nested/suffix/{$baz}suffix/foo' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRouteImport - parentRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRoute - } - '/non-nested/suffix/{$baz}suffix_/bar': { - id: '/non-nested/suffix/{$baz}suffix_/bar' - path: '/{$baz}suffix/bar' - fullPath: '/non-nested/suffix/{$baz}suffix/bar' - preLoaderRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRouteImport - parentRoute: typeof NonNestedSuffixRouteRoute - } - '/params-ps/named/$foo/$bar': { - id: '/params-ps/named/$foo/$bar' - path: '/$bar' - fullPath: '/params-ps/named/$foo/$bar' - preLoaderRoute: typeof ParamsPsNamedFooBarRouteRouteImport - parentRoute: typeof ParamsPsNamedFooRouteRoute - } - '/params-ps/non-nested/$foo_/$bar': { - id: '/params-ps/non-nested/$foo_/$bar' - path: '/$bar' - fullPath: '/params-ps/non-nested/$foo/$bar' - preLoaderRoute: typeof ParamsPsNonNestedFooBarRouteImport - parentRoute: typeof ParamsPsNonNestedFooRouteRoute - } - '/relative/link/nested/': { - id: '/relative/link/nested/' - path: '/nested' - fullPath: '/relative/link/nested/' - preLoaderRoute: typeof RelativeLinkNestedIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/path/': { - id: '/relative/link/path/' - path: '/path' - fullPath: '/relative/link/path/' - preLoaderRoute: typeof RelativeLinkPathIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/with-search/': { - id: '/relative/link/with-search/' - path: '/with-search' - fullPath: '/relative/link/with-search/' - preLoaderRoute: typeof RelativeLinkWithSearchIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/useNavigate/nested/': { - id: '/relative/useNavigate/nested/' - path: '/nested' - fullPath: '/relative/useNavigate/nested/' - preLoaderRoute: typeof RelativeUseNavigateNestedIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/path/': { - id: '/relative/useNavigate/path/' - path: '/path' - fullPath: '/relative/useNavigate/path/' - preLoaderRoute: typeof RelativeUseNavigatePathIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/with-search/': { - id: '/relative/useNavigate/with-search/' - path: '/with-search' - fullPath: '/relative/useNavigate/with-search/' - preLoaderRoute: typeof RelativeUseNavigateWithSearchIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/non-nested/deep/$baz_/bar/': { - id: '/non-nested/deep/$baz_/bar/' - path: '/' - fullPath: '/non-nested/deep/$baz/bar/' - preLoaderRoute: typeof NonNestedDeepBazBarIndexRouteImport - parentRoute: typeof NonNestedDeepBazBarRouteRoute - } - '/non-nested/deep/$baz_/bar/$foo': { - id: '/non-nested/deep/$baz_/bar/$foo' - path: '/$foo' - fullPath: '/non-nested/deep/$baz/bar/$foo' - preLoaderRoute: typeof NonNestedDeepBazBarFooRouteRouteImport - parentRoute: typeof NonNestedDeepBazBarRouteRoute - } - '/non-nested/deep/$baz_/bar_/qux': { - id: '/non-nested/deep/$baz_/bar_/qux' - path: '/$baz/bar/qux' - fullPath: '/non-nested/deep/$baz/bar/qux' - preLoaderRoute: typeof NonNestedDeepBazBarQuxRouteImport - parentRoute: typeof NonNestedDeepRouteRoute - } - '/params-ps/named/$foo/$bar/$baz': { - id: '/params-ps/named/$foo/$bar/$baz' - path: '/$baz' - fullPath: '/params-ps/named/$foo/$bar/$baz' - preLoaderRoute: typeof ParamsPsNamedFooBarBazRouteImport - parentRoute: typeof ParamsPsNamedFooBarRouteRoute - } - '/relative/link/nested/deep/': { - id: '/relative/link/nested/deep/' - path: '/nested/deep' - fullPath: '/relative/link/nested/deep/' - preLoaderRoute: typeof RelativeLinkNestedDeepIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/link/path/$path/': { - id: '/relative/link/path/$path/' - path: '/path/$path' - fullPath: '/relative/link/path/$path/' - preLoaderRoute: typeof RelativeLinkPathPathIndexRouteImport - parentRoute: typeof RelativeLinkRouteRoute - } - '/relative/useNavigate/nested/deep/': { - id: '/relative/useNavigate/nested/deep/' - path: '/nested/deep' - fullPath: '/relative/useNavigate/nested/deep/' - preLoaderRoute: typeof RelativeUseNavigateNestedDeepIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/relative/useNavigate/path/$path/': { - id: '/relative/useNavigate/path/$path/' - path: '/path/$path' - fullPath: '/relative/useNavigate/path/$path/' - preLoaderRoute: typeof RelativeUseNavigatePathPathIndexRouteImport - parentRoute: typeof RelativeUseNavigateRouteRoute - } - '/non-nested/deep/$baz_/bar/$foo/': { - id: '/non-nested/deep/$baz_/bar/$foo/' - path: '/' - fullPath: '/non-nested/deep/$baz/bar/$foo/' - preLoaderRoute: typeof NonNestedDeepBazBarFooIndexRouteImport - parentRoute: typeof NonNestedDeepBazBarFooRouteRoute - } - '/non-nested/deep/$baz_/bar/$foo_/qux': { - id: '/non-nested/deep/$baz_/bar/$foo_/qux' - path: '/$foo/qux' - fullPath: '/non-nested/deep/$baz/bar/$foo/qux' - preLoaderRoute: typeof NonNestedDeepBazBarFooQuxRouteImport - parentRoute: typeof NonNestedDeepBazBarRouteRoute - } - } -} - -interface NonNestedDeepBazRouteRouteChildren { - NonNestedDeepBazIndexRoute: typeof NonNestedDeepBazIndexRoute -} - -const NonNestedDeepBazRouteRouteChildren: NonNestedDeepBazRouteRouteChildren = { - NonNestedDeepBazIndexRoute: NonNestedDeepBazIndexRoute, -} - -const NonNestedDeepBazRouteRouteWithChildren = - NonNestedDeepBazRouteRoute._addFileChildren( - NonNestedDeepBazRouteRouteChildren, - ) - -interface NonNestedDeepBazBarFooRouteRouteChildren { - NonNestedDeepBazBarFooIndexRoute: typeof NonNestedDeepBazBarFooIndexRoute -} - -const NonNestedDeepBazBarFooRouteRouteChildren: NonNestedDeepBazBarFooRouteRouteChildren = - { - NonNestedDeepBazBarFooIndexRoute: NonNestedDeepBazBarFooIndexRoute, - } - -const NonNestedDeepBazBarFooRouteRouteWithChildren = - NonNestedDeepBazBarFooRouteRoute._addFileChildren( - NonNestedDeepBazBarFooRouteRouteChildren, - ) - -interface NonNestedDeepBazBarRouteRouteChildren { - NonNestedDeepBazBarFooRouteRoute: typeof NonNestedDeepBazBarFooRouteRouteWithChildren - NonNestedDeepBazBarIndexRoute: typeof NonNestedDeepBazBarIndexRoute - NonNestedDeepBazBarFooQuxRoute: typeof NonNestedDeepBazBarFooQuxRoute -} - -const NonNestedDeepBazBarRouteRouteChildren: NonNestedDeepBazBarRouteRouteChildren = - { - NonNestedDeepBazBarFooRouteRoute: - NonNestedDeepBazBarFooRouteRouteWithChildren, - NonNestedDeepBazBarIndexRoute: NonNestedDeepBazBarIndexRoute, - NonNestedDeepBazBarFooQuxRoute: NonNestedDeepBazBarFooQuxRoute, - } - -const NonNestedDeepBazBarRouteRouteWithChildren = - NonNestedDeepBazBarRouteRoute._addFileChildren( - NonNestedDeepBazBarRouteRouteChildren, - ) - -interface NonNestedDeepRouteRouteChildren { - NonNestedDeepBazRouteRoute: typeof NonNestedDeepBazRouteRouteWithChildren - NonNestedDeepBazBarRouteRoute: typeof NonNestedDeepBazBarRouteRouteWithChildren - NonNestedDeepBazBarQuxRoute: typeof NonNestedDeepBazBarQuxRoute -} - -const NonNestedDeepRouteRouteChildren: NonNestedDeepRouteRouteChildren = { - NonNestedDeepBazRouteRoute: NonNestedDeepBazRouteRouteWithChildren, - NonNestedDeepBazBarRouteRoute: NonNestedDeepBazBarRouteRouteWithChildren, - NonNestedDeepBazBarQuxRoute: NonNestedDeepBazBarQuxRoute, -} - -const NonNestedDeepRouteRouteWithChildren = - NonNestedDeepRouteRoute._addFileChildren(NonNestedDeepRouteRouteChildren) - -interface NonNestedNamedBazRouteRouteChildren { - NonNestedNamedBazFooRoute: typeof NonNestedNamedBazFooRoute - NonNestedNamedBazIndexRoute: typeof NonNestedNamedBazIndexRoute -} - -const NonNestedNamedBazRouteRouteChildren: NonNestedNamedBazRouteRouteChildren = - { - NonNestedNamedBazFooRoute: NonNestedNamedBazFooRoute, - NonNestedNamedBazIndexRoute: NonNestedNamedBazIndexRoute, - } - -const NonNestedNamedBazRouteRouteWithChildren = - NonNestedNamedBazRouteRoute._addFileChildren( - NonNestedNamedBazRouteRouteChildren, - ) - -interface NonNestedNamedRouteRouteChildren { - NonNestedNamedBazRouteRoute: typeof NonNestedNamedBazRouteRouteWithChildren - NonNestedNamedBazBarRoute: typeof NonNestedNamedBazBarRoute -} - -const NonNestedNamedRouteRouteChildren: NonNestedNamedRouteRouteChildren = { - NonNestedNamedBazRouteRoute: NonNestedNamedBazRouteRouteWithChildren, - NonNestedNamedBazBarRoute: NonNestedNamedBazBarRoute, -} - -const NonNestedNamedRouteRouteWithChildren = - NonNestedNamedRouteRoute._addFileChildren(NonNestedNamedRouteRouteChildren) - -interface NonNestedPathBazRouteRouteChildren { - NonNestedPathBazFooRoute: typeof NonNestedPathBazFooRoute - NonNestedPathBazIndexRoute: typeof NonNestedPathBazIndexRoute -} - -const NonNestedPathBazRouteRouteChildren: NonNestedPathBazRouteRouteChildren = { - NonNestedPathBazFooRoute: NonNestedPathBazFooRoute, - NonNestedPathBazIndexRoute: NonNestedPathBazIndexRoute, -} - -const NonNestedPathBazRouteRouteWithChildren = - NonNestedPathBazRouteRoute._addFileChildren( - NonNestedPathBazRouteRouteChildren, - ) - -interface NonNestedPathRouteRouteChildren { - NonNestedPathBazRouteRoute: typeof NonNestedPathBazRouteRouteWithChildren - NonNestedPathBazBarRoute: typeof NonNestedPathBazBarRoute -} - -const NonNestedPathRouteRouteChildren: NonNestedPathRouteRouteChildren = { - NonNestedPathBazRouteRoute: NonNestedPathBazRouteRouteWithChildren, - NonNestedPathBazBarRoute: NonNestedPathBazBarRoute, -} - -const NonNestedPathRouteRouteWithChildren = - NonNestedPathRouteRoute._addFileChildren(NonNestedPathRouteRouteChildren) - -interface NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren { - NonNestedPrefixPrefixChar123bazChar125FooRoute: typeof NonNestedPrefixPrefixChar123bazChar125FooRoute - NonNestedPrefixPrefixChar123bazChar125IndexRoute: typeof NonNestedPrefixPrefixChar123bazChar125IndexRoute -} - -const NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren: NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren = - { - NonNestedPrefixPrefixChar123bazChar125FooRoute: - NonNestedPrefixPrefixChar123bazChar125FooRoute, - NonNestedPrefixPrefixChar123bazChar125IndexRoute: - NonNestedPrefixPrefixChar123bazChar125IndexRoute, - } - -const NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren = - NonNestedPrefixPrefixChar123bazChar125RouteRoute._addFileChildren( - NonNestedPrefixPrefixChar123bazChar125RouteRouteChildren, - ) - -interface NonNestedPrefixRouteRouteChildren { - NonNestedPrefixPrefixChar123bazChar125RouteRoute: typeof NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren - NonNestedPrefixPrefixChar123bazChar125BarRoute: typeof NonNestedPrefixPrefixChar123bazChar125BarRoute -} - -const NonNestedPrefixRouteRouteChildren: NonNestedPrefixRouteRouteChildren = { - NonNestedPrefixPrefixChar123bazChar125RouteRoute: - NonNestedPrefixPrefixChar123bazChar125RouteRouteWithChildren, - NonNestedPrefixPrefixChar123bazChar125BarRoute: - NonNestedPrefixPrefixChar123bazChar125BarRoute, -} - -const NonNestedPrefixRouteRouteWithChildren = - NonNestedPrefixRouteRoute._addFileChildren(NonNestedPrefixRouteRouteChildren) - -interface NonNestedSuffixChar123bazChar125suffixRouteRouteChildren { - NonNestedSuffixChar123bazChar125suffixFooRoute: typeof NonNestedSuffixChar123bazChar125suffixFooRoute - NonNestedSuffixChar123bazChar125suffixIndexRoute: typeof NonNestedSuffixChar123bazChar125suffixIndexRoute -} - -const NonNestedSuffixChar123bazChar125suffixRouteRouteChildren: NonNestedSuffixChar123bazChar125suffixRouteRouteChildren = - { - NonNestedSuffixChar123bazChar125suffixFooRoute: - NonNestedSuffixChar123bazChar125suffixFooRoute, - NonNestedSuffixChar123bazChar125suffixIndexRoute: - NonNestedSuffixChar123bazChar125suffixIndexRoute, - } - -const NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren = - NonNestedSuffixChar123bazChar125suffixRouteRoute._addFileChildren( - NonNestedSuffixChar123bazChar125suffixRouteRouteChildren, - ) - -interface NonNestedSuffixRouteRouteChildren { - NonNestedSuffixChar123bazChar125suffixRouteRoute: typeof NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren - NonNestedSuffixChar123bazChar125suffixBarRoute: typeof NonNestedSuffixChar123bazChar125suffixBarRoute -} - -const NonNestedSuffixRouteRouteChildren: NonNestedSuffixRouteRouteChildren = { - NonNestedSuffixChar123bazChar125suffixRouteRoute: - NonNestedSuffixChar123bazChar125suffixRouteRouteWithChildren, - NonNestedSuffixChar123bazChar125suffixBarRoute: - NonNestedSuffixChar123bazChar125suffixBarRoute, -} - -const NonNestedSuffixRouteRouteWithChildren = - NonNestedSuffixRouteRoute._addFileChildren(NonNestedSuffixRouteRouteChildren) - -interface NonNestedRouteRouteChildren { - NonNestedDeepRouteRoute: typeof NonNestedDeepRouteRouteWithChildren - NonNestedNamedRouteRoute: typeof NonNestedNamedRouteRouteWithChildren - NonNestedPathRouteRoute: typeof NonNestedPathRouteRouteWithChildren - NonNestedPrefixRouteRoute: typeof NonNestedPrefixRouteRouteWithChildren - NonNestedSuffixRouteRoute: typeof NonNestedSuffixRouteRouteWithChildren -} - -const NonNestedRouteRouteChildren: NonNestedRouteRouteChildren = { - NonNestedDeepRouteRoute: NonNestedDeepRouteRouteWithChildren, - NonNestedNamedRouteRoute: NonNestedNamedRouteRouteWithChildren, - NonNestedPathRouteRoute: NonNestedPathRouteRouteWithChildren, - NonNestedPrefixRouteRoute: NonNestedPrefixRouteRouteWithChildren, - NonNestedSuffixRouteRoute: NonNestedSuffixRouteRouteWithChildren, -} - -const NonNestedRouteRouteWithChildren = NonNestedRouteRoute._addFileChildren( - NonNestedRouteRouteChildren, -) - -interface SearchParamsRouteRouteChildren { - SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute - SearchParamsIndexRoute: typeof SearchParamsIndexRoute -} - -const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = { - SearchParamsDefaultRoute: SearchParamsDefaultRoute, - SearchParamsIndexRoute: SearchParamsIndexRoute, -} - -const SearchParamsRouteRouteWithChildren = - SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren) - -interface Char45824Char54620Char48124Char44397RouteRouteChildren { - Char45824Char54620Char48124Char44397WildcardSplatRoute: typeof Char45824Char54620Char48124Char44397WildcardSplatRoute - Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: typeof Char45824Char54620Char48124Char44397Char55357Char56960IdRoute -} - -const Char45824Char54620Char48124Char44397RouteRouteChildren: Char45824Char54620Char48124Char44397RouteRouteChildren = - { - Char45824Char54620Char48124Char44397WildcardSplatRoute: - Char45824Char54620Char48124Char44397WildcardSplatRoute, - Char45824Char54620Char48124Char44397Char55357Char56960IdRoute: - Char45824Char54620Char48124Char44397Char55357Char56960IdRoute, - } - -const Char45824Char54620Char48124Char44397RouteRouteWithChildren = - Char45824Char54620Char48124Char44397RouteRoute._addFileChildren( - Char45824Char54620Char48124Char44397RouteRouteChildren, - ) - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface MasksRouteChildren { - MasksAdminUserIdRoute: typeof MasksAdminUserIdRoute - MasksPublicUsernameRoute: typeof MasksPublicUsernameRoute -} - -const MasksRouteChildren: MasksRouteChildren = { - MasksAdminUserIdRoute: MasksAdminUserIdRoute, - MasksPublicUsernameRoute: MasksPublicUsernameRoute, -} - -const MasksRouteWithChildren = MasksRoute._addFileChildren(MasksRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface ParamsPsNonNestedFooRouteRouteChildren { - ParamsPsNonNestedFooBarRoute: typeof ParamsPsNonNestedFooBarRoute -} - -const ParamsPsNonNestedFooRouteRouteChildren: ParamsPsNonNestedFooRouteRouteChildren = - { - ParamsPsNonNestedFooBarRoute: ParamsPsNonNestedFooBarRoute, - } - -const ParamsPsNonNestedFooRouteRouteWithChildren = - ParamsPsNonNestedFooRouteRoute._addFileChildren( - ParamsPsNonNestedFooRouteRouteChildren, - ) - -interface ParamsPsNonNestedRouteRouteChildren { - ParamsPsNonNestedFooRouteRoute: typeof ParamsPsNonNestedFooRouteRouteWithChildren -} - -const ParamsPsNonNestedRouteRouteChildren: ParamsPsNonNestedRouteRouteChildren = - { - ParamsPsNonNestedFooRouteRoute: ParamsPsNonNestedFooRouteRouteWithChildren, - } - -const ParamsPsNonNestedRouteRouteWithChildren = - ParamsPsNonNestedRouteRoute._addFileChildren( - ParamsPsNonNestedRouteRouteChildren, - ) - -interface RelativeLinkRouteRouteChildren { - RelativeLinkRelativeLinkARoute: typeof RelativeLinkRelativeLinkARoute - RelativeLinkRelativeLinkBRoute: typeof RelativeLinkRelativeLinkBRoute - RelativeLinkNestedIndexRoute: typeof RelativeLinkNestedIndexRoute - RelativeLinkPathIndexRoute: typeof RelativeLinkPathIndexRoute - RelativeLinkWithSearchIndexRoute: typeof RelativeLinkWithSearchIndexRoute - RelativeLinkNestedDeepIndexRoute: typeof RelativeLinkNestedDeepIndexRoute - RelativeLinkPathPathIndexRoute: typeof RelativeLinkPathPathIndexRoute -} - -const RelativeLinkRouteRouteChildren: RelativeLinkRouteRouteChildren = { - RelativeLinkRelativeLinkARoute: RelativeLinkRelativeLinkARoute, - RelativeLinkRelativeLinkBRoute: RelativeLinkRelativeLinkBRoute, - RelativeLinkNestedIndexRoute: RelativeLinkNestedIndexRoute, - RelativeLinkPathIndexRoute: RelativeLinkPathIndexRoute, - RelativeLinkWithSearchIndexRoute: RelativeLinkWithSearchIndexRoute, - RelativeLinkNestedDeepIndexRoute: RelativeLinkNestedDeepIndexRoute, - RelativeLinkPathPathIndexRoute: RelativeLinkPathPathIndexRoute, -} - -const RelativeLinkRouteRouteWithChildren = - RelativeLinkRouteRoute._addFileChildren(RelativeLinkRouteRouteChildren) - -interface RelativeUseNavigateRouteRouteChildren { - RelativeUseNavigateRelativeUseNavigateARoute: typeof RelativeUseNavigateRelativeUseNavigateARoute - RelativeUseNavigateRelativeUseNavigateBRoute: typeof RelativeUseNavigateRelativeUseNavigateBRoute - RelativeUseNavigateNestedIndexRoute: typeof RelativeUseNavigateNestedIndexRoute - RelativeUseNavigatePathIndexRoute: typeof RelativeUseNavigatePathIndexRoute - RelativeUseNavigateWithSearchIndexRoute: typeof RelativeUseNavigateWithSearchIndexRoute - RelativeUseNavigateNestedDeepIndexRoute: typeof RelativeUseNavigateNestedDeepIndexRoute - RelativeUseNavigatePathPathIndexRoute: typeof RelativeUseNavigatePathPathIndexRoute -} - -const RelativeUseNavigateRouteRouteChildren: RelativeUseNavigateRouteRouteChildren = - { - RelativeUseNavigateRelativeUseNavigateARoute: - RelativeUseNavigateRelativeUseNavigateARoute, - RelativeUseNavigateRelativeUseNavigateBRoute: - RelativeUseNavigateRelativeUseNavigateBRoute, - RelativeUseNavigateNestedIndexRoute: RelativeUseNavigateNestedIndexRoute, - RelativeUseNavigatePathIndexRoute: RelativeUseNavigatePathIndexRoute, - RelativeUseNavigateWithSearchIndexRoute: - RelativeUseNavigateWithSearchIndexRoute, - RelativeUseNavigateNestedDeepIndexRoute: - RelativeUseNavigateNestedDeepIndexRoute, - RelativeUseNavigatePathPathIndexRoute: - RelativeUseNavigatePathPathIndexRoute, - } - -const RelativeUseNavigateRouteRouteWithChildren = - RelativeUseNavigateRouteRoute._addFileChildren( - RelativeUseNavigateRouteRouteChildren, - ) - -interface groupLayoutRouteChildren { - groupLayoutInsidelayoutRoute: typeof groupLayoutInsidelayoutRoute -} - -const groupLayoutRouteChildren: groupLayoutRouteChildren = { - groupLayoutInsidelayoutRoute: groupLayoutInsidelayoutRoute, -} - -const groupLayoutRouteWithChildren = groupLayoutRoute._addFileChildren( - groupLayoutRouteChildren, -) - -interface RedirectTargetRouteChildren { - RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute - RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute - RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute -} - -const RedirectTargetRouteChildren: RedirectTargetRouteChildren = { - RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute, - RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute, - RedirectTargetIndexRoute: RedirectTargetIndexRoute, -} - -const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren( - RedirectTargetRouteChildren, -) - -interface ParamsPsNamedFooBarRouteRouteChildren { - ParamsPsNamedFooBarBazRoute: typeof ParamsPsNamedFooBarBazRoute -} - -const ParamsPsNamedFooBarRouteRouteChildren: ParamsPsNamedFooBarRouteRouteChildren = - { - ParamsPsNamedFooBarBazRoute: ParamsPsNamedFooBarBazRoute, - } - -const ParamsPsNamedFooBarRouteRouteWithChildren = - ParamsPsNamedFooBarRouteRoute._addFileChildren( - ParamsPsNamedFooBarRouteRouteChildren, - ) - -interface ParamsPsNamedFooRouteRouteChildren { - ParamsPsNamedFooBarRouteRoute: typeof ParamsPsNamedFooBarRouteRouteWithChildren -} - -const ParamsPsNamedFooRouteRouteChildren: ParamsPsNamedFooRouteRouteChildren = { - ParamsPsNamedFooBarRouteRoute: ParamsPsNamedFooBarRouteRouteWithChildren, -} - -const ParamsPsNamedFooRouteRouteWithChildren = - ParamsPsNamedFooRouteRoute._addFileChildren( - ParamsPsNamedFooRouteRouteChildren, - ) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - NonNestedRouteRoute: NonNestedRouteRouteWithChildren, - SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren, - Char45824Char54620Char48124Char44397RouteRoute: - Char45824Char54620Char48124Char44397RouteRouteWithChildren, - LayoutRoute: LayoutRouteWithChildren, - AnchorRoute: AnchorRoute, - ComponentTypesTestRoute: ComponentTypesTestRoute, - EditingARoute: EditingARoute, - EditingBRoute: EditingBRoute, - HoverPreloadHashRoute: HoverPreloadHashRoute, - MasksRoute: MasksRouteWithChildren, - NotRemountDepsRoute: NotRemountDepsRoute, - PostsRoute: PostsRouteWithChildren, - RemountDepsRoute: RemountDepsRoute, - ParamsPsNonNestedRouteRoute: ParamsPsNonNestedRouteRouteWithChildren, - RelativeLinkRouteRoute: RelativeLinkRouteRouteWithChildren, - RelativeUseNavigateRouteRoute: RelativeUseNavigateRouteRouteWithChildren, - anotherGroupOnlyrouteinsideRoute: anotherGroupOnlyrouteinsideRoute, - groupLayoutRoute: groupLayoutRouteWithChildren, - groupInsideRoute: groupInsideRoute, - groupLazyinsideRoute: groupLazyinsideRoute, - RedirectTargetRoute: RedirectTargetRouteWithChildren, - ParamsPsIndexRoute: ParamsPsIndexRoute, - RedirectIndexRoute: RedirectIndexRoute, - RelativeIndexRoute: RelativeIndexRoute, - ParamsPsNamedFooRouteRoute: ParamsPsNamedFooRouteRouteWithChildren, - groupSubfolderInsideRoute: groupSubfolderInsideRoute, - ParamsPsNamedPrefixChar123fooChar125Route: - ParamsPsNamedPrefixChar123fooChar125Route, - ParamsPsNamedChar123fooChar125suffixRoute: - ParamsPsNamedChar123fooChar125suffixRoute, - ParamsPsWildcardSplatRoute: ParamsPsWildcardSplatRoute, - ParamsPsWildcardPrefixAtChar45824Char123Char125Route: - ParamsPsWildcardPrefixAtChar45824Char123Char125Route, - ParamsPsWildcardPrefixChar123Char125Route: - ParamsPsWildcardPrefixChar123Char125Route, - ParamsPsWildcardChar123Char125suffixRoute: - ParamsPsWildcardChar123Char125suffixRoute, - ParamsPsWildcardChar123Char125suffixAtChar45824Route: - ParamsPsWildcardChar123Char125suffixAtChar45824Route, - ParamsSingleValueRoute: ParamsSingleValueRoute, - PostsPostIdEditRoute: PostsPostIdEditRoute, - RedirectPreloadFirstRoute: RedirectPreloadFirstRoute, - RedirectPreloadSecondRoute: RedirectPreloadSecondRoute, - RedirectPreloadThirdRoute: RedirectPreloadThirdRoute, - TransitionCountCreateResourceRoute: TransitionCountCreateResourceRoute, - TransitionTypingCreateResourceRoute: TransitionTypingCreateResourceRoute, - ParamsPsNamedIndexRoute: ParamsPsNamedIndexRoute, - ParamsPsWildcardIndexRoute: ParamsPsWildcardIndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx b/e2e/solid-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx deleted file mode 100644 index 5142996809..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(another-group)/onlyrouteinside.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { getRouteApi, useSearch } from '@tanstack/solid-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(another-group)/onlyrouteinside') - -export const Route = createFileRoute('/(another-group)/onlyrouteinside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ - from: '/(another-group)/onlyrouteinside', - }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx b/e2e/solid-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx deleted file mode 100644 index 50516a8f44..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(group)/_layout.insidelayout.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { getRouteApi, useSearch } from '@tanstack/solid-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/_layout/insidelayout') - -export const Route = createFileRoute('/(group)/_layout/insidelayout')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/_layout/insidelayout' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/(group)/_layout.tsx b/e2e/solid-router/basic-file-based/src/routes/(group)/_layout.tsx deleted file mode 100644 index f403f766aa..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(group)/_layout.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/(group)/_layout')({ - component: () => ( - <> -
/(group)/_layout!
- - - ), -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/(group)/inside.tsx b/e2e/solid-router/basic-file-based/src/routes/(group)/inside.tsx deleted file mode 100644 index ce73a933c4..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(group)/inside.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { getRouteApi, useSearch } from '@tanstack/solid-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/inside') - -export const Route = createFileRoute('/(group)/inside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/inside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx b/e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx deleted file mode 100644 index ed9b6acb5a..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.lazy.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/solid-router' -import { getRouteApi, useSearch } from '@tanstack/solid-router' - -const routeApi = getRouteApi('/(group)/lazyinside') - -export const Route = createLazyFileRoute('/(group)/lazyinside')({ - component: () => { - const searchViaHook = useSearch({ from: '/(group)/lazyinside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.tsx b/e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.tsx deleted file mode 100644 index 2a055aee9b..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(group)/lazyinside.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/(group)/lazyinside')({ - validateSearch: z.object({ hello: z.string().optional() }), -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx b/e2e/solid-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx deleted file mode 100644 index 0ea47eb5b3..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/(group)/subfolder/inside.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { getRouteApi, useSearch } from '@tanstack/solid-router' -import { z } from 'zod' - -const routeApi = getRouteApi('/(group)/subfolder/inside') - -export const Route = createFileRoute('/(group)/subfolder/inside')({ - validateSearch: z.object({ hello: z.string().optional() }), - component: () => { - const searchViaHook = useSearch({ from: '/(group)/subfolder/inside' }) - const searchViaRouteHook = Route.useSearch() - const searchViaRouteApi = routeApi.useSearch() - return ( - <> -
{searchViaHook().hello}
-
- {searchViaRouteHook().hello} -
-
- {searchViaRouteApi().hello} -
- - ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/__root.tsx b/e2e/solid-router/basic-file-based/src/routes/__root.tsx deleted file mode 100644 index 6acb7a3638..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,166 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, - useCanGoBack, - useRouter, - useRouterState, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - const router = useRouter() - const canGoBack = useCanGoBack() - // test useRouterState doesn't crash client side navigation - const _state = useRouterState() - - return ( - <> - -
- {' '} - - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Only Route Inside Group - {' '} - - Inside Group - {' '} - - Inside Subfolder Inside Group - {' '} - - Inside Group Inside Layout - {' '} - - Lazy Inside Group - {' '} - - redirect - {' '} - - relative routing - {' '} - - unicode path - {' '} - - This Route Does Not Exist - {' '} - - Masks - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/_layout.tsx b/e2e/solid-router/basic-file-based/src/routes/_layout.tsx deleted file mode 100644 index 5525c0c297..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 000a19e988..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index 997e6caf80..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 70135c5809..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/basic-file-based/src/routes/anchor.tsx b/e2e/solid-router/basic-file-based/src/routes/anchor.tsx deleted file mode 100644 index 37ea2e5d56..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/anchor.tsx +++ /dev/null @@ -1,222 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, useLocation, useNavigate } from '@tanstack/solid-router' -import { - createEffect, - createRenderEffect, - createSignal, - onCleanup, -} from 'solid-js' - -export const Route = createFileRoute('/anchor')({ - component: AnchorComponent, -}) - -const anchors: Array<{ - id: string - title: string - hashScrollIntoView?: boolean | ScrollIntoViewOptions -}> = [ - { - id: 'default-anchor', - title: 'Default Anchor', - }, - { - id: 'false-anchor', - title: 'No Scroll Into View', - hashScrollIntoView: false, - }, - { - id: 'smooth-scroll', - title: 'Smooth Scroll', - hashScrollIntoView: { behavior: 'smooth' }, - }, -] as const - -function AnchorSection({ id, title }: { id: string; title: string }) { - const [hasShown, setHasShown] = createSignal(false) - let elementRef: HTMLHeadingElement | null = null - - createEffect(() => { - const observer = new IntersectionObserver( - ([entry]) => { - if (!hasShown() && entry.isIntersecting) { - setHasShown(true) - } - }, - { threshold: 0.01 }, - ) - - const currentRef = elementRef - if (currentRef) { - observer.observe(currentRef) - } - - onCleanup(() => { - if (currentRef) { - observer.unobserve(currentRef) - } - }) - }) - - return ( -
-

- {`${title} ${hasShown() ? '(shown)' : ''}`} -

-
- ) -} - -function AnchorComponent() { - const navigate = useNavigate() - const location = useLocation() - const [withScroll, setWithScroll] = createSignal(true) - - return ( -
- -
-
{ - event.preventDefault() - event.stopPropagation() - const formData = new FormData(event.target as HTMLFormElement) - - const toHash = formData.get('hash') as string - - if (!toHash) { - return - } - - const hashScrollIntoView = withScroll() - ? ({ - behavior: formData.get('scrollBehavior') as ScrollBehavior, - block: formData.get('scrollBlock') as ScrollLogicalPosition, - inline: formData.get('scrollInline') as ScrollLogicalPosition, - } satisfies ScrollIntoViewOptions) - : false - - navigate({ hash: toHash, hashScrollIntoView }) - }} - > -

Scroll with navigate

-
- -
- -
-
- {withScroll() ? ( - <> -
- -
- -
- -
- -
- -
- - ) : null} -
- -
-
- - {anchors.map((anchor) => ( - - ))} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx b/e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx deleted file mode 100644 index aa8cecd80e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/component-types-test.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -// Test route for type safety of different component types -// This test should -// - check that `false` can be set on the `errorComponent` -// ...without causing build-time TypeScript errors -export const Route = createFileRoute('/component-types-test')({ - component: () =>
Testing test types
, - errorComponent: false, // Should not cause TypeScript error - pendingComponent: undefined, // Should not cause TypeScript error - notFoundComponent: undefined, // Should not cause TypeScript error -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/editing-a.tsx b/e2e/solid-router/basic-file-based/src/routes/editing-a.tsx deleted file mode 100644 index ad7b579f33..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/editing-a.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { useBlocker } from '@tanstack/solid-router' -import { createSignal } from 'solid-js' - -export const Route = createFileRoute('/editing-a')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = Route.useNavigate() - const [input, setInput] = createSignal('') - - const blocker = useBlocker({ - shouldBlockFn: ({ next }) => { - if (next.fullPath === '/editing-b' && input().length > 0) { - return true - } - return false - }, - withResolver: true, - }) - - return ( -
-

Editing A

- - - {blocker().status === 'blocked' && ( - - )} -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/editing-b.tsx b/e2e/solid-router/basic-file-based/src/routes/editing-b.tsx deleted file mode 100644 index 660c8fd63b..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/editing-b.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { useBlocker } from '@tanstack/solid-router' -import { createEffect, createSignal, createMemo } from 'solid-js' - -export const Route = createFileRoute('/editing-b')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = Route.useNavigate() - const [input, setInput] = createSignal('') - - const blocker = createMemo(() => - useBlocker({ - condition: input(), - }), - ) - - return ( -
-

Editing B

- - - {blocker()().status === 'blocked' && ( - - )} -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/hover-preload-hash.tsx b/e2e/solid-router/basic-file-based/src/routes/hover-preload-hash.tsx deleted file mode 100644 index 9b9da8bb90..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/hover-preload-hash.tsx +++ /dev/null @@ -1,265 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/hover-preload-hash')({ - component: Page, -}) - -function Page() { - return ( - <> -
Hello from About!
- - To hash - - -

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

Hash is here

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

-

- Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit - amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam - nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, - sed diam voluptua. At vero eos et accusam et justo duo dolores et ea - rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem - ipsum dolor sit amet. -

- - ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/index.tsx b/e2e/solid-router/basic-file-based/src/routes/index.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/masks.admin.$userId.tsx b/e2e/solid-router/basic-file-based/src/routes/masks.admin.$userId.tsx deleted file mode 100644 index c808349245..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/masks.admin.$userId.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/masks/admin/$userId')({ - component: AdminUserRoute, -}) - -function AdminUserRoute() { - const params = Route.useParams() - - return ( -
-
{params().userId}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/masks.public.$username.tsx b/e2e/solid-router/basic-file-based/src/routes/masks.public.$username.tsx deleted file mode 100644 index ea73ade15a..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/masks.public.$username.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/masks/public/$username')({ - component: PublicUserRoute, -}) - -function PublicUserRoute() { - const params = Route.useParams() - - return ( -
-
{params().username}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/masks.tsx b/e2e/solid-router/basic-file-based/src/routes/masks.tsx deleted file mode 100644 index ade84f501d..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/masks.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useRouterState, -} from '@tanstack/solid-router' - -export const Route = createFileRoute('/masks')({ - component: MasksLayout, -}) - -function MasksLayout() { - const location = useRouterState({ - select: (state) => state.location, - }) - - return ( -
-

Route Masks

- -
-
{location().pathname}
-
- {location().maskedLocation?.pathname ?? ''} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx deleted file mode 100644 index 9f2a1a9d45..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx deleted file mode 100644 index 152a12147e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested named baz route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx deleted file mode 100644 index cb5dda58bf..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar/foo index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx deleted file mode 100644 index 7822e408e7..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello deeply nested named baz/bar/foo route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx deleted file mode 100644 index 7ecdbd8c8e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.$foo_.qux.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/$foo_/qux')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar/foo/qux -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx deleted file mode 100644 index ee2483e367..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx deleted file mode 100644 index 3c3dd5f386..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello deeply nested baz/bar route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx deleted file mode 100644 index d172a31e5e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/$baz_.bar_.qux.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep/$baz_/bar_/qux')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello deeply nested baz/bar/qux -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/route.tsx deleted file mode 100644 index 164236388c..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/deep/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/deep')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested deep layout -
-
- - To Baz - - - To named baz/bar - - - To named baz/bar/foo - - - To named baz/bar/foo/qux - - - To named baz/bar/qux - -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx deleted file mode 100644 index 1ce1960f8b..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/named/$baz/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested named baz foo page -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx deleted file mode 100644 index 91a8186db6..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/named/$baz/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested named baz index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx deleted file mode 100644 index 93bb825be1..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/named/$baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested named baz route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx deleted file mode 100644 index 1f2170a771..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/$baz_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/named/$baz_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested named bar -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/named/route.tsx deleted file mode 100644 index 1eb6cb54d4..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/named/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/named')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested named layout -
-
- - To named index - - - To named foo - - - To named foo 2 - - - To named bar - - - To named bar 2 - -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx deleted file mode 100644 index f7b6e97632..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/path/baz/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested path baz foo page -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx deleted file mode 100644 index 9053ec481e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/path/baz/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested path baz index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx deleted file mode 100644 index ed7f8ba790..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/path/baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested path baz route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx deleted file mode 100644 index 462c0ee4e1..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/baz_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/path/baz_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested path bar -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/path/route.tsx deleted file mode 100644 index 279b6fbfab..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/path/route.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/path')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested path layout -
-
- - To path index - - - To path foo - - - To path foo 2 - - - To path bar - - - To path bar 2 - -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx deleted file mode 100644 index ad9e1479df..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested prefix foo page -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx deleted file mode 100644 index a6e09a9d97..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested prefix index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx deleted file mode 100644 index 41d94b7f7e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested prefix route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx deleted file mode 100644 index c1a3928b01..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/prefix{$baz}_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/prefix/prefix{$baz}_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested prefix bar -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/route.tsx deleted file mode 100644 index 6a80067245..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/prefix/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/prefix')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested prefix layout -
-
- - To prefix index - - - To prefix foo - - - To prefix foo 2 - - - To prefix bar - - - To prefix bar 2 - -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx deleted file mode 100644 index 5a21eff91e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/route.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

- Non-nested paths -

-
    -
  • - - To named param tests - - - To prefix param tests - - - To suffix param tests - - - To path tests - -
  • -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/route.tsx deleted file mode 100644 index 5fbee63113..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/route.tsx +++ /dev/null @@ -1,58 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested suffix layout -
-
- - To suffix index - - - To suffix foo - - - To suffix foo 2 - - - To suffix bar - - - To suffix bar 2 - -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx deleted file mode 100644 index ac5df1dc15..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.foo.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello nested suffix foo page -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx deleted file mode 100644 index 0dd908d0a3..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.index.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix/')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello nested suffix index -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx deleted file mode 100644 index d27f65d510..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix.route.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Hello non-nested suffix route layout -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx b/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx deleted file mode 100644 index 26403727c6..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/non-nested/suffix/{$baz}suffix_.bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/non-nested/suffix/{$baz}suffix_/bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
-
- Hello non-nested suffix bar -
-
- {JSON.stringify(params())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/notRemountDeps.tsx b/e2e/solid-router/basic-file-based/src/routes/notRemountDeps.tsx deleted file mode 100644 index 93ede208ad..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/notRemountDeps.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createSignal } from 'solid-js' -import { onMount } from 'solid-js' - -export const Route = createFileRoute('/notRemountDeps')({ - validateSearch(search: { searchParam: string }) { - return { searchParam: search.searchParam } - }, - loaderDeps(opts) { - return opts.search - }, - component: Home, - remountDeps(opts) { - return opts.params - }, -}) - -const [mounts, setMounts] = createSignal(0) - -function Home() { - const search = Route.useSearch() - const navigate = Route.useNavigate() - - onMount(() => { - setMounts((m) => m + 1) - }) - - return ( -
- - -
Search: {search().searchParam}
-
- Page component mounts: {mounts()} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/index.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/index.tsx deleted file mode 100644 index 0a9de2169e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/index.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

Named path params

-
    -
  • - - /params-ps/named/$foo - -
  • -
  • - - /params-ps/named/$foo - with special characters - -
  • -
  • - - /params-ps/named/{'prefix{$foo}'} - -
  • -
  • - - /params-ps/named/{'{$foo}suffix'} - -
  • -
-
-

Wildcard path params

-
    -
  • - - /params-ps/wildcard/$ - -
  • -
  • - - /params-ps/wildcard/$ with escaped params - -
  • -
  • - - /params-ps/wildcard/$ with encoded params - -
  • -
  • - - /params-ps/wildcard/{'prefix{$}'} - -
  • -
  • - - /params-ps/wildcard/{'prefix@대{$}'} - -
  • -
  • - - /params-ps/wildcard/{'{$}suffix'} - -
  • -
  • - - /params-ps/wildcard/{'{$}suffix@대'} - -
  • -
-
-

Non-nested path params

-
    -
  • - - Non-nested - -
  • -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx deleted file mode 100644 index 0b6488f389..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.$baz.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/named/$foo/$bar/$baz')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
- Hello "/params-ps/named/$foo/$bar/$baz"! -
- baz: {params().baz} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx deleted file mode 100644 index 4387aed56d..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/$bar.route.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useParams, -} from '@tanstack/solid-router' -import { createEffect, createSignal } from 'solid-js' - -export const Route = createFileRoute('/params-ps/named/$foo/$bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const [renderBarCount, setBarRenderCount] = createSignal(0) - const [renderBazCount, setBazRenderCount] = createSignal(0) - - const params = useParams({ - strict: false, - }) - - createEffect(() => { - params().bar - setBarRenderCount((prev) => prev + 1) - }) - - createEffect(() => { - params().baz - setBazRenderCount((prev) => prev + 1) - }) - - return ( -
- Hello "/params-ps/named/$foo/$bar"! -
- Bar Render Count:{' '} - {renderBarCount()} -
-
- Bar: {params().bar} -
-
- Baz in Bar Render Count:{' '} - - {renderBazCount()} - -
-
- Baz in Bar:{' '} - - {params().baz ?? 'no param'} - -
- - To Baz - - -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx deleted file mode 100644 index ee4ff7ae8d..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/$foo/route.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { createEffect, createSignal } from 'solid-js' - -export const Route = createFileRoute('/params-ps/named/$foo')({ - component: RouteComponent, -}) - -function RouteComponent() { - const [renderCount, setRenderCount] = createSignal(0) - const params = Route.useParams() - - createEffect(() => { - params().foo - - setRenderCount((prev) => prev + 1) - }) - - return ( -
-

ParamsNamedFoo

-
- RenderCount: {renderCount()} -
-
{JSON.stringify(params())}
- - Index - - - Bar1 - - - Bar2 - - - Bar with special characters - - -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/index.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/named/index.tsx deleted file mode 100644 index 2e2f3ef917..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/index.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/named/')({ - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx deleted file mode 100644 index 8e312b2e92..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/prefix{$foo}.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/params-ps/named/prefix{$foo}')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsNamedFooPrefix

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx deleted file mode 100644 index b6f9c804d4..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/named/{$foo}suffix.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/params-ps/named/{$foo}suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsNamedFooSuffix

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx deleted file mode 100644 index 3da9f4322a..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/$bar.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute, useParams } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/non-nested/$foo_/$bar')({ - component: RouteComponent, -}) - -function RouteComponent() { - const fooParams = useParams({ from: `/params-ps/non-nested/$foo_` }) - const routeParams = Route.useParams() - - return ( -
-
{JSON.stringify(fooParams())}
-
- {JSON.stringify(routeParams())} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx deleted file mode 100644 index b0611e8627..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/$foo_/route.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/non-nested/$foo_')() diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx deleted file mode 100644 index 6de7393593..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/non-nested/route.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/non-nested')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

Non-nested path params

-
    -
  • - - /params-ps/non-nested/foo/bar - - - /params-ps/non-nested/foo2/bar2 - -
  • -
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx deleted file mode 100644 index ce0e048db8..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/$.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/params-ps/wildcard/$')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplat

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx deleted file mode 100644 index 2acc75d10c..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/wildcard/')({ - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx deleted file mode 100644 index 64cd60ed29..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix@대{$}.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/wildcard/prefix@대{$}')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatPrefix

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx deleted file mode 100644 index 85774b6e51..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/prefix{$}.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/params-ps/wildcard/prefix{$}')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatPrefix

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx deleted file mode 100644 index 7facaef073..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/params-ps/wildcard/{$}suffix')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatSuffix

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx b/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx deleted file mode 100644 index 92d1426441..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params-ps/wildcard/{$}suffix@대.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params-ps/wildcard/{$}suffix@대')({ - component: RouteComponent, -}) - -function RouteComponent() { - const p = Route.useParams() - return ( -
-

ParamsWildcardSplatSuffix

-
{JSON.stringify(p())}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/params.single.$value.tsx b/e2e/solid-router/basic-file-based/src/routes/params.single.$value.tsx deleted file mode 100644 index 5c00affc15..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/params.single.$value.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/params/single/$value')({ - component: RouteComponent, -}) - -function RouteComponent() { - const value = Route.useParams({ select: (s) => s.value }) - - return ( -
-
-

What's the value???

-

Check path param value is printed correctly for a single param.

-
-

- Value: {value()} -

-
- - Self link to same - - - Self link to amended value {`e2e${value()}`} - -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/posts.$postId.tsx b/e2e/solid-router/basic-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index a112484f11..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ErrorComponent } from '@tanstack/solid-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

- {post().title} -

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/posts.index.tsx b/e2e/solid-router/basic-file-based/src/routes/posts.index.tsx deleted file mode 100644 index ac7c378e60..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/basic-file-based/src/routes/posts.tsx b/e2e/solid-router/basic-file-based/src/routes/posts.tsx deleted file mode 100644 index 5a31160395..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - head: () => ({ - meta: [ - { - title: 'Posts page', - }, - ], - }), - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx b/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx deleted file mode 100644 index b509ebac84..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/posts_.$postId.edit.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { createFileRoute, getRouteApi, useParams } from '@tanstack/solid-router' - -export const Route = createFileRoute('/posts_/$postId/edit')({ - component: PostEditPage, -}) - -const api = getRouteApi(`/posts_/$postId/edit`) - -function PostEditPage() { - const paramsViaApi = api.useParams() - const paramsViaHook = useParams({ from: `/posts_/$postId/edit` }) - const paramsViaRouteHook = Route.useParams() - - return ( - <> -
{paramsViaHook().postId}
-
- {paramsViaRouteHook().postId} -
-
{paramsViaApi().postId}
- - ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/$target.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/$target.tsx deleted file mode 100644 index 1672e7ac3a..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/$target.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { retainSearchParams } from '@tanstack/solid-router' -import z from 'zod' - -export const Route = createFileRoute('/redirect/$target')({ - params: { - parse: (p) => - z - .object({ - target: z.union([z.literal('internal'), z.literal('external')]), - }) - .parse(p), - }, - validateSearch: z.object({ - reloadDocument: z.boolean().optional(), - preload: z.literal(false).optional(), - externalHost: z.string().optional(), - }), - search: { - middlewares: [retainSearchParams(['externalHost'])], - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/$target/index.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/$target/index.tsx deleted file mode 100644 index 0454fe0a7f..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/$target/index.tsx +++ /dev/null @@ -1,66 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/')({ - component: () => { - const preload = Route.useSearch({ select: (s) => s.preload }) - return ( -
-
- - via-beforeLoad - -
-
- - via-beforeLoad (reloadDocument=true) - -
-
- - via-loader - -
-
- - via-loader (reloadDocument=true) - -
-
- ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx deleted file mode 100644 index bc36059052..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-beforeLoad.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/via-beforeLoad')({ - beforeLoad: ({ - params: { target }, - search: { reloadDocument, externalHost }, - }) => { - switch (target) { - case 'internal': - throw redirect({ to: '/posts', reloadDocument }) - case 'external': - const href = externalHost ?? 'http://example.com' - throw redirect({ href }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx deleted file mode 100644 index 0878aaea49..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/$target/via-loader.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/via-loader')({ - loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({ - reloadDocument, - externalHost, - }), - loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => { - switch (target) { - case 'internal': - throw redirect({ to: '/posts', reloadDocument }) - case 'external': - const href = externalHost ?? 'http://example.com' - throw redirect({ href }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/index.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/index.tsx deleted file mode 100644 index a49aa819ce..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/index.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/')({ - component: () => ( -
- - internal - {' '} - - external - -
- ), -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/preload/first.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/preload/first.tsx deleted file mode 100644 index d093f16051..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/preload/first.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/preload/first')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- - go to second - -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/preload/second.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/preload/second.tsx deleted file mode 100644 index c4084e43fb..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/preload/second.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/preload/second')({ - loader: async () => { - await new Promise((r) => setTimeout(r, 1000)) - throw redirect({ from: Route.fullPath, to: '../third' }) - }, - component: RouteComponent, - pendingComponent: () =>

second pending

, -}) - -function RouteComponent() { - return
Hello "/redirect/preload/second"!
-} diff --git a/e2e/solid-router/basic-file-based/src/routes/redirect/preload/third.tsx b/e2e/solid-router/basic-file-based/src/routes/redirect/preload/third.tsx deleted file mode 100644 index 35cacf7934..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/redirect/preload/third.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/redirect/preload/third')({ - component: RouteComponent, -}) - -function RouteComponent() { - return
Hello "/redirect/preload/third"!
-} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/index.tsx deleted file mode 100644 index 4ccd38e430..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/index.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Relative Routing Tests - Home -
-
- Using Links - Using useNavigate -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx deleted file mode 100644 index d92d2b5e7c..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/nested/deep/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/link/nested/deep/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/nested/deep/"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/nested/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/nested/index.tsx deleted file mode 100644 index 5ddaa68d75..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/nested/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/link/nested/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/nested/"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx deleted file mode 100644 index bdfcafee62..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/path/$path/index.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/link/path/$path/')({ - component: RouteComponent, - loader: ({ params }) => { - return params - }, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-
- Hello from "/relative/links/path/{params().path}"! -
-
- - To {params().path === 'a' ? 'b' : 'a'} - -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/path/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/path/index.tsx deleted file mode 100644 index 36bf3f5cde..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/path/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/link/path/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Relative Routing Tests - Path Params -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx deleted file mode 100644 index daa2cea064..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-a.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/link/relative-link-a')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/relative-link-a"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx deleted file mode 100644 index 9f80899b73..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/relative-link-b.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/link/relative-link-b')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/link/relative-link-b"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/route.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/route.tsx deleted file mode 100644 index 2d77690c4e..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/route.tsx +++ /dev/null @@ -1,95 +0,0 @@ -import { - Link, - Outlet, - createFileRoute, - useNavigate, -} from '@tanstack/solid-router' -import { createEffect } from 'solid-js' - -export const Route = createFileRoute('/relative/link')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = useNavigate() - - createEffect(() => { - console.log('navigate') - }) - - return ( -
-
- Relative Routing - Links - Index -
-
- - Return To Home - - - Return To Index - - - Reload - - - Back - - - To Relative Link A - - - To Relative Link B - - - To Deeply Nested - - - To Path Param A - - - To With Search Params - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/link/with-search/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/link/with-search/index.tsx deleted file mode 100644 index f571340a56..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/link/with-search/index.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/relative/link/with-search/')({ - component: RouteComponent, - validateSearch: z.object({ - searchParam: z.string().default('1'), - }), -}) - -function RouteComponent() { - const searchParams = Route.useSearch() - return ( - <> -
- Hello "/relative/link/with-search/" searchParam:{' '} - {searchParams().searchParam}! -
-
- - Update Search - - - ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx deleted file mode 100644 index a373967b11..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/deep/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/useNavigate/nested/deep/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/nested/deep/"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx deleted file mode 100644 index 5e41c4c6db..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/nested/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/useNavigate/nested/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/nested/"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx deleted file mode 100644 index c56ef52e18..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/$path/index.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute, useNavigate } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/useNavigate/path/$path/')({ - component: RouteComponent, - loader: ({ params }) => { - return params - }, -}) - -function RouteComponent() { - const navigate = useNavigate() - - const params = Route.useParams() - - return ( -
-
- Hello from "/relative/useNavigate/path/{params().path}"! -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx deleted file mode 100644 index 6734648ae5..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/path/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/relative/useNavigate/path/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
- Relative Routing Tests - Path Params -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx deleted file mode 100644 index bbe5625a62..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-a.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute( - '/relative/useNavigate/relative-useNavigate-a', -)({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/relative-useNavigate-a"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx deleted file mode 100644 index 9be49cfcdc..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/relative-useNavigate-b.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute( - '/relative/useNavigate/relative-useNavigate-b', -)({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/relative/useNavigate/relative-useNavigate-b"! -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/route.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/route.tsx deleted file mode 100644 index 7bdaeaecb5..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/route.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import { Outlet, createFileRoute, useNavigate } from '@tanstack/solid-router' -import { createEffect } from 'solid-js' - -export const Route = createFileRoute('/relative/useNavigate')({ - component: RouteComponent, -}) - -function RouteComponent() { - const navigate = useNavigate() - - createEffect(() => { - console.log('navigate') - }) - - return ( -
-
- Relative Routing - Links - Index -
-
- - - - - - - - - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx b/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx deleted file mode 100644 index 524eae04a7..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/relative/useNavigate/with-search/index.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute, useNavigate } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/relative/useNavigate/with-search/')({ - component: RouteComponent, - validateSearch: z.object({ - searchParam: z.string().default('1'), - }), -}) - -function RouteComponent() { - const navigate = useNavigate() - const searchParams = Route.useSearch() - - return ( - <> -
- Hello "/relative/useNavigate/with-search/" searchParam:{' '} - {searchParams().searchParam}! -
-
- - - ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/remountDeps.tsx b/e2e/solid-router/basic-file-based/src/routes/remountDeps.tsx deleted file mode 100644 index 191bbad925..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/remountDeps.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createSignal } from 'solid-js' -import { onMount } from 'solid-js' - -export const Route = createFileRoute('/remountDeps')({ - validateSearch(search: { searchParam: string }) { - return { searchParam: search.searchParam } - }, - loaderDeps(opts) { - return opts.search - }, - component: Home, - remountDeps(opts) { - return opts.search - }, -}) - -const [mounts, setMounts] = createSignal(0) - -function Home() { - const search = Route.useSearch() - const navigate = Route.useNavigate() - - onMount(() => { - setMounts((m) => m + 1) - }) - - return ( -
- - -
Search: {search().searchParam}
-
- Page component mounts: {mounts()} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/search-params/default.tsx b/e2e/solid-router/basic-file-based/src/routes/search-params/default.tsx deleted file mode 100644 index 3687946620..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/search-params/default.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/search-params/default')({ - validateSearch: z.object({ - default: z.string().default('d1'), - }), - beforeLoad: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - loader: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - component: () => { - const search = Route.useSearch() - const context = Route.useRouteContext() - return ( - <> -
{search().default}
-
{context().hello}
- - ) - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/search-params/index.tsx b/e2e/solid-router/basic-file-based/src/routes/search-params/index.tsx deleted file mode 100644 index baeb5ea6ff..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/search-params/index.tsx +++ /dev/null @@ -1,43 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/search-params/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- - go to /search-params/default - -
- - go to /search-params/default?default=d2 - -
- - go to /search-params/default?default=🚀대한민국 - -
- - go to - /search-params/default?default=%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD - -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/search-params/route.tsx b/e2e/solid-router/basic-file-based/src/routes/search-params/route.tsx deleted file mode 100644 index 6efa7152b6..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/search-params/route.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/search-params')({ - beforeLoad: async () => { - await new Promise((resolve) => setTimeout(resolve, 100)) - return { hello: 'world' as string } - }, -}) diff --git a/e2e/solid-router/basic-file-based/src/routes/transition/count/create-resource.tsx b/e2e/solid-router/basic-file-based/src/routes/transition/count/create-resource.tsx deleted file mode 100644 index 182a03fd1a..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/transition/count/create-resource.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { Suspense, createResource } from 'solid-js' -import { z } from 'zod' - -export const Route = createFileRoute('/transition/count/create-resource')({ - validateSearch: z.object({ - n: z.number().default(1), - }), - component: Home, -}) - -function Home() { - return ( -
- ({ n: s.n + 1 })} - > - Increase - - - -
- ) -} - -function Result() { - const searchQuery = Route.useSearch() - - const [doubleQuery] = createResource( - () => searchQuery().n, - async (n) => { - await new Promise((r) => setTimeout(r, 1000)) - return n * 2 - }, - ) - - return ( -
- -
n: {searchQuery().n}
-
double: {doubleQuery()}
-
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/transition/typing/create-resource.tsx b/e2e/solid-router/basic-file-based/src/routes/transition/typing/create-resource.tsx deleted file mode 100644 index 832b1ab0c3..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/transition/typing/create-resource.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Suspense, createResource } from 'solid-js' - -export const Route = createFileRoute('/transition/typing/create-resource')({ - validateSearch: (search: { query?: string }) => ({ - query: search.query ?? '', - }), - component: Home, - ssr: true, -}) - -function Home() { - const searchQuery = Route.useSearch() - const navigate = Route.useNavigate() - - const [asyncResult] = createResource( - () => searchQuery().query, - async (query) => { - await new Promise((r) => setTimeout(r, 1000)) - return query - }, - ) - - return ( -
-
- { - navigate({ search: { query: e.currentTarget.value } }) - }} - /> - -
- - - Query: {searchQuery().query} -
- Result: {asyncResult()} -
-
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/대한민국/route.tsx b/e2e/solid-router/basic-file-based/src/routes/대한민국/route.tsx deleted file mode 100644 index e996d48c76..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/대한민국/route.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/대한민국')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-

- Hello "/대한민국"! -

-
    -
  • - - link to latin id - -
  • -
  • - - link to unicode id - -
  • -
  • - - link to foo/bar - -
  • -
  • - - link to foo%\/🚀대 - -
  • -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx b/e2e/solid-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx deleted file mode 100644 index d849f5675c..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/대한민국/wildcard.$.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/대한민국/wildcard/$')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-

Unicode Wildcard Params

-
- Hello /대한민국/wildcard/ - {params()._splat} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx b/e2e/solid-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx deleted file mode 100644 index 93bb5e561c..0000000000 --- a/e2e/solid-router/basic-file-based/src/routes/대한민국/🚀.$id.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/대한민국/🚀/$id')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - - return ( -
-

Unicode Named Params

-
- Hello /대한민국/🚀/ - {params().id} -
-
- ) -} diff --git a/e2e/solid-router/basic-file-based/src/styles.css b/e2e/solid-router/basic-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-file-based/src/vite-env.d.ts b/e2e/solid-router/basic-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-file-based/tests/app.spec.ts b/e2e/solid-router/basic-file-based/tests/app.spec.ts deleted file mode 100644 index 274d234031..0000000000 --- a/e2e/solid-router/basic-file-based/tests/app.spec.ts +++ /dev/null @@ -1,317 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test("useBlocker doesn't block navigation if condition is not met", async ({ - page, -}) => { - await page.goto('/editing-a') - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByRole('button', { name: 'Go to next step' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') -}) - -test('useBlocker does block navigation if condition is met', async ({ - page, -}) => { - await page.goto('/editing-a') - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go to next step' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') - - await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible() -}) - -test('Proceeding through blocked navigation works', async ({ page }) => { - await page.goto('/editing-a') - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go to next step' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') - - await page.getByRole('button', { name: 'Proceed' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') -}) - -test("legacy useBlocker doesn't block navigation if condition is not met", async ({ - page, -}) => { - await page.goto('/editing-b') - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByRole('button', { name: 'Go back' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') -}) - -test('legacy useBlocker does block navigation if condition is met', async ({ - page, -}) => { - await page.goto('/editing-b') - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go back' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') - - await expect(page.getByRole('button', { name: 'Proceed' })).toBeVisible() -}) - -test('legacy Proceeding through blocked navigation works', async ({ page }) => { - await page.goto('/editing-b') - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByLabel('Enter your name:').fill('foo') - - await page.getByRole('button', { name: 'Go back' }).click() - await expect(page.getByRole('heading')).toContainText('Editing B') - - await page.getByRole('button', { name: 'Proceed' }).click() - await expect(page.getByRole('heading')).toContainText('Editing A') -}) - -test('useCanGoBack correctly disables back button', async ({ page }) => { - const getBackButtonDisabled = async () => { - const backButton = page.getByTestId('back-button') - const isDisabled = (await backButton.getAttribute('disabled')) !== null - return isDisabled - } - - expect(await getBackButtonDisabled()).toBe(true) - - await page.getByRole('link', { name: 'Posts' }).click() - await expect(page.getByTestId('posts-links')).toBeInViewport() - expect(await getBackButtonDisabled()).toBe(false) - - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByTestId('post-title')).toBeInViewport() - expect(await getBackButtonDisabled()).toBe(false) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goBack() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goForward() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goBack() - expect(await getBackButtonDisabled()).toBe(false) - - await page.goBack() - expect(await getBackButtonDisabled()).toBe(true) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(true) -}) - -test('useCanGoBack correctly disables back button, using router.history and window.history', async ({ - page, -}) => { - const getBackButtonDisabled = async () => { - const backButton = page.getByTestId('back-button') - const isDisabled = (await backButton.getAttribute('disabled')) !== null - return isDisabled - } - - await page.getByRole('link', { name: 'Posts' }).click() - await expect(page.getByTestId('posts-links')).toBeInViewport() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByTestId('post-title')).toBeInViewport() - await page.getByTestId('back-button').click() - expect(await getBackButtonDisabled()).toBe(false) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(false) - - await page.getByTestId('back-button').click() - expect(await getBackButtonDisabled()).toBe(true) - - await page.evaluate('window.history.forward()') - expect(await getBackButtonDisabled()).toBe(false) - - await page.evaluate('window.history.forward()') - expect(await getBackButtonDisabled()).toBe(false) - - await page.evaluate('window.history.back()') - expect(await getBackButtonDisabled()).toBe(false) - - await page.evaluate('window.history.back()') - expect(await getBackButtonDisabled()).toBe(true) - - await page.reload() - expect(await getBackButtonDisabled()).toBe(true) -}) - -const testCases = [ - { - description: 'Navigating to a route inside a route group', - testId: 'link-to-route-inside-group', - }, - { - description: - 'Navigating to a route inside a subfolder inside a route group ', - testId: 'link-to-route-inside-group-inside-subfolder', - }, - { - description: 'Navigating to a route inside a route group inside a layout', - testId: 'link-to-route-inside-group-inside-layout', - }, - { - description: 'Navigating to a lazy route inside a route group', - testId: 'link-to-lazy-route-inside-group', - }, - - { - description: 'Navigating to the only route inside a route group ', - testId: 'link-to-only-route-inside-group', - }, -] - -testCases.forEach(({ description, testId }) => { - test(description, async ({ page }) => { - await page.getByTestId(testId).click() - await expect(page.getByTestId('search-via-hook')).toContainText('world') - await expect(page.getByTestId('search-via-route-hook')).toContainText( - 'world', - ) - await expect(page.getByTestId('search-via-route-api')).toContainText( - 'world', - ) - }) -}) - -test('navigating to an unnested route', async ({ page }) => { - const postId = 'hello-world' - page.goto(`/posts/${postId}/edit`) - await expect(page.getByTestId('params-via-hook')).toContainText(postId) - await expect(page.getByTestId('params-via-route-hook')).toContainText(postId) - await expect(page.getByTestId('params-via-route-api')).toContainText(postId) -}) - -async function getRenderCount(page: Page) { - const renderCount = parseInt( - await page.getByTestId('render-count').innerText(), - ) - return renderCount -} -async function structuralSharingTest(page: Page, enabled: boolean) { - page.goto(`/structural-sharing/${enabled}/?foo=f1&bar=b1`) - await expect(page.getByTestId('enabled')).toHaveText(JSON.stringify(enabled)) - - async function checkSearch({ foo, bar }: { foo: string; bar: string }) { - expect(page.url().endsWith(`?foo=${foo}&bar=${bar}`)).toBe(true) - const expectedSearch = JSON.stringify({ values: [foo, bar] }) - await expect(page.getByTestId('search-via-hook')).toHaveText(expectedSearch) - await expect(page.getByTestId('search-via-route-hook')).toHaveText( - expectedSearch, - ) - await expect(page.getByTestId('search-via-route-api-hook')).toHaveText( - expectedSearch, - ) - } - - await checkSearch({ bar: 'b1', foo: 'f1' }) - await page.getByTestId('link').click() - await checkSearch({ bar: 'b2', foo: 'f2' }) -} - -test('Should change title on client side navigation', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Posts' }).click() - - await expect(page).toHaveTitle('Posts page') -}) - -test('Should change post navigating back and forth', async ({ page }) => { - await page.goto('/posts/1') - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - - await page.getByRole('link', { name: 'qui est esse' }).click() - await expect(page.getByTestId('post-title')).toContainText('qui est esse') - - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByTestId('post-title')).toContainText('sunt aut facere') -}) - -test('Should not remount deps when remountDeps does not change ', async ({ - page, -}) => { - await page.goto('/notRemountDeps') - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) -}) - -test('Should remount deps when remountDeps does change ', async ({ page }) => { - await page.goto('/remountDeps') - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 1', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 2', - ) - await page.getByRole('button', { name: 'Regenerate search param' }).click() - await expect(page.getByTestId('component-mounts')).toContainText( - 'Page component mounts: 3', - ) -}) - -test.describe('Unicode route rendering', () => { - test('should render non-latin route correctly', async ({ page, baseURL }) => { - await page.goto('/대한민국') - - await expect(page.locator('body')).toContainText('Hello "/대한민국"!') - - expect(page.url()).toBe(`${baseURL}/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`) - }) -}) diff --git a/e2e/solid-router/basic-file-based/tests/hover-preload-hash.spec.ts b/e2e/solid-router/basic-file-based/tests/hover-preload-hash.spec.ts deleted file mode 100644 index 1263faf391..0000000000 --- a/e2e/solid-router/basic-file-based/tests/hover-preload-hash.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import { toRuntimePath } from '@tanstack/router-e2e-utils' - -test('clicking hash link then hovering another link does not scroll back to hash', async ({ - page, -}) => { - // Go to the page without hash - await page.goto(toRuntimePath('/hover-preload-hash')) - - // Click the hash link to navigate to position1 - await page.getByTestId('link-to-hash').click() - await expect(page.locator('#position1')).toBeInViewport() - - // Scroll up so position1 is no longer in view - await page.evaluate(() => window.scrollTo(0, 0)) - await expect(page.locator('#position1')).not.toBeInViewport() - - // Hover the link to trigger intent preload (should NOT scroll back) - await page.getByTestId('link-to-only-route-inside-group').hover() - await page.waitForTimeout(400) - - // Ensure we did not jump back to the hash target - await expect(page.locator('#position1')).not.toBeInViewport() -}) diff --git a/e2e/solid-router/basic-file-based/tests/mask.spec.ts b/e2e/solid-router/basic-file-based/tests/mask.spec.ts deleted file mode 100644 index 9a7ee8a1c8..0000000000 --- a/e2e/solid-router/basic-file-based/tests/mask.spec.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test('route masks transform params and expose masked pathname in the browser (solid)', async ({ - page, -}) => { - await page.goto('/') - - await page.getByTestId('link-to-masks').click() - await expect(page.getByText('Route Masks')).toBeVisible() - - const link = page.getByTestId('link-to-admin-mask') - await link.click() - - await page.waitForURL('/masks/public/user-42') - - await expect(page.getByTestId('admin-user-component')).toBeInViewport() - await expect(page.getByTestId('admin-user-id')).toHaveText('42') - - await expect(page.getByTestId('router-pathname')).toHaveText( - '/masks/admin/42', - ) - - await expect(page.getByTestId('router-masked-pathname')).toHaveText( - '/masks/public/user-42', - ) -}) diff --git a/e2e/solid-router/basic-file-based/tests/non-nested-paths.spec.ts b/e2e/solid-router/basic-file-based/tests/non-nested-paths.spec.ts deleted file mode 100644 index ea0e585c75..0000000000 --- a/e2e/solid-router/basic-file-based/tests/non-nested-paths.spec.ts +++ /dev/null @@ -1,351 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -const testCases: Array<{ - name: string - testPathDesc: string - testPathPrefix: string - testPathSuffix: string - paramValue: Record - paramValue2: Record -}> = [ - { - name: 'Named path params', - testPathDesc: 'named', - testPathPrefix: '', - testPathSuffix: '', - paramValue: { baz: 'baz' }, - paramValue2: { baz: 'baz_' }, - }, - { - name: 'prefix params', - testPathPrefix: 'prefix', - testPathSuffix: '', - testPathDesc: 'prefix', - paramValue: { baz: 'baz' }, - paramValue2: { baz: 'baz_' }, - }, - { - name: 'suffix params', - testPathPrefix: '', - testPathSuffix: 'suffix', - testPathDesc: 'suffix', - paramValue: { baz: 'baz' }, - paramValue2: { baz: 'baz2' }, - }, - { - name: 'path', - testPathPrefix: '', - testPathSuffix: '', - testPathDesc: 'path', - paramValue: {}, - paramValue2: {}, - }, -] - -test.describe('Non-nested paths', () => { - testCases.forEach( - ({ - name, - testPathDesc, - testPathPrefix, - testPathSuffix, - paramValue, - paramValue2, - }) => { - test.describe(name, () => { - const path = `/non-nested/${testPathDesc}` - const paramNameDesc = Object.keys(paramValue)[0] ?? 'baz' - - test.beforeEach(async ({ page }) => { - await page.goto('/non-nested') - await page.waitForURL('/non-nested') - }) - - test('Should not un-nest nested paths', async ({ page }) => { - const nonNestedPathHeading = page.getByTestId( - 'non-nested-path-heading', - ) - await expect(nonNestedPathHeading).toBeVisible() - - await page.getByTestId(`l-to-${testPathDesc}`).click() - await page.waitForURL(path) - - const rootRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const pathRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`, - ) - - const indexHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-index-heading`, - ) - - const fooHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-foo-heading`, - ) - - const indexParams = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-index-param`, - ) - - const fooParams = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-foo-param`, - ) - - const indexLink = page.getByTestId(`to-${testPathDesc}-index`) - const fooLink = page.getByTestId(`to-${testPathDesc}-foo`) - const foo2Link = page.getByTestId(`to-${testPathDesc}-foo-2`) - - const indexPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}` - const fooPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo` - const foo2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/foo` - - console.log(await indexLink.getAttribute('href')) - await expect(indexLink).toHaveAttribute('href', indexPath) - await expect(fooLink).toHaveAttribute('href', fooPath) - await expect(foo2Link).toHaveAttribute('href', foo2Path) - - await indexLink.click() - await page.waitForURL(indexPath) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).toBeVisible() - await expect(indexHeading).toBeVisible() - const indexParamValue = await indexParams.innerText() - expect(JSON.parse(indexParamValue)).toEqual(paramValue) - - await fooLink.click() - await page.waitForURL(fooPath) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).toBeVisible() - await expect(fooHeading).toBeVisible() - const fooParamValue = await fooParams.innerText() - expect(JSON.parse(fooParamValue)).toEqual(paramValue) - - await foo2Link.click() - await page.waitForURL(foo2Path) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).toBeVisible() - await expect(fooHeading).toBeVisible() - const foo2ParamValue = await fooParams.innerText() - expect(JSON.parse(foo2ParamValue)).toEqual(paramValue2) - }) - - test('Should not nest non-nested paths', async ({ page }) => { - const nonNestedPathHeading = page.getByTestId( - 'non-nested-path-heading', - ) - await expect(nonNestedPathHeading).toBeVisible() - - await page.getByTestId(`l-to-${testPathDesc}`).click() - await page.waitForURL(path) - - const rootRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const pathRouteHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-route-heading`, - ) - - const barHeading = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-bar-heading`, - ) - - const barParams = page.getByTestId( - `non-nested-${testPathDesc}-${paramNameDesc}-bar-param`, - ) - - const barLink = page.getByTestId(`to-${testPathDesc}-bar`) - const bar2Link = page.getByTestId(`to-${testPathDesc}-bar-2`) - - const barPath = `${path}/${testPathPrefix}${paramValue[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar` - const bar2Path = `${path}/${testPathPrefix}${paramValue2[paramNameDesc] ?? 'baz'}${testPathSuffix}/bar` - await expect(barLink).toHaveAttribute('href', barPath) - - await expect(bar2Link).toHaveAttribute('href', bar2Path) - - await barLink.click() - await page.waitForURL(barPath) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).not.toBeVisible() - await expect(barHeading).toBeVisible() - const barParamValue = await barParams.innerText() - expect(JSON.parse(barParamValue)).toEqual(paramValue) - - await bar2Link.click() - await page.waitForURL(bar2Path) - await expect(rootRouteHeading).toBeVisible() - await expect(pathRouteHeading).not.toBeVisible() - await expect(barHeading).toBeVisible() - const bar2ParamValue = await barParams.innerText() - expect(JSON.parse(bar2ParamValue)).toEqual(paramValue2) - }) - }) - }, - ) -}) - -test.describe('Deeply nested non-nested paths', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/non-nested/deep') - await page.waitForURL('/non-nested/deep') - }) - - test('It should nest nested paths 1 level deep', async ({ page }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const bazLink = page.getByTestId('to-deep-baz') - await bazLink.click() - await page.waitForURL('/non-nested/deep/baz') - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazIndexHeading = page.getByTestId( - 'non-nested-deep-baz-index-heading', - ) - const bazIndexParams = page.getByTestId('non-nested-deep-baz-index-param') - - await expect(bazRouteHeading).toBeVisible() - await expect(bazIndexHeading).toBeVisible() - expect(await bazIndexParams.innerText()).toBe( - JSON.stringify({ baz: 'baz' }), - ) - }) - - test('It should not nest non-nested paths 1 level deep', async ({ page }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - const bazBarLink = page.getByTestId('to-deep-baz-bar') - - await bazBarLink.click() - await page.waitForURL('/non-nested/deep/baz-bar/bar') - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazBarRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-route-heading', - ) - const bazBarIndexHeading = page.getByTestId( - 'non-nested-deep-baz-bar-index-heading', - ) - const bazBarIndexParams = page.getByTestId( - 'non-nested-deep-baz-bar-index-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).toBeVisible() - await expect(bazBarIndexHeading).toBeVisible() - expect(await bazBarIndexParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar' }), - ) - }) - - test('It should not nest non-nested paths 2 levels deep', async ({ - page, - }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const bazBarQuxLink = page.getByTestId('to-deep-baz-bar-qux') - await bazBarQuxLink.click() - - await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/qux') - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazBarRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-route-heading', - ) - const bazBarQuxHeading = page.getByTestId( - 'non-nested-deep-baz-bar-qux-heading', - ) - const bazBarQuxParams = page.getByTestId( - 'non-nested-deep-baz-bar-qux-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).not.toBeVisible() - await expect(bazBarQuxHeading).toBeVisible() - await expect(bazBarQuxParams).toBeVisible() - expect(await bazBarQuxParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar-qux' }), - ) - }) - - test('It should nest and un-nest non-nested across paths multiple levels deep', async ({ - page, - }) => { - const rootRouteHeading = page.getByTestId( - `non-nested-deep-root-route-heading`, - ) - - await expect(rootRouteHeading).toBeVisible() - - const bazBarFooLink = page.getByTestId('to-deep-baz-bar-foo') - await bazBarFooLink.click() - - await page.waitForURL('/non-nested/deep/baz-bar/bar/foo') - - const bazRouteHeading = page.getByTestId( - 'non-nested-deep-baz-route-heading', - ) - const bazBarRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-route-heading', - ) - const bazBarFooRouteHeading = page.getByTestId( - 'non-nested-deep-baz-bar-foo-route-heading', - ) - const bazBarFooIndexHeading = page.getByTestId( - 'non-nested-deep-baz-bar-foo-index-heading', - ) - const bazBarFooIndexParams = page.getByTestId( - 'non-nested-deep-baz-bar-foo-index-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).toBeVisible() - await expect(bazBarFooRouteHeading).toBeVisible() - await expect(bazBarFooIndexHeading).toBeVisible() - await expect(bazBarFooIndexParams).toBeVisible() - expect(await bazBarFooIndexParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar', foo: 'foo' }), - ) - - const bazBarFooQuxLink = page.getByTestId('to-deep-baz-bar-foo-qux') - await bazBarFooQuxLink.click() - await page.waitForURL('/non-nested/deep/baz-bar-qux/bar/foo/qux') - - const bazBarFooQuxHeading = page.getByTestId( - 'non-nested-deep-baz-bar-foo-qux-heading', - ) - const bazBarFooQuxParams = page.getByTestId( - 'non-nested-deep-baz-bar-foo-qux-param', - ) - - await expect(bazRouteHeading).not.toBeVisible() - await expect(bazBarRouteHeading).toBeVisible() - await expect(bazBarFooRouteHeading).not.toBeVisible() - await expect(bazBarFooQuxHeading).toBeVisible() - await expect(bazBarFooQuxParams).toBeVisible() - expect(await bazBarFooQuxParams.innerText()).toBe( - JSON.stringify({ baz: 'baz-bar-qux', foo: 'foo' }), - ) - }) -}) diff --git a/e2e/solid-router/basic-file-based/tests/params.spec.ts b/e2e/solid-router/basic-file-based/tests/params.spec.ts deleted file mode 100644 index 6014689ed2..0000000000 --- a/e2e/solid-router/basic-file-based/tests/params.spec.ts +++ /dev/null @@ -1,496 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test.describe('ensure single params have been parsed correctly whilst being stable in the browser', () => { - const cases = [ - { value: 'hello', expected: 'hello' }, - { - value: '100%25', - expected: '100%', - }, - { - value: '100%2525', - expected: '100%25', - }, - { - value: '100%26', - expected: '100&', - }, - ] - - function getParsedValue(page: Page) { - return page.getByTestId('parsed-param-value').textContent() - } - - for (const { value, expected } of cases) { - test(`navigating to /params/single/${value}`, async ({ page, baseURL }) => { - await page.goto(`/params/single/${value}`) - - // on the first run, the value should be the same as the expected value - const valueOnFirstRun = await getParsedValue(page) - expect(valueOnFirstRun).toBe(expected) - - // the url/pathname should be the same as the expected value - const urlOnFirstRun = page.url().replace(baseURL!, '') - expect(urlOnFirstRun).toBe(`/params/single/${value}`) - - // click on the self link to the same value - await page.getByTestId('self-link-same').click() - const valueOnSecondRun = await getParsedValue(page) - expect(valueOnSecondRun).toBe(expected) - - // click on the self link to the amended value - await page.getByTestId('self-link-amended').click() - const valueOnThirdRun = await getParsedValue(page) - expect(valueOnThirdRun).toBe(`e2e${expected}`) - - // the url/pathname should be the same as the expected value - const urlOnThirdRun = page.url().replace(baseURL!, '') - expect(urlOnThirdRun).toBe(`/params/single/e2e${value}`) - }) - } -}) - -test.describe('params operations + non-nested routes', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps/non-nested') - }) - - test('useParams must resolve non-nested path params', async ({ page }) => { - await page.waitForURL('/params-ps/non-nested') - - const fooBarLink = page.getByTestId('l-to-non-nested-foo-bar') - - const foo2Bar2Link = page.getByTestId('l-to-non-nested-foo2-bar2') - - await expect(fooBarLink).toHaveAttribute( - 'href', - '/params-ps/non-nested/foo/bar', - ) - - await fooBarLink.click() - await page.waitForURL('/params-ps/non-nested/foo/bar') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe('/params-ps/non-nested/foo/bar') - - const fooParamsValue = page.getByTestId('foo-params-value') - const fooParamsText = await fooParamsValue.innerText() - const fooParamsObj = JSON.parse(fooParamsText) - expect(fooParamsObj).toEqual({ foo: 'foo' }) - - const paramsValue = page.getByTestId('foo-bar-params-value') - const paramsText = await paramsValue.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual({ foo: 'foo', bar: 'bar' }) - - await expect(foo2Bar2Link).toHaveAttribute( - 'href', - '/params-ps/non-nested/foo2/bar2', - ) - await foo2Bar2Link.click() - await page.waitForURL('/params-ps/non-nested/foo2/bar2') - const pagePathname2 = new URL(page.url()).pathname - expect(pagePathname2).toBe('/params-ps/non-nested/foo2/bar2') - - const foo2ParamsValue = page.getByTestId('foo-params-value') - const foo2ParamsText = await foo2ParamsValue.innerText() - const foo2ParamsObj = JSON.parse(foo2ParamsText) - expect(foo2ParamsObj).toEqual({ foo: 'foo2' }) - - const params2Value = page.getByTestId('foo-bar-params-value') - const params2Text = await params2Value.innerText() - const params2Obj = JSON.parse(params2Text) - expect(params2Obj).toEqual({ foo: 'foo2', bar: 'bar2' }) - }) -}) - -test.describe('params operations + prefix/suffix', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps') - }) - - test.describe('named params', () => { - const NAMED_PARAMS_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-named-foo', - pathname: '/params-ps/named/foo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFoo', - }, - { - id: 'l-to-named-prefixfoo', - pathname: '/params-ps/named/prefixfoo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooPrefix', - }, - { - id: 'l-to-named-foosuffix', - pathname: '/params-ps/named/foosuffix', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooSuffix', - }, - { - id: 'l-to-named-foo-special-characters', - pathname: '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80', - params: { foo: 'foo%\\/🚀대' }, - destHeadingId: 'ParamsNamedFoo', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - - test(`ensure use params doesn't cause excess renders and is stable across various usage options`, async ({ - page, - }) => { - await page.goto('/params-ps/named/foo') - await page.waitForLoadState('networkidle') - - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe('/params-ps/named/foo') - - const fooRenderCount = page.getByTestId('foo-render-count') - const fooIndexLink = page.getByTestId('params-foo-links-index') - const fooBar1Link = page.getByTestId('params-foo-links-bar1') - const fooBar2Link = page.getByTestId('params-foo-links-bar2') - const fooBarBazLink = page.getByTestId('params-foo-bar-links-baz') - const fooValue = page.getByTestId('params-output') - const fooBarValue = page.getByTestId('foo-bar-value') - const fooBazInBarValue = page.getByTestId('foo-baz-in-bar-value') - const fooBarRenderCount = page.getByTestId('foo-bar-render-count') - const fooBarBazValue = page.getByTestId('foo-bar-baz-value') - - await expect(fooRenderCount).toBeInViewport() - await expect(fooValue).toBeInViewport() - await expect(fooIndexLink).toBeInViewport() - await expect(fooBar1Link).toBeInViewport() - await expect(fooBar2Link).toBeInViewport() - await expect(fooRenderCount).toHaveText('1') - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - - await fooBar1Link.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarRenderCount).toBeInViewport() - await expect(fooBarValue).toBeInViewport() - await expect(fooBazInBarValue).toBeInViewport() - await expect(fooBarBazLink).toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - await expect(fooBarRenderCount).toHaveText('1') - await expect(fooBarValue).toHaveText('1') - await expect(fooBazInBarValue).toHaveText('no param') - - await fooBarBazLink.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarRenderCount).toBeInViewport() - await expect(fooBarValue).toBeInViewport() - await expect(fooBazInBarValue).toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - await expect(fooBarRenderCount).toHaveText('2') - await expect(fooBarValue).toHaveText('1') - await expect(fooBazInBarValue).toHaveText('1_10') - await expect(fooBarBazValue).toHaveText('1_10') - - await fooBar2Link.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarValue).toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - await expect(fooBarValue).toHaveText('2') - - await fooIndexLink.click() - await page.waitForLoadState('networkidle') - await expect(fooValue).toBeInViewport() - await expect(fooRenderCount).toBeInViewport() - await expect(fooBarValue).not.toBeInViewport() - await expect(fooValue).toHaveText(JSON.stringify({ foo: 'foo' })) - await expect(fooRenderCount).toHaveText('1') - }) - }) - - test.describe('wildcard param', () => { - const WILDCARD_PARAM_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-wildcard-foo', - pathname: '/params-ps/wildcard/foo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplat', - }, - { - id: 'l-to-wildcard-prefixfoo', - pathname: '/params-ps/wildcard/prefixfoo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatPrefix', - }, - { - id: 'l-to-wildcard-foosuffix', - pathname: '/params-ps/wildcard/foosuffix', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatSuffix', - }, - { - id: 'l-to-wildcard-escaped', - pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`, - params: { - _splat: 'test[s\\/.\\/parameter%!🚀]', - '*': 'test[s\\/.\\/parameter%!🚀]', - }, - destHeadingId: 'ParamsWildcardSplat', - }, - { - id: 'l-to-wildcard-prefix-escaped', - pathname: `/params-ps/wildcard/prefix@%EB%8C%80test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]`, - params: { - _splat: 'test[s\\/.\\/parameter%!🚀]', - '*': 'test[s\\/.\\/parameter%!🚀]', - }, - destHeadingId: 'ParamsWildcardSplatPrefix', - }, - { - id: 'l-to-wildcard-suffix-escaped', - pathname: `/params-ps/wildcard/test[s%5C/.%5C/parameter%25!%F0%9F%9A%80]suffix@%EB%8C%80`, - params: { - _splat: 'test[s\\/.\\/parameter%!🚀]', - '*': 'test[s\\/.\\/parameter%!🚀]', - }, - destHeadingId: 'ParamsWildcardSplatSuffix', - }, - { - id: 'l-to-wildcard-encoded', - pathname: - '/params-ps/wildcard/%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - params: { - '*': '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - _splat: '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - }, - destHeadingId: 'ParamsWildcardSplat', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - }) -}) - -test.describe('Unicode params', () => { - test('should render non-latin route correctly across multiple params', async ({ - page, - baseURL, - }) => { - await page.goto('/params-ps') - await page.waitForURL('/params-ps') - const fooLink = page.getByTestId('l-to-named-foo-special-characters') - - await fooLink.click() - await page.waitForURL('/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80') - - expect(page.url()).toBe( - `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80`, - ) - - const headingEl = page.getByRole('heading', { name: 'ParamsNamedFoo' }) - await expect(headingEl).toBeVisible() - let paramsEl = page.getByTestId('params-output') - let paramsText = await paramsEl.innerText() - expect(paramsText).toEqual(JSON.stringify({ foo: 'foo%\\/🚀대' })) - - const barLink = page.getByTestId('params-foo-links-bar-special-characters') - - await barLink.click() - - await page.waitForURL( - '/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80', - ) - - expect(page.url()).toBe( - `${baseURL}/params-ps/named/foo%25%5C%2F%F0%9F%9A%80%EB%8C%80/%F0%9F%9A%80%252F%2Fabc%EB%8C%80`, - ) - - paramsEl = page.getByTestId('foo-bar-value') - paramsText = await paramsEl.innerText() - expect(paramsText).toEqual('🚀%2F/abc대') - }) - - test.describe('should handle routes with non-latin paths and params correctly', () => { - const testCases = [ - { - name: 'named', - childPath: '🚀', - latinParams: 'foo', - unicodeParams: 'foo%\\/🚀대', - }, - { - name: 'wildcard', - childPath: 'wildcard', - latinParams: 'foo/bar', - unicodeParams: 'foo%\\/🚀대', - }, - ] - - testCases.forEach(({ name, childPath, latinParams, unicodeParams }) => { - test(`${name} params`, async ({ page, baseURL }) => { - const pascalCaseName = name.charAt(0).toUpperCase() + name.slice(1) - const routeParentPath = '/대한민국' - const encodedRouteParentPath = encodeURI(routeParentPath) - const childRoutePath = `${routeParentPath}/${childPath}` - const encodedChildRoutePath = encodeURI(childRoutePath) - - await page.goto(routeParentPath) - await page.waitForURL(encodedRouteParentPath) - - const headingRootEl = page.getByTestId('unicode-heading') - - expect(await headingRootEl.innerText()).toBe('Hello "/대한민국"!') - - const latinLink = page.getByTestId(`l-to-${name}-latin`) - const unicodeLink = page.getByTestId(`l-to-${name}-unicode`) - - await expect(latinLink).not.toContainClass('font-bold') - await expect(unicodeLink).not.toContainClass('font-bold') - - await latinLink.click() - - await page.waitForURL(`${encodedChildRoutePath}/${latinParams}`) - - expect(page.url()).toBe( - `${baseURL}${encodedChildRoutePath}/${latinParams}`, - ) - - await expect(latinLink).toContainClass('font-bold') - await expect(unicodeLink).not.toContainClass('font-bold') - - const headingEl = page.getByTestId(`unicode-${name}-heading`) - const paramsEl = page.getByTestId(`unicode-${name}-params`) - - expect(await headingEl.innerText()).toBe( - `Unicode ${pascalCaseName} Params`, - ) - - expect(await paramsEl.innerText()).toBe(latinParams) - - await unicodeLink.click() - - const encodedParams = - name === 'wildcard' - ? encodeURI(unicodeParams) - : encodeURIComponent(unicodeParams) - - await page.waitForURL(`${encodedChildRoutePath}/${encodedParams}`) - - expect(page.url()).toBe( - `${baseURL}${encodedChildRoutePath}/${encodedParams}`, - ) - - await expect(latinLink).not.toContainClass('font-bold') - await expect(unicodeLink).toContainClass('font-bold') - - expect(await headingEl.innerText()).toBe( - `Unicode ${pascalCaseName} Params`, - ) - expect(await paramsEl.innerText()).toBe(unicodeParams) - }) - }) - }) -}) diff --git a/e2e/solid-router/basic-file-based/tests/redirect.spec.ts b/e2e/solid-router/basic-file-based/tests/redirect.spec.ts deleted file mode 100644 index c3604ccb92..0000000000 --- a/e2e/solid-router/basic-file-based/tests/redirect.spec.ts +++ /dev/null @@ -1,128 +0,0 @@ -import queryString from 'node:querystring' -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import combinateImport from 'combinate' - -// somehow playwright does not correctly import default exports -const combinate = (combinateImport as any).default as typeof combinateImport - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const EXTERNAL_ORIGIN = `http://127.0.0.1:${PORT}` - -test.describe('redirects', () => { - const internalNavigationTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - preload: [false, true] as const, - }) - - internalNavigationTestMatrix.forEach( - ({ thrower, reloadDocument, preload }) => { - test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - await page.goto( - `/redirect/internal${preload === false ? '?preload=false' : ''}`, - ) - const link = page.getByTestId( - `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`, - ) - - await page.waitForLoadState('networkidle') - let requestHappened = false - - const requestPromise = new Promise((resolve) => { - page.on('request', (request) => { - if ( - request.url() === 'https://jsonplaceholder.typicode.com/posts' - ) { - requestHappened = true - resolve() - } - }) - }) - await link.focus() - - const expectRequestHappened = preload && !reloadDocument - const timeoutPromise = new Promise((resolve) => - setTimeout(resolve, expectRequestHappened ? 5000 : 500), - ) - await Promise.race([requestPromise, timeoutPromise]) - await page.waitForLoadState('networkidle') - expect(requestHappened).toBe(expectRequestHappened) - await link.click() - let fullPageLoad = false - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - - const url = `http://localhost:${PORT}/posts` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - expect(fullPageLoad).toBe(reloadDocument) - }) - }, - ) - - const internalDirectVisitTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - }) - - internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => { - test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - - await page.goto(`/redirect/internal/via-${thrower}`) - - const url = `http://localhost:${PORT}/posts` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - }) - }) - - const externalTestMatrix = combinate({ - scenario: ['navigate', 'direct_visit'] as const, - thrower: ['beforeLoad', 'loader'] as const, - }) - - externalTestMatrix.forEach(({ scenario, thrower }) => { - test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - }) - if (scenario === 'navigate') { - await page.goto(`/redirect/external?${q}`) - await page.getByTestId(`via-${thrower}`).click() - } else { - await page.goto(`/redirect/external/via-${thrower}?${q}`) - } - - const url = `${EXTERNAL_ORIGIN}/` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - }) - }) - - test('regression test for #3097', async ({ page }) => { - await page.goto(`/redirect/preload/first`) - const link = page.getByTestId(`link`) - await link.focus() - await link.click() - await page.waitForURL('/redirect/preload/third') - await expect(page.getByTestId(`third`)).toBeInViewport() - }) -}) diff --git a/e2e/solid-router/basic-file-based/tests/relative.spec.ts b/e2e/solid-router/basic-file-based/tests/relative.spec.ts deleted file mode 100644 index f62c248680..0000000000 --- a/e2e/solid-router/basic-file-based/tests/relative.spec.ts +++ /dev/null @@ -1,272 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import combinateImport from 'combinate' - -// somehow playwright does not correctly import default exports -const combinate = (combinateImport as any).default as typeof combinateImport - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -test.describe('relative_routing', () => { - const internalNavigationTestMatrix = combinate({ - navigation: ['link', 'useNavigate'] as const, - }) - - internalNavigationTestMatrix.forEach(({ navigation }) => { - test(`simple relative navigation. navigation: ${navigation}`, async ({ - page, - }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const indexLink = page.getByTestId(`relative-${navigation}-index`) - const backLink = page.getByTestId(`relative-${navigation}-back`) - const relativeRouteA = page.getByTestId(`relative-${navigation}-a`) - const relativeRouteB = page.getByTestId(`relative-${navigation}-b`) - - await relativeRouteA.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-a`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-a-header`), - ).toBeInViewport() - - await relativeRouteB.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/relative-${navigation}-b`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-b-header`), - ).toBeInViewport() - - await indexLink.click() - - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-b-header`), - ).not.toBeInViewport() - - await backLink.click() - - await page.waitForURL(`http://localhost:${PORT}/relative`) - - await expect(page.getByTestId(`relative-routing-home`)).toBeInViewport() - }) - - test(`nested chilren. navigation: ${navigation}`, async ({ page }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const backLink = page.getByTestId(`relative-${navigation}-back`) - - const deeplyNestedChildRoute = page.getByTestId( - `relative-${navigation}-deeply-nested`, - ) - - await deeplyNestedChildRoute.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/nested/deep`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-nested-deep-header`), - ).toBeInViewport() - - await backLink.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/nested`, - ) - - await expect( - page.getByTestId(`relative-${navigation}-nested-header`), - ).toBeInViewport() - }) - - test(`with path params. navigation: ${navigation}`, async ({ page }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const pathParamRoute = page.getByTestId(`relative-${navigation}-path`) - - await pathParamRoute.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/path/a`, - ) - - expect(page.url().endsWith('/path/a')).toBe(true) - - await expect( - page.getByTestId(`relative-${navigation}-path-param-header`), - ).toBeInViewport() - - const switchParamLink = page.getByTestId( - `relative-${navigation}-path-param-switchAB`, - ) - - await switchParamLink.click() - - await page.waitForURL( - `http://localhost:${PORT}/relative/${navigation}/path/b`, - ) - - expect(page.url().endsWith('/path/b')).toBe(true) - - await expect( - page.getByTestId(`relative-${navigation}-path-param-header`), - ).toBeInViewport() - }) - - test(`with search params. navigation: ${navigation}`, async ({ page }) => { - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - const searchParamRoute = page.getByTestId( - `relative-${navigation}-withSearch`, - ) - - await searchParamRoute.click() - - let expectedUrl = new URL( - `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam="1"`, - ) - - await page.waitForLoadState('domcontentloaded') - - expect(page.url().toString()).toBe(expectedUrl.toString()) - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toBeInViewport() - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toContainText('searchParam: 1') - - const updateSearchLink = page.getByTestId( - `relative-${navigation}-withSearch-update-param`, - ) - - await updateSearchLink.click() - - await page.waitForLoadState('domcontentloaded') - - expectedUrl = new URL( - `http://localhost:${PORT}/relative/${navigation}/with-search?searchParam="2"`, - ) - - expect(page.url().toString()).toBe(expectedUrl.toString()) - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toContainText('searchParam: 2') - - await expect( - page.getByTestId(`relative-${navigation}-withSearch-header`), - ).toBeInViewport() - }) - - test(`shouldn't cause excessive rendering. navigation: ${navigation}`, async ({ - page, - }) => { - let navigateMsgs = 0 - - page.on('console', (msg) => { - if (msg.text() === 'navigate') { - navigateMsgs++ - } - }) - - await page.waitForLoadState('networkidle') - await page.goto(`/relative/${navigation}`) - await page.waitForURL(`http://localhost:${PORT}/relative/${navigation}`) - - await expect( - page.getByTestId(`relative-${navigation}-header`), - ).toBeInViewport() - - expect(navigateMsgs).toBe(1) - const indexLink = page.getByTestId(`relative-${navigation}-index`) - const backLink = page.getByTestId(`relative-${navigation}-back`) - const relativeRouteA = page.getByTestId(`relative-${navigation}-a`) - const relativeRouteB = page.getByTestId(`relative-${navigation}-b`) - const deeplyNestedChildRoute = page.getByTestId( - `relative-${navigation}-deeply-nested`, - ) - const pathParamRoute = page.getByTestId(`relative-${navigation}-path`) - const searchParamRoute = page.getByTestId( - `relative-${navigation}-withSearch`, - ) - - await relativeRouteA.click() - await page.waitForLoadState('domcontentloaded') - await relativeRouteB.click() - await page.waitForLoadState('domcontentloaded') - await deeplyNestedChildRoute.click() - await page.waitForLoadState('domcontentloaded') - await backLink.click() - await page.waitForLoadState('domcontentloaded') - await pathParamRoute.click() - await page.waitForLoadState('domcontentloaded') - const switchParamLink = page.getByTestId( - `relative-${navigation}-path-param-switchAB`, - ) - await switchParamLink.click() - await page.waitForLoadState('domcontentloaded') - await searchParamRoute.click() - await page.waitForLoadState('domcontentloaded') - - const updateSearchLink = page.getByTestId( - `relative-${navigation}-withSearch-update-param`, - ) - - await updateSearchLink.click() - await page.waitForLoadState('domcontentloaded') - - await indexLink.click() - await page.waitForLoadState('domcontentloaded') - - expect(navigateMsgs).toBe(1) - }) - }) -}) diff --git a/e2e/solid-router/basic-file-based/tests/scroll-into-view.spec.ts b/e2e/solid-router/basic-file-based/tests/scroll-into-view.spec.ts deleted file mode 100644 index 6730959838..0000000000 --- a/e2e/solid-router/basic-file-based/tests/scroll-into-view.spec.ts +++ /dev/null @@ -1,214 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' -import type { Page } from '@playwright/test' - -const anchors = { - defaultAnchor: 'default-anchor', - noScrollIntoView: 'false-anchor', - smoothScroll: 'smooth-scroll', -} as const - -const formTestIds = { - targetAnchor: 'hash-select', - scrollIntoView: 'with-scroll', - behaviorSelect: 'behavior-select', - blockSelect: 'block-select', - inlineSelect: 'inline-select', - navigateButton: 'navigate-button', -} - -const shownSuffix = '(shown)' - -const activeClass = 'font-bold active' - -function getAnchorTarget(page: Page, anchor: string) { - return page.getByTestId(`heading-${anchor}`) -} - -function getAnchorLink(page: Page, anchor: string) { - return page.getByTestId(`link-${anchor}`) -} - -test.beforeEach(async ({ page }) => { - await page.goto('/anchor') -}) - -// Testing the `Link` component with the `hashScrollIntoView` prop -test('Navigating via anchor `Link` with default hash scrolling behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await getAnchorLink(page, anchors.defaultAnchor).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toBeVisible() - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.defaultAnchor)).toHaveClass( - activeClass, - ) -}) - -test('Navigating via anchor `Link` with hash scrolling disabled', async ({ - page, -}) => { - const initialScrollPosition = await page.evaluate(() => window.scrollY) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await getAnchorLink(page, anchors.noScrollIntoView).click() - - // The active anchor should have updated - await expect(getAnchorLink(page, anchors.noScrollIntoView)).toHaveClass( - activeClass, - ) - - // The anchor should not have been visible, because the scroll should not have been activated - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - // Expect the same scroll position as before - expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition) -}) - -test('Navigating via anchor `Link` with smooth hash scrolling behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - await getAnchorLink(page, anchors.smoothScroll).click() - await expect(getAnchorTarget(page, anchors.smoothScroll)).toBeVisible() - - // Smooth scrolling should activate the IntersectionObserver on all headings, making them all render "(shown)" - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText( - shownSuffix, - ) - await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText( - shownSuffix, - ) - await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) -}) - -// Testing the `useNavigate` hook with the `hashScrollIntoView` option -test('Navigating via `useNavigate` with instant scroll behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - // Scroll to the last anchor instantly, should not activate Intersection Observers for the other anchors - await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll') - await page.getByTestId(formTestIds.scrollIntoView).check() - await page.getByTestId(formTestIds.behaviorSelect).selectOption('instant') - await page.getByTestId(formTestIds.blockSelect).selectOption('start') - await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest') - await page.getByTestId(formTestIds.navigateButton).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toBeVisible() - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) -}) - -test('Navigating via `useNavigate` with scrollIntoView disabled', async ({ - page, -}) => { - const initialScrollPosition = await page.evaluate(() => window.scrollY) - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - // Navigate to the last anchor, but with scrollIntoView disabled should not activate Intersection Observers for any anchors - await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll') - await page.getByTestId(formTestIds.scrollIntoView).uncheck() - await page.getByTestId(formTestIds.navigateButton).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).not.toContainText( - shownSuffix, - ) - - await expect( - getAnchorTarget(page, anchors.noScrollIntoView), - ).not.toContainText(shownSuffix) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) - - // Expect the same scroll position as before - expect(await page.evaluate(() => window.scrollY)).toBe(initialScrollPosition) -}) - -test('Navigating via `useNavigate` with smooth scroll behavior', async ({ - page, -}) => { - await expect(getAnchorTarget(page, anchors.smoothScroll)).not.toContainText( - shownSuffix, - ) - - // Scroll to the last anchor smoothly, should activate Intersection Observers for the other anchors, making them all render "(shown)" - await page.getByTestId(formTestIds.targetAnchor).selectOption('Smooth Scroll') - await page.getByTestId(formTestIds.scrollIntoView).check() - await page.getByTestId(formTestIds.behaviorSelect).selectOption('smooth') - await page.getByTestId(formTestIds.blockSelect).selectOption('start') - await page.getByTestId(formTestIds.inlineSelect).selectOption('nearest') - await page.getByTestId(formTestIds.navigateButton).click() - - await expect(getAnchorTarget(page, anchors.defaultAnchor)).toContainText( - shownSuffix, - ) - - await expect(getAnchorTarget(page, anchors.noScrollIntoView)).toContainText( - shownSuffix, - ) - - await expect(getAnchorTarget(page, anchors.smoothScroll)).toContainText( - shownSuffix, - ) - - await expect(getAnchorLink(page, anchors.smoothScroll)).toHaveClass( - activeClass, - ) -}) diff --git a/e2e/solid-router/basic-file-based/tests/search-params.spec.ts b/e2e/solid-router/basic-file-based/tests/search-params.spec.ts deleted file mode 100644 index a99488a47a..0000000000 --- a/e2e/solid-router/basic-file-based/tests/search-params.spec.ts +++ /dev/null @@ -1,144 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.describe('/search-params/default', () => { - test('Directly visiting the route without search param set', async ({ - page, - }) => { - await page.goto('/search-params/default') - await page.waitForURL('/search-params/default?default=d1') - - await expect(page.getByTestId('search-default')).toContainText('d1') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d1'), - ).toBeTruthy() - }) - - test('Directly visiting the route with search param set', async ({ - page, - }) => { - await page.goto('/search-params/default/?default=d2') - await page.waitForURL('/search-params/default?default=d2') - - await expect(page.getByTestId('search-default')).toContainText('d2') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d2'), - ).toBeTruthy() - }) - - test('Directly visiting the route with special character search param set', async ({ - page, - }) => { - await page.goto('/search-params/default/?default=🚀대한민국') - await page.waitForURL( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - - await expect(page.getByTestId('search-default')).toContainText('🚀대한민국') - await expect(page.getByTestId('context-hello')).toContainText('world') - - expect( - page - .url() - .endsWith( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ), - ).toBeTruthy() - }) - - test('Directly visiting the route with encoded character search param set', async ({ - page, - }) => { - await page.goto( - '/search-params/default/?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ) - await page.waitForURL( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ) - - await expect(page.getByTestId('search-default')).toContainText( - '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - await expect(page.getByTestId('context-hello')).toContainText('world') - - expect( - page - .url() - .endsWith( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ), - ).toBeTruthy() - }) - - test('navigating to the route without search param set', async ({ page }) => { - await page.goto('/search-params/') - await page.getByTestId('link-to-default-without-search').click() - await page.waitForURL('/search-params/default?default=d1') - - await expect(page.getByTestId('search-default')).toContainText('d1') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d1'), - ).toBeTruthy() - }) - - test('navigating to the route with search param set', async ({ page }) => { - await page.goto('/search-params/') - await page.getByTestId('link-to-default-with-search').click() - await page.waitForURL('/search-params/default?default=d2') - - await expect(page.getByTestId('search-default')).toContainText('d2') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d2'), - ).toBeTruthy() - }) - - test('navigating to the route with special character search param set', async ({ - page, - }) => { - await page.goto('/search-params/') - await page - .getByTestId('link-to-default-with-search-special-characters') - .click() - await page.waitForURL( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - - await expect(page.getByTestId('search-default')).toContainText('🚀대한민국') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page - .url() - .endsWith( - '/search-params/default?default=%F0%9F%9A%80%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ), - ).toBeTruthy() - }) - - test('navigating to the route with encoded character search param set', async ({ - page, - }) => { - await page.goto('/search-params/') - await page - .getByTestId('link-to-default-with-search-encoded-characters') - .click() - await page.waitForURL( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ) - - await expect(page.getByTestId('search-default')).toContainText( - '%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD', - ) - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page - .url() - .endsWith( - '/search-params/default?default=%25EB%258C%2580%25ED%2595%259C%25EB%25AF%25BC%25EA%25B5%25AD', - ), - ).toBeTruthy() - }) -}) diff --git a/e2e/solid-router/basic-file-based/tests/transition.spec.ts b/e2e/solid-router/basic-file-based/tests/transition.spec.ts deleted file mode 100644 index 06f6d04a77..0000000000 --- a/e2e/solid-router/basic-file-based/tests/transition.spec.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test('transitions/count/create-resource should keep old values visible during navigation', async ({ - page, -}) => { - await page.goto('/transition/count/create-resource') - - await expect(page.getByTestId('n-value')).toContainText('n: 1') - await expect(page.getByTestId('double-value')).toContainText('double: 2') - - const bodyTexts: Array = [] - - const pollInterval = setInterval(async () => { - const text = await page - .locator('body') - .textContent() - .catch(() => '') - if (text) bodyTexts.push(text) - }, 50) - - // 1 click - - page.getByTestId('increase-button').click() - - await expect(page.getByTestId('n-value')).toContainText('n: 1', { - timeout: 2_000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 2', { - timeout: 2_000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 2', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 4', { - timeout: 2000, - }) - - // 2 clicks - - page.getByTestId('increase-button').click() - page.getByTestId('increase-button').click() - - await expect(page.getByTestId('n-value')).toContainText('n: 2', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 4', { - timeout: 2000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 4', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 8', { - timeout: 2000, - }) - - // 3 clicks - - page.getByTestId('increase-button').click() - page.getByTestId('increase-button').click() - page.getByTestId('increase-button').click() - - await expect(page.getByTestId('n-value')).toContainText('n: 4', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 8', { - timeout: 2000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 7', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 14', { - timeout: 2000, - }) - - clearInterval(pollInterval) - - // With proper transitions, old values should remain visible until new ones arrive - const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...')) - - if (hasLoadingText) { - throw new Error( - 'FAILED: "Loading..." appeared during navigation. ' + - 'Solid Router should use transitions to keep old values visible.', - ) - } -}) diff --git a/e2e/solid-router/basic-file-based/tsconfig.json b/e2e/solid-router/basic-file-based/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basic-file-based/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-file-based/vite.config.js b/e2e/solid-router/basic-file-based/vite.config.js deleted file mode 100644 index bfd3a0404e..0000000000 --- a/e2e/solid-router/basic-file-based/vite.config.js +++ /dev/null @@ -1,15 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'solid', - }), - solid(), - ], -}) diff --git a/e2e/solid-router/basic-scroll-restoration/.devcontainer/devcontainer.json b/e2e/solid-router/basic-scroll-restoration/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-scroll-restoration/.gitignore b/e2e/solid-router/basic-scroll-restoration/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/solid-router/basic-scroll-restoration/index.html b/e2e/solid-router/basic-scroll-restoration/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-scroll-restoration/package.json b/e2e/solid-router/basic-scroll-restoration/package.json deleted file mode 100644 index e2b945cb6a..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-scroll-restoration", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/solid-virtual": "^3.13.0", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "typescript": "~5.9.0" - } -} diff --git a/e2e/solid-router/basic-scroll-restoration/playwright.config.ts b/e2e/solid-router/basic-scroll-restoration/playwright.config.ts deleted file mode 100644 index 6a684ac89e..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_SERVER_PORT=${PORT} pnpm build && VITE_SERVER_PORT=${PORT} pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-scroll-restoration/src/main.tsx b/e2e/solid-router/basic-scroll-restoration/src/main.tsx deleted file mode 100644 index c90182caf7..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/src/main.tsx +++ /dev/null @@ -1,280 +0,0 @@ -import { render } from 'solid-js/web' -import { - HeadContent, - Link, - Outlet, - RouterProvider, - createRootRoute, - createRoute, - createRouter, - useElementScrollRestoration, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' -import { createVirtualizer } from '@tanstack/solid-virtual' -import './styles.css' -import { createRenderEffect } from 'solid-js' - -const rootRoute = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - About - - - About (No Reset) - - - By-Element - -
- - - - ) -} - -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: IndexComponent, -}) - -function IndexComponent() { - createRenderEffect(() => { - window.invokeOrders.push('index-useLayoutEffect') - }, []) - - return ( -
-

- Welcome Home! -

-
-
- {Array.from({ length: 50 }).map((_, i) => ( -
- Home Item {i + 1} -
- ))} -
-
- ) -} - -const aboutRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/about', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: AboutComponent, -}) - -function AboutComponent() { - createRenderEffect(() => { - window.invokeOrders.push('about-useLayoutEffect') - }, []) - return ( -
-

Hello from About!

-
- {Array.from({ length: 50 }).map((_, i) => ( -
- About Item {i + 1} -
- ))} -
-
- ) -} - -const byElementRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/by-element', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: ByElementComponent, -}) - -function ByElementComponent() { - // We need a unique ID for manual scroll restoration on a specific element - // It should be as unique as possible for this element across your app - const scrollRestorationId = 'myVirtualizedContent' - - // We use that ID to get the scroll entry for this element - const scrollEntry = useElementScrollRestoration({ - id: scrollRestorationId, - }) - - // Let's use TanStack Virtual to virtualize some content! - let virtualizerParentRef: HTMLDivElement | undefined - const virtualizer = createVirtualizer({ - count: 10000, - getScrollElement: () => virtualizerParentRef ?? null, - estimateSize: () => 100, - // We pass the scrollY from the scroll restoration entry to the virtualizer - // as the initial offset - initialOffset: scrollEntry?.scrollY, - }) - - return ( -
-
Hello from By-Element!
-
-
-
- First Regular List Item -
-
- {Array.from({ length: 50 }).map((_, i) => ( -
- Regular List Item {i + 1} -
- ))} -
-
- {Array.from({ length: 2 }).map((_, i) => ( -
-
- {Array.from({ length: 50 }).map((_, i) => ( -
- About Item {i + 1} -
- ))} -
-
- ))} -
-
Virtualized
-
-
- {virtualizer.getVirtualItems().map((item) => ( -
-
- Virtualized Item {item.index + 1} -
-
- ))} -
-
-
-
-
-
- ) -} - -const fooRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/foo', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: FooComponent, -}) - -function FooComponent() { - return ( -
-

Hello from Foo!

- - Go to Bar - -
- {Array.from({ length: 50 }).map((_, i) => ( -
- Foo Item {i + 1} -
- ))} -
-
- ) -} - -const barRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/bar', - loader: () => new Promise((r) => setTimeout(r, 500)), - component: BarComponent, -}) - -function BarComponent() { - return ( -
-

Hello from Bar!

-
- {Array.from({ length: 50 }).map((_, i) => ( -
- Bar Item {i + 1} -
- ))} -
-
- ) -} - -const routeTree = rootRoute.addChildren([ - indexRoute, - aboutRoute, - byElementRoute, - fooRoute, - barRoute, -]) - -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - scrollRestoration: true, - getScrollRestorationKey: (location) => location.pathname, -}) - -declare global { - interface Window { - invokeOrders: Array - } -} -window.invokeOrders = [] -router.subscribe('onBeforeRouteMount', (event) => { - window.invokeOrders.push(event.type) -}) - -router.subscribe('onResolved', (event) => { - window.invokeOrders.push(event.type) -}) - -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic-scroll-restoration/src/styles.css b/e2e/solid-router/basic-scroll-restoration/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-scroll-restoration/src/vite-env.d.ts b/e2e/solid-router/basic-scroll-restoration/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-scroll-restoration/tests/app.spec.ts b/e2e/solid-router/basic-scroll-restoration/tests/app.spec.ts deleted file mode 100644 index af79f97c52..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/tests/app.spec.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('restore scroll positions by page, home pages top message should not display on navigating back', async ({ - page, -}) => { - // Step 1: Navigate to the home page - await page.goto('/') - - await expect(page.locator('#greeting')).toContainText('Welcome Home!') - await expect(page.locator('#top-message')).toBeInViewport() - - // Step 2: Scroll to a position that hides the top - const targetScrollPosition = 1000 - await page.evaluate( - (scrollPos: number) => window.scrollTo(0, scrollPos), - targetScrollPosition, - ) - - // Verify initial scroll position - const scrollPosition = await page.evaluate(() => window.scrollY) - expect(scrollPosition).toBe(targetScrollPosition) - - await expect(page.locator('#top-message')).not.toBeInViewport() - await page.waitForTimeout(1000) - - // Step 3: Navigate to the about page - await page.getByRole('link', { name: 'About', exact: true }).click() - await expect(page.locator('#greeting')).toContainText('Hello from About!') - - // Step 4: Go back to the home page and immediately check the message - await page.goBack() - - // Wait for the home page to have rendered - await page.waitForSelector('#greeting') - await page.waitForTimeout(1000) - await expect(page.locator('#top-message')).not.toBeInViewport() - - // Confirm the scroll position was restored correctly - const restoredScrollPosition = await page.evaluate(() => window.scrollY) - expect(restoredScrollPosition).toBe(targetScrollPosition) -}) - -test('restore scroll positions by element, first regular list item should not display on navigating back', async ({ - page, -}) => { - // Step 1: Navigate to the by-element page - await page.goto('/by-element') - - // Step 2: Scroll to a position that hides the first list item in regular list - const targetScrollPosition = 1000 - await page.waitForSelector('#RegularList') - await expect(page.locator('#first-regular-list-item')).toBeInViewport() - - await page.evaluate( - (scrollPos: number) => - document.querySelector('#RegularList')!.scrollTo(0, scrollPos), - targetScrollPosition, - ) - - // Verify initial scroll position - const scrollPosition = await page.evaluate( - () => document.querySelector('#RegularList')!.scrollTop, - ) - expect(scrollPosition).toBe(targetScrollPosition) - - await expect(page.locator('#first-regular-list-item')).not.toBeInViewport() - - // Step 3: Navigate to the about page - await page.getByRole('link', { name: 'About', exact: true }).click() - await expect(page.locator('#greeting')).toContainText('Hello from About!') - - // Step 4: Go back to the by-element page and immediately check the message - await page.goBack() - - // TODO: For some reason, this only works in headed mode. - // When someone can explain that to me, I'll fix this test. - - // Confirm the scroll position was restored correctly - // const restoredScrollPosition = await page.evaluate( - // () => document.querySelector('#RegularList')!.scrollTop, - // ) - // expect(restoredScrollPosition).toBe(targetScrollPosition) -}) - -test('scroll to top when not scrolled, regression test for #4782', async ({ - page, -}) => { - await page.goto('/foo') - - await expect(page.getByTestId('foo-route-component')).toBeVisible() - - let scrollPosition = await page.evaluate(() => window.scrollY) - expect(scrollPosition).toBe(0) - - // do not scroll, just navigate to /bar - await page.getByTestId('go-to-bar-link').click() - await expect(page.getByTestId('bar-route-component')).toBeVisible() - - const targetScrollPosition = 1000 - await page.evaluate( - (scrollPos: number) => window.scrollTo(0, scrollPos), - targetScrollPosition, - ) - scrollPosition = await page.evaluate(() => window.scrollY) - expect(scrollPosition).toBe(targetScrollPosition) - - // navigate back to /foo - await page.goBack() - await expect(page.getByTestId('foo-route-component')).toBeVisible() - - // check if scroll position is restored to 0 since we did not scroll on /foo - const restoredScrollPosition = await page.evaluate(() => window.scrollY) - expect(restoredScrollPosition).toBe(0) -}) diff --git a/e2e/solid-router/basic-scroll-restoration/tests/router-events.spec.ts b/e2e/solid-router/basic-scroll-restoration/tests/router-events.spec.ts deleted file mode 100644 index 23cbd15451..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/tests/router-events.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('after a navigation, should have emitted "onBeforeRouteMount","onResolved" and useRenderEffect setup in the correct order', async ({ - page, -}) => { - // Navigate to the Home page - await page.goto('/') - await expect(page.locator('#greeting')).toContainText('Welcome Home!') - - let orders = await page.evaluate(() => window.invokeOrders) - - expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved') - expectItemOrder(orders, 'onBeforeRouteMount', 'index-useLayoutEffect') - - // Clear the invokeOrders array - orders = await page.evaluate(() => { - window.invokeOrders = [] - return window.invokeOrders - }) - - // Navigate to the About page - await page.getByRole('link', { name: 'About', exact: true }).click() - await expect(page.locator('#greeting')).toContainText('Hello from About!') - - orders = await page.evaluate(() => window.invokeOrders) - - expectItemOrder(orders, 'onBeforeRouteMount', 'onResolved') - expectItemOrder(orders, 'onBeforeRouteMount', 'about-useLayoutEffect') -}) - -function expectItemOrder( - array: Array, - firstItem: TItem, - secondItem: TItem, -) { - const firstIndex = array.findIndex((item) => item === firstItem) - const secondIndex = array.findIndex((item) => item === secondItem) - - if (firstIndex === -1 || secondIndex === -1) { - throw new Error('One or both items were not found in the array ' + array) - } - - expect(firstIndex).toBeLessThan(secondIndex) -} diff --git a/e2e/solid-router/basic-scroll-restoration/tsconfig.json b/e2e/solid-router/basic-scroll-restoration/tsconfig.json deleted file mode 100644 index 98f8016075..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-scroll-restoration/vite.config.js b/e2e/solid-router/basic-scroll-restoration/vite.config.js deleted file mode 100644 index fb5faf9236..0000000000 --- a/e2e/solid-router/basic-scroll-restoration/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), solid()], -}) diff --git a/e2e/solid-router/basic-solid-query-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/basic-solid-query-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-solid-query-file-based/.gitignore b/e2e/solid-router/basic-solid-query-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/basic-solid-query-file-based/index.html b/e2e/solid-router/basic-solid-query-file-based/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-solid-query-file-based/package.json b/e2e/solid-router/basic-solid-query-file-based/package.json deleted file mode 100644 index 5243275066..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-solid-query-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-query": "^5.90.9", - "@tanstack/solid-query-devtools": "^5.90.0", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic-solid-query-file-based/playwright.config.ts b/e2e/solid-router/basic-solid-query-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-solid-query-file-based/src/main.tsx b/e2e/solid-router/basic-solid-query-file-based/src/main.tsx deleted file mode 100644 index 7f1d2165f1..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/main.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { QueryClient, QueryClientProvider } from '@tanstack/solid-query' -import { routeTree } from './routeTree.gen' -import './styles.css' - -export const queryClient = new QueryClient() - -// Set up a Router instance -const router = createRouter({ - routeTree, - context: { - queryClient, - }, - scrollRestoration: true, - defaultPreload: 'intent', - // Since we're using React Query, we don't want loader calls to ever be stale - // This will ensure that the loader is always called when the route is preloaded or visited - defaultPreloadStaleTime: 0, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render( - () => ( - - - - ), - rootElement, - ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/postQueryOptions.tsx b/e2e/solid-router/basic-solid-query-file-based/src/postQueryOptions.tsx deleted file mode 100644 index fe118d7bde..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/postQueryOptions.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { queryOptions } from '@tanstack/solid-query' -import { fetchPost } from './posts' - -export const postQueryOptions = (postId: string) => - queryOptions({ - queryKey: ['posts', { postId }], - queryFn: () => fetchPost(postId), - }) diff --git a/e2e/solid-router/basic-solid-query-file-based/src/posts.tsx b/e2e/solid-router/basic-solid-query-file-based/src/posts.tsx deleted file mode 100644 index 1f6cb8e308..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/posts.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -export class PostNotFoundError extends Error {} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw new PostNotFoundError(`Post with id "${postId}" not found!`) - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/postsQueryOptions.tsx b/e2e/solid-router/basic-solid-query-file-based/src/postsQueryOptions.tsx deleted file mode 100644 index ce59b8a0bb..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/postsQueryOptions.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { queryOptions } from '@tanstack/solid-query' -import { fetchPosts } from './posts' - -export const postsQueryOptions = queryOptions({ - queryKey: ['posts'], - queryFn: () => fetchPosts(), -}) diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts deleted file mode 100644 index 9cc1d71391..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,220 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/_layout': typeof LayoutRouteWithChildren - '/posts': typeof PostsRouteWithChildren - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/posts/$postId' - | '/posts/' - | '/layout-a' - | '/layout-b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/posts/$postId' | '/posts' | '/layout-a' | '/layout-b' - id: - | '__root__' - | '/' - | '/_layout' - | '/posts' - | '/_layout/_layout-2' - | '/posts/$postId' - | '/posts/' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - LayoutRoute: typeof LayoutRouteWithChildren - PostsRoute: typeof PostsRouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - } -} - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - LayoutRoute: LayoutRouteWithChildren, - PostsRoute: PostsRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/__root.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/__root.tsx deleted file mode 100644 index 6b59adb953..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,71 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRouteWithContext, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' -import { SolidQueryDevtools } from '@tanstack/solid-query-devtools' -import type { QueryClient } from '@tanstack/solid-query' - -export const Route = createRootRouteWithContext<{ - queryClient: QueryClient -}>()({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - This Route Does Not Exist - -
-
- - - - - ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout.tsx deleted file mode 100644 index 5525c0c297..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 000a19e988..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index 997e6caf80..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 70135c5809..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/index.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/index.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.$postId.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index f771b7be7e..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ErrorComponent, useRouter } from '@tanstack/solid-router' -import { useQuery } from '@tanstack/solid-query' -import { createEffect, createMemo } from 'solid-js' -import { PostNotFoundError } from '../posts' -import { postQueryOptions } from '../postQueryOptions' -import { queryClient } from '../main' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error, reset }: ErrorComponentProps) { - const router = useRouter() - if (error instanceof PostNotFoundError) { - return
{error.message}
- } - - createEffect(() => { - reset() - queryClient.resetQueries() - }) - - return ( -
- - -
- ) -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: ({ context: { queryClient }, params: { postId } }) => { - return queryClient.ensureQueryData(postQueryOptions(postId)) - }, - errorComponent: PostErrorComponent, - component: PostComponent, -}) - -function PostComponent() { - const params = Route.useParams() - const post = createMemo(() => - useQuery(() => postQueryOptions(params().postId)), - ) - - return ( -
-

{post().data?.title}

-
{post().data?.body}
-
- ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.index.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.index.tsx deleted file mode 100644 index 812b581e0a..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.tsx b/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.tsx deleted file mode 100644 index d194367647..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' -import { useQuery } from '@tanstack/solid-query' -import { createMemo } from 'solid-js' -import { postsQueryOptions } from '../postsQueryOptions' - -export const Route = createFileRoute('/posts')({ - loader: ({ context: { queryClient } }) => - queryClient.ensureQueryData(postsQueryOptions), - component: PostsComponent, -}) - -function PostsComponent() { - const postsQuery = useQuery(() => postsQueryOptions) - const posts = createMemo(() => { - if (postsQuery.data) { - return postsQuery.data - } else { - return [] - } - }) - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/styles.css b/e2e/solid-router/basic-solid-query-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-solid-query-file-based/src/vite-env.d.ts b/e2e/solid-router/basic-solid-query-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-solid-query-file-based/tests/app.spec.ts b/e2e/solid-router/basic-solid-query-file-based/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/basic-solid-query-file-based/tsconfig.json b/e2e/solid-router/basic-solid-query-file-based/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-solid-query-file-based/vite.config.js b/e2e/solid-router/basic-solid-query-file-based/vite.config.js deleted file mode 100644 index 95863b470a..0000000000 --- a/e2e/solid-router/basic-solid-query-file-based/vite.config.js +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ target: 'solid', autoCodeSplitting: true }), - solid(), - ], -}) diff --git a/e2e/solid-router/basic-solid-query/.devcontainer/devcontainer.json b/e2e/solid-router/basic-solid-query/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-solid-query/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-solid-query/.gitignore b/e2e/solid-router/basic-solid-query/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/solid-router/basic-solid-query/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/basic-solid-query/index.html b/e2e/solid-router/basic-solid-query/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-solid-query/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-solid-query/package.json b/e2e/solid-router/basic-solid-query/package.json deleted file mode 100644 index 1efe55fa60..0000000000 --- a/e2e/solid-router/basic-solid-query/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-solid-query", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/solid-query": "^5.90.9", - "@tanstack/solid-query-devtools": "^5.90.0", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic-solid-query/playwright.config.ts b/e2e/solid-router/basic-solid-query/playwright.config.ts deleted file mode 100644 index e7b8439dba..0000000000 --- a/e2e/solid-router/basic-solid-query/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-solid-query/src/main.tsx b/e2e/solid-router/basic-solid-query/src/main.tsx deleted file mode 100644 index 6228ad8e86..0000000000 --- a/e2e/solid-router/basic-solid-query/src/main.tsx +++ /dev/null @@ -1,277 +0,0 @@ -import { render } from 'solid-js/web' -import { - ErrorComponent, - HeadContent, - Link, - Outlet, - RouterProvider, - createRootRouteWithContext, - createRoute, - createRouter, - useRouter, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' -import { SolidQueryDevtools } from '@tanstack/solid-query-devtools' -import { - QueryClient, - QueryClientProvider, - useQuery, -} from '@tanstack/solid-query' -import { createEffect, createMemo } from 'solid-js' -import { NotFoundError, postQueryOptions, postsQueryOptions } from './posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' -import './styles.css' - -const rootRoute = createRootRouteWithContext<{ - queryClient: QueryClient -}>()({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - This Route Does Not Exist - -
-
- - - - - ) -} - -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - component: IndexRouteComponent, -}) - -function IndexRouteComponent() { - return ( -
-

Welcome Home!

-
- ) -} - -const postsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'posts', - loader: ({ context: { queryClient } }) => - queryClient.ensureQueryData(postsQueryOptions), -}).lazy(() => import('./posts.lazy').then((d) => d.Route)) - -const postsIndexRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '/', - component: PostsIndexRouteComponent, -}) - -function PostsIndexRouteComponent() { - return
Select a post.
-} - -function PostErrorComponent({ error, reset }: ErrorComponentProps) { - const router = useRouter() - if (error instanceof NotFoundError) { - return
{error.message}
- } - createEffect(() => { - reset() - queryClient.resetQueries() - }) - - return ( -
- - -
- ) -} - -const postRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '$postId', - errorComponent: PostErrorComponent, - loader: ({ context: { queryClient }, params: { postId } }) => - queryClient.ensureQueryData(postQueryOptions(postId)), - component: PostRouteComponent, -}) - -function PostRouteComponent() { - const params = postRoute.useParams() - const postQuery = useQuery(() => postQueryOptions(params().postId)) - const post = createMemo(() => postQuery.data) - - return ( -
-

{post()?.title}

-
{post()?.body}
-
- ) -} - -const layoutRoute = createRoute({ - getParentRoute: () => rootRoute, - id: '_layout', - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} - -const layout2Route = createRoute({ - getParentRoute: () => layoutRoute, - id: '_layout-2', - component: Layout2Component, -}) - -function Layout2Component() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} - -const layoutARoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-a', - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} - -const layoutBRoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-b', - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} - -const routeTree = rootRoute.addChildren([ - postsRoute.addChildren([postRoute, postsIndexRoute]), - layoutRoute.addChildren([ - layout2Route.addChildren([layoutARoute, layoutBRoute]), - ]), - indexRoute, -]) - -const queryClient = new QueryClient() - -// Set up a Router instance -const router = createRouter({ - routeTree, - scrollRestoration: true, - defaultPreload: 'intent', - // Since we're using React Query, we don't want loader calls to ever be stale - // This will ensure that the loader is always called when the route is preloaded or visited - defaultPreloadStaleTime: 0, - context: { - queryClient, - }, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render( - () => ( - - - - ), - rootElement, - ) -} diff --git a/e2e/solid-router/basic-solid-query/src/posts.lazy.tsx b/e2e/solid-router/basic-solid-query/src/posts.lazy.tsx deleted file mode 100644 index 4b0d610e5d..0000000000 --- a/e2e/solid-router/basic-solid-query/src/posts.lazy.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router' -import { useQuery } from '@tanstack/solid-query' -import { Suspense, createMemo } from 'solid-js' -import { postsQueryOptions } from './posts' - -export const Route = createLazyRoute('/posts')({ - component: PostsComponent, -}) - -function PostsComponent() { - const postsQuery = useQuery(() => postsQueryOptions) - - const posts = createMemo(() => { - if (postsQuery.data) { - return postsQuery.data - } else { - return [] - } - }) - - return ( -
-
    - - {[ - ...posts(), - { id: 'i-do-not-exist', title: 'Non-existent Post' }, - ].map((post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - })} -
    -
- -
- ) -} diff --git a/e2e/solid-router/basic-solid-query/src/posts.ts b/e2e/solid-router/basic-solid-query/src/posts.ts deleted file mode 100644 index 392fd2deb0..0000000000 --- a/e2e/solid-router/basic-solid-query/src/posts.ts +++ /dev/null @@ -1,46 +0,0 @@ -import axios from 'redaxios' -import { queryOptions } from '@tanstack/solid-query' - -export class NotFoundError extends Error {} - -type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -const fetchPosts = async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} - -const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} - -export const postQueryOptions = (postId: string) => - queryOptions({ - queryKey: ['posts', { postId }], - queryFn: () => fetchPost(postId), - }) - -export const postsQueryOptions = queryOptions({ - queryKey: ['posts'], - queryFn: () => fetchPosts(), -}) diff --git a/e2e/solid-router/basic-solid-query/src/styles.css b/e2e/solid-router/basic-solid-query/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic-solid-query/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-solid-query/src/vite-env.d.ts b/e2e/solid-router/basic-solid-query/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-solid-query/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-solid-query/tests/app.spec.ts b/e2e/solid-router/basic-solid-query/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/solid-router/basic-solid-query/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/basic-solid-query/tsconfig.json b/e2e/solid-router/basic-solid-query/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basic-solid-query/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-solid-query/vite.config.js b/e2e/solid-router/basic-solid-query/vite.config.js deleted file mode 100644 index fb5faf9236..0000000000 --- a/e2e/solid-router/basic-solid-query/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), solid()], -}) diff --git a/e2e/solid-router/basic-virtual-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/basic-virtual-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-virtual-file-based/.gitignore b/e2e/solid-router/basic-virtual-file-based/.gitignore deleted file mode 100644 index 4d2da67b50..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/basic-virtual-file-based/index.html b/e2e/solid-router/basic-virtual-file-based/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-virtual-file-based/package.json b/e2e/solid-router/basic-virtual-file-based/package.json deleted file mode 100644 index 4f188d9262..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-virtual-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/virtual-file-routes": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic-virtual-file-based/playwright.config.ts b/e2e/solid-router/basic-virtual-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-virtual-file-based/routes.ts b/e2e/solid-router/basic-virtual-file-based/routes.ts deleted file mode 100644 index 6c2c144ec5..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/routes.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - index, - layout, - physical, - rootRoute, - route, -} from '@tanstack/virtual-file-routes' - -export const routes = rootRoute('root.tsx', [ - index('home.tsx'), - route('/posts', 'posts/posts.tsx', [ - index('posts/posts-home.tsx'), - route('$postId', 'posts/posts-detail.tsx'), - ]), - layout('first', 'layout/first-layout.tsx', [ - layout('second', 'layout/second-layout.tsx', [ - route('/layout-a', 'a.tsx'), - route('/layout-b', 'b.tsx'), - ]), - ]), - physical('/classic', 'file-based-subtree'), -]) diff --git a/e2e/solid-router/basic-virtual-file-based/src/main.tsx b/e2e/solid-router/basic-virtual-file-based/src/main.tsx deleted file mode 100644 index 8128384193..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/main.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/posts.tsx b/e2e/solid-router/basic-virtual-file-based/src/posts.tsx deleted file mode 100644 index d5f0ce903d..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts b/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts deleted file mode 100644 index 0aa373b49f..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routeTree.gen.ts +++ /dev/null @@ -1,317 +0,0 @@ -/* 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 homeRouteImport } from './routes/home' -import { Route as layoutFirstLayoutRouteImport } from './routes/layout/first-layout' -import { Route as postsPostsRouteImport } from './routes/posts/posts' -import { Route as layoutSecondLayoutRouteImport } from './routes/layout/second-layout' -import { Route as ClassicHelloRouteRouteImport } from './routes/file-based-subtree/hello/route' -import { Route as postsPostsHomeRouteImport } from './routes/posts/posts-home' -import { Route as postsPostsDetailRouteImport } from './routes/posts/posts-detail' -import { Route as aRouteImport } from './routes/a' -import { Route as bRouteImport } from './routes/b' -import { Route as ClassicHelloIndexRouteImport } from './routes/file-based-subtree/hello/index' -import { Route as ClassicHelloUniverseRouteImport } from './routes/file-based-subtree/hello/universe' -import { Route as ClassicHelloWorldRouteImport } from './routes/file-based-subtree/hello/world' - -const homeRoute = homeRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const layoutFirstLayoutRoute = layoutFirstLayoutRouteImport.update({ - id: '/_first', - getParentRoute: () => rootRouteImport, -} as any) -const postsPostsRoute = postsPostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const layoutSecondLayoutRoute = layoutSecondLayoutRouteImport.update({ - id: '/_second', - getParentRoute: () => layoutFirstLayoutRoute, -} as any) -const ClassicHelloRouteRoute = ClassicHelloRouteRouteImport.update({ - id: '/classic/hello', - path: '/classic/hello', - getParentRoute: () => rootRouteImport, -} as any) -const postsPostsHomeRoute = postsPostsHomeRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => postsPostsRoute, -} as any) -const postsPostsDetailRoute = postsPostsDetailRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => postsPostsRoute, -} as any) -const aRoute = aRouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => layoutSecondLayoutRoute, -} as any) -const bRoute = bRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => layoutSecondLayoutRoute, -} as any) -const ClassicHelloIndexRoute = ClassicHelloIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => ClassicHelloRouteRoute, -} as any) -const ClassicHelloUniverseRoute = ClassicHelloUniverseRouteImport.update({ - id: '/universe', - path: '/universe', - getParentRoute: () => ClassicHelloRouteRoute, -} as any) -const ClassicHelloWorldRoute = ClassicHelloWorldRouteImport.update({ - id: '/world', - path: '/world', - getParentRoute: () => ClassicHelloRouteRoute, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof homeRoute - '/posts': typeof postsPostsRouteWithChildren - '/classic/hello': typeof ClassicHelloRouteRouteWithChildren - '/posts/': typeof postsPostsHomeRoute - '/posts/$postId': typeof postsPostsDetailRoute - '/layout-a': typeof aRoute - '/layout-b': typeof bRoute - '/classic/hello/universe': typeof ClassicHelloUniverseRoute - '/classic/hello/world': typeof ClassicHelloWorldRoute - '/classic/hello/': typeof ClassicHelloIndexRoute -} -export interface FileRoutesByTo { - '/': typeof homeRoute - '/posts': typeof postsPostsHomeRoute - '/posts/$postId': typeof postsPostsDetailRoute - '/layout-a': typeof aRoute - '/layout-b': typeof bRoute - '/classic/hello/universe': typeof ClassicHelloUniverseRoute - '/classic/hello/world': typeof ClassicHelloWorldRoute - '/classic/hello': typeof ClassicHelloIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof homeRoute - '/_first': typeof layoutFirstLayoutRouteWithChildren - '/posts': typeof postsPostsRouteWithChildren - '/classic/hello': typeof ClassicHelloRouteRouteWithChildren - '/posts/': typeof postsPostsHomeRoute - '/_first/_second': typeof layoutSecondLayoutRouteWithChildren - '/posts/$postId': typeof postsPostsDetailRoute - '/_first/_second/layout-a': typeof aRoute - '/_first/_second/layout-b': typeof bRoute - '/classic/hello/universe': typeof ClassicHelloUniverseRoute - '/classic/hello/world': typeof ClassicHelloWorldRoute - '/classic/hello/': typeof ClassicHelloIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/classic/hello' - | '/posts/' - | '/posts/$postId' - | '/layout-a' - | '/layout-b' - | '/classic/hello/universe' - | '/classic/hello/world' - | '/classic/hello/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/posts' - | '/posts/$postId' - | '/layout-a' - | '/layout-b' - | '/classic/hello/universe' - | '/classic/hello/world' - | '/classic/hello' - id: - | '__root__' - | '/' - | '/_first' - | '/posts' - | '/classic/hello' - | '/posts/' - | '/_first/_second' - | '/posts/$postId' - | '/_first/_second/layout-a' - | '/_first/_second/layout-b' - | '/classic/hello/universe' - | '/classic/hello/world' - | '/classic/hello/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - homeRoute: typeof homeRoute - layoutFirstLayoutRoute: typeof layoutFirstLayoutRouteWithChildren - postsPostsRoute: typeof postsPostsRouteWithChildren - ClassicHelloRouteRoute: typeof ClassicHelloRouteRouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof homeRouteImport - parentRoute: typeof rootRouteImport - } - '/_first': { - id: '/_first' - path: '' - fullPath: '/' - preLoaderRoute: typeof layoutFirstLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof postsPostsRouteImport - parentRoute: typeof rootRouteImport - } - '/_first/_second': { - id: '/_first/_second' - path: '' - fullPath: '/' - preLoaderRoute: typeof layoutSecondLayoutRouteImport - parentRoute: typeof layoutFirstLayoutRoute - } - '/classic/hello': { - id: '/classic/hello' - path: '/classic/hello' - fullPath: '/classic/hello' - preLoaderRoute: typeof ClassicHelloRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof postsPostsHomeRouteImport - parentRoute: typeof postsPostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof postsPostsDetailRouteImport - parentRoute: typeof postsPostsRoute - } - '/_first/_second/layout-a': { - id: '/_first/_second/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof aRouteImport - parentRoute: typeof layoutSecondLayoutRoute - } - '/_first/_second/layout-b': { - id: '/_first/_second/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof bRouteImport - parentRoute: typeof layoutSecondLayoutRoute - } - '/classic/hello/': { - id: '/classic/hello/' - path: '/' - fullPath: '/classic/hello/' - preLoaderRoute: typeof ClassicHelloIndexRouteImport - parentRoute: typeof ClassicHelloRouteRoute - } - '/classic/hello/universe': { - id: '/classic/hello/universe' - path: '/universe' - fullPath: '/classic/hello/universe' - preLoaderRoute: typeof ClassicHelloUniverseRouteImport - parentRoute: typeof ClassicHelloRouteRoute - } - '/classic/hello/world': { - id: '/classic/hello/world' - path: '/world' - fullPath: '/classic/hello/world' - preLoaderRoute: typeof ClassicHelloWorldRouteImport - parentRoute: typeof ClassicHelloRouteRoute - } - } -} - -interface layoutSecondLayoutRouteChildren { - aRoute: typeof aRoute - bRoute: typeof bRoute -} - -const layoutSecondLayoutRouteChildren: layoutSecondLayoutRouteChildren = { - aRoute: aRoute, - bRoute: bRoute, -} - -const layoutSecondLayoutRouteWithChildren = - layoutSecondLayoutRoute._addFileChildren(layoutSecondLayoutRouteChildren) - -interface layoutFirstLayoutRouteChildren { - layoutSecondLayoutRoute: typeof layoutSecondLayoutRouteWithChildren -} - -const layoutFirstLayoutRouteChildren: layoutFirstLayoutRouteChildren = { - layoutSecondLayoutRoute: layoutSecondLayoutRouteWithChildren, -} - -const layoutFirstLayoutRouteWithChildren = - layoutFirstLayoutRoute._addFileChildren(layoutFirstLayoutRouteChildren) - -interface postsPostsRouteChildren { - postsPostsHomeRoute: typeof postsPostsHomeRoute - postsPostsDetailRoute: typeof postsPostsDetailRoute -} - -const postsPostsRouteChildren: postsPostsRouteChildren = { - postsPostsHomeRoute: postsPostsHomeRoute, - postsPostsDetailRoute: postsPostsDetailRoute, -} - -const postsPostsRouteWithChildren = postsPostsRoute._addFileChildren( - postsPostsRouteChildren, -) - -interface ClassicHelloRouteRouteChildren { - ClassicHelloUniverseRoute: typeof ClassicHelloUniverseRoute - ClassicHelloWorldRoute: typeof ClassicHelloWorldRoute - ClassicHelloIndexRoute: typeof ClassicHelloIndexRoute -} - -const ClassicHelloRouteRouteChildren: ClassicHelloRouteRouteChildren = { - ClassicHelloUniverseRoute: ClassicHelloUniverseRoute, - ClassicHelloWorldRoute: ClassicHelloWorldRoute, - ClassicHelloIndexRoute: ClassicHelloIndexRoute, -} - -const ClassicHelloRouteRouteWithChildren = - ClassicHelloRouteRoute._addFileChildren(ClassicHelloRouteRouteChildren) - -const rootRouteChildren: RootRouteChildren = { - homeRoute: homeRoute, - layoutFirstLayoutRoute: layoutFirstLayoutRouteWithChildren, - postsPostsRoute: postsPostsRouteWithChildren, - ClassicHelloRouteRoute: ClassicHelloRouteRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/a.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/a.tsx deleted file mode 100644 index be88a87cbe..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_first/_second/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/b.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/b.tsx deleted file mode 100644 index c26087837b..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_first/_second/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx deleted file mode 100644 index 6cc8bb1a6f..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/')({ - component: () =>
This is the index
, -}) diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx deleted file mode 100644 index f4f30d8425..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/route.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/classic/hello')({ - component: () => ( -
- Hello! -
{' '} - - say hello to the universe - {' '} - - say hello to the world - - -
- ), -}) diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx deleted file mode 100644 index f250de10c1..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/universe.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/universe')({ - component: () =>
Hello /classic/hello/universe!
, -}) diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx deleted file mode 100644 index d207a49114..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/file-based-subtree/hello/world.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/world')({ - component: () =>
Hello /classic/hello/world!
, -}) diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/home.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/home.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/home.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx deleted file mode 100644 index 5c77421bb2..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/layout/first-layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_first')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx deleted file mode 100644 index 9ab147de5e..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/layout/second-layout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_first/_second')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx deleted file mode 100644 index 990f473ae8..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-detail.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' -import { fetchPost } from '../../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx deleted file mode 100644 index 812b581e0a..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts-home.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts.tsx deleted file mode 100644 index 9ae6dfc747..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/posts/posts.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { fetchPosts } from '../../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/routes/root.tsx b/e2e/solid-router/basic-virtual-file-based/src/routes/root.tsx deleted file mode 100644 index 8f32c2f877..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/routes/root.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Subtree - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/styles.css b/e2e/solid-router/basic-virtual-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-virtual-file-based/src/vite-env.d.ts b/e2e/solid-router/basic-virtual-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-virtual-file-based/tests/app.spec.ts b/e2e/solid-router/basic-virtual-file-based/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/basic-virtual-file-based/tsconfig.json b/e2e/solid-router/basic-virtual-file-based/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-virtual-file-based/vite.config.ts b/e2e/solid-router/basic-virtual-file-based/vite.config.ts deleted file mode 100644 index 62bb160684..0000000000 --- a/e2e/solid-router/basic-virtual-file-based/vite.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import { routes } from './routes' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'solid', - autoCodeSplitting: true, - virtualRouteConfig: routes, - }), - solid(), - ], -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/.gitignore b/e2e/solid-router/basic-virtual-named-export-config-file-based/.gitignore deleted file mode 100644 index 47bb41d43a..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/.gitignore +++ /dev/null @@ -1,13 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ - -src/routeTree.gen.ts \ No newline at end of file diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/index.html b/e2e/solid-router/basic-virtual-named-export-config-file-based/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/package.json b/e2e/solid-router/basic-virtual-named-export-config-file-based/package.json deleted file mode 100644 index 7a29e6576a..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic-virtual-named-export-config-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/virtual-file-routes": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/playwright.config.ts b/e2e/solid-router/basic-virtual-named-export-config-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/routes.ts b/e2e/solid-router/basic-virtual-named-export-config-file-based/routes.ts deleted file mode 100644 index 6c2c144ec5..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/routes.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - index, - layout, - physical, - rootRoute, - route, -} from '@tanstack/virtual-file-routes' - -export const routes = rootRoute('root.tsx', [ - index('home.tsx'), - route('/posts', 'posts/posts.tsx', [ - index('posts/posts-home.tsx'), - route('$postId', 'posts/posts-detail.tsx'), - ]), - layout('first', 'layout/first-layout.tsx', [ - layout('second', 'layout/second-layout.tsx', [ - route('/layout-a', 'a.tsx'), - route('/layout-b', 'b.tsx'), - ]), - ]), - physical('/classic', 'file-based-subtree'), -]) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/main.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/main.tsx deleted file mode 100644 index 8128384193..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/main.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { render } from 'solid-js/web' -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/posts.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/posts.tsx deleted file mode 100644 index d5f0ce903d..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx deleted file mode 100644 index be88a87cbe..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_first/_second/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx deleted file mode 100644 index c26087837b..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_first/_second/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx deleted file mode 100644 index 6cc8bb1a6f..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/')({ - component: () =>
This is the index
, -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx deleted file mode 100644 index f4f30d8425..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/classic/hello')({ - component: () => ( -
- Hello! -
{' '} - - say hello to the universe - {' '} - - say hello to the world - - -
- ), -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx deleted file mode 100644 index f250de10c1..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/universe')({ - component: () =>
Hello /classic/hello/universe!
, -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx deleted file mode 100644 index d207a49114..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/world')({ - component: () =>
Hello /classic/hello/world!
, -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/home.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx deleted file mode 100644 index 5c77421bb2..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_first')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx deleted file mode 100644 index 9ab147de5e..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_first/_second')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx deleted file mode 100644 index 990f473ae8..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' -import { fetchPost } from '../../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx deleted file mode 100644 index 812b581e0a..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx deleted file mode 100644 index 9ae6dfc747..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { fetchPosts } from '../../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx deleted file mode 100644 index 8f32c2f877..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/routes/root.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Subtree - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/styles.css b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/styles.css deleted file mode 100644 index 0bd1287c82..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss' source('../'); - -@source './**/*.{js,jsx,ts,tsx}'; - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/vite-env.d.ts b/e2e/solid-router/basic-virtual-named-export-config-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts b/e2e/solid-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts deleted file mode 100644 index fbf093cd51..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/tsconfig.json b/e2e/solid-router/basic-virtual-named-export-config-file-based/tsconfig.json deleted file mode 100644 index 9ca79abe0a..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "skipLibCheck": true, - "resolveJsonModule": true, - "allowJs": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic-virtual-named-export-config-file-based/vite.config.ts b/e2e/solid-router/basic-virtual-named-export-config-file-based/vite.config.ts deleted file mode 100644 index ec379c254d..0000000000 --- a/e2e/solid-router/basic-virtual-named-export-config-file-based/vite.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'solid', - autoCodeSplitting: true, - virtualRouteConfig: './routes.ts', - }), - solid(), - ], -}) diff --git a/e2e/solid-router/basic/.devcontainer/devcontainer.json b/e2e/solid-router/basic/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/basic/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/basic/.gitignore b/e2e/solid-router/basic/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/solid-router/basic/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/solid-router/basic/index.html b/e2e/solid-router/basic/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/basic/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/basic/package.json b/e2e/solid-router/basic/package.json deleted file mode 100644 index 29f10e19ff..0000000000 --- a/e2e/solid-router/basic/package.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-basic", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-router/basic/playwright.config.ts b/e2e/solid-router/basic/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/basic/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/basic/src/main.tsx b/e2e/solid-router/basic/src/main.tsx deleted file mode 100644 index 9604bca3cd..0000000000 --- a/e2e/solid-router/basic/src/main.tsx +++ /dev/null @@ -1,458 +0,0 @@ -import { render } from 'solid-js/web' -import { - ErrorComponent, - HeadContent, - Link, - Outlet, - RouterProvider, - createLink, - createRootRoute, - createRoute, - createRouter, - redirect, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' -import { NotFoundError, fetchPost, fetchPosts } from './posts' -import './styles.css' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -const rootRoute = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - const SvgLink = createLink('svg') - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - View Transition - {' '} - - View Transition types - {' '} - - Layout - {' '} - - This Route Does Not Exist - {' '} -
- - Link in SVG - - - - -
-
- - - - ) -} -const indexRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/', - component: IndexComponent, -}) - -function IndexComponent() { - return ( -
-

Welcome Home!

-
- ) -} - -export const postsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: 'posts', - loader: () => fetchPosts(), -}).lazy(() => import('./posts.lazy').then((d) => d.Route)) - -const postsIndexRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '/', - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} - -function PostErrorComponent({ error }: ErrorComponentProps) { - if (error instanceof NotFoundError) { - return
{error.message}
- } - - return -} - -const postRoute = createRoute({ - getParentRoute: () => postsRoute, - path: '$postId', - errorComponent: PostErrorComponent, - loader: ({ params }) => fetchPost(params.postId), - component: PostComponent, -}) - -function PostComponent() { - const post = postRoute.useLoaderData() - - return ( -
-

{post().title}

-
-
{post().body}
-
- ) -} - -const layoutRoute = createRoute({ - getParentRoute: () => rootRoute, - id: '_layout', - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} - -const layout2Route = createRoute({ - getParentRoute: () => layoutRoute, - id: '_layout-2', - component: Layout2Component, -}) - -function Layout2Component() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} - -const layoutARoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-a', - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} - -const layoutBRoute = createRoute({ - getParentRoute: () => layout2Route, - path: '/layout-b', - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} - -const paramsPsRoute = createRoute({ - getParentRoute: () => rootRoute, - path: '/params-ps', -}) - -const paramsPsIndexRoute = createRoute({ - getParentRoute: () => paramsPsRoute, - path: '/', - component: function ParamsIndex() { - return ( -
-

Named path params

-
    -
  • - - /params-ps/named/$foo - -
  • -
  • - - /params-ps/named/{'prefix{$foo}'} - -
  • -
  • - - /params-ps/named/{'{$foo}suffix'} - -
  • -
-
-

Wildcard path params

-
    -
  • - - /params-ps/wildcard/$ - -
  • -
  • - - /params-ps/wildcard/{'prefix{$}'} - -
  • -
  • - - /params-ps/wildcard/{'{$}suffix'} - -
  • -
-
- ) - }, -}) - -const paramsPsNamedRoute = createRoute({ - getParentRoute: () => paramsPsRoute, - path: '/named', -}) - -const paramsPsNamedIndexRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/', - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) - -const paramsPsNamedFooRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/$foo', - component: function ParamsNamedFoo() { - const p = paramsPsNamedFooRoute.useParams() - return ( -
-

ParamsNamedFoo

-
{JSON.stringify(p())}
-
- ) - }, -}) - -const paramsPsNamedFooPrefixRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/prefix{$foo}', - component: function ParamsNamedFooMarkdown() { - const p = paramsPsNamedFooPrefixRoute.useParams() - return ( -
-

ParamsNamedFooPrefix

-
{JSON.stringify(p())}
-
- ) - }, -}) - -const paramsPsNamedFooSuffixRoute = createRoute({ - getParentRoute: () => paramsPsNamedRoute, - path: '/{$foo}suffix', - component: function ParamsNamedFooSuffix() { - const p = paramsPsNamedFooSuffixRoute.useParams() - return ( -
-

ParamsNamedFooSuffix

-
{JSON.stringify(p())}
-
- ) - }, -}) - -const paramsPsWildcardRoute = createRoute({ - getParentRoute: () => paramsPsRoute, - path: '/wildcard', -}) - -const paramsPsWildcardIndexRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: '/', - beforeLoad: () => { - throw redirect({ to: '/params-ps' }) - }, -}) - -const paramsPsWildcardSplatRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: '$', - component: function ParamsWildcardSplat() { - const p = paramsPsWildcardSplatRoute.useParams() - return ( -
-

ParamsWildcardSplat

-
{JSON.stringify(p())}
-
- ) - }, -}) - -const paramsPsWildcardSplatPrefixRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: 'prefix{$}', - component: function ParamsWildcardSplatPrefix() { - const p = paramsPsWildcardSplatPrefixRoute.useParams() - return ( -
-

ParamsWildcardSplatPrefix

-
{JSON.stringify(p())}
-
- ) - }, -}) - -const paramsPsWildcardSplatSuffixRoute = createRoute({ - getParentRoute: () => paramsPsWildcardRoute, - path: '{$}suffix', - component: function ParamsWildcardSplatSuffix() { - const p = paramsPsWildcardSplatSuffixRoute.useParams() - return ( -
-

ParamsWildcardSplatSuffix

-
{JSON.stringify(p())}
-
- ) - }, -}) - -const routeTree = rootRoute.addChildren([ - postsRoute.addChildren([postRoute, postsIndexRoute]), - layoutRoute.addChildren([ - layout2Route.addChildren([layoutARoute, layoutBRoute]), - ]), - paramsPsRoute.addChildren([ - paramsPsNamedRoute.addChildren([ - paramsPsNamedFooPrefixRoute, - paramsPsNamedFooSuffixRoute, - paramsPsNamedFooRoute, - paramsPsNamedIndexRoute, - ]), - paramsPsWildcardRoute.addChildren([ - paramsPsWildcardSplatRoute, - paramsPsWildcardSplatPrefixRoute, - paramsPsWildcardSplatSuffixRoute, - paramsPsWildcardIndexRoute, - ]), - paramsPsIndexRoute, - ]), - indexRoute, -]) - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/basic/src/posts.lazy.tsx b/e2e/solid-router/basic/src/posts.lazy.tsx deleted file mode 100644 index 5277a5979a..0000000000 --- a/e2e/solid-router/basic/src/posts.lazy.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Link, Outlet, createLazyRoute } from '@tanstack/solid-router' - -export const Route = createLazyRoute('/posts')({ - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
- -
- ) -} diff --git a/e2e/solid-router/basic/src/posts.ts b/e2e/solid-router/basic/src/posts.ts deleted file mode 100644 index f72d16fee3..0000000000 --- a/e2e/solid-router/basic/src/posts.ts +++ /dev/null @@ -1,32 +0,0 @@ -import axios from 'redaxios' - -export class NotFoundError extends Error {} - -type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} diff --git a/e2e/solid-router/basic/src/styles.css b/e2e/solid-router/basic/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/basic/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/basic/src/vite-env.d.ts b/e2e/solid-router/basic/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/basic/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/basic/tests/app.spec.ts b/e2e/solid-router/basic/tests/app.spec.ts deleted file mode 100644 index 9c0a6b6901..0000000000 --- a/e2e/solid-router/basic/tests/app.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a layout") - await expect(page.locator('#app')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Navigating to a post page with viewTransition', async ({ page }) => { - await page.getByRole('link', { name: 'View Transition', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating to a post page with viewTransition types', async ({ - page, -}) => { - await page.getByRole('link', { name: 'View Transition types' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Link in SVG does not trigger a full page reload', async ({ page }) => { - let fullPageLoad = false - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - - await page.getByRole('link', { name: 'Open posts from SVG' }).click() - const url = `http://localhost:${PORT}/posts` - await page.waitForURL(url) - - expect(fullPageLoad).toBeFalsy() -}) diff --git a/e2e/solid-router/basic/tests/params.spec.ts b/e2e/solid-router/basic/tests/params.spec.ts deleted file mode 100644 index f673138047..0000000000 --- a/e2e/solid-router/basic/tests/params.spec.ts +++ /dev/null @@ -1,150 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.describe('params operations + prefix/suffix', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/params-ps') - }) - - test.describe('named params', () => { - const NAMED_PARAMS_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-named-foo', - pathname: '/params-ps/named/foo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFoo', - }, - { - id: 'l-to-named-prefixfoo', - pathname: '/params-ps/named/prefixfoo', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooPrefix', - }, - { - id: 'l-to-named-foosuffix', - pathname: '/params-ps/named/foosuffix', - params: { foo: 'foo' }, - destHeadingId: 'ParamsNamedFooSuffix', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - NAMED_PARAMS_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - }) - - test.describe('wildcard param', () => { - const WILDCARD_PARAM_PAIRS = [ - // Test ID | Expected href - { - id: 'l-to-wildcard-foo', - pathname: '/params-ps/wildcard/foo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplat', - }, - { - id: 'l-to-wildcard-prefixfoo', - pathname: '/params-ps/wildcard/prefixfoo', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatPrefix', - }, - { - id: 'l-to-wildcard-foosuffix', - pathname: '/params-ps/wildcard/foosuffix', - params: { '*': 'foo', _splat: 'foo' }, - destHeadingId: 'ParamsWildcardSplatSuffix', - }, - ] satisfies Array<{ - id: string - pathname: string - params: Record - destHeadingId: string - }> - - test.describe('Link', () => { - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`interpolation for testid="${id}" has href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await expect(link).toHaveAttribute('href', pathname) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ id, pathname }) => { - test(`navigation for testid="${id}" succeeds to href="${pathname}"`, async ({ - page, - }) => { - const link = page.getByTestId(id) - await link.click() - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - }) - }) - }) - - WILDCARD_PARAM_PAIRS.forEach(({ pathname, params, destHeadingId }) => { - test(`on first-load to "${pathname}" has correct params`, async ({ - page, - }) => { - await page.goto(pathname) - await page.waitForLoadState('networkidle') - const pagePathname = new URL(page.url()).pathname - expect(pagePathname).toBe(pathname) - - const headingEl = page.getByRole('heading', { name: destHeadingId }) - await expect(headingEl).toBeVisible() - - const paramsEl = page.getByTestId('params-output') - const paramsText = await paramsEl.innerText() - const paramsObj = JSON.parse(paramsText) - expect(paramsObj).toEqual(params) - }) - }) - }) -}) diff --git a/e2e/solid-router/basic/tsconfig.json b/e2e/solid-router/basic/tsconfig.json deleted file mode 100644 index 44cb3c81d1..0000000000 --- a/e2e/solid-router/basic/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/basic/vite.config.js b/e2e/solid-router/basic/vite.config.js deleted file mode 100644 index fb5faf9236..0000000000 --- a/e2e/solid-router/basic/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), solid()], -}) diff --git a/e2e/solid-router/generator-cli-only/.devcontainer/devcontainer.json b/e2e/solid-router/generator-cli-only/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/generator-cli-only/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/generator-cli-only/.gitignore b/e2e/solid-router/generator-cli-only/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/solid-router/generator-cli-only/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/solid-router/generator-cli-only/index.html b/e2e/solid-router/generator-cli-only/index.html deleted file mode 100644 index 9b6335c0ac..0000000000 --- a/e2e/solid-router/generator-cli-only/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/solid-router/generator-cli-only/package.json b/e2e/solid-router/generator-cli-only/package.json deleted file mode 100644 index 55fd448971..0000000000 --- a/e2e/solid-router/generator-cli-only/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-generator-cli-only", - "private": true, - "type": "module", - "scripts": { - "dev": "tsr generate && vite --port 3000", - "dev:e2e": "tsr generate && vite", - "build": "tsr generate && vite build && tsc --noEmit", - "preview": "vite preview", - "start": "tsr generate && vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/router-cli": "workspace:^", - "solid-js": "^1.9.10", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite-plugin-solid": "^2.11.11", - "vite": "^8.0.14" - } -} diff --git a/e2e/solid-router/generator-cli-only/playwright.config.ts b/e2e/solid-router/generator-cli-only/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/generator-cli-only/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/generator-cli-only/src/main.tsx b/e2e/solid-router/generator-cli-only/src/main.tsx deleted file mode 100644 index fc12c76570..0000000000 --- a/e2e/solid-router/generator-cli-only/src/main.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { render } from 'solid-js/web' -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/generator-cli-only/src/posts.ts b/e2e/solid-router/generator-cli-only/src/posts.ts deleted file mode 100644 index f72d16fee3..0000000000 --- a/e2e/solid-router/generator-cli-only/src/posts.ts +++ /dev/null @@ -1,32 +0,0 @@ -import axios from 'redaxios' - -export class NotFoundError extends Error {} - -type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} diff --git a/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts b/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts deleted file mode 100644 index c0f9fbabe4..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routeTree.gen.ts +++ /dev/null @@ -1,230 +0,0 @@ -/* 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 PathlessLayoutRouteImport } from './routes/_pathlessLayout' -import { Route as PostsRouteRouteImport } from './routes/posts.route' -import { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a' -import { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const PathlessLayoutRoute = PathlessLayoutRouteImport.update({ - id: '/_pathlessLayout', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const PathlessLayoutNestedLayoutRoute = - PathlessLayoutNestedLayoutRouteImport.update({ - id: '/_nested-layout', - getParentRoute: () => PathlessLayoutRoute, - } as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRouteRoute, -} as any) -const PathlessLayoutNestedLayoutRouteARoute = - PathlessLayoutNestedLayoutRouteARouteImport.update({ - id: '/route-a', - path: '/route-a', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - } as any) -const PathlessLayoutNestedLayoutRouteBRoute = - PathlessLayoutNestedLayoutRouteBRouteImport.update({ - id: '/route-b', - path: '/route-b', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - } as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/posts': typeof PostsRouteRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute - '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/posts/$postId': typeof PostsPostIdRoute - '/posts': typeof PostsIndexRoute - '/route-a': typeof PathlessLayoutNestedLayoutRouteARoute - '/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/posts': typeof PostsRouteRouteWithChildren - '/_pathlessLayout': typeof PathlessLayoutRouteWithChildren - '/_pathlessLayout/_nested-layout': typeof PathlessLayoutNestedLayoutRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/posts/': typeof PostsIndexRoute - '/_pathlessLayout/_nested-layout/route-a': typeof PathlessLayoutNestedLayoutRouteARoute - '/_pathlessLayout/_nested-layout/route-b': typeof PathlessLayoutNestedLayoutRouteBRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/posts' - | '/posts/$postId' - | '/posts/' - | '/route-a' - | '/route-b' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/posts/$postId' | '/posts' | '/route-a' | '/route-b' - id: - | '__root__' - | '/' - | '/posts' - | '/_pathlessLayout' - | '/_pathlessLayout/_nested-layout' - | '/posts/$postId' - | '/posts/' - | '/_pathlessLayout/_nested-layout/route-a' - | '/_pathlessLayout/_nested-layout/route-b' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - PostsRouteRoute: typeof PostsRouteRouteWithChildren - PathlessLayoutRoute: typeof PathlessLayoutRouteWithChildren -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_pathlessLayout': { - id: '/_pathlessLayout' - path: '' - fullPath: '/' - preLoaderRoute: typeof PathlessLayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/_pathlessLayout/_nested-layout': { - id: '/_pathlessLayout/_nested-layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteImport - parentRoute: typeof PathlessLayoutRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRouteRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRouteRoute - } - '/_pathlessLayout/_nested-layout/route-a': { - id: '/_pathlessLayout/_nested-layout/route-a' - path: '/route-a' - fullPath: '/route-a' - preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteARouteImport - parentRoute: typeof PathlessLayoutNestedLayoutRoute - } - '/_pathlessLayout/_nested-layout/route-b': { - id: '/_pathlessLayout/_nested-layout/route-b' - path: '/route-b' - fullPath: '/route-b' - preLoaderRoute: typeof PathlessLayoutNestedLayoutRouteBRouteImport - parentRoute: typeof PathlessLayoutNestedLayoutRoute - } - } -} - -interface PostsRouteRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteRouteChildren: PostsRouteRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -interface PathlessLayoutNestedLayoutRouteChildren { - PathlessLayoutNestedLayoutRouteARoute: typeof PathlessLayoutNestedLayoutRouteARoute - PathlessLayoutNestedLayoutRouteBRoute: typeof PathlessLayoutNestedLayoutRouteBRoute -} - -const PathlessLayoutNestedLayoutRouteChildren: PathlessLayoutNestedLayoutRouteChildren = - { - PathlessLayoutNestedLayoutRouteARoute: - PathlessLayoutNestedLayoutRouteARoute, - PathlessLayoutNestedLayoutRouteBRoute: - PathlessLayoutNestedLayoutRouteBRoute, - } - -const PathlessLayoutNestedLayoutRouteWithChildren = - PathlessLayoutNestedLayoutRoute._addFileChildren( - PathlessLayoutNestedLayoutRouteChildren, - ) - -interface PathlessLayoutRouteChildren { - PathlessLayoutNestedLayoutRoute: typeof PathlessLayoutNestedLayoutRouteWithChildren -} - -const PathlessLayoutRouteChildren: PathlessLayoutRouteChildren = { - PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren, -} - -const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( - PathlessLayoutRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - PostsRouteRoute: PostsRouteRouteWithChildren, - PathlessLayoutRoute: PathlessLayoutRouteWithChildren, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/generator-cli-only/src/routes/__root.tsx b/e2e/solid-router/generator-cli-only/src/routes/__root.tsx deleted file mode 100644 index 67bc9248fa..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/__root.tsx +++ /dev/null @@ -1,61 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Pathless Layout - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout.tsx b/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout.tsx deleted file mode 100644 index b52af5379b..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_pathlessLayout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a pathless layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx b/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx deleted file mode 100644 index f54a42abb4..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_pathlessLayout/_nested-layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested pathless layout
-
- - Go to route A - - - Go to route B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx b/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx deleted file mode 100644 index 6f87493831..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-a.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')( - { - component: LayoutAComponent, - }, -) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx b/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx deleted file mode 100644 index fac72b0da6..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/_pathlessLayout/_nested-layout/route-b.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')( - { - component: LayoutBComponent, - }, -) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/generator-cli-only/src/routes/index.tsx b/e2e/solid-router/generator-cli-only/src/routes/index.tsx deleted file mode 100644 index bdfb4c7676..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/generator-cli-only/src/routes/posts.$postId.tsx b/e2e/solid-router/generator-cli-only/src/routes/posts.$postId.tsx deleted file mode 100644 index 86ac48fcd9..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/generator-cli-only/src/routes/posts.index.tsx b/e2e/solid-router/generator-cli-only/src/routes/posts.index.tsx deleted file mode 100644 index 33d0386c19..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/posts.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/generator-cli-only/src/routes/posts.route.tsx b/e2e/solid-router/generator-cli-only/src/routes/posts.route.tsx deleted file mode 100644 index 4c9cb45373..0000000000 --- a/e2e/solid-router/generator-cli-only/src/routes/posts.route.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsLayoutComponent, -}) - -function PostsLayoutComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/generator-cli-only/src/styles.css b/e2e/solid-router/generator-cli-only/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/generator-cli-only/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/generator-cli-only/src/vite-env.d.ts b/e2e/solid-router/generator-cli-only/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/generator-cli-only/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/generator-cli-only/tests/app.spec.ts b/e2e/solid-router/generator-cli-only/tests/app.spec.ts deleted file mode 100644 index ced5ac9310..0000000000 --- a/e2e/solid-router/generator-cli-only/tests/app.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested pathless layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a pathless layout") - await expect(page.locator('#app')).toContainText( - "I'm a nested pathless layout", - ) - - await page.getByRole('link', { name: 'Go to route A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Go to route B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/generator-cli-only/tsconfig.json b/e2e/solid-router/generator-cli-only/tsconfig.json deleted file mode 100644 index 44cb3c81d1..0000000000 --- a/e2e/solid-router/generator-cli-only/tsconfig.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true, - "types": ["vite/client"] - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/generator-cli-only/tsr.config.json b/e2e/solid-router/generator-cli-only/tsr.config.json deleted file mode 100644 index 570e09bf5a..0000000000 --- a/e2e/solid-router/generator-cli-only/tsr.config.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "routesDirectory": "./src/routes", - "generatedRouteTree": "./src/routeTree.gen.ts", - "target": "solid" -} diff --git a/e2e/solid-router/generator-cli-only/vite.config.js b/e2e/solid-router/generator-cli-only/vite.config.js deleted file mode 100644 index fb5faf9236..0000000000 --- a/e2e/solid-router/generator-cli-only/vite.config.js +++ /dev/null @@ -1,8 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [tailwindcss(), solid()], -}) diff --git a/e2e/solid-router/js-only-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/js-only-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/js-only-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/js-only-file-based/.gitignore b/e2e/solid-router/js-only-file-based/.gitignore deleted file mode 100644 index 218ef7614b..0000000000 --- a/e2e/solid-router/js-only-file-based/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -node_modules -.DS_Store -dist -dist-hash -dist-ssr -*.local - -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ \ No newline at end of file diff --git a/e2e/solid-router/js-only-file-based/index.html b/e2e/solid-router/js-only-file-based/index.html deleted file mode 100644 index 5f9851cdc9..0000000000 --- a/e2e/solid-router/js-only-file-based/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Vite App - - -
- - - diff --git a/e2e/solid-router/js-only-file-based/package.json b/e2e/solid-router/js-only-file-based/package.json deleted file mode 100644 index 3704edb6f9..0000000000 --- a/e2e/solid-router/js-only-file-based/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-js-only-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "solid-js": "^1.9.10", - "redaxios": "catalog:", - "tailwindcss": "^4.2.2" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "vite-plugin-solid": "^2.11.11", - "vite": "^8.0.14" - } -} diff --git a/e2e/solid-router/js-only-file-based/playwright.config.ts b/e2e/solid-router/js-only-file-based/playwright.config.ts deleted file mode 100644 index 0925936d55..0000000000 --- a/e2e/solid-router/js-only-file-based/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/js-only-file-based/src/main.jsx b/e2e/solid-router/js-only-file-based/src/main.jsx deleted file mode 100644 index 0e691e3e3c..0000000000 --- a/e2e/solid-router/js-only-file-based/src/main.jsx +++ /dev/null @@ -1,18 +0,0 @@ -import { RouterProvider, createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import { render } from 'solid-js/web' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultStaleTime: 5000, - scrollRestoration: true, -}) - -const rootElement = document.getElementById('app') - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/js-only-file-based/src/posts.js b/e2e/solid-router/js-only-file-based/src/posts.js deleted file mode 100644 index 36c1c281f6..0000000000 --- a/e2e/solid-router/js-only-file-based/src/posts.js +++ /dev/null @@ -1,23 +0,0 @@ -import axios from 'redaxios' - -export class NotFoundError extends Error {} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios.get(`${queryURL}/posts`).then((r) => r.data.slice(0, 10)) -} - -export const fetchPost = async (postId) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - - if (!post) { - throw new NotFoundError(`Post with id "${postId}" not found!`) - } - - return post -} diff --git a/e2e/solid-router/js-only-file-based/src/routeTree.gen.js b/e2e/solid-router/js-only-file-based/src/routeTree.gen.js deleted file mode 100644 index 80683abb30..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routeTree.gen.js +++ /dev/null @@ -1,95 +0,0 @@ -/* 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 PathlessLayoutRouteImport } from './routes/_pathlessLayout' -import { Route as PostsRouteRouteImport } from './routes/posts.route' -import { Route as PathlessLayoutNestedLayoutRouteImport } from './routes/_pathlessLayout/_nested-layout' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as PathlessLayoutNestedLayoutRouteARouteImport } from './routes/_pathlessLayout/_nested-layout/route-a' -import { Route as PathlessLayoutNestedLayoutRouteBRouteImport } from './routes/_pathlessLayout/_nested-layout/route-b' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -}) -const PathlessLayoutRoute = PathlessLayoutRouteImport.update({ - id: '/_pathlessLayout', - getParentRoute: () => rootRouteImport, -}) -const PostsRouteRoute = PostsRouteRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -}) -const PathlessLayoutNestedLayoutRoute = - PathlessLayoutNestedLayoutRouteImport.update({ - id: '/_nested-layout', - getParentRoute: () => PathlessLayoutRoute, - }) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRouteRoute, -}) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRouteRoute, -}) -const PathlessLayoutNestedLayoutRouteARoute = - PathlessLayoutNestedLayoutRouteARouteImport.update({ - id: '/route-a', - path: '/route-a', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - }) -const PathlessLayoutNestedLayoutRouteBRoute = - PathlessLayoutNestedLayoutRouteBRouteImport.update({ - id: '/route-b', - path: '/route-b', - getParentRoute: () => PathlessLayoutNestedLayoutRoute, - }) - -const PostsRouteRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteRouteWithChildren = PostsRouteRoute._addFileChildren( - PostsRouteRouteChildren, -) - -const PathlessLayoutNestedLayoutRouteChildren = { - PathlessLayoutNestedLayoutRouteARoute: PathlessLayoutNestedLayoutRouteARoute, - PathlessLayoutNestedLayoutRouteBRoute: PathlessLayoutNestedLayoutRouteBRoute, -} - -const PathlessLayoutNestedLayoutRouteWithChildren = - PathlessLayoutNestedLayoutRoute._addFileChildren( - PathlessLayoutNestedLayoutRouteChildren, - ) - -const PathlessLayoutRouteChildren = { - PathlessLayoutNestedLayoutRoute: PathlessLayoutNestedLayoutRouteWithChildren, -} - -const PathlessLayoutRouteWithChildren = PathlessLayoutRoute._addFileChildren( - PathlessLayoutRouteChildren, -) - -const rootRouteChildren = { - IndexRoute: IndexRoute, - PostsRouteRoute: PostsRouteRouteWithChildren, - PathlessLayoutRoute: PathlessLayoutRouteWithChildren, -} -export const routeTree = rootRouteImport._addFileChildren(rootRouteChildren) diff --git a/e2e/solid-router/js-only-file-based/src/routes/__root.jsx b/e2e/solid-router/js-only-file-based/src/routes/__root.jsx deleted file mode 100644 index 67bc9248fa..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/__root.jsx +++ /dev/null @@ -1,61 +0,0 @@ -import { Link, Outlet, createRootRoute } from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> -
- - Home - {' '} - - Posts - {' '} - - Pathless Layout - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout.jsx b/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout.jsx deleted file mode 100644 index 7cdec28d8d..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout.jsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_pathlessLayout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a pathless layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx b/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx deleted file mode 100644 index bea54d9af4..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout.jsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_pathlessLayout/_nested-layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested pathless layout
-
- - Go to route A - - - Go to route B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx b/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx deleted file mode 100644 index 16b0aea0c5..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-a.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-a')( - { - component: LayoutAComponent, - }, -) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx b/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx deleted file mode 100644 index 4e592567bb..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/_pathlessLayout/_nested-layout/route-b.jsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_pathlessLayout/_nested-layout/route-b')( - { - component: LayoutBComponent, - }, -) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/js-only-file-based/src/routes/index.jsx b/e2e/solid-router/js-only-file-based/src/routes/index.jsx deleted file mode 100644 index bdfb4c7676..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/index.jsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/js-only-file-based/src/routes/posts.$postId.jsx b/e2e/solid-router/js-only-file-based/src/routes/posts.$postId.jsx deleted file mode 100644 index 26bcb3bb7e..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/posts.$postId.jsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -import { ErrorComponent } from '@tanstack/solid-router' -import { fetchPost } from '../posts' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -export function PostErrorComponent({ error }) { - return -} - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/js-only-file-based/src/routes/posts.index.jsx b/e2e/solid-router/js-only-file-based/src/routes/posts.index.jsx deleted file mode 100644 index 33d0386c19..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/posts.index.jsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/js-only-file-based/src/routes/posts.route.jsx b/e2e/solid-router/js-only-file-based/src/routes/posts.route.jsx deleted file mode 100644 index db486f3835..0000000000 --- a/e2e/solid-router/js-only-file-based/src/routes/posts.route.jsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -import { Link, Outlet } from '@tanstack/solid-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsLayoutComponent, -}) - -function PostsLayoutComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/js-only-file-based/src/styles.css b/e2e/solid-router/js-only-file-based/src/styles.css deleted file mode 100644 index ce24a390c7..0000000000 --- a/e2e/solid-router/js-only-file-based/src/styles.css +++ /dev/null @@ -1,21 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/js-only-file-based/src/vite-env.d.ts b/e2e/solid-router/js-only-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/js-only-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/js-only-file-based/tests/app.spec.ts b/e2e/solid-router/js-only-file-based/tests/app.spec.ts deleted file mode 100644 index ced5ac9310..0000000000 --- a/e2e/solid-router/js-only-file-based/tests/app.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts', exact: true }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested pathless layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Pathless Layout', exact: true }).click() - - await expect(page.locator('#app')).toContainText("I'm a pathless layout") - await expect(page.locator('#app')).toContainText( - "I'm a nested pathless layout", - ) - - await page.getByRole('link', { name: 'Go to route A' }).click() - await expect(page.locator('#app')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Go to route B' }).click() - await expect(page.locator('#app')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/js-only-file-based/tsconfig.json b/e2e/solid-router/js-only-file-based/tsconfig.json deleted file mode 100644 index e011e786b5..0000000000 --- a/e2e/solid-router/js-only-file-based/tsconfig.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "target": "ESNext", - "moduleResolution": "Bundler", - "module": "ESNext", - "resolveJsonModule": true, - "allowJs": true, - "skipLibCheck": true - }, - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/js-only-file-based/vite.config.js b/e2e/solid-router/js-only-file-based/vite.config.js deleted file mode 100644 index ee3b365449..0000000000 --- a/e2e/solid-router/js-only-file-based/vite.config.js +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'vite' -import solid from 'vite-plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/vite' -import tailwindcss from '@tailwindcss/vite' - -// https://vitejs.dev/config/ -export default defineConfig({ - plugins: [ - tailwindcss(), - tanstackRouter({ - target: 'solid', - disableTypes: true, - }), - solid(), - ], -}) diff --git a/e2e/solid-router/rspack-basic-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/rspack-basic-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/rspack-basic-file-based/.gitignore b/e2e/solid-router/rspack-basic-file-based/.gitignore deleted file mode 100644 index e826cc86e8..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# Local -.DS_Store -*.local -*.log* - -# Dist -node_modules -dist/ -dist-hash/ - -# IDE -.vscode/* -!.vscode/extensions.json -.idea - -# E2E -src/routeTree.gen.ts -test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/rspack-basic-file-based/README.md b/e2e/solid-router/rspack-basic-file-based/README.md deleted file mode 100644 index 93f18812e1..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Example - -To run this example: - -- `pnpm install` -- `pnpm dev` diff --git a/e2e/solid-router/rspack-basic-file-based/package.json b/e2e/solid-router/rspack-basic-file-based/package.json deleted file mode 100644 index 4015f0f606..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-rspack-basic-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "rsbuild dev --port 3000", - "build": "rsbuild build && tsc --noEmit", - "preview": "rsbuild preview", - "start": "rsbuild preview", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-babel": "^1.1.2", - "@rsbuild/plugin-solid": "^1.1.1", - "@tailwindcss/postcss": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "postcss": "^8.5.1", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2" - } -} diff --git a/e2e/solid-router/rspack-basic-file-based/playwright.config.ts b/e2e/solid-router/rspack-basic-file-based/playwright.config.ts deleted file mode 100644 index 4eead86444..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/rspack-basic-file-based/postcss.config.mjs b/e2e/solid-router/rspack-basic-file-based/postcss.config.mjs deleted file mode 100644 index a7f73a2d1d..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export default { - plugins: { - '@tailwindcss/postcss': {}, - }, -} diff --git a/e2e/solid-router/rspack-basic-file-based/rsbuild.config.ts b/e2e/solid-router/rspack-basic-file-based/rsbuild.config.ts deleted file mode 100644 index 27be8f1dfa..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/rsbuild.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginSolid } from '@rsbuild/plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/rspack' -import { pluginBabel } from '@rsbuild/plugin-babel' - -export default defineConfig({ - plugins: [ - pluginBabel({ - include: /\.(?:jsx|tsx)$/, - }), - pluginSolid(), - ], - tools: { - rspack: { - plugins: [tanstackRouter({ target: 'solid', autoCodeSplitting: true })], - }, - }, -}) diff --git a/e2e/solid-router/rspack-basic-file-based/src/app.tsx b/e2e/solid-router/rspack-basic-file-based/src/app.tsx deleted file mode 100644 index 0981f90396..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/app.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { RouterProvider, createRouter } from '@tanstack/solid-router' - -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} -const App = () => { - return -} - -export default App diff --git a/e2e/solid-router/rspack-basic-file-based/src/env.d.ts b/e2e/solid-router/rspack-basic-file-based/src/env.d.ts deleted file mode 100644 index b0ac762b09..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/rspack-basic-file-based/src/index.tsx b/e2e/solid-router/rspack-basic-file-based/src/index.tsx deleted file mode 100644 index 3403ff7cbf..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { render } from 'solid-js/web' -import App from './app' - -const rootEl = document.getElementById('root') - -if (rootEl) { - render(() => , rootEl) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/posts.tsx b/e2e/solid-router/rspack-basic-file-based/src/posts.tsx deleted file mode 100644 index d5f0ce903d..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/__root.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/__root.tsx deleted file mode 100644 index 9b44d4fba4..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/__root.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/_layout.tsx deleted file mode 100644 index 5525c0c297..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 000a19e988..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index 997e6caf80..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 70135c5809..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/index.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/index.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/index.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/posts.$postId.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/posts.$postId.tsx deleted file mode 100644 index 7a74c9adec..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ErrorComponent } from '@tanstack/solid-router' -import { fetchPost } from '../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/posts.index.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/posts.index.tsx deleted file mode 100644 index 812b581e0a..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/posts.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/rspack-basic-file-based/src/routes/posts.tsx b/e2e/solid-router/rspack-basic-file-based/src/routes/posts.tsx deleted file mode 100644 index 86fb7a1841..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/routes/posts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' -import { fetchPosts } from '../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/styles.css b/e2e/solid-router/rspack-basic-file-based/src/styles.css deleted file mode 100644 index 0bd1287c82..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss' source('../'); - -@source './**/*.{js,jsx,ts,tsx}'; - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/rspack-basic-file-based/src/vite-env.d.ts b/e2e/solid-router/rspack-basic-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/rspack-basic-file-based/tests/app.spec.ts b/e2e/solid-router/rspack-basic-file-based/tests/app.spec.ts deleted file mode 100644 index d230263bfe..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#root')).toContainText("I'm a layout") - await expect(page.locator('#root')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#root')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#root')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/rspack-basic-file-based/tsconfig.json b/e2e/solid-router/rspack-basic-file-based/tsconfig.json deleted file mode 100644 index a023bcef57..0000000000 --- a/e2e/solid-router/rspack-basic-file-based/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "module": "ESNext", - "jsx": "preserve", - "jsxImportSource": "solid-js", - "strict": true, - "skipLibCheck": true, - "isolatedModules": true, - "resolveJsonModule": true, - "useDefineForClassFields": true, - "allowJs": true - }, - "include": ["src", "tests"], - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.gitignore b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.gitignore deleted file mode 100644 index e826cc86e8..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -# Local -.DS_Store -*.local -*.log* - -# Dist -node_modules -dist/ -dist-hash/ - -# IDE -.vscode/* -!.vscode/extensions.json -.idea - -# E2E -src/routeTree.gen.ts -test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/README.md b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/README.md deleted file mode 100644 index 93f18812e1..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# Example - -To run this example: - -- `pnpm install` -- `pnpm dev` diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json deleted file mode 100644 index 3772d7beb1..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-rspack-basic-virtual-named-export-config-file-based", - "private": true, - "type": "module", - "scripts": { - "dev": "rsbuild dev --port 3000", - "build": "rsbuild build && tsc --noEmit", - "preview": "rsbuild preview", - "start": "rsbuild preview", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-babel": "^1.1.2", - "@rsbuild/plugin-solid": "^1.1.1", - "@tailwindcss/postcss": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/virtual-file-routes": "workspace:^", - "postcss": "^8.5.1", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2" - } -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts deleted file mode 100644 index 1c1d021f2f..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/playwright.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && pnpm start --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs deleted file mode 100644 index a7f73a2d1d..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export default { - plugins: { - '@tailwindcss/postcss': {}, - }, -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/routes.ts b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/routes.ts deleted file mode 100644 index 6c2c144ec5..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/routes.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { - index, - layout, - physical, - rootRoute, - route, -} from '@tanstack/virtual-file-routes' - -export const routes = rootRoute('root.tsx', [ - index('home.tsx'), - route('/posts', 'posts/posts.tsx', [ - index('posts/posts-home.tsx'), - route('$postId', 'posts/posts-detail.tsx'), - ]), - layout('first', 'layout/first-layout.tsx', [ - layout('second', 'layout/second-layout.tsx', [ - route('/layout-a', 'a.tsx'), - route('/layout-b', 'b.tsx'), - ]), - ]), - physical('/classic', 'file-based-subtree'), -]) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts deleted file mode 100644 index 956d9edb08..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/rsbuild.config.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginSolid } from '@rsbuild/plugin-solid' -import { tanstackRouter } from '@tanstack/router-plugin/rspack' -import { pluginBabel } from '@rsbuild/plugin-babel' - -export default defineConfig({ - plugins: [ - pluginBabel({ - include: /\.(?:jsx|tsx)$/, - }), - pluginSolid(), - ], - tools: { - rspack: { - plugins: [ - tanstackRouter({ - target: 'solid', - autoCodeSplitting: true, - virtualRouteConfig: './routes.ts', - }), - ], - }, - }, -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx deleted file mode 100644 index 0981f90396..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/app.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { RouterProvider, createRouter } from '@tanstack/solid-router' - -import { routeTree } from './routeTree.gen' -import './styles.css' - -// Set up a Router instance -const router = createRouter({ - routeTree, - defaultPreload: 'intent', - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} -const App = () => { - return -} - -export default App diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts deleted file mode 100644 index b0ac762b09..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx deleted file mode 100644 index 3403ff7cbf..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { render } from 'solid-js/web' -import App from './app' - -const rootEl = document.getElementById('root') - -if (rootEl) { - render(() => , rootEl) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx deleted file mode 100644 index d5f0ce903d..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/posts.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx deleted file mode 100644 index be88a87cbe..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_first/_second/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx deleted file mode 100644 index c26087837b..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_first/_second/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx deleted file mode 100644 index 6cc8bb1a6f..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/index.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/')({ - component: () =>
This is the index
, -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx deleted file mode 100644 index 3808e5346d..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/route.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/classic/hello')({ - component: () => ( -
- Hello! -
{' '} - - say hello to the universe - {' '} - - say hello to the world - - -
- ), -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx deleted file mode 100644 index f250de10c1..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/universe.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/universe')({ - component: () =>
Hello /classic/hello/universe!
, -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx deleted file mode 100644 index d207a49114..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/file-based-subtree/hello/world.tsx +++ /dev/null @@ -1,4 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/classic/hello/world')({ - component: () =>
Hello /classic/hello/world!
, -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx deleted file mode 100644 index 3f905db60c..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/home.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!

-
- ) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx deleted file mode 100644 index 79135e7727..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/first-layout.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_first')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx deleted file mode 100644 index 8d843581a0..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/layout/second-layout.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_first/_second')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx deleted file mode 100644 index 05383bbade..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-detail.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ErrorComponent } from '@tanstack/solid-router' -import { fetchPost } from '../../posts' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost(postId), - errorComponent: PostErrorComponent as any, - notFoundComponent: () => { - return

Post not found

- }, - component: PostComponent, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx deleted file mode 100644 index 812b581e0a..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts-home.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx deleted file mode 100644 index 228fab45f1..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/posts/posts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Link, Outlet } from '@tanstack/solid-router' -import { fetchPosts } from '../../posts' - -export const Route = createFileRoute('/posts')({ - loader: fetchPosts, - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - {[...posts(), { id: 'i-do-not-exist', title: 'Non-existent Post' }].map( - (post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }, - )} -
-
- -
- ) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx deleted file mode 100644 index 8f32c2f877..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/routes/root.tsx +++ /dev/null @@ -1,75 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, - notFoundComponent: () => { - return ( -
-

This is the notFoundComponent configured on root route

- Start Over -
- ) - }, -}) - -function RootComponent() { - return ( - <> - -
- - Home - {' '} - - Posts - {' '} - - Layout - {' '} - - Subtree - {' '} - - This Route Does Not Exist - -
-
- - {/* Start rendering router matches */} - - - ) -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css deleted file mode 100644 index 0bd1287c82..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/styles.css +++ /dev/null @@ -1,23 +0,0 @@ -@import 'tailwindcss' source('../'); - -@source './**/*.{js,jsx,ts,tsx}'; - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -html { - color-scheme: light dark; -} -* { - @apply border-gray-200 dark:border-gray-800; -} -body { - @apply bg-gray-50 text-gray-950 dark:bg-gray-900 dark:text-gray-200; -} diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/vite-env.d.ts b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts deleted file mode 100644 index d230263bfe..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test.beforeEach(async ({ page }) => { - await page.goto('/') -}) - -test('Navigating to a post page', async ({ page }) => { - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('#root')).toContainText("I'm a layout") - await expect(page.locator('#root')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('#root')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('#root')).toContainText("I'm layout B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await expect(page.getByRole('paragraph')).toContainText( - 'This is the notFoundComponent configured on root route', - ) - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) diff --git a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json b/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json deleted file mode 100644 index ce2e856442..0000000000 --- a/e2e/solid-router/rspack-basic-virtual-named-export-config-file-based/tsconfig.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "compilerOptions": { - "target": "ES2020", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "module": "ESNext", - "jsx": "preserve", - "jsxImportSource": "solid-js", - "strict": true, - "skipLibCheck": true, - "isolatedModules": true, - "resolveJsonModule": true, - "useDefineForClassFields": true, - "allowJs": true - }, - "include": ["src", "tests", "./routes.ts"], - "exclude": ["node_modules", "dist"] -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json b/e2e/solid-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/.gitignore b/e2e/solid-router/scroll-restoration-sandbox-vite/.gitignore deleted file mode 100644 index 0a3fb8351b..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -.DS_Store -dist -dist-ssr -dist-hash -*.local -test-results diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/README.md b/e2e/solid-router/scroll-restoration-sandbox-vite/README.md deleted file mode 100644 index 31385a5005..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# Scroll Restoration Testing Sandbox with Vite - -To run this example: - -- `npm install` -- `npm start` - -This sandbox is for testing the scroll restoration behavior. - -## Setup - -- Create your files in `src/routes` directory. -- Make sure you update the arrays in the following files with the expected routes - - `tests/app.spec.ts` > routes array - - `src/routes/__root.tsx` > Nav component, routes array - - `src/routes/index.tsx` > Navigation test suite, routes array diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/index.html b/e2e/solid-router/scroll-restoration-sandbox-vite/index.html deleted file mode 100644 index 21e30f1695..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -
- - - diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/package.json b/e2e/solid-router/scroll-restoration-sandbox-vite/package.json deleted file mode 100644 index cd816f7e09..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/package.json +++ /dev/null @@ -1,42 +0,0 @@ -{ - "name": "tanstack-router-e2e-solid-scroll-restoration-sandbox-vite", - "private": true, - "type": "module", - "scripts": { - "dev": "vite --port 3000", - "dev:hash": "VITE_APP_HISTORY=hash vite --port 3000", - "dev:e2e": "vite", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "vite", - "test:e2e:browser": "VITE_APP_HISTORY=browser playwright test --config=playwright.browser.config.ts --project=chromium", - "test:e2e:hash": "VITE_APP_HISTORY=hash playwright test --config=playwright.hash.config.ts --project=chromium", - "test:e2e": "pnpm run test:e2e:browser && pnpm run test:e2e:hash" - }, - "dependencies": { - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-plugin": "workspace:^", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwindcss": "^4.2.2", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - }, - "nx": { - "targets": { - "test:e2e": { - "outputs": [ - "...", - "{projectRoot}/dist-hash" - ] - } - } - } -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts b/e2e/solid-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts deleted file mode 100644 index e2681daea5..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/playwright.browser.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_APP_HISTORY=browser pnpm build && VITE_APP_HISTORY=browser pnpm preview --port ${PORT}`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts b/e2e/solid-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts deleted file mode 100644 index 445616b9bd..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/playwright.hash.config.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_APP_HISTORY=hash vite build --outDir dist-hash && VITE_APP_HISTORY=hash pnpm preview --port ${PORT} --outDir dist-hash`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/main.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/main.tsx deleted file mode 100644 index 3694995e1f..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/main.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { render } from 'solid-js/web' -import { - RouterProvider, - createHashHistory, - createRouter, -} from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import type { RouterHistory } from '@tanstack/solid-router' -import './styles.css' - -let history: RouterHistory | undefined - -if (import.meta.env.VITE_APP_HISTORY === 'hash') { - history = createHashHistory() -} - -// Set up a Router instance -const router = createRouter({ - routeTree, - history, - scrollRestoration: true, -}) - -// Register things for typesafety -declare module '@tanstack/solid-router' { - interface Register { - router: typeof router - } -} - -const rootElement = document.getElementById('app')! - -if (!rootElement.innerHTML) { - render(() => , rootElement) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/posts.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/posts.tsx deleted file mode 100644 index bc56dff904..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/posts.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import axios from 'redaxios' - -export function sleep(ms: number) { - return new Promise((r) => setTimeout(r, ms)) -} - -export type PostType = { - id: string - title: string - body: string -} - -export class PostNotFoundError extends Error {} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = async (postId: string) => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - if (err.status === 404) { - throw new PostNotFoundError(`Post with id "${postId}" not found!`) - } - throw err - }) - - return post -} - -export const fetchPosts = async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts deleted file mode 100644 index bbd53dbfe6..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routeTree.gen.ts +++ /dev/null @@ -1,181 +0,0 @@ -/* 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 { createFileRoute } from '@tanstack/solid-router' - -import { Route as rootRouteImport } from './routes/__root' -import { Route as IndexRouteImport } from './routes/index' -import { Route as testsLazyPageRouteImport } from './routes/(tests)/lazy-page' -import { Route as testsLazyWithLoaderPageRouteImport } from './routes/(tests)/lazy-with-loader-page' -import { Route as testsNormalPageRouteImport } from './routes/(tests)/normal-page' -import { Route as testsPageWithSearchRouteImport } from './routes/(tests)/page-with-search' - -const testsVirtualPageLazyRouteImport = createFileRoute( - '/(tests)/virtual-page', -)() - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const testsLazyPageRoute = testsLazyPageRouteImport - .update({ - id: '/(tests)/lazy-page', - path: '/lazy-page', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(tests)/lazy-page.lazy').then((d) => d.Route)) -const testsLazyWithLoaderPageRoute = testsLazyWithLoaderPageRouteImport - .update({ - id: '/(tests)/lazy-with-loader-page', - path: '/lazy-with-loader-page', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => - import('./routes/(tests)/lazy-with-loader-page.lazy').then((d) => d.Route), - ) -const testsNormalPageRoute = testsNormalPageRouteImport.update({ - id: '/(tests)/normal-page', - path: '/normal-page', - getParentRoute: () => rootRouteImport, -} as any) -const testsPageWithSearchRoute = testsPageWithSearchRouteImport.update({ - id: '/(tests)/page-with-search', - path: '/page-with-search', - getParentRoute: () => rootRouteImport, -} as any) -const testsVirtualPageLazyRoute = testsVirtualPageLazyRouteImport - .update({ - id: '/(tests)/virtual-page', - path: '/virtual-page', - getParentRoute: () => rootRouteImport, - } as any) - .lazy(() => import('./routes/(tests)/virtual-page.lazy').then((d) => d.Route)) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/lazy-page': typeof testsLazyPageRoute - '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute - '/normal-page': typeof testsNormalPageRoute - '/page-with-search': typeof testsPageWithSearchRoute - '/virtual-page': typeof testsVirtualPageLazyRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/lazy-page': typeof testsLazyPageRoute - '/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute - '/normal-page': typeof testsNormalPageRoute - '/page-with-search': typeof testsPageWithSearchRoute - '/virtual-page': typeof testsVirtualPageLazyRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/(tests)/lazy-page': typeof testsLazyPageRoute - '/(tests)/lazy-with-loader-page': typeof testsLazyWithLoaderPageRoute - '/(tests)/normal-page': typeof testsNormalPageRoute - '/(tests)/page-with-search': typeof testsPageWithSearchRoute - '/(tests)/virtual-page': typeof testsVirtualPageLazyRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/lazy-page' - | '/lazy-with-loader-page' - | '/normal-page' - | '/page-with-search' - | '/virtual-page' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/lazy-page' - | '/lazy-with-loader-page' - | '/normal-page' - | '/page-with-search' - | '/virtual-page' - id: - | '__root__' - | '/' - | '/(tests)/lazy-page' - | '/(tests)/lazy-with-loader-page' - | '/(tests)/normal-page' - | '/(tests)/page-with-search' - | '/(tests)/virtual-page' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - testsLazyPageRoute: typeof testsLazyPageRoute - testsLazyWithLoaderPageRoute: typeof testsLazyWithLoaderPageRoute - testsNormalPageRoute: typeof testsNormalPageRoute - testsPageWithSearchRoute: typeof testsPageWithSearchRoute - testsVirtualPageLazyRoute: typeof testsVirtualPageLazyRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/lazy-page': { - id: '/(tests)/lazy-page' - path: '/lazy-page' - fullPath: '/lazy-page' - preLoaderRoute: typeof testsLazyPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/lazy-with-loader-page': { - id: '/(tests)/lazy-with-loader-page' - path: '/lazy-with-loader-page' - fullPath: '/lazy-with-loader-page' - preLoaderRoute: typeof testsLazyWithLoaderPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/normal-page': { - id: '/(tests)/normal-page' - path: '/normal-page' - fullPath: '/normal-page' - preLoaderRoute: typeof testsNormalPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/page-with-search': { - id: '/(tests)/page-with-search' - path: '/page-with-search' - fullPath: '/page-with-search' - preLoaderRoute: typeof testsPageWithSearchRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/virtual-page': { - id: '/(tests)/virtual-page' - path: '/virtual-page' - fullPath: '/virtual-page' - preLoaderRoute: typeof testsVirtualPageLazyRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - testsLazyPageRoute: testsLazyPageRoute, - testsLazyWithLoaderPageRoute: testsLazyWithLoaderPageRoute, - testsNormalPageRoute: testsNormalPageRoute, - testsPageWithSearchRoute: testsPageWithSearchRoute, - testsVirtualPageLazyRoute: testsVirtualPageLazyRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx deleted file mode 100644 index 2e7b3306d2..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.lazy.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/solid-router' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createLazyFileRoute('/(tests)/lazy-page')({ - component: Component, -}) - -function Component() { - return ( -
-

lazy-page

-
- -
- ) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx deleted file mode 100644 index bec395f32c..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-page.tsx +++ /dev/null @@ -1,2 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/(tests)/lazy-page')({}) diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx deleted file mode 100644 index 2079777df0..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.lazy.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/solid-router' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createLazyFileRoute('/(tests)/lazy-with-loader-page')({ - component: Component, -}) - -function Component() { - return ( -
-

lazy-with-loader-page

-
- -
- ) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx deleted file mode 100644 index 6f2cf280a4..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/lazy-with-loader-page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { sleep } from '../../posts' - -export const Route = createFileRoute('/(tests)/lazy-with-loader-page')({ - loader: async () => { - await sleep(1000) - return { foo: 'bar' } - }, -}) diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx deleted file mode 100644 index 6151049c35..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/normal-page.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/normal-page')({ - component: Component, -}) - -function Component() { - return ( -
-

normal-page

-
- -
- ) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx deleted file mode 100644 index 7a9b3957e8..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/page-with-search.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/page-with-search')({ - validateSearch: z.object({ where: z.string() }), - component: Component, -}) - -function Component() { - return ( -
-

page-with-search

-
- -
- ) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx deleted file mode 100644 index 8c6c8ef353..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/(tests)/virtual-page.lazy.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createLazyFileRoute } from '@tanstack/solid-router' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createLazyFileRoute('/(tests)/virtual-page')({ - component: Component, -}) - -function Component() { - return ( -
-

virtual-page

-
- -
- ) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx deleted file mode 100644 index 0539293f92..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/-components/scroll-block.tsx +++ /dev/null @@ -1,16 +0,0 @@ -export const atTheTopId = 'at-the-top' -export const atTheBottomId = 'at-the-bottom' - -export function ScrollBlock({ number = 100 }: { number?: number }) { - return ( - <> -
- {Array.from({ length: number }).map((_, i) => ( -
{i}
- ))} -
- At the bottom -
- - ) -} diff --git a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx b/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx deleted file mode 100644 index 9f76b37ef9..0000000000 --- a/e2e/solid-router/scroll-restoration-sandbox-vite/src/routes/__root.tsx +++ /dev/null @@ -1,63 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - createRootRoute, - linkOptions, -} from '@tanstack/solid-router' -import { Dynamic } from 'solid-js/web' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - <> - -
- ) -} diff --git a/e2e/solid-start/basic-solid-query/src/routes/posts_.$postId.deep.tsx b/e2e/solid-start/basic-solid-query/src/routes/posts_.$postId.deep.tsx deleted file mode 100644 index 9352a3d086..0000000000 --- a/e2e/solid-start/basic-solid-query/src/routes/posts_.$postId.deep.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { useQuery } from '@tanstack/solid-query' -import { postQueryOptions } from '../utils/posts' -import { PostErrorComponent } from './posts.$postId' - -export const Route = createFileRoute('/posts_/$postId/deep')({ - loader: async ({ params: { postId }, context }) => { - const data = await context.queryClient.ensureQueryData( - postQueryOptions(postId), - ) - - return { - title: data.title, - } - }, - head: ({ loaderData }) => ({ - meta: loaderData ? [{ title: loaderData.title }] : undefined, - }), - errorComponent: PostErrorComponent, - component: PostDeepComponent, -}) - -function PostDeepComponent() { - const params = Route.useParams() - const postQuery = useQuery(() => postQueryOptions(params().postId)) - - return ( -
- - ← All Posts - -

{postQuery.data?.title}

-
{postQuery.data?.body}
-
- ) -} diff --git a/e2e/solid-start/basic-solid-query/src/routes/suspense-transition.tsx b/e2e/solid-start/basic-solid-query/src/routes/suspense-transition.tsx deleted file mode 100644 index 56355f60d8..0000000000 --- a/e2e/solid-start/basic-solid-query/src/routes/suspense-transition.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { queryOptions, useQuery } from '@tanstack/solid-query' -import { Link, createFileRoute } from '@tanstack/solid-router' -import { Suspense } from 'solid-js' - -const doubleQueryOptions = (n: number) => - queryOptions({ - queryKey: ['double', n], - queryFn: async () => { - // Add a delay to make the transition observable - await new Promise((r) => setTimeout(r, 500)) - return n * 2 - }, - placeholderData: (previousData) => previousData, - }) - -export const Route = createFileRoute('/suspense-transition')({ - validateSearch: (search: { n?: number }) => ({ n: search.n ?? 1 }), - component: SuspenseTransitionComponent, - ssr: false, // Disable SSR to avoid suspense issues during initial load -}) - -function SuspenseTransitionComponent() { - return ( -
-

Suspense Transition Test

- -
- ({ n: s.n + 1 })} - > - Increase - -
- - -
- ) -} - -function Result() { - const search = Route.useSearch() - const doubleQuery = useQuery(() => doubleQueryOptions(search().n)) - - return ( -
- {/* This manual Suspense boundary should transition, not immediately show fallback */} - Loading...
} - > -
-
- n: {search().n} -
-
- double: {doubleQuery.data} -
-
- -
- ) -} diff --git a/e2e/solid-start/basic-solid-query/src/routes/transition/count/query.tsx b/e2e/solid-start/basic-solid-query/src/routes/transition/count/query.tsx deleted file mode 100644 index 256b097dd9..0000000000 --- a/e2e/solid-start/basic-solid-query/src/routes/transition/count/query.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { Suspense } from 'solid-js' -import { queryOptions, useQuery } from '@tanstack/solid-query' -import { z } from 'zod' - -const searchSchema = z.object({ - n: z.number().default(1), -}) - -const doubleQueryOptions = (n: number) => - queryOptions({ - queryKey: ['transition-double', n], - queryFn: async () => { - await new Promise((resolve) => setTimeout(resolve, 1000)) - return { n, double: n * 2 } - }, - placeholderData: (oldData) => oldData, - }) - -export const Route = createFileRoute('/transition/count/query')({ - validateSearch: searchSchema, - loader: ({ context: { queryClient }, location }) => { - const { n } = searchSchema.parse(location.search) - return queryClient.ensureQueryData(doubleQueryOptions(n)) - }, - component: TransitionPage, -}) - -function TransitionPage() { - const search = Route.useSearch() - - const doubleQuery = useQuery(() => doubleQueryOptions(search().n)) - - return ( - -
- ({ n: s.n + 1 })} - > - Increase - - -
-
n: {doubleQuery.data?.n}
-
- double: {doubleQuery.data?.double} -
-
-
-
- ) -} diff --git a/e2e/solid-start/basic-solid-query/src/routes/users.$userId.tsx b/e2e/solid-start/basic-solid-query/src/routes/users.$userId.tsx deleted file mode 100644 index 71e4b765b4..0000000000 --- a/e2e/solid-start/basic-solid-query/src/routes/users.$userId.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { useQuery } from '@tanstack/solid-query' -import { ErrorComponent, createFileRoute } from '@tanstack/solid-router' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -import { NotFound } from '~/components/NotFound' -import { userQueryOptions } from '~/utils/users' - -export const Route = createFileRoute('/users/$userId')({ - loader: async ({ context, params: { userId } }) => { - await context.queryClient.ensureQueryData(userQueryOptions(userId)) - }, - errorComponent: UserErrorComponent, - component: UserComponent, - notFoundComponent: () => { - return User not found - }, -}) - -function UserErrorComponent(props: ErrorComponentProps) { - return -} - -function UserComponent() { - const params = Route.useParams() - const userQuery = useQuery(() => userQueryOptions(params().userId)) - const user = () => userQuery.data - - return ( -
-

- {user()?.name ?? 'loading...'} -

-
{user()?.email ?? ''}
-
- ) -} diff --git a/e2e/solid-start/basic-solid-query/src/routes/users.index.tsx b/e2e/solid-start/basic-solid-query/src/routes/users.index.tsx deleted file mode 100644 index bbc96801a9..0000000000 --- a/e2e/solid-start/basic-solid-query/src/routes/users.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/users/')({ - component: UsersIndexComponent, -}) - -function UsersIndexComponent() { - return
Select a user.
-} diff --git a/e2e/solid-start/basic-solid-query/src/routes/users.tsx b/e2e/solid-start/basic-solid-query/src/routes/users.tsx deleted file mode 100644 index d957122a6e..0000000000 --- a/e2e/solid-start/basic-solid-query/src/routes/users.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import { useQuery } from '@tanstack/solid-query' -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { For } from 'solid-js' - -import { usersQueryOptions } from '~/utils/users' - -export const Route = createFileRoute('/users')({ - loader: async ({ context }) => { - await context.queryClient.ensureQueryData(usersQueryOptions()) - }, - component: UsersComponent, -}) - -function UsersComponent() { - const usersQuery = useQuery(() => usersQueryOptions()) - - return ( -
-
    - - {(user) => ( -
  • - -
    {user.name}
    - -
  • - )} -
    -
-
- -
- ) -} diff --git a/e2e/solid-start/basic-solid-query/src/styles/app.css b/e2e/solid-start/basic-solid-query/src/styles/app.css deleted file mode 100644 index 7ff6765215..0000000000 --- a/e2e/solid-start/basic-solid-query/src/styles/app.css +++ /dev/null @@ -1,16 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -body { - @apply text-base; - font-family: system-ui, sans-serif; -} diff --git a/e2e/solid-start/basic-solid-query/src/utils/posts.tsx b/e2e/solid-start/basic-solid-query/src/utils/posts.tsx deleted file mode 100644 index c280c9bfbf..0000000000 --- a/e2e/solid-start/basic-solid-query/src/utils/posts.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { queryOptions } from '@tanstack/solid-query' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -export const postsQueryOptions = () => - queryOptions({ - queryKey: ['posts'], - queryFn: async () => { - console.info('Fetching posts...') - await new Promise((r) => setTimeout(r, 500)) - return axios - .get>('https://jsonplaceholder.typicode.com/posts') - .then((r) => r.data.slice(0, 10)) - }, - }) - -export const postQueryOptions = (postId: string) => - queryOptions({ - queryKey: ['posts', postId], - queryFn: async () => { - console.info(`Fetching post with id ${postId}...`) - await new Promise((r) => setTimeout(r, 500)) - - return axios - .get(`https://jsonplaceholder.typicode.com/posts/${postId}`) - .then((r) => r.data) - }, - }) diff --git a/e2e/solid-start/basic-solid-query/src/utils/seo.ts b/e2e/solid-start/basic-solid-query/src/utils/seo.ts deleted file mode 100644 index f909e9e5fc..0000000000 --- a/e2e/solid-start/basic-solid-query/src/utils/seo.ts +++ /dev/null @@ -1,30 +0,0 @@ -export function seo(params: { - title: string - description?: string - keywords?: string - image?: string -}) { - const { title, description, keywords, image } = params - - const tags = [ - { title }, - { name: 'description', content: description }, - { name: 'keywords', content: keywords }, - { name: 'twitter:title', content: title }, - { name: 'twitter:description', content: description }, - { name: 'twitter:creator', content: '@tannerlinsley' }, - { name: 'twitter:site', content: '@tannerlinsley' }, - { name: 'og:type', content: 'website' }, - { name: 'og:title', content: title }, - { name: 'og:description', content: description }, - ...(image - ? [ - { name: 'twitter:image', content: image }, - { name: 'twitter:card', content: 'summary_large_image' }, - { name: 'og:image', content: image }, - ] - : []), - ] - - return tags -} diff --git a/e2e/solid-start/basic-solid-query/src/utils/users.tsx b/e2e/solid-start/basic-solid-query/src/utils/users.tsx deleted file mode 100644 index e7fc1a5de4..0000000000 --- a/e2e/solid-start/basic-solid-query/src/utils/users.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { queryOptions } from '@tanstack/solid-query' -import { createIsomorphicFn } from '@tanstack/solid-start' -import { getRequestUrl } from '@tanstack/solid-start/server' -import axios from 'redaxios' - -export type User = { - id: number - name: string - email: string -} - -const getOrigin = createIsomorphicFn() - .server(() => getRequestUrl().origin) - .client(() => window.location.origin) - -export const usersQueryOptions = () => - queryOptions({ - queryKey: ['users'], - queryFn: () => - axios - .get>(getOrigin() + '/api/users') - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch users') - }), - }) - -export const userQueryOptions = (id: string) => - queryOptions({ - queryKey: ['users', id], - queryFn: () => - axios - .get(getOrigin() + '/api/users/' + id) - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch user') - }), - }) diff --git a/e2e/solid-start/basic-solid-query/test-results/.last-run.json b/e2e/solid-start/basic-solid-query/test-results/.last-run.json deleted file mode 100644 index cbcc1fbac1..0000000000 --- a/e2e/solid-start/basic-solid-query/test-results/.last-run.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "passed", - "failedTests": [] -} \ No newline at end of file diff --git a/e2e/solid-start/basic-solid-query/tests/app.spec.ts b/e2e/solid-start/basic-solid-query/tests/app.spec.ts deleted file mode 100644 index 4ce5c20ef7..0000000000 --- a/e2e/solid-start/basic-solid-query/tests/app.spec.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test('Navigating to post', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await page.getByRole('link', { name: 'Deep View' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating to user', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Users' }).click() - await page.getByRole('link', { name: 'Leanne Graham' }).click() - await expect(page.getByRole('heading')).toContainText('Leanne Graham') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Layout', exact: true }).click() - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('body')).toContainText("I'm A!") - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('body')).toContainText("I'm B!") -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Manual Suspense boundaries should transition on navigation', async ({ - page, -}) => { - // Navigate to the suspense transition test page - await page.goto('/suspense-transition') - - // Wait for initial content to load - await expect(page.getByTestId('n-value')).toHaveText('1') - await expect(page.getByTestId('double-value')).toHaveText('2') - - // Click the increase button to trigger navigation with search params change - await page.getByTestId('increase-button').click() - - // During the transition, the old content should remain visible - // and the fallback should NOT be shown - await expect(page.getByTestId('suspense-fallback')).not.toBeVisible({ - timeout: 100, - }) - - // The old content should still be visible during transition - await expect(page.getByTestId('suspense-content')).toBeVisible() - - // After transition completes, new content should be visible - await expect(page.getByTestId('n-value')).toHaveText('2') - await expect(page.getByTestId('double-value')).toHaveText('4') -}) diff --git a/e2e/solid-start/basic-solid-query/tests/transition.spec.ts b/e2e/solid-start/basic-solid-query/tests/transition.spec.ts deleted file mode 100644 index a0f3bf0964..0000000000 --- a/e2e/solid-start/basic-solid-query/tests/transition.spec.ts +++ /dev/null @@ -1,96 +0,0 @@ -import { expect } from '@playwright/test' -import { apiTest as test } from '@tanstack/router-e2e-utils' - -test('transitions/count/query should keep old values visible during navigation', async ({ - page, -}) => { - await page.goto('/transition/count/query') - - await expect(page.getByTestId('n-value')).toContainText('n: 1') - await expect(page.getByTestId('double-value')).toContainText('double: 2') - - const bodyTexts: Array = [] - - const pollInterval = setInterval(async () => { - const text = await page - .locator('body') - .textContent() - .catch(() => '') - if (text) bodyTexts.push(text) - }, 50) - - // 1 click - - page.getByTestId('increase-button').click() - - await expect(page.getByTestId('n-value')).toContainText('n: 1', { - timeout: 2_000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 2', { - timeout: 2_000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 2', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 4', { - timeout: 2000, - }) - - // 2 clicks - - // page.getByTestId('increase-button').click() - // page.getByTestId('increase-button').click() - - // await expect(page.getByTestId('n-value')).toContainText('n: 2', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 4', { - // timeout: 2000, - // }) - - // await page.waitForTimeout(200) - - // await expect(page.getByTestId('n-value')).toContainText('n: 4', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 8', { - // timeout: 2000, - // }) - - // // 3 clicks - - // page.getByTestId('increase-button').click() - // page.getByTestId('increase-button').click() - // page.getByTestId('increase-button').click() - - // await expect(page.getByTestId('n-value')).toContainText('n: 4', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 8', { - // timeout: 2000, - // }) - - // await page.waitForTimeout(200) - - // await expect(page.getByTestId('n-value')).toContainText('n: 7', { - // timeout: 2000, - // }) - // await expect(page.getByTestId('double-value')).toContainText('double: 14', { - // timeout: 2000, - // }) - - clearInterval(pollInterval) - - // With proper transitions, old values should remain visible until new ones arrive - const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...')) - - if (hasLoadingText) { - throw new Error( - 'FAILED: "Loading..." appeared during navigation. ' + - 'Solid Router should use transitions to keep old values visible.', - ) - } -}) diff --git a/e2e/solid-start/basic-solid-query/tsconfig.json b/e2e/solid-start/basic-solid-query/tsconfig.json deleted file mode 100644 index c34f9d7c36..0000000000 --- a/e2e/solid-start/basic-solid-query/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/basic-solid-query/vite.config.ts b/e2e/solid-start/basic-solid-query/vite.config.ts deleted file mode 100644 index c0ae2c4cca..0000000000 --- a/e2e/solid-start/basic-solid-query/vite.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - plugins: [tailwindcss(), tanstackStart(), solid({ ssr: true })], -}) diff --git a/e2e/solid-start/basic-tsr-config/.devcontainer/devcontainer.json b/e2e/solid-start/basic-tsr-config/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/basic-tsr-config/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/basic-tsr-config/.gitignore b/e2e/solid-start/basic-tsr-config/.gitignore deleted file mode 100644 index 14577724eb..0000000000 --- a/e2e/solid-start/basic-tsr-config/.gitignore +++ /dev/null @@ -1,22 +0,0 @@ -node_modules -package-lock.json -yarn.lock - -.DS_Store -.cache -.env -.vercel -.output - -/build/ -/api/ -/server/build -/public/build -# Sentry Config File -.env.sentry-build-plugin -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ - -count.txt diff --git a/e2e/solid-start/basic-tsr-config/.prettierignore b/e2e/solid-start/basic-tsr-config/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/solid-start/basic-tsr-config/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/solid-start/basic-tsr-config/README.md b/e2e/solid-start/basic-tsr-config/README.md deleted file mode 100644 index 90cba4aac1..0000000000 --- a/e2e/solid-start/basic-tsr-config/README.md +++ /dev/null @@ -1,72 +0,0 @@ -# Welcome to TanStack.com! - -This site is built with TanStack Router! - -- [TanStack Router Docs](https://tanstack.com/router) - -It's deployed automagically with Netlify! - -- [Netlify](https://netlify.com/) - -## Development - -From your terminal: - -```sh -pnpm install -pnpm dev -``` - -This starts your app in development mode, rebuilding assets on file changes. - -## Editing and previewing the docs of TanStack projects locally - -The documentations for all TanStack projects except for `React Charts` are hosted on [https://tanstack.com](https://tanstack.com), powered by this TanStack Router app. -In production, the markdown doc pages are fetched from the GitHub repos of the projects, but in development they are read from the local file system. - -Follow these steps if you want to edit the doc pages of a project (in these steps we'll assume it's [`TanStack/form`](https://github.com/tanstack/form)) and preview them locally : - -1. Create a new directory called `tanstack`. - -```sh -mkdir tanstack -``` - -2. Enter the directory and clone this repo and the repo of the project there. - -```sh -cd tanstack -git clone git@github.com:TanStack/tanstack.com.git -git clone git@github.com:TanStack/form.git -``` - -> [!NOTE] -> Your `tanstack` directory should look like this: -> -> ``` -> tanstack/ -> | -> +-- form/ -> | -> +-- tanstack.com/ -> ``` - -> [!WARNING] -> Make sure the name of the directory in your local file system matches the name of the project's repo. For example, `tanstack/form` must be cloned into `form` (this is the default) instead of `some-other-name`, because that way, the doc pages won't be found. - -3. Enter the `tanstack/tanstack.com` directory, install the dependencies and run the app in dev mode: - -```sh -cd tanstack.com -pnpm i -# The app will run on https://localhost:3000 by default -pnpm dev -``` - -4. Now you can visit http://localhost:3000/form/latest/docs/overview in the browser and see the changes you make in `tanstack/form/docs`. - -> [!NOTE] -> The updated pages need to be manually reloaded in the browser. - -> [!WARNING] -> You will need to update the `docs/config.json` file (in the project's repo) if you add a new doc page! diff --git a/e2e/solid-start/basic-tsr-config/package.json b/e2e/solid-start/basic-tsr-config/package.json deleted file mode 100644 index 8d720d5ce4..0000000000 --- a/e2e/solid-start/basic-tsr-config/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-basic-tsr-config", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev", - "build": "rimraf ./count.txt && vite build && tsc --noEmit", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@tanstack/router-e2e-utils": "workspace:^", - "@types/node": "^22.10.2", - "srvx": "^1.0.0", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "rimraf": "catalog:" - } -} diff --git a/e2e/solid-start/basic-tsr-config/playwright.config.ts b/e2e/solid-start/basic-tsr-config/playwright.config.ts deleted file mode 100644 index e6b92ce385..0000000000 --- a/e2e/solid-start/basic-tsr-config/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && VITE_SERVER_PORT=${PORT} PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts b/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts deleted file mode 100644 index 4776246e1f..0000000000 --- a/e2e/solid-start/basic-tsr-config/src/app/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' - fileRoutesByTo: FileRoutesByTo - to: '/' - id: '__root__' | '/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/basic-tsr-config/src/app/router.tsx b/e2e/solid-start/basic-tsr-config/src/app/router.tsx deleted file mode 100644 index b8757ff85b..0000000000 --- a/e2e/solid-start/basic-tsr-config/src/app/router.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - const router = createRouter({ - routeTree, - scrollRestoration: true, - }) - - return router -} diff --git a/e2e/solid-start/basic-tsr-config/src/app/routes/__root.tsx b/e2e/solid-start/basic-tsr-config/src/app/routes/__root.tsx deleted file mode 100644 index 8a55678998..0000000000 --- a/e2e/solid-start/basic-tsr-config/src/app/routes/__root.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { - charset: 'utf-8', - }, - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - { - title: 'TanStack Start Starter', - }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - - ) -} diff --git a/e2e/solid-start/basic-tsr-config/src/app/routes/index.tsx b/e2e/solid-start/basic-tsr-config/src/app/routes/index.tsx deleted file mode 100644 index 5c96a11880..0000000000 --- a/e2e/solid-start/basic-tsr-config/src/app/routes/index.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import fs from 'node:fs' -import { useRouter, createFileRoute } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' - -const filePath = 'count.txt' - -const getCount = createServerFn({ - method: 'GET', -}).handler(async () => { - const number = await fs.promises.readFile(filePath, 'utf-8').catch(() => '0') - return parseInt(number || '0') -}) - -const updateCount = createServerFn({ method: 'POST' }) - .validator((d: number) => d) - .handler(async ({ data }) => { - const count = await getCount() - await fs.promises.writeFile(filePath, `${count + data}`) - }) -export const Route = createFileRoute('/')({ - component: Home, - loader: async () => await getCount(), -}) - -function Home() { - const router = useRouter() - const state = Route.useLoaderData() - - return ( - - ) -} diff --git a/e2e/solid-start/basic-tsr-config/src/app/vite-env.d.ts b/e2e/solid-start/basic-tsr-config/src/app/vite-env.d.ts deleted file mode 100644 index 0b2af560d6..0000000000 --- a/e2e/solid-start/basic-tsr-config/src/app/vite-env.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*?url' { - const url: string - export default url -} diff --git a/e2e/solid-start/basic-tsr-config/tests/app.spec.ts b/e2e/solid-start/basic-tsr-config/tests/app.spec.ts deleted file mode 100644 index 782007684a..0000000000 --- a/e2e/solid-start/basic-tsr-config/tests/app.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('opening the app', async ({ page }) => { - await page.goto('/') - - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('add-button')).toContainText('Add 1 to 0?') - await page.getByTestId('add-button').click() - await page.waitForLoadState('networkidle') - await expect(page.getByTestId('add-button')).toContainText('Add 1 to 1?') -}) diff --git a/e2e/solid-start/basic-tsr-config/tsconfig.json b/e2e/solid-start/basic-tsr-config/tsconfig.json deleted file mode 100644 index 51ca13850e..0000000000 --- a/e2e/solid-start/basic-tsr-config/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/app/*"] - }, - "noEmit": true - } -} diff --git a/e2e/solid-start/basic-tsr-config/vite.config.ts b/e2e/solid-start/basic-tsr-config/vite.config.ts deleted file mode 100644 index 56b36b5c03..0000000000 --- a/e2e/solid-start/basic-tsr-config/vite.config.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - server: { - port: 3000, - }, - plugins: [ - tanstackStart({ - srcDirectory: './src/app', - }), - viteSolid({ ssr: true }), - ], -}) diff --git a/e2e/solid-start/basic/.devcontainer/devcontainer.json b/e2e/solid-start/basic/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/basic/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/basic/.gitignore b/e2e/solid-start/basic/.gitignore deleted file mode 100644 index b9c2c7e5f6..0000000000 --- a/e2e/solid-start/basic/.gitignore +++ /dev/null @@ -1,21 +0,0 @@ -node_modules -package-lock.json -yarn.lock - -.DS_Store -.cache -.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-vite-*/ diff --git a/e2e/solid-start/basic/.prettierignore b/e2e/solid-start/basic/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/solid-start/basic/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/solid-start/basic/package.json b/e2e/solid-start/basic/package.json deleted file mode 100644 index e83ed11775..0000000000 --- a/e2e/solid-start/basic/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-basic", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev", - "build": "pnpm build:vite", - "preview": "vite preview", - "start": "node server.js", - "test:e2e:local": "playwright test --project=chromium", - "build:vite": "vite build && tsc --noEmit", - "build:rsbuild": "rsbuild build && tsc --noEmit" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "express": "^5.2.1", - "http-proxy-middleware": "^3.0.5", - "js-cookie": "^3.0.5", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwind-merge": "^3.6.0", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-babel": "^1.1.2", - "@rsbuild/plugin-solid": "^1.1.1", - "@tailwindcss/postcss": "^4.2.2", - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/js-cookie": "^3.0.6", - "@types/node": "^22.10.2", - "combinate": "^1.1.11", - "srvx": "^1.0.0", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - }, - "nx": { - "metadata": { - "playwrightModes": [ - { - "toolchain": "vite", - "mode": "ssr", - "shards": 4 - }, - { - "toolchain": "vite", - "mode": "spa" - }, - { - "toolchain": "vite", - "mode": "prerender", - "env": { - "NODE_OPTIONS": "--import=@tanstack/router-e2e-utils/mock-api" - } - }, - { - "toolchain": "vite", - "mode": "preview" - }, - { - "toolchain": "rsbuild", - "mode": "ssr" - } - ] - } - } -} diff --git a/e2e/solid-start/basic/playwright.config.ts b/e2e/solid-start/basic/playwright.config.ts deleted file mode 100644 index 9322874f3a..0000000000 --- a/e2e/solid-start/basic/playwright.config.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const mode = process.env.MODE ?? 'ssr' - -const distDir = process.env.E2E_DIST_DIR ?? 'dist' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` -const commandByMode = - mode === 'preview' - ? `pnpm preview --host 0.0.0.0 --outDir ${distDir} --port ${PORT}` - : `pnpm start` - -export default defineConfig({ - testDir: './tests', - workers: 1, - reporter: [['line']], - - use: { - baseURL, - }, - - webServer: { - command: commandByMode, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ''} --import=@tanstack/router-e2e-utils/mock-api`, - MODE: mode, - START_PORT: '0', - PORT: String(PORT), - E2E_DIST_DIR: distDir, - }, - }, - - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], -}) diff --git a/e2e/solid-start/basic/postcss.config.mjs b/e2e/solid-start/basic/postcss.config.mjs deleted file mode 100644 index a7f73a2d1d..0000000000 --- a/e2e/solid-start/basic/postcss.config.mjs +++ /dev/null @@ -1,5 +0,0 @@ -export default { - plugins: { - '@tailwindcss/postcss': {}, - }, -} diff --git a/e2e/solid-start/basic/public/android-chrome-192x192.png b/e2e/solid-start/basic/public/android-chrome-192x192.png deleted file mode 100644 index 09c8324f8c..0000000000 Binary files a/e2e/solid-start/basic/public/android-chrome-192x192.png and /dev/null differ diff --git a/e2e/solid-start/basic/public/android-chrome-512x512.png b/e2e/solid-start/basic/public/android-chrome-512x512.png deleted file mode 100644 index 11d626ea3d..0000000000 Binary files a/e2e/solid-start/basic/public/android-chrome-512x512.png and /dev/null differ diff --git a/e2e/solid-start/basic/public/apple-touch-icon.png b/e2e/solid-start/basic/public/apple-touch-icon.png deleted file mode 100644 index 5a9423cc02..0000000000 Binary files a/e2e/solid-start/basic/public/apple-touch-icon.png and /dev/null differ diff --git a/e2e/solid-start/basic/public/favicon-16x16.png b/e2e/solid-start/basic/public/favicon-16x16.png deleted file mode 100644 index e3389b0044..0000000000 Binary files a/e2e/solid-start/basic/public/favicon-16x16.png and /dev/null differ diff --git a/e2e/solid-start/basic/public/favicon-32x32.png b/e2e/solid-start/basic/public/favicon-32x32.png deleted file mode 100644 index 900c77d444..0000000000 Binary files a/e2e/solid-start/basic/public/favicon-32x32.png and /dev/null differ diff --git a/e2e/solid-start/basic/public/favicon.ico b/e2e/solid-start/basic/public/favicon.ico deleted file mode 100644 index 1a1751676f..0000000000 Binary files a/e2e/solid-start/basic/public/favicon.ico and /dev/null differ diff --git a/e2e/solid-start/basic/public/favicon.png b/e2e/solid-start/basic/public/favicon.png deleted file mode 100644 index 1e77bc0609..0000000000 Binary files a/e2e/solid-start/basic/public/favicon.png and /dev/null differ diff --git a/e2e/solid-start/basic/public/script.js b/e2e/solid-start/basic/public/script.js deleted file mode 100644 index 897477e7d0..0000000000 --- a/e2e/solid-start/basic/public/script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_1 loaded') -window.SCRIPT_1 = true diff --git a/e2e/solid-start/basic/public/script2.js b/e2e/solid-start/basic/public/script2.js deleted file mode 100644 index 819af30daf..0000000000 --- a/e2e/solid-start/basic/public/script2.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_2 loaded') -window.SCRIPT_2 = true diff --git a/e2e/solid-start/basic/public/site.webmanifest b/e2e/solid-start/basic/public/site.webmanifest deleted file mode 100644 index fa99de77db..0000000000 --- a/e2e/solid-start/basic/public/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/e2e/solid-start/basic/rsbuild.config.ts b/e2e/solid-start/basic/rsbuild.config.ts deleted file mode 100644 index ea04a3167a..0000000000 --- a/e2e/solid-start/basic/rsbuild.config.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginBabel } from '@rsbuild/plugin-babel' -import { pluginSolid } from '@rsbuild/plugin-solid' -import { tanstackStart } from '@tanstack/solid-start/plugin/rsbuild' - -const outDir = process.env.E2E_DIST_DIR ?? 'dist' - -export default defineConfig({ - plugins: [ - pluginBabel({ - include: /\.(?:jsx|tsx)$/, - }), - pluginSolid(), - tanstackStart(), - ], - output: { - distPath: { - root: outDir, - }, - }, -}) diff --git a/e2e/solid-start/basic/server.js b/e2e/solid-start/basic/server.js deleted file mode 100644 index 3e1ddab400..0000000000 --- a/e2e/solid-start/basic/server.js +++ /dev/null @@ -1,98 +0,0 @@ -import fs from 'node:fs' -import path from 'node:path' -import { toNodeHandler } from 'srvx/node' -import express from 'express' -import { createProxyMiddleware } from 'http-proxy-middleware' - -const port = Number(process.env.PORT ?? 3000) - -const startPort = Number(process.env.START_PORT ?? 0) - -const isSpaMode = process.env.MODE === 'spa' -const isPrerender = process.env.MODE === 'prerender' -const distDir = process.env.E2E_DIST_DIR || 'dist' -const distClientDir = path.resolve(distDir, 'client') - -function resolveDistServerEntryPath() { - 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 async function createStartServer() { - const distServerEntryPath = resolveDistServerEntryPath() - const server = (await import(distServerEntryPath)).default - const nodeHandler = toNodeHandler(server.fetch) - - const app = express() - - // to keep testing uniform stop express from redirecting /posts to /posts/ - // when serving pre-rendered pages - app.use(express.static(distClientDir, { redirect: !isPrerender })) - - app.use(async (req, res, next) => { - try { - await nodeHandler(req, res) - } catch (error) { - next(error) - } - }) - - return { app } -} - -export async function createSpaServer(backendPort) { - const app = express() - - app.use( - '/api', - createProxyMiddleware({ - target: `http://localhost:${backendPort}/api`, // Replace with your target server's URL - changeOrigin: false, // Needed for virtual hosted sites, - }), - ) - - app.use( - '/_serverFn', - createProxyMiddleware({ - target: `http://localhost:${backendPort}/_serverFn`, // Replace with your target server's URL - changeOrigin: false, // Needed for virtual hosted sites, - }), - ) - - app.use(express.static(distClientDir)) - - app.get('/{*splat}', (req, res) => { - res.sendFile('index.html', { root: distClientDir }) - }) - - return { app } -} - -// Bind the backend first so the SPA proxy receives the port actually held by it. -const { app: startApp } = await createStartServer() -const backend = startApp.listen(isSpaMode ? startPort : port, async (error) => { - if (error) { - throw error - } - const backendPort = backend.address().port - if (isSpaMode) { - const { app } = await createSpaServer(backendPort) - const frontend = app.listen(port, (frontendError) => { - if (frontendError) { - throw frontendError - } - console.info(`E2E app: http://localhost:${frontend.address().port}`) - }) - } else { - console.info(`E2E app: http://localhost:${backendPort}`) - } -}) diff --git a/e2e/solid-start/basic/src/client.tsx b/e2e/solid-start/basic/src/client.tsx deleted file mode 100644 index 0e10259d30..0000000000 --- a/e2e/solid-start/basic/src/client.tsx +++ /dev/null @@ -1,10 +0,0 @@ -// DO NOT DELETE THIS FILE!!! -// This file is a good smoke test to make sure the custom client entry is working -import { hydrate } from 'solid-js/web' -import { StartClient, hydrateStart } from '@tanstack/solid-start/client' - -console.log("[client-entry]: using custom client entry in 'src/client.tsx'") - -hydrateStart().then((router) => { - hydrate(() => , document) -}) diff --git a/e2e/solid-start/basic/src/components/CustomMessage.tsx b/e2e/solid-start/basic/src/components/CustomMessage.tsx deleted file mode 100644 index c038b66d2f..0000000000 --- a/e2e/solid-start/basic/src/components/CustomMessage.tsx +++ /dev/null @@ -1,8 +0,0 @@ -export function CustomMessage({ message }: { message: string }) { - return ( -
-
This is a custom message:
-

{message}

-
- ) -} diff --git a/e2e/solid-start/basic/src/components/DefaultCatchBoundary.tsx b/e2e/solid-start/basic/src/components/DefaultCatchBoundary.tsx deleted file mode 100644 index f44db955a0..0000000000 --- a/e2e/solid-start/basic/src/components/DefaultCatchBoundary.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - ErrorComponent, - Link, - useLocation, - useRouter, -} from '@tanstack/solid-router' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function DefaultCatchBoundary({ error }: ErrorComponentProps) { - const router = useRouter() - const isRoot = useLocation({ - select: (location) => location.pathname === '/', - }) - - console.error(error) - - return ( -
- -
- - {isRoot() ? ( - - Home - - ) : ( - { - e.preventDefault() - window.history.back() - }} - > - Go Back - - )} -
-
- ) -} diff --git a/e2e/solid-start/basic/src/components/NotFound.tsx b/e2e/solid-start/basic/src/components/NotFound.tsx deleted file mode 100644 index c48444862b..0000000000 --- a/e2e/solid-start/basic/src/components/NotFound.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Link } from '@tanstack/solid-router' - -export function NotFound({ children }: { children?: any }) { - return ( -
-
- {children ||

The page you are looking for does not exist.

} -
-

- - - Start Over - -

-
- ) -} diff --git a/e2e/solid-start/basic/src/components/PostErrorComponent.tsx b/e2e/solid-start/basic/src/components/PostErrorComponent.tsx deleted file mode 100644 index 3e5d62c79b..0000000000 --- a/e2e/solid-start/basic/src/components/PostErrorComponent.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} diff --git a/e2e/solid-start/basic/src/components/RedirectOnClick.tsx b/e2e/solid-start/basic/src/components/RedirectOnClick.tsx deleted file mode 100644 index 385748e2a5..0000000000 --- a/e2e/solid-start/basic/src/components/RedirectOnClick.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { useServerFn } from '@tanstack/solid-start' -import { throwRedirect } from './throwRedirect' - -interface RedirectOnClickProps { - target: 'internal' | 'external' - reloadDocument?: boolean - externalHost?: string -} - -export function RedirectOnClick({ - target, - reloadDocument, - externalHost, -}: RedirectOnClickProps) { - const execute = useServerFn(throwRedirect) - return ( - - ) -} diff --git a/e2e/solid-start/basic/src/components/UserErrorComponent.tsx b/e2e/solid-start/basic/src/components/UserErrorComponent.tsx deleted file mode 100644 index 69762add4c..0000000000 --- a/e2e/solid-start/basic/src/components/UserErrorComponent.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router' - -export function UserErrorComponent({ error }: ErrorComponentProps) { - return -} diff --git a/e2e/solid-start/basic/src/components/throwRedirect.ts b/e2e/solid-start/basic/src/components/throwRedirect.ts deleted file mode 100644 index fd4a056324..0000000000 --- a/e2e/solid-start/basic/src/components/throwRedirect.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { redirect } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' - -export const throwRedirect = createServerFn() - .validator( - (opts: { - target: 'internal' | 'external' - reloadDocument?: boolean - externalHost?: string - }) => opts, - ) - .handler((ctx) => { - if (ctx.data.target === 'internal') { - throw redirect({ to: '/posts', reloadDocument: ctx.data.reloadDocument }) - } - const href = ctx.data.externalHost ?? 'http://example.com' - throw redirect({ - href, - }) - }) diff --git a/e2e/solid-start/basic/src/raw-stream-fns.ts b/e2e/solid-start/basic/src/raw-stream-fns.ts deleted file mode 100644 index 3c2f4fca09..0000000000 --- a/e2e/solid-start/basic/src/raw-stream-fns.ts +++ /dev/null @@ -1,480 +0,0 @@ -import { RawStream, createServerFn } from '@tanstack/solid-start' - -// Helper to create a delayed Uint8Array stream -function createDelayedStream( - chunks: Array, - delayMs: number, -): ReadableStream { - return new ReadableStream({ - async start(controller) { - for (const chunk of chunks) { - await new Promise((resolve) => setTimeout(resolve, delayMs)) - controller.enqueue(chunk) - } - controller.close() - }, - }) -} - -// Helper to create a stream with variable delays per chunk -// Each entry is [chunk, delayBeforeMs] - delay happens BEFORE enqueueing the chunk -function createVariableDelayStream( - chunksWithDelays: Array<[Uint8Array, number]>, -): ReadableStream { - return new ReadableStream({ - async start(controller) { - for (const [chunk, delayMs] of chunksWithDelays) { - await new Promise((resolve) => setTimeout(resolve, delayMs)) - controller.enqueue(chunk) - } - controller.close() - }, - }) -} - -// Helper to encode text to Uint8Array -function encode(text: string): Uint8Array { - return new TextEncoder().encode(text) -} - -// Export helpers for use in components and SSR routes -export { encode, createDelayedStream, concatBytes } - -// Expected data for hint tests - defined here for both server and client verification -// Test 7: Text hint with pure text -export const TEST7_CHUNKS = [ - encode('Hello, '), - encode('World! '), - encode('This is text.'), -] -export const TEST7_EXPECTED = concatBytes(TEST7_CHUNKS) - -// Test 8: Text hint with pure binary (invalid UTF-8) -export const TEST8_CHUNKS = [ - new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]), - new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]), -] -export const TEST8_EXPECTED = concatBytes(TEST8_CHUNKS) - -// Test 9: Text hint with mixed content -export const TEST9_CHUNKS = [ - encode('Valid UTF-8 text'), - new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8 - encode(' More text'), -] -export const TEST9_EXPECTED = concatBytes(TEST9_CHUNKS) - -// Test 10: Binary hint with text data -export const TEST10_CHUNKS = [encode('This is text but using binary hint')] -export const TEST10_EXPECTED = concatBytes(TEST10_CHUNKS) - -// Test 11: Binary hint with pure binary -export const TEST11_CHUNKS = [ - new Uint8Array([0x00, 0x01, 0x02, 0xff, 0xfe, 0xfd]), -] -export const TEST11_EXPECTED = concatBytes(TEST11_CHUNKS) - -// Helper to concatenate byte arrays -function concatBytes(chunks: Array): Uint8Array { - const totalLength = chunks.reduce((acc, c) => acc + c.length, 0) - const result = new Uint8Array(totalLength) - let offset = 0 - for (const chunk of chunks) { - result.set(chunk, offset) - offset += chunk.length - } - return result -} - -// Test 1: Simple single raw stream -export const singleRawStreamFn = createServerFn().handler(async () => { - const stream = createDelayedStream( - [encode('chunk1'), encode('chunk2'), encode('chunk3')], - 50, - ) - return { - message: 'Single stream test', - data: new RawStream(stream), - } -}) - -// Test 2: Multiple raw streams -export const multipleRawStreamsFn = createServerFn().handler(async () => { - const stream1 = createDelayedStream( - [encode('stream1-a'), encode('stream1-b')], - 30, - ) - const stream2 = createDelayedStream( - [encode('stream2-a'), encode('stream2-b')], - 50, - ) - return { - message: 'Multiple streams test', - first: new RawStream(stream1), - second: new RawStream(stream2), - } -}) - -// Test 3: JSON streaming ends before raw stream -export const jsonEndsFirstFn = createServerFn().handler(async () => { - // Slow raw stream (takes 500ms total) - const slowStream = createDelayedStream( - [encode('slow-1'), encode('slow-2'), encode('slow-3'), encode('slow-4')], - 125, - ) - return { - message: 'JSON ends first test', - timestamp: Date.now(), - slowData: new RawStream(slowStream), - } -}) - -// Test 4: Raw stream ends before JSON streaming (fast stream, deferred JSON) -export const rawEndsFirstFn = createServerFn().handler(async () => { - // Fast raw stream (completes quickly) - const fastStream = createDelayedStream([encode('fast-done')], 10) - - // Deferred promise - NOT awaited, so it streams as deferred JSON - const deferredData = new Promise((resolve) => - setTimeout(() => resolve('deferred-json-data'), 200), - ) - - return { - message: 'Raw ends first test', - deferredData, - fastData: new RawStream(fastStream), - } -}) - -// Test 5: Large binary data -export const largeBinaryFn = createServerFn().handler(async () => { - // Create 1KB chunks - const chunk = new Uint8Array(1024) - for (let i = 0; i < chunk.length; i++) { - chunk[i] = i % 256 - } - - const stream = createDelayedStream([chunk, chunk, chunk], 20) - - return { - message: 'Large binary test', - size: 3072, - binary: new RawStream(stream), - } -}) - -// Test 6: Mixed streaming (promise + raw stream) -export const mixedStreamingFn = createServerFn().handler(async () => { - const rawStream = createDelayedStream( - [encode('mixed-raw-1'), encode('mixed-raw-2')], - 50, - ) - - return { - immediate: 'immediate-value', - deferred: new Promise((resolve) => - setTimeout(() => resolve('deferred-value'), 100), - ), - raw: new RawStream(rawStream), - } -}) - -// Test 7: Text hint with pure text data (should use UTF-8 encoding) -export const textHintPureTextFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST7_CHUNKS, 30) - return { - message: 'Text hint with pure text', - data: new RawStream(stream, { hint: 'text' }), - } -}) - -// Test 8: Text hint with pure binary data (should fallback to base64) -export const textHintPureBinaryFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST8_CHUNKS, 30) - return { - message: 'Text hint with pure binary', - data: new RawStream(stream, { hint: 'text' }), - } -}) - -// Test 9: Text hint with mixed content (some UTF-8, some binary) -export const textHintMixedFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST9_CHUNKS, 30) - return { - message: 'Text hint with mixed content', - data: new RawStream(stream, { hint: 'text' }), - } -}) - -// Test 10: Binary hint with text data (should still use base64) -export const binaryHintTextFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST10_CHUNKS, 30) - return { - message: 'Binary hint with text data', - data: new RawStream(stream, { hint: 'binary' }), - } -}) - -// Test 11: Binary hint with pure binary data -export const binaryHintBinaryFn = createServerFn().handler(async () => { - const stream = createDelayedStream(TEST11_CHUNKS, 30) - return { - message: 'Binary hint with binary data', - data: new RawStream(stream, { hint: 'binary' }), - } -}) - -// ============================================================================ -// MULTIPLEXING TESTS - Verify correct interleaving of multiple streams -// ============================================================================ - -// Expected data for multiplexing tests -// Test 12: Two streams with interleaved timing -// Stream A: sends at 0ms, 150ms, 200ms (3 chunks with pauses) -// Stream B: sends at 50ms, 100ms, 250ms (3 chunks, different rhythm) -export const TEST12_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('A1-first'), 0], // immediate - [encode('A2-after-pause'), 150], // 150ms pause - [encode('A3-quick'), 50], // 50ms after A2 -] -export const TEST12_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('B1-start'), 50], // 50ms after start - [encode('B2-continue'), 50], // 50ms after B1 - [encode('B3-final'), 150], // 150ms pause then final -] -export const TEST12_STREAM_A_EXPECTED = concatBytes( - TEST12_STREAM_A_CHUNKS.map(([chunk]) => chunk), -) -export const TEST12_STREAM_B_EXPECTED = concatBytes( - TEST12_STREAM_B_CHUNKS.map(([chunk]) => chunk), -) - -// Test 13: Burst-pause-burst pattern (single stream) -// 3 chunks quickly, long pause, 3 more chunks quickly -export const TEST13_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('burst1-a'), 10], - [encode('burst1-b'), 10], - [encode('burst1-c'), 10], - [encode('pause-then-burst2-a'), 200], // long pause - [encode('burst2-b'), 10], - [encode('burst2-c'), 10], -] -export const TEST13_EXPECTED = concatBytes( - TEST13_CHUNKS.map(([chunk]) => chunk), -) - -// Test 14: Three concurrent streams with different patterns -// Stream A: fast steady (every 30ms) -// Stream B: slow steady (every 100ms) -// Stream C: burst pattern (quick-pause-quick) -export const TEST14_STREAM_A_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('A1'), 30], - [encode('A2'), 30], - [encode('A3'), 30], - [encode('A4'), 30], -] -export const TEST14_STREAM_B_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('B1-slow'), 100], - [encode('B2-slow'), 100], -] -export const TEST14_STREAM_C_CHUNKS: Array<[Uint8Array, number]> = [ - [encode('C1-burst'), 20], - [encode('C2-burst'), 20], - [encode('C3-after-pause'), 150], -] -export const TEST14_STREAM_A_EXPECTED = concatBytes( - TEST14_STREAM_A_CHUNKS.map(([chunk]) => chunk), -) -export const TEST14_STREAM_B_EXPECTED = concatBytes( - TEST14_STREAM_B_CHUNKS.map(([chunk]) => chunk), -) -export const TEST14_STREAM_C_EXPECTED = concatBytes( - TEST14_STREAM_C_CHUNKS.map(([chunk]) => chunk), -) - -// Test 12: Interleaved multiplexing - two streams with variable delays -export const interleavedStreamsFn = createServerFn().handler(async () => { - const streamA = createVariableDelayStream(TEST12_STREAM_A_CHUNKS) - const streamB = createVariableDelayStream(TEST12_STREAM_B_CHUNKS) - - return { - message: 'Interleaved streams test', - streamA: new RawStream(streamA), - streamB: new RawStream(streamB), - } -}) - -// Test 13: Burst-pause-burst pattern -export const burstPauseBurstFn = createServerFn().handler(async () => { - const stream = createVariableDelayStream(TEST13_CHUNKS) - - return { - message: 'Burst-pause-burst test', - data: new RawStream(stream), - } -}) - -// Test 14: Three concurrent streams -export const threeStreamsFn = createServerFn().handler(async () => { - const streamA = createVariableDelayStream(TEST14_STREAM_A_CHUNKS) - const streamB = createVariableDelayStream(TEST14_STREAM_B_CHUNKS) - const streamC = createVariableDelayStream(TEST14_STREAM_C_CHUNKS) - - return { - message: 'Three concurrent streams test', - fast: new RawStream(streamA), - slow: new RawStream(streamB), - burst: new RawStream(streamC), - } -}) - -// ============================================================================ -// EDGE CASE TESTS -// ============================================================================ - -// Test 15: Empty stream (zero bytes) -export const emptyStreamFn = createServerFn().handler(async () => { - // Stream that immediately closes with no data - const stream = new ReadableStream({ - start(controller) { - controller.close() - }, - }) - - return { - message: 'Empty stream test', - data: new RawStream(stream), - } -}) - -// Test 16: Stream that errors mid-flight -export const errorStreamFn = createServerFn().handler(async () => { - // Stream that sends some data then errors - const stream = new ReadableStream({ - async start(controller) { - controller.enqueue(encode('chunk-before-error')) - await new Promise((resolve) => setTimeout(resolve, 50)) - controller.error(new Error('Intentional stream error')) - }, - }) - - return { - message: 'Error stream test', - data: new RawStream(stream), - } -}) - -// Helpers for consuming streams (exported for use in components) -// Note: RawStream is the marker class used in loaders/server functions, -// but after SSR deserialization it becomes ReadableStream. -// We accept both types to handle the TypeScript mismatch. -export function createStreamConsumer() { - const decoder = new TextDecoder() - - return async function consumeStream( - stream: ReadableStream | RawStream, - ): Promise { - // Handle both RawStream (from type system) and ReadableStream (runtime) - const actualStream = - stream instanceof RawStream - ? stream.stream - : (stream as ReadableStream) - const reader = actualStream.getReader() - const chunks: Array = [] - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - while (true) { - const { done, value } = await reader.read() - if (done) break - chunks.push(decoder.decode(value, { stream: true })) - } - - return chunks.join('') - } -} - -export async function consumeBinaryStream( - stream: ReadableStream | RawStream, -): Promise { - // Handle both RawStream (from type system) and ReadableStream (runtime) - const actualStream = - stream instanceof RawStream - ? stream.stream - : (stream as ReadableStream) - const reader = actualStream.getReader() - let totalBytes = 0 - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - while (true) { - const { done, value } = await reader.read() - if (done) break - totalBytes += value.length - } - - return totalBytes -} - -// Helper to collect all bytes from a stream -export async function collectBytes( - stream: ReadableStream | RawStream, -): Promise { - const actualStream = - stream instanceof RawStream - ? stream.stream - : (stream as ReadableStream) - const reader = actualStream.getReader() - const chunks: Array = [] - let totalLength = 0 - - // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition - while (true) { - const { done, value } = await reader.read() - if (done) break - chunks.push(value) - totalLength += value.length - } - - const result = new Uint8Array(totalLength) - let pos = 0 - for (const chunk of chunks) { - result.set(chunk, pos) - pos += chunk.length - } - return result -} - -// Compare two Uint8Arrays byte-by-byte -export function compareBytes( - actual: Uint8Array, - expected: Uint8Array, -): { - match: boolean - mismatchIndex: number | null - actualLength: number - expectedLength: number -} { - if (actual.length !== expected.length) { - return { - match: false, - mismatchIndex: -1, // -1 indicates length mismatch - actualLength: actual.length, - expectedLength: expected.length, - } - } - for (let i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) { - return { - match: false, - mismatchIndex: i, - actualLength: actual.length, - expectedLength: expected.length, - } - } - } - return { - match: true, - mismatchIndex: null, - actualLength: actual.length, - expectedLength: expected.length, - } -} diff --git a/e2e/solid-start/basic/src/routeTree.gen.ts b/e2e/solid-start/basic/src/routeTree.gen.ts deleted file mode 100644 index 07ba58b219..0000000000 --- a/e2e/solid-start/basic/src/routeTree.gen.ts +++ /dev/null @@ -1,1449 +0,0 @@ -/* 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 LayoutRouteImport } from './routes/_layout' -import { Route as DeferredRouteImport } from './routes/deferred' -import { Route as DeferredWithoutSuspenseRouteImport } from './routes/deferred-without-suspense' -import { Route as ErrorNormalizationRouteImport } from './routes/error-normalization' -import { Route as InlineScriptsRouteImport } from './routes/inline-scripts' -import { Route as LinksRouteImport } from './routes/links' -import { Route as NotFoundRouteRouteImport } from './routes/not-found/route' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as RawStreamRouteImport } from './routes/raw-stream' -import { Route as ScriptsRouteImport } from './routes/scripts' -import { Route as SearchParamsRouteRouteImport } from './routes/search-params/route' -import { Route as SpecialCharsRouteRouteImport } from './routes/specialChars/route' -import { Route as StreamRouteImport } from './routes/stream' -import { Route as UsersRouteImport } from './routes/users' -import { Route as LayoutLayout2RouteImport } from './routes/_layout/_layout-2' -import { Route as ApiUsersRouteImport } from './routes/api/users' -import { Route as MultiCookieRedirectIndexRouteImport } from './routes/multi-cookie-redirect/index' -import { Route as MultiCookieRedirectTargetRouteImport } from './routes/multi-cookie-redirect/target' -import { Route as NotFoundIndexRouteImport } from './routes/not-found/index' -import { Route as NotFoundParentBoundaryRouteRouteImport } from './routes/not-found/parent-boundary/route' -import { Route as NotFoundViaBeforeLoadRouteImport } from './routes/not-found/via-beforeLoad' -import { Route as NotFoundViaBeforeLoadTargetRootRouteImport } from './routes/not-found/via-beforeLoad-target-root' -import { Route as NotFoundViaLoaderRouteImport } from './routes/not-found/via-loader' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as RawStreamIndexRouteImport } from './routes/raw-stream/index' -import { Route as RawStreamClientCallRouteImport } from './routes/raw-stream/client-call' -import { Route as RawStreamSsrBinaryHintRouteImport } from './routes/raw-stream/ssr-binary-hint' -import { Route as RawStreamSsrMixedRouteImport } from './routes/raw-stream/ssr-mixed' -import { Route as RawStreamSsrMultipleRouteImport } from './routes/raw-stream/ssr-multiple' -import { Route as RawStreamSsrSingleRouteImport } from './routes/raw-stream/ssr-single' -import { Route as RawStreamSsrTextHintRouteImport } from './routes/raw-stream/ssr-text-hint' -import { Route as RedirectIndexRouteImport } from './routes/redirect/index' -import { Route as RedirectTargetRouteImport } from './routes/redirect/$target' -import { Route as SearchParamsIndexRouteImport } from './routes/search-params/index' -import { Route as SearchParamsDefaultRouteImport } from './routes/search-params/default' -import { Route as SearchParamsLoaderThrowsRedirectRouteImport } from './routes/search-params/loader-throws-redirect' -import { Route as SpecialCharsParamRouteImport } from './routes/specialChars/$param' -import { Route as SpecialCharsHashRouteImport } from './routes/specialChars/hash' -import { Route as SpecialCharsMalformedRouteRouteImport } from './routes/specialChars/malformed/route' -import { Route as SpecialCharsSearchRouteImport } from './routes/specialChars/search' -import { Route as SpecialCharsChar45824Char54620Char48124Char44397RouteImport } from './routes/specialChars/대한민국' -import { Route as UsersIndexRouteImport } from './routes/users.index' -import { Route as UsersUserIdRouteImport } from './routes/users.$userId' -import { Route as LayoutLayout2LayoutARouteImport } from './routes/_layout/_layout-2/layout-a' -import { Route as LayoutLayout2LayoutBRouteImport } from './routes/_layout/_layout-2/layout-b' -import { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId' -import { Route as NotFoundParentBoundaryViaBeforeLoadRouteImport } from './routes/not-found/parent-boundary/via-beforeLoad' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep' -import { Route as RedirectTargetIndexRouteImport } from './routes/redirect/$target/index' -import { Route as RedirectTargetViaBeforeLoadRouteImport } from './routes/redirect/$target/via-beforeLoad' -import { Route as RedirectTargetViaLoaderRouteImport } from './routes/redirect/$target/via-loader' -import { Route as SpecialCharsMalformedParamRouteImport } from './routes/specialChars/malformed/$param' -import { Route as SpecialCharsMalformedSearchRouteImport } from './routes/specialChars/malformed/search' -import { Route as TransitionCountCreateResourceRouteImport } from './routes/transition/count/create-resource' -import { Route as TransitionTypingCreateResourceRouteImport } from './routes/transition/typing/create-resource' -import { Route as RedirectTargetServerFnIndexRouteImport } from './routes/redirect/$target/serverFn/index' -import { Route as RedirectTargetServerFnViaBeforeLoadRouteImport } from './routes/redirect/$target/serverFn/via-beforeLoad' -import { Route as RedirectTargetServerFnViaLoaderRouteImport } from './routes/redirect/$target/serverFn/via-loader' -import { Route as RedirectTargetServerFnViaUseServerFnRouteImport } from './routes/redirect/$target/serverFn/via-useServerFn' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutRoute = LayoutRouteImport.update({ - id: '/_layout', - getParentRoute: () => rootRouteImport, -} as any) -const DeferredRoute = DeferredRouteImport.update({ - id: '/deferred', - path: '/deferred', - getParentRoute: () => rootRouteImport, -} as any) -const DeferredWithoutSuspenseRoute = DeferredWithoutSuspenseRouteImport.update({ - id: '/deferred-without-suspense', - path: '/deferred-without-suspense', - getParentRoute: () => rootRouteImport, -} as any) -const ErrorNormalizationRoute = ErrorNormalizationRouteImport.update({ - id: '/error-normalization', - path: '/error-normalization', - getParentRoute: () => rootRouteImport, -} as any) -const InlineScriptsRoute = InlineScriptsRouteImport.update({ - id: '/inline-scripts', - path: '/inline-scripts', - getParentRoute: () => rootRouteImport, -} as any) -const LinksRoute = LinksRouteImport.update({ - id: '/links', - path: '/links', - getParentRoute: () => rootRouteImport, -} as any) -const NotFoundRouteRoute = NotFoundRouteRouteImport.update({ - id: '/not-found', - path: '/not-found', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const RawStreamRoute = RawStreamRouteImport.update({ - id: '/raw-stream', - path: '/raw-stream', - getParentRoute: () => rootRouteImport, -} as any) -const ScriptsRoute = ScriptsRouteImport.update({ - id: '/scripts', - path: '/scripts', - getParentRoute: () => rootRouteImport, -} as any) -const SearchParamsRouteRoute = SearchParamsRouteRouteImport.update({ - id: '/search-params', - path: '/search-params', - getParentRoute: () => rootRouteImport, -} as any) -const SpecialCharsRouteRoute = SpecialCharsRouteRouteImport.update({ - id: '/specialChars', - path: '/specialChars', - getParentRoute: () => rootRouteImport, -} as any) -const StreamRoute = StreamRouteImport.update({ - id: '/stream', - path: '/stream', - getParentRoute: () => rootRouteImport, -} as any) -const UsersRoute = UsersRouteImport.update({ - id: '/users', - path: '/users', - getParentRoute: () => rootRouteImport, -} as any) -const LayoutLayout2Route = LayoutLayout2RouteImport.update({ - id: '/_layout-2', - getParentRoute: () => LayoutRoute, -} as any) -const ApiUsersRoute = ApiUsersRouteImport.update({ - id: '/api/users', - path: '/api/users', - getParentRoute: () => rootRouteImport, -} as any) -const MultiCookieRedirectIndexRoute = - MultiCookieRedirectIndexRouteImport.update({ - id: '/multi-cookie-redirect/', - path: '/multi-cookie-redirect/', - getParentRoute: () => rootRouteImport, - } as any) -const MultiCookieRedirectTargetRoute = - MultiCookieRedirectTargetRouteImport.update({ - id: '/multi-cookie-redirect/target', - path: '/multi-cookie-redirect/target', - getParentRoute: () => rootRouteImport, - } as any) -const NotFoundIndexRoute = NotFoundIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const NotFoundParentBoundaryRouteRoute = - NotFoundParentBoundaryRouteRouteImport.update({ - id: '/parent-boundary', - path: '/parent-boundary', - getParentRoute: () => NotFoundRouteRoute, - } as any) -const NotFoundViaBeforeLoadRoute = NotFoundViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const NotFoundViaBeforeLoadTargetRootRoute = - NotFoundViaBeforeLoadTargetRootRouteImport.update({ - id: '/via-beforeLoad-target-root', - path: '/via-beforeLoad-target-root', - getParentRoute: () => NotFoundRouteRoute, - } as any) -const NotFoundViaLoaderRoute = NotFoundViaLoaderRouteImport.update({ - id: '/via-loader', - path: '/via-loader', - getParentRoute: () => NotFoundRouteRoute, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const RawStreamIndexRoute = RawStreamIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamClientCallRoute = RawStreamClientCallRouteImport.update({ - id: '/client-call', - path: '/client-call', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrBinaryHintRoute = RawStreamSsrBinaryHintRouteImport.update({ - id: '/ssr-binary-hint', - path: '/ssr-binary-hint', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrMixedRoute = RawStreamSsrMixedRouteImport.update({ - id: '/ssr-mixed', - path: '/ssr-mixed', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrMultipleRoute = RawStreamSsrMultipleRouteImport.update({ - id: '/ssr-multiple', - path: '/ssr-multiple', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrSingleRoute = RawStreamSsrSingleRouteImport.update({ - id: '/ssr-single', - path: '/ssr-single', - getParentRoute: () => RawStreamRoute, -} as any) -const RawStreamSsrTextHintRoute = RawStreamSsrTextHintRouteImport.update({ - id: '/ssr-text-hint', - path: '/ssr-text-hint', - getParentRoute: () => RawStreamRoute, -} as any) -const RedirectIndexRoute = RedirectIndexRouteImport.update({ - id: '/redirect/', - path: '/redirect/', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetRoute = RedirectTargetRouteImport.update({ - id: '/redirect/$target', - path: '/redirect/$target', - getParentRoute: () => rootRouteImport, -} as any) -const SearchParamsIndexRoute = SearchParamsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const SearchParamsDefaultRoute = SearchParamsDefaultRouteImport.update({ - id: '/default', - path: '/default', - getParentRoute: () => SearchParamsRouteRoute, -} as any) -const SearchParamsLoaderThrowsRedirectRoute = - SearchParamsLoaderThrowsRedirectRouteImport.update({ - id: '/loader-throws-redirect', - path: '/loader-throws-redirect', - getParentRoute: () => SearchParamsRouteRoute, - } as any) -const SpecialCharsParamRoute = SpecialCharsParamRouteImport.update({ - id: '/$param', - path: '/$param', - getParentRoute: () => SpecialCharsRouteRoute, -} as any) -const SpecialCharsHashRoute = SpecialCharsHashRouteImport.update({ - id: '/hash', - path: '/hash', - getParentRoute: () => SpecialCharsRouteRoute, -} as any) -const SpecialCharsMalformedRouteRoute = - SpecialCharsMalformedRouteRouteImport.update({ - id: '/malformed', - path: '/malformed', - getParentRoute: () => SpecialCharsRouteRoute, - } as any) -const SpecialCharsSearchRoute = SpecialCharsSearchRouteImport.update({ - id: '/search', - path: '/search', - getParentRoute: () => SpecialCharsRouteRoute, -} as any) -const SpecialCharsChar45824Char54620Char48124Char44397Route = - SpecialCharsChar45824Char54620Char48124Char44397RouteImport.update({ - id: '/대한민국', - path: '/대한민국', - getParentRoute: () => SpecialCharsRouteRoute, - } as any) -const UsersIndexRoute = UsersIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => UsersRoute, -} as any) -const UsersUserIdRoute = UsersUserIdRouteImport.update({ - id: '/$userId', - path: '/$userId', - getParentRoute: () => UsersRoute, -} as any) -const LayoutLayout2LayoutARoute = LayoutLayout2LayoutARouteImport.update({ - id: '/layout-a', - path: '/layout-a', - getParentRoute: () => LayoutLayout2Route, -} as any) -const LayoutLayout2LayoutBRoute = LayoutLayout2LayoutBRouteImport.update({ - id: '/layout-b', - path: '/layout-b', - getParentRoute: () => LayoutLayout2Route, -} as any) -const ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({ - id: '/$userId', - path: '/$userId', - getParentRoute: () => ApiUsersRoute, -} as any) -const NotFoundParentBoundaryViaBeforeLoadRoute = - NotFoundParentBoundaryViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => NotFoundParentBoundaryRouteRoute, - } as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/posts_/$postId/deep', - path: '/posts/$postId/deep', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectTargetIndexRoute = RedirectTargetIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => RedirectTargetRoute, -} as any) -const RedirectTargetViaBeforeLoadRoute = - RedirectTargetViaBeforeLoadRouteImport.update({ - id: '/via-beforeLoad', - path: '/via-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetViaLoaderRoute = RedirectTargetViaLoaderRouteImport.update({ - id: '/via-loader', - path: '/via-loader', - getParentRoute: () => RedirectTargetRoute, -} as any) -const SpecialCharsMalformedParamRoute = - SpecialCharsMalformedParamRouteImport.update({ - id: '/$param', - path: '/$param', - getParentRoute: () => SpecialCharsMalformedRouteRoute, - } as any) -const SpecialCharsMalformedSearchRoute = - SpecialCharsMalformedSearchRouteImport.update({ - id: '/search', - path: '/search', - getParentRoute: () => SpecialCharsMalformedRouteRoute, - } as any) -const TransitionCountCreateResourceRoute = - TransitionCountCreateResourceRouteImport.update({ - id: '/transition/count/create-resource', - path: '/transition/count/create-resource', - getParentRoute: () => rootRouteImport, - } as any) -const TransitionTypingCreateResourceRoute = - TransitionTypingCreateResourceRouteImport.update({ - id: '/transition/typing/create-resource', - path: '/transition/typing/create-resource', - getParentRoute: () => rootRouteImport, - } as any) -const RedirectTargetServerFnIndexRoute = - RedirectTargetServerFnIndexRouteImport.update({ - id: '/serverFn/', - path: '/serverFn/', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetServerFnViaBeforeLoadRoute = - RedirectTargetServerFnViaBeforeLoadRouteImport.update({ - id: '/serverFn/via-beforeLoad', - path: '/serverFn/via-beforeLoad', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetServerFnViaLoaderRoute = - RedirectTargetServerFnViaLoaderRouteImport.update({ - id: '/serverFn/via-loader', - path: '/serverFn/via-loader', - getParentRoute: () => RedirectTargetRoute, - } as any) -const RedirectTargetServerFnViaUseServerFnRoute = - RedirectTargetServerFnViaUseServerFnRouteImport.update({ - id: '/serverFn/via-useServerFn', - path: '/serverFn/via-useServerFn', - getParentRoute: () => RedirectTargetRoute, - } as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/not-found': typeof NotFoundRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/specialChars': typeof SpecialCharsRouteRouteWithChildren - '/deferred': typeof DeferredRoute - '/deferred-without-suspense': typeof DeferredWithoutSuspenseRoute - '/error-normalization': typeof ErrorNormalizationRoute - '/inline-scripts': typeof InlineScriptsRoute - '/links': typeof LinksRoute - '/posts': typeof PostsRouteWithChildren - '/raw-stream': typeof RawStreamRouteWithChildren - '/scripts': typeof ScriptsRoute - '/stream': typeof StreamRoute - '/users': typeof UsersRouteWithChildren - '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren - '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute - '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute - '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute - '/not-found/via-loader': typeof NotFoundViaLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/raw-stream/client-call': typeof RawStreamClientCallRoute - '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute - '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute - '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute - '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute - '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute - '/specialChars/$param': typeof SpecialCharsParamRoute - '/specialChars/hash': typeof SpecialCharsHashRoute - '/specialChars/search': typeof SpecialCharsSearchRoute - '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route - '/users/$userId': typeof UsersUserIdRoute - '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute - '/not-found/': typeof NotFoundIndexRoute - '/posts/': typeof PostsIndexRoute - '/raw-stream/': typeof RawStreamIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/users/': typeof UsersIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/api/users/$userId': typeof ApiUsersUserIdRoute - '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute - '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute - '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute - '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute - '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute - '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute - '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/specialChars': typeof SpecialCharsRouteRouteWithChildren - '/deferred': typeof DeferredRoute - '/deferred-without-suspense': typeof DeferredWithoutSuspenseRoute - '/error-normalization': typeof ErrorNormalizationRoute - '/inline-scripts': typeof InlineScriptsRoute - '/links': typeof LinksRoute - '/scripts': typeof ScriptsRoute - '/stream': typeof StreamRoute - '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren - '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute - '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute - '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute - '/not-found/via-loader': typeof NotFoundViaLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/raw-stream/client-call': typeof RawStreamClientCallRoute - '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute - '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute - '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute - '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute - '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute - '/search-params/default': typeof SearchParamsDefaultRoute - '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute - '/specialChars/$param': typeof SpecialCharsParamRoute - '/specialChars/hash': typeof SpecialCharsHashRoute - '/specialChars/search': typeof SpecialCharsSearchRoute - '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route - '/users/$userId': typeof UsersUserIdRoute - '/multi-cookie-redirect': typeof MultiCookieRedirectIndexRoute - '/not-found': typeof NotFoundIndexRoute - '/posts': typeof PostsIndexRoute - '/raw-stream': typeof RawStreamIndexRoute - '/redirect': typeof RedirectIndexRoute - '/search-params': typeof SearchParamsIndexRoute - '/users': typeof UsersIndexRoute - '/layout-a': typeof LayoutLayout2LayoutARoute - '/layout-b': typeof LayoutLayout2LayoutBRoute - '/api/users/$userId': typeof ApiUsersUserIdRoute - '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute - '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute - '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute - '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute - '/redirect/$target': typeof RedirectTargetIndexRoute - '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute - '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute - '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute - '/redirect/$target/serverFn': typeof RedirectTargetServerFnIndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/not-found': typeof NotFoundRouteRouteWithChildren - '/search-params': typeof SearchParamsRouteRouteWithChildren - '/specialChars': typeof SpecialCharsRouteRouteWithChildren - '/_layout': typeof LayoutRouteWithChildren - '/deferred': typeof DeferredRoute - '/deferred-without-suspense': typeof DeferredWithoutSuspenseRoute - '/error-normalization': typeof ErrorNormalizationRoute - '/inline-scripts': typeof InlineScriptsRoute - '/links': typeof LinksRoute - '/posts': typeof PostsRouteWithChildren - '/raw-stream': typeof RawStreamRouteWithChildren - '/scripts': typeof ScriptsRoute - '/stream': typeof StreamRoute - '/users': typeof UsersRouteWithChildren - '/not-found/parent-boundary': typeof NotFoundParentBoundaryRouteRouteWithChildren - '/specialChars/malformed': typeof SpecialCharsMalformedRouteRouteWithChildren - '/_layout/_layout-2': typeof LayoutLayout2RouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/multi-cookie-redirect/target': typeof MultiCookieRedirectTargetRoute - '/not-found/via-beforeLoad': typeof NotFoundViaBeforeLoadRoute - '/not-found/via-beforeLoad-target-root': typeof NotFoundViaBeforeLoadTargetRootRoute - '/not-found/via-loader': typeof NotFoundViaLoaderRoute - '/posts/$postId': typeof PostsPostIdRoute - '/raw-stream/client-call': typeof RawStreamClientCallRoute - '/raw-stream/ssr-binary-hint': typeof RawStreamSsrBinaryHintRoute - '/raw-stream/ssr-mixed': typeof RawStreamSsrMixedRoute - '/raw-stream/ssr-multiple': typeof RawStreamSsrMultipleRoute - '/raw-stream/ssr-single': typeof RawStreamSsrSingleRoute - '/raw-stream/ssr-text-hint': typeof RawStreamSsrTextHintRoute - '/redirect/$target': typeof RedirectTargetRouteWithChildren - '/search-params/default': typeof SearchParamsDefaultRoute - '/search-params/loader-throws-redirect': typeof SearchParamsLoaderThrowsRedirectRoute - '/specialChars/$param': typeof SpecialCharsParamRoute - '/specialChars/hash': typeof SpecialCharsHashRoute - '/specialChars/search': typeof SpecialCharsSearchRoute - '/specialChars/대한민국': typeof SpecialCharsChar45824Char54620Char48124Char44397Route - '/users/$userId': typeof UsersUserIdRoute - '/multi-cookie-redirect/': typeof MultiCookieRedirectIndexRoute - '/not-found/': typeof NotFoundIndexRoute - '/posts/': typeof PostsIndexRoute - '/raw-stream/': typeof RawStreamIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/search-params/': typeof SearchParamsIndexRoute - '/users/': typeof UsersIndexRoute - '/_layout/_layout-2/layout-a': typeof LayoutLayout2LayoutARoute - '/_layout/_layout-2/layout-b': typeof LayoutLayout2LayoutBRoute - '/api/users/$userId': typeof ApiUsersUserIdRoute - '/not-found/parent-boundary/via-beforeLoad': typeof NotFoundParentBoundaryViaBeforeLoadRoute - '/posts_/$postId/deep': typeof PostsPostIdDeepRoute - '/redirect/$target/via-beforeLoad': typeof RedirectTargetViaBeforeLoadRoute - '/redirect/$target/via-loader': typeof RedirectTargetViaLoaderRoute - '/specialChars/malformed/$param': typeof SpecialCharsMalformedParamRoute - '/specialChars/malformed/search': typeof SpecialCharsMalformedSearchRoute - '/transition/count/create-resource': typeof TransitionCountCreateResourceRoute - '/transition/typing/create-resource': typeof TransitionTypingCreateResourceRoute - '/redirect/$target/': typeof RedirectTargetIndexRoute - '/redirect/$target/serverFn/via-beforeLoad': typeof RedirectTargetServerFnViaBeforeLoadRoute - '/redirect/$target/serverFn/via-loader': typeof RedirectTargetServerFnViaLoaderRoute - '/redirect/$target/serverFn/via-useServerFn': typeof RedirectTargetServerFnViaUseServerFnRoute - '/redirect/$target/serverFn/': typeof RedirectTargetServerFnIndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/not-found' - | '/search-params' - | '/specialChars' - | '/deferred' - | '/deferred-without-suspense' - | '/error-normalization' - | '/inline-scripts' - | '/links' - | '/posts' - | '/raw-stream' - | '/scripts' - | '/stream' - | '/users' - | '/not-found/parent-boundary' - | '/specialChars/malformed' - | '/api/users' - | '/multi-cookie-redirect/target' - | '/not-found/via-beforeLoad' - | '/not-found/via-beforeLoad-target-root' - | '/not-found/via-loader' - | '/posts/$postId' - | '/raw-stream/client-call' - | '/raw-stream/ssr-binary-hint' - | '/raw-stream/ssr-mixed' - | '/raw-stream/ssr-multiple' - | '/raw-stream/ssr-single' - | '/raw-stream/ssr-text-hint' - | '/redirect/$target' - | '/search-params/default' - | '/search-params/loader-throws-redirect' - | '/specialChars/$param' - | '/specialChars/hash' - | '/specialChars/search' - | '/specialChars/대한민국' - | '/users/$userId' - | '/multi-cookie-redirect/' - | '/not-found/' - | '/posts/' - | '/raw-stream/' - | '/redirect/' - | '/search-params/' - | '/users/' - | '/layout-a' - | '/layout-b' - | '/api/users/$userId' - | '/not-found/parent-boundary/via-beforeLoad' - | '/posts/$postId/deep' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/specialChars/malformed/$param' - | '/specialChars/malformed/search' - | '/transition/count/create-resource' - | '/transition/typing/create-resource' - | '/redirect/$target/' - | '/redirect/$target/serverFn/via-beforeLoad' - | '/redirect/$target/serverFn/via-loader' - | '/redirect/$target/serverFn/via-useServerFn' - | '/redirect/$target/serverFn/' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/specialChars' - | '/deferred' - | '/deferred-without-suspense' - | '/error-normalization' - | '/inline-scripts' - | '/links' - | '/scripts' - | '/stream' - | '/not-found/parent-boundary' - | '/specialChars/malformed' - | '/api/users' - | '/multi-cookie-redirect/target' - | '/not-found/via-beforeLoad' - | '/not-found/via-beforeLoad-target-root' - | '/not-found/via-loader' - | '/posts/$postId' - | '/raw-stream/client-call' - | '/raw-stream/ssr-binary-hint' - | '/raw-stream/ssr-mixed' - | '/raw-stream/ssr-multiple' - | '/raw-stream/ssr-single' - | '/raw-stream/ssr-text-hint' - | '/search-params/default' - | '/search-params/loader-throws-redirect' - | '/specialChars/$param' - | '/specialChars/hash' - | '/specialChars/search' - | '/specialChars/대한민국' - | '/users/$userId' - | '/multi-cookie-redirect' - | '/not-found' - | '/posts' - | '/raw-stream' - | '/redirect' - | '/search-params' - | '/users' - | '/layout-a' - | '/layout-b' - | '/api/users/$userId' - | '/not-found/parent-boundary/via-beforeLoad' - | '/posts/$postId/deep' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/specialChars/malformed/$param' - | '/specialChars/malformed/search' - | '/transition/count/create-resource' - | '/transition/typing/create-resource' - | '/redirect/$target' - | '/redirect/$target/serverFn/via-beforeLoad' - | '/redirect/$target/serverFn/via-loader' - | '/redirect/$target/serverFn/via-useServerFn' - | '/redirect/$target/serverFn' - id: - | '__root__' - | '/' - | '/not-found' - | '/search-params' - | '/specialChars' - | '/_layout' - | '/deferred' - | '/deferred-without-suspense' - | '/error-normalization' - | '/inline-scripts' - | '/links' - | '/posts' - | '/raw-stream' - | '/scripts' - | '/stream' - | '/users' - | '/not-found/parent-boundary' - | '/specialChars/malformed' - | '/_layout/_layout-2' - | '/api/users' - | '/multi-cookie-redirect/target' - | '/not-found/via-beforeLoad' - | '/not-found/via-beforeLoad-target-root' - | '/not-found/via-loader' - | '/posts/$postId' - | '/raw-stream/client-call' - | '/raw-stream/ssr-binary-hint' - | '/raw-stream/ssr-mixed' - | '/raw-stream/ssr-multiple' - | '/raw-stream/ssr-single' - | '/raw-stream/ssr-text-hint' - | '/redirect/$target' - | '/search-params/default' - | '/search-params/loader-throws-redirect' - | '/specialChars/$param' - | '/specialChars/hash' - | '/specialChars/search' - | '/specialChars/대한민국' - | '/users/$userId' - | '/multi-cookie-redirect/' - | '/not-found/' - | '/posts/' - | '/raw-stream/' - | '/redirect/' - | '/search-params/' - | '/users/' - | '/_layout/_layout-2/layout-a' - | '/_layout/_layout-2/layout-b' - | '/api/users/$userId' - | '/not-found/parent-boundary/via-beforeLoad' - | '/posts_/$postId/deep' - | '/redirect/$target/via-beforeLoad' - | '/redirect/$target/via-loader' - | '/specialChars/malformed/$param' - | '/specialChars/malformed/search' - | '/transition/count/create-resource' - | '/transition/typing/create-resource' - | '/redirect/$target/' - | '/redirect/$target/serverFn/via-beforeLoad' - | '/redirect/$target/serverFn/via-loader' - | '/redirect/$target/serverFn/via-useServerFn' - | '/redirect/$target/serverFn/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - NotFoundRouteRoute: typeof NotFoundRouteRouteWithChildren - SearchParamsRouteRoute: typeof SearchParamsRouteRouteWithChildren - SpecialCharsRouteRoute: typeof SpecialCharsRouteRouteWithChildren - LayoutRoute: typeof LayoutRouteWithChildren - DeferredRoute: typeof DeferredRoute - DeferredWithoutSuspenseRoute: typeof DeferredWithoutSuspenseRoute - ErrorNormalizationRoute: typeof ErrorNormalizationRoute - InlineScriptsRoute: typeof InlineScriptsRoute - LinksRoute: typeof LinksRoute - PostsRoute: typeof PostsRouteWithChildren - RawStreamRoute: typeof RawStreamRouteWithChildren - ScriptsRoute: typeof ScriptsRoute - StreamRoute: typeof StreamRoute - UsersRoute: typeof UsersRouteWithChildren - ApiUsersRoute: typeof ApiUsersRouteWithChildren - MultiCookieRedirectTargetRoute: typeof MultiCookieRedirectTargetRoute - RedirectTargetRoute: typeof RedirectTargetRouteWithChildren - MultiCookieRedirectIndexRoute: typeof MultiCookieRedirectIndexRoute - RedirectIndexRoute: typeof RedirectIndexRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute - TransitionCountCreateResourceRoute: typeof TransitionCountCreateResourceRoute - TransitionTypingCreateResourceRoute: typeof TransitionTypingCreateResourceRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout': { - id: '/_layout' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutRouteImport - parentRoute: typeof rootRouteImport - } - '/deferred': { - id: '/deferred' - path: '/deferred' - fullPath: '/deferred' - preLoaderRoute: typeof DeferredRouteImport - parentRoute: typeof rootRouteImport - } - '/deferred-without-suspense': { - id: '/deferred-without-suspense' - path: '/deferred-without-suspense' - fullPath: '/deferred-without-suspense' - preLoaderRoute: typeof DeferredWithoutSuspenseRouteImport - parentRoute: typeof rootRouteImport - } - '/error-normalization': { - id: '/error-normalization' - path: '/error-normalization' - fullPath: '/error-normalization' - preLoaderRoute: typeof ErrorNormalizationRouteImport - parentRoute: typeof rootRouteImport - } - '/inline-scripts': { - id: '/inline-scripts' - path: '/inline-scripts' - fullPath: '/inline-scripts' - preLoaderRoute: typeof InlineScriptsRouteImport - parentRoute: typeof rootRouteImport - } - '/links': { - id: '/links' - path: '/links' - fullPath: '/links' - preLoaderRoute: typeof LinksRouteImport - parentRoute: typeof rootRouteImport - } - '/not-found': { - id: '/not-found' - path: '/not-found' - fullPath: '/not-found' - preLoaderRoute: typeof NotFoundRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/raw-stream': { - id: '/raw-stream' - path: '/raw-stream' - fullPath: '/raw-stream' - preLoaderRoute: typeof RawStreamRouteImport - parentRoute: typeof rootRouteImport - } - '/scripts': { - id: '/scripts' - path: '/scripts' - fullPath: '/scripts' - preLoaderRoute: typeof ScriptsRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params': { - id: '/search-params' - path: '/search-params' - fullPath: '/search-params' - preLoaderRoute: typeof SearchParamsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/specialChars': { - id: '/specialChars' - path: '/specialChars' - fullPath: '/specialChars' - preLoaderRoute: typeof SpecialCharsRouteRouteImport - parentRoute: typeof rootRouteImport - } - '/stream': { - id: '/stream' - path: '/stream' - fullPath: '/stream' - preLoaderRoute: typeof StreamRouteImport - parentRoute: typeof rootRouteImport - } - '/users': { - id: '/users' - path: '/users' - fullPath: '/users' - preLoaderRoute: typeof UsersRouteImport - parentRoute: typeof rootRouteImport - } - '/_layout/_layout-2': { - id: '/_layout/_layout-2' - path: '' - fullPath: '/' - preLoaderRoute: typeof LayoutLayout2RouteImport - parentRoute: typeof LayoutRoute - } - '/api/users': { - id: '/api/users' - path: '/api/users' - fullPath: '/api/users' - preLoaderRoute: typeof ApiUsersRouteImport - parentRoute: typeof rootRouteImport - } - '/multi-cookie-redirect/': { - id: '/multi-cookie-redirect/' - path: '/multi-cookie-redirect' - fullPath: '/multi-cookie-redirect/' - preLoaderRoute: typeof MultiCookieRedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/multi-cookie-redirect/target': { - id: '/multi-cookie-redirect/target' - path: '/multi-cookie-redirect/target' - fullPath: '/multi-cookie-redirect/target' - preLoaderRoute: typeof MultiCookieRedirectTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/not-found/': { - id: '/not-found/' - path: '/' - fullPath: '/not-found/' - preLoaderRoute: typeof NotFoundIndexRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/parent-boundary': { - id: '/not-found/parent-boundary' - path: '/parent-boundary' - fullPath: '/not-found/parent-boundary' - preLoaderRoute: typeof NotFoundParentBoundaryRouteRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/via-beforeLoad': { - id: '/not-found/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/not-found/via-beforeLoad' - preLoaderRoute: typeof NotFoundViaBeforeLoadRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/via-beforeLoad-target-root': { - id: '/not-found/via-beforeLoad-target-root' - path: '/via-beforeLoad-target-root' - fullPath: '/not-found/via-beforeLoad-target-root' - preLoaderRoute: typeof NotFoundViaBeforeLoadTargetRootRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/not-found/via-loader': { - id: '/not-found/via-loader' - path: '/via-loader' - fullPath: '/not-found/via-loader' - preLoaderRoute: typeof NotFoundViaLoaderRouteImport - parentRoute: typeof NotFoundRouteRoute - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/raw-stream/': { - id: '/raw-stream/' - path: '/' - fullPath: '/raw-stream/' - preLoaderRoute: typeof RawStreamIndexRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/client-call': { - id: '/raw-stream/client-call' - path: '/client-call' - fullPath: '/raw-stream/client-call' - preLoaderRoute: typeof RawStreamClientCallRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-binary-hint': { - id: '/raw-stream/ssr-binary-hint' - path: '/ssr-binary-hint' - fullPath: '/raw-stream/ssr-binary-hint' - preLoaderRoute: typeof RawStreamSsrBinaryHintRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-mixed': { - id: '/raw-stream/ssr-mixed' - path: '/ssr-mixed' - fullPath: '/raw-stream/ssr-mixed' - preLoaderRoute: typeof RawStreamSsrMixedRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-multiple': { - id: '/raw-stream/ssr-multiple' - path: '/ssr-multiple' - fullPath: '/raw-stream/ssr-multiple' - preLoaderRoute: typeof RawStreamSsrMultipleRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-single': { - id: '/raw-stream/ssr-single' - path: '/ssr-single' - fullPath: '/raw-stream/ssr-single' - preLoaderRoute: typeof RawStreamSsrSingleRouteImport - parentRoute: typeof RawStreamRoute - } - '/raw-stream/ssr-text-hint': { - id: '/raw-stream/ssr-text-hint' - path: '/ssr-text-hint' - fullPath: '/raw-stream/ssr-text-hint' - preLoaderRoute: typeof RawStreamSsrTextHintRouteImport - parentRoute: typeof RawStreamRoute - } - '/redirect/': { - id: '/redirect/' - path: '/redirect' - fullPath: '/redirect/' - preLoaderRoute: typeof RedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target': { - id: '/redirect/$target' - path: '/redirect/$target' - fullPath: '/redirect/$target' - preLoaderRoute: typeof RedirectTargetRouteImport - parentRoute: typeof rootRouteImport - } - '/search-params/': { - id: '/search-params/' - path: '/' - fullPath: '/search-params/' - preLoaderRoute: typeof SearchParamsIndexRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/search-params/default': { - id: '/search-params/default' - path: '/default' - fullPath: '/search-params/default' - preLoaderRoute: typeof SearchParamsDefaultRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/search-params/loader-throws-redirect': { - id: '/search-params/loader-throws-redirect' - path: '/loader-throws-redirect' - fullPath: '/search-params/loader-throws-redirect' - preLoaderRoute: typeof SearchParamsLoaderThrowsRedirectRouteImport - parentRoute: typeof SearchParamsRouteRoute - } - '/specialChars/$param': { - id: '/specialChars/$param' - path: '/$param' - fullPath: '/specialChars/$param' - preLoaderRoute: typeof SpecialCharsParamRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/hash': { - id: '/specialChars/hash' - path: '/hash' - fullPath: '/specialChars/hash' - preLoaderRoute: typeof SpecialCharsHashRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/malformed': { - id: '/specialChars/malformed' - path: '/malformed' - fullPath: '/specialChars/malformed' - preLoaderRoute: typeof SpecialCharsMalformedRouteRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/search': { - id: '/specialChars/search' - path: '/search' - fullPath: '/specialChars/search' - preLoaderRoute: typeof SpecialCharsSearchRouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/specialChars/대한민국': { - id: '/specialChars/대한민국' - path: '/대한민국' - fullPath: '/specialChars/대한민국' - preLoaderRoute: typeof SpecialCharsChar45824Char54620Char48124Char44397RouteImport - parentRoute: typeof SpecialCharsRouteRoute - } - '/users/': { - id: '/users/' - path: '/' - fullPath: '/users/' - preLoaderRoute: typeof UsersIndexRouteImport - parentRoute: typeof UsersRoute - } - '/users/$userId': { - id: '/users/$userId' - path: '/$userId' - fullPath: '/users/$userId' - preLoaderRoute: typeof UsersUserIdRouteImport - parentRoute: typeof UsersRoute - } - '/_layout/_layout-2/layout-a': { - id: '/_layout/_layout-2/layout-a' - path: '/layout-a' - fullPath: '/layout-a' - preLoaderRoute: typeof LayoutLayout2LayoutARouteImport - parentRoute: typeof LayoutLayout2Route - } - '/_layout/_layout-2/layout-b': { - id: '/_layout/_layout-2/layout-b' - path: '/layout-b' - fullPath: '/layout-b' - preLoaderRoute: typeof LayoutLayout2LayoutBRouteImport - parentRoute: typeof LayoutLayout2Route - } - '/api/users/$userId': { - id: '/api/users/$userId' - path: '/$userId' - fullPath: '/api/users/$userId' - preLoaderRoute: typeof ApiUsersUserIdRouteImport - parentRoute: typeof ApiUsersRoute - } - '/not-found/parent-boundary/via-beforeLoad': { - id: '/not-found/parent-boundary/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/not-found/parent-boundary/via-beforeLoad' - preLoaderRoute: typeof NotFoundParentBoundaryViaBeforeLoadRouteImport - parentRoute: typeof NotFoundParentBoundaryRouteRoute - } - '/posts_/$postId/deep': { - id: '/posts_/$postId/deep' - path: '/posts/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target/': { - id: '/redirect/$target/' - path: '/' - fullPath: '/redirect/$target/' - preLoaderRoute: typeof RedirectTargetIndexRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-beforeLoad': { - id: '/redirect/$target/via-beforeLoad' - path: '/via-beforeLoad' - fullPath: '/redirect/$target/via-beforeLoad' - preLoaderRoute: typeof RedirectTargetViaBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/via-loader': { - id: '/redirect/$target/via-loader' - path: '/via-loader' - fullPath: '/redirect/$target/via-loader' - preLoaderRoute: typeof RedirectTargetViaLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/specialChars/malformed/$param': { - id: '/specialChars/malformed/$param' - path: '/$param' - fullPath: '/specialChars/malformed/$param' - preLoaderRoute: typeof SpecialCharsMalformedParamRouteImport - parentRoute: typeof SpecialCharsMalformedRouteRoute - } - '/specialChars/malformed/search': { - id: '/specialChars/malformed/search' - path: '/search' - fullPath: '/specialChars/malformed/search' - preLoaderRoute: typeof SpecialCharsMalformedSearchRouteImport - parentRoute: typeof SpecialCharsMalformedRouteRoute - } - '/transition/count/create-resource': { - id: '/transition/count/create-resource' - path: '/transition/count/create-resource' - fullPath: '/transition/count/create-resource' - preLoaderRoute: typeof TransitionCountCreateResourceRouteImport - parentRoute: typeof rootRouteImport - } - '/transition/typing/create-resource': { - id: '/transition/typing/create-resource' - path: '/transition/typing/create-resource' - fullPath: '/transition/typing/create-resource' - preLoaderRoute: typeof TransitionTypingCreateResourceRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/$target/serverFn/': { - id: '/redirect/$target/serverFn/' - path: '/serverFn' - fullPath: '/redirect/$target/serverFn/' - preLoaderRoute: typeof RedirectTargetServerFnIndexRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/serverFn/via-beforeLoad': { - id: '/redirect/$target/serverFn/via-beforeLoad' - path: '/serverFn/via-beforeLoad' - fullPath: '/redirect/$target/serverFn/via-beforeLoad' - preLoaderRoute: typeof RedirectTargetServerFnViaBeforeLoadRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/serverFn/via-loader': { - id: '/redirect/$target/serverFn/via-loader' - path: '/serverFn/via-loader' - fullPath: '/redirect/$target/serverFn/via-loader' - preLoaderRoute: typeof RedirectTargetServerFnViaLoaderRouteImport - parentRoute: typeof RedirectTargetRoute - } - '/redirect/$target/serverFn/via-useServerFn': { - id: '/redirect/$target/serverFn/via-useServerFn' - path: '/serverFn/via-useServerFn' - fullPath: '/redirect/$target/serverFn/via-useServerFn' - preLoaderRoute: typeof RedirectTargetServerFnViaUseServerFnRouteImport - parentRoute: typeof RedirectTargetRoute - } - } -} - -interface NotFoundParentBoundaryRouteRouteChildren { - NotFoundParentBoundaryViaBeforeLoadRoute: typeof NotFoundParentBoundaryViaBeforeLoadRoute -} - -const NotFoundParentBoundaryRouteRouteChildren: NotFoundParentBoundaryRouteRouteChildren = - { - NotFoundParentBoundaryViaBeforeLoadRoute: - NotFoundParentBoundaryViaBeforeLoadRoute, - } - -const NotFoundParentBoundaryRouteRouteWithChildren = - NotFoundParentBoundaryRouteRoute._addFileChildren( - NotFoundParentBoundaryRouteRouteChildren, - ) - -interface NotFoundRouteRouteChildren { - NotFoundParentBoundaryRouteRoute: typeof NotFoundParentBoundaryRouteRouteWithChildren - NotFoundViaBeforeLoadRoute: typeof NotFoundViaBeforeLoadRoute - NotFoundViaBeforeLoadTargetRootRoute: typeof NotFoundViaBeforeLoadTargetRootRoute - NotFoundViaLoaderRoute: typeof NotFoundViaLoaderRoute - NotFoundIndexRoute: typeof NotFoundIndexRoute -} - -const NotFoundRouteRouteChildren: NotFoundRouteRouteChildren = { - NotFoundParentBoundaryRouteRoute: - NotFoundParentBoundaryRouteRouteWithChildren, - NotFoundViaBeforeLoadRoute: NotFoundViaBeforeLoadRoute, - NotFoundViaBeforeLoadTargetRootRoute: NotFoundViaBeforeLoadTargetRootRoute, - NotFoundViaLoaderRoute: NotFoundViaLoaderRoute, - NotFoundIndexRoute: NotFoundIndexRoute, -} - -const NotFoundRouteRouteWithChildren = NotFoundRouteRoute._addFileChildren( - NotFoundRouteRouteChildren, -) - -interface SearchParamsRouteRouteChildren { - SearchParamsDefaultRoute: typeof SearchParamsDefaultRoute - SearchParamsLoaderThrowsRedirectRoute: typeof SearchParamsLoaderThrowsRedirectRoute - SearchParamsIndexRoute: typeof SearchParamsIndexRoute -} - -const SearchParamsRouteRouteChildren: SearchParamsRouteRouteChildren = { - SearchParamsDefaultRoute: SearchParamsDefaultRoute, - SearchParamsLoaderThrowsRedirectRoute: SearchParamsLoaderThrowsRedirectRoute, - SearchParamsIndexRoute: SearchParamsIndexRoute, -} - -const SearchParamsRouteRouteWithChildren = - SearchParamsRouteRoute._addFileChildren(SearchParamsRouteRouteChildren) - -interface SpecialCharsMalformedRouteRouteChildren { - SpecialCharsMalformedParamRoute: typeof SpecialCharsMalformedParamRoute - SpecialCharsMalformedSearchRoute: typeof SpecialCharsMalformedSearchRoute -} - -const SpecialCharsMalformedRouteRouteChildren: SpecialCharsMalformedRouteRouteChildren = - { - SpecialCharsMalformedParamRoute: SpecialCharsMalformedParamRoute, - SpecialCharsMalformedSearchRoute: SpecialCharsMalformedSearchRoute, - } - -const SpecialCharsMalformedRouteRouteWithChildren = - SpecialCharsMalformedRouteRoute._addFileChildren( - SpecialCharsMalformedRouteRouteChildren, - ) - -interface SpecialCharsRouteRouteChildren { - SpecialCharsMalformedRouteRoute: typeof SpecialCharsMalformedRouteRouteWithChildren - SpecialCharsParamRoute: typeof SpecialCharsParamRoute - SpecialCharsHashRoute: typeof SpecialCharsHashRoute - SpecialCharsSearchRoute: typeof SpecialCharsSearchRoute - SpecialCharsChar45824Char54620Char48124Char44397Route: typeof SpecialCharsChar45824Char54620Char48124Char44397Route -} - -const SpecialCharsRouteRouteChildren: SpecialCharsRouteRouteChildren = { - SpecialCharsMalformedRouteRoute: SpecialCharsMalformedRouteRouteWithChildren, - SpecialCharsParamRoute: SpecialCharsParamRoute, - SpecialCharsHashRoute: SpecialCharsHashRoute, - SpecialCharsSearchRoute: SpecialCharsSearchRoute, - SpecialCharsChar45824Char54620Char48124Char44397Route: - SpecialCharsChar45824Char54620Char48124Char44397Route, -} - -const SpecialCharsRouteRouteWithChildren = - SpecialCharsRouteRoute._addFileChildren(SpecialCharsRouteRouteChildren) - -interface LayoutLayout2RouteChildren { - LayoutLayout2LayoutARoute: typeof LayoutLayout2LayoutARoute - LayoutLayout2LayoutBRoute: typeof LayoutLayout2LayoutBRoute -} - -const LayoutLayout2RouteChildren: LayoutLayout2RouteChildren = { - LayoutLayout2LayoutARoute: LayoutLayout2LayoutARoute, - LayoutLayout2LayoutBRoute: LayoutLayout2LayoutBRoute, -} - -const LayoutLayout2RouteWithChildren = LayoutLayout2Route._addFileChildren( - LayoutLayout2RouteChildren, -) - -interface LayoutRouteChildren { - LayoutLayout2Route: typeof LayoutLayout2RouteWithChildren -} - -const LayoutRouteChildren: LayoutRouteChildren = { - LayoutLayout2Route: LayoutLayout2RouteWithChildren, -} - -const LayoutRouteWithChildren = - LayoutRoute._addFileChildren(LayoutRouteChildren) - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface RawStreamRouteChildren { - RawStreamClientCallRoute: typeof RawStreamClientCallRoute - RawStreamSsrBinaryHintRoute: typeof RawStreamSsrBinaryHintRoute - RawStreamSsrMixedRoute: typeof RawStreamSsrMixedRoute - RawStreamSsrMultipleRoute: typeof RawStreamSsrMultipleRoute - RawStreamSsrSingleRoute: typeof RawStreamSsrSingleRoute - RawStreamSsrTextHintRoute: typeof RawStreamSsrTextHintRoute - RawStreamIndexRoute: typeof RawStreamIndexRoute -} - -const RawStreamRouteChildren: RawStreamRouteChildren = { - RawStreamClientCallRoute: RawStreamClientCallRoute, - RawStreamSsrBinaryHintRoute: RawStreamSsrBinaryHintRoute, - RawStreamSsrMixedRoute: RawStreamSsrMixedRoute, - RawStreamSsrMultipleRoute: RawStreamSsrMultipleRoute, - RawStreamSsrSingleRoute: RawStreamSsrSingleRoute, - RawStreamSsrTextHintRoute: RawStreamSsrTextHintRoute, - RawStreamIndexRoute: RawStreamIndexRoute, -} - -const RawStreamRouteWithChildren = RawStreamRoute._addFileChildren( - RawStreamRouteChildren, -) - -interface UsersRouteChildren { - UsersUserIdRoute: typeof UsersUserIdRoute - UsersIndexRoute: typeof UsersIndexRoute -} - -const UsersRouteChildren: UsersRouteChildren = { - UsersUserIdRoute: UsersUserIdRoute, - UsersIndexRoute: UsersIndexRoute, -} - -const UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren) - -interface ApiUsersRouteChildren { - ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute -} - -const ApiUsersRouteChildren: ApiUsersRouteChildren = { - ApiUsersUserIdRoute: ApiUsersUserIdRoute, -} - -const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren( - ApiUsersRouteChildren, -) - -interface RedirectTargetRouteChildren { - RedirectTargetViaBeforeLoadRoute: typeof RedirectTargetViaBeforeLoadRoute - RedirectTargetViaLoaderRoute: typeof RedirectTargetViaLoaderRoute - RedirectTargetIndexRoute: typeof RedirectTargetIndexRoute - RedirectTargetServerFnViaBeforeLoadRoute: typeof RedirectTargetServerFnViaBeforeLoadRoute - RedirectTargetServerFnViaLoaderRoute: typeof RedirectTargetServerFnViaLoaderRoute - RedirectTargetServerFnViaUseServerFnRoute: typeof RedirectTargetServerFnViaUseServerFnRoute - RedirectTargetServerFnIndexRoute: typeof RedirectTargetServerFnIndexRoute -} - -const RedirectTargetRouteChildren: RedirectTargetRouteChildren = { - RedirectTargetViaBeforeLoadRoute: RedirectTargetViaBeforeLoadRoute, - RedirectTargetViaLoaderRoute: RedirectTargetViaLoaderRoute, - RedirectTargetIndexRoute: RedirectTargetIndexRoute, - RedirectTargetServerFnViaBeforeLoadRoute: - RedirectTargetServerFnViaBeforeLoadRoute, - RedirectTargetServerFnViaLoaderRoute: RedirectTargetServerFnViaLoaderRoute, - RedirectTargetServerFnViaUseServerFnRoute: - RedirectTargetServerFnViaUseServerFnRoute, - RedirectTargetServerFnIndexRoute: RedirectTargetServerFnIndexRoute, -} - -const RedirectTargetRouteWithChildren = RedirectTargetRoute._addFileChildren( - RedirectTargetRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - NotFoundRouteRoute: NotFoundRouteRouteWithChildren, - SearchParamsRouteRoute: SearchParamsRouteRouteWithChildren, - SpecialCharsRouteRoute: SpecialCharsRouteRouteWithChildren, - LayoutRoute: LayoutRouteWithChildren, - DeferredRoute: DeferredRoute, - DeferredWithoutSuspenseRoute: DeferredWithoutSuspenseRoute, - ErrorNormalizationRoute: ErrorNormalizationRoute, - InlineScriptsRoute: InlineScriptsRoute, - LinksRoute: LinksRoute, - PostsRoute: PostsRouteWithChildren, - RawStreamRoute: RawStreamRouteWithChildren, - ScriptsRoute: ScriptsRoute, - StreamRoute: StreamRoute, - UsersRoute: UsersRouteWithChildren, - ApiUsersRoute: ApiUsersRouteWithChildren, - MultiCookieRedirectTargetRoute: MultiCookieRedirectTargetRoute, - RedirectTargetRoute: RedirectTargetRouteWithChildren, - MultiCookieRedirectIndexRoute: MultiCookieRedirectIndexRoute, - RedirectIndexRoute: RedirectIndexRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, - TransitionCountCreateResourceRoute: TransitionCountCreateResourceRoute, - TransitionTypingCreateResourceRoute: TransitionTypingCreateResourceRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/basic/src/router.tsx b/e2e/solid-start/basic/src/router.tsx deleted file mode 100644 index 5da353c1ce..0000000000 --- a/e2e/solid-start/basic/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import { DefaultCatchBoundary } from './components/DefaultCatchBoundary' -import { NotFound } from './components/NotFound' - -export function getRouter() { - const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultErrorComponent: DefaultCatchBoundary, - defaultNotFoundComponent: () => , - scrollRestoration: true, - }) - - return router -} diff --git a/e2e/solid-start/basic/src/routes/__root.tsx b/e2e/solid-start/basic/src/routes/__root.tsx deleted file mode 100644 index c517867dab..0000000000 --- a/e2e/solid-start/basic/src/routes/__root.tsx +++ /dev/null @@ -1,180 +0,0 @@ -/// -import { - ClientOnly, - HeadContent, - Link, - Outlet, - Scripts, - createRootRoute, - useRouterState, -} from '@tanstack/solid-router' - -import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools' -import { HydrationScript } from 'solid-js/web' -import { NotFound } from '~/components/NotFound' -import '~/styles/app.css' -import { seo } from '~/utils/seo' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - ...seo({ - title: - 'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework', - description: `TanStack Start is a type-safe, client-first, full-stack React framework. `, - }), - ], - links: [ - { - rel: 'apple-touch-icon', - sizes: '180x180', - href: '/apple-touch-icon.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '32x32', - href: '/favicon-32x32.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '16x16', - href: '/favicon-16x16.png', - }, - { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' }, - { rel: 'icon', href: '/favicon.ico' }, - ], - styles: [ - { - media: 'all and (min-width: 500px)', - children: ` - .inline-div { - color: white; - background-color: gray; - max-width: 250px; - }`, - }, - ], - }), - errorComponent: (props) =>

{props.error.stack}

, - notFoundComponent: () => , - component: RootComponent, -}) - -function RootComponent() { - const routerState = useRouterState({ - select: (state) => ({ isLoading: state.isLoading, status: state.status }), - }) - - return ( - - - - - - -
- - Home - {' '} - - Posts - {' '} - - Users - {' '} - - Layout - {' '} - - Scripts - {' '} - - Inline Scripts - {' '} - - Deferred - {' '} - - redirect - {' '} - - Raw Stream - {' '} - - This Route Does Not Exist - -
- - - - -
This is an inline styled div
- - - - - ) -} diff --git a/e2e/solid-start/basic/src/routes/_layout.tsx b/e2e/solid-start/basic/src/routes/_layout.tsx deleted file mode 100644 index d43b4ef5f5..0000000000 --- a/e2e/solid-start/basic/src/routes/_layout.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a layout
-
- -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/_layout/_layout-2.tsx b/e2e/solid-start/basic/src/routes/_layout/_layout-2.tsx deleted file mode 100644 index 7a5a3623a0..0000000000 --- a/e2e/solid-start/basic/src/routes/_layout/_layout-2.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/_layout/_layout-2')({ - component: LayoutComponent, -}) - -function LayoutComponent() { - return ( -
-
I'm a nested layout
-
- - Layout A - - - Layout B - -
-
- -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-a.tsx b/e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-a.tsx deleted file mode 100644 index 997e6caf80..0000000000 --- a/e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-a.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-a')({ - component: LayoutAComponent, -}) - -function LayoutAComponent() { - return
I'm layout A!
-} diff --git a/e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-b.tsx b/e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-b.tsx deleted file mode 100644 index 70135c5809..0000000000 --- a/e2e/solid-start/basic/src/routes/_layout/_layout-2/layout-b.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/_layout/_layout-2/layout-b')({ - component: LayoutBComponent, -}) - -function LayoutBComponent() { - return
I'm layout B!
-} diff --git a/e2e/solid-start/basic/src/routes/api/users.$userId.ts b/e2e/solid-start/basic/src/routes/api/users.$userId.ts deleted file mode 100644 index ed90076917..0000000000 --- a/e2e/solid-start/basic/src/routes/api/users.$userId.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import type { User } from '~/utils/users' - -export const Route = createFileRoute('/api/users/$userId')({ - server: { - handlers: { - GET: async ({ params, request }) => { - console.info(`Fetching users by id=${params.userId}... @`, request.url) - try { - const res = await fetch( - `https://jsonplaceholder.typicode.com/users/${params.userId}`, - ) - if (!res.ok) { - throw new Error('Failed to fetch user') - } - const user = (await res.json()) as User - return Response.json({ - id: user.id, - name: user.name, - email: user.email, - }) - } catch (e) { - console.error(e) - return Response.json({ error: 'User not found' }, { status: 404 }) - } - }, - }, - }, -}) diff --git a/e2e/solid-start/basic/src/routes/api/users.ts b/e2e/solid-start/basic/src/routes/api/users.ts deleted file mode 100644 index f2fa98359a..0000000000 --- a/e2e/solid-start/basic/src/routes/api/users.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createMiddleware } from '@tanstack/solid-start' -import type { User } from '~/utils/users' - -const userLoggerMiddleware = createMiddleware().server( - async ({ next, request }) => { - console.info('In: /users') - const result = await next() - result.response.headers.set('x-users', 'true') - console.info('Out: /users') - return result - }, -) - -const testParentMiddleware = createMiddleware().server( - async ({ next, request }) => { - console.info('In: testParentMiddleware') - const result = await next() - result.response.headers.set('x-test-parent', 'true') - console.info('Out: testParentMiddleware') - return result - }, -) - -const testMiddleware = createMiddleware() - .middleware([testParentMiddleware]) - .server(async ({ next, request }) => { - console.info('In: testMiddleware') - const result = await next() - result.response.headers.set('x-test', 'true') - // if (Math.random() > 0.5) { - // throw new Response(null, { - // status: 302, - // headers: { Location: 'https://www.google.com' }, - // }) - // } - console.info('Out: testMiddleware') - return result - }) - -export const Route = createFileRoute('/api/users')({ - server: { - middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware], - handlers: { - GET: async ({ request }) => { - console.info('Fetching users... @', request.url) - const res = await fetch('https://jsonplaceholder.typicode.com/users') - if (!res.ok) { - throw new Error('Failed to fetch users') - } - const data = (await res.json()) as Array - const list = data.slice(0, 10) - return Response.json( - list.map((u) => ({ id: u.id, name: u.name, email: u.email })), - ) - }, - }, - }, -}) diff --git a/e2e/solid-start/basic/src/routes/deferred-without-suspense.tsx b/e2e/solid-start/basic/src/routes/deferred-without-suspense.tsx deleted file mode 100644 index 1238bea151..0000000000 --- a/e2e/solid-start/basic/src/routes/deferred-without-suspense.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' - -const promise = createServerFn().handler(async () => { - await new Promise((r) => setTimeout(r, 3000)) - return crypto.randomUUID() -}) - -export const Route = createFileRoute('/deferred-without-suspense')({ - component: RouteComponent, - loader() { - return { promise: promise() } - }, -}) - -function RouteComponent() { - const data = Route.useLoaderData() - return ( - <> - data{' '} - Loading...

- } - promise={data().promise} - > - {(data) => ( - {data} - )} -
- - ) -} diff --git a/e2e/solid-start/basic/src/routes/deferred.tsx b/e2e/solid-start/basic/src/routes/deferred.tsx deleted file mode 100644 index 2a53643453..0000000000 --- a/e2e/solid-start/basic/src/routes/deferred.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' -import { Suspense, createSignal } from 'solid-js' - -const personServerFn = createServerFn({ method: 'GET' }) - .validator((data: { name: string }) => data) - .handler(({ data }) => { - return { name: data.name, randomNumber: Math.floor(Math.random() * 100) } - }) - -const slowServerFn = createServerFn({ method: 'GET' }) - .validator((data: { name: string }) => data) - .handler(async ({ data }) => { - await new Promise((r) => setTimeout(r, 1000)) - return { name: data.name, randomNumber: Math.floor(Math.random() * 100) } - }) - -export const Route = createFileRoute('/deferred')({ - loader: async () => { - return { - deferredStuff: new Promise((r) => - setTimeout(() => r('Hello deferred!'), 2000), - ), - deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }), - person: await personServerFn({ data: { name: 'John Doe' } }), - } - }, - component: Deferred, -}) - -function Deferred() { - const [count, setCount] = createSignal(0) - // const { deferredStuff, deferredPerson, person } = Route.useLoaderData() - const loaderData = Route.useLoaderData() - - return ( -
-
- {loaderData().person.name} - {loaderData().person.randomNumber} -
- Loading person...
}> - ( -
- {data.name} - {data.randomNumber} -
- )} - /> - - Loading stuff...
}> -

{data}

} - /> - -
Count: {count()}
-
- -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/error-normalization.tsx b/e2e/solid-start/basic/src/routes/error-normalization.tsx deleted file mode 100644 index 12e9d2f205..0000000000 --- a/e2e/solid-start/basic/src/routes/error-normalization.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { createSignal, onMount } from 'solid-js' - -export const Route = createFileRoute('/error-normalization')({ - validateSearch: (search) => ({ - kind: search.kind === 'string' ? ('string' as const) : ('null' as const), - }), - loaderDeps: ({ search }) => search, - loader: ({ deps }) => { - throw deps.kind === 'string' ? 'loader failure' : null - }, - errorComponent: ({ error }) => { - const [hydrated, setHydrated] = createSignal(false) - onMount(() => setHydrated(true)) - - return ( -
- - Throw null - -
- ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/index.tsx b/e2e/solid-start/basic/src/routes/index.tsx deleted file mode 100644 index 6b23caf87b..0000000000 --- a/e2e/solid-start/basic/src/routes/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { CustomMessage } from '~/components/CustomMessage' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!!!

- -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/inline-scripts.tsx b/e2e/solid-start/basic/src/routes/inline-scripts.tsx deleted file mode 100644 index a2833c2ae1..0000000000 --- a/e2e/solid-start/basic/src/routes/inline-scripts.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/inline-scripts')({ - head: () => ({ - scripts: [ - { - children: - 'window.INLINE_SCRIPT_1 = true; console.log("Inline script 1 executed");', - }, - { - children: - 'window.INLINE_SCRIPT_2 = "test"; console.log("Inline script 2 executed");', - type: 'text/javascript', - }, - ], - }), - component: InlineScriptsComponent, -}) - -function InlineScriptsComponent() { - return ( -
-

Inline Scripts Test

-

- This route tests inline script duplication prevention. Two inline - scripts should be loaded. -

-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/links.tsx b/e2e/solid-start/basic/src/routes/links.tsx deleted file mode 100644 index d6ce6a449b..0000000000 --- a/e2e/solid-start/basic/src/routes/links.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/links')({ - component: () => { - const navigate = Route.useNavigate() - return ( -
-

- link test -

-
- - Link to /posts - -
-
- - Link to /posts (reloadDocument=true) - -
-
- -
-
- -
-
- ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/multi-cookie-redirect/index.tsx b/e2e/solid-start/basic/src/routes/multi-cookie-redirect/index.tsx deleted file mode 100644 index a7abb3b009..0000000000 --- a/e2e/solid-start/basic/src/routes/multi-cookie-redirect/index.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' -import { setCookie } from '@tanstack/solid-start/server' - -const setMultipleCookiesAndRedirect = createServerFn().handler(() => { - // Set multiple cookies before redirecting - // This tests that multiple Set-Cookie headers are preserved during redirect - setCookie('session', 'session-value', { path: '/' }) - setCookie('csrf', 'csrf-token-value', { path: '/' }) - setCookie('theme', 'dark', { path: '/' }) - - throw redirect({ to: '/multi-cookie-redirect/target' }) -}) - -export const Route = createFileRoute('/multi-cookie-redirect/')({ - loader: () => setMultipleCookiesAndRedirect(), - component: () => null, -}) diff --git a/e2e/solid-start/basic/src/routes/multi-cookie-redirect/target.tsx b/e2e/solid-start/basic/src/routes/multi-cookie-redirect/target.tsx deleted file mode 100644 index 1ebd4ecb39..0000000000 --- a/e2e/solid-start/basic/src/routes/multi-cookie-redirect/target.tsx +++ /dev/null @@ -1,40 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import Cookies from 'js-cookie' -import * as Solid from 'solid-js' - -export const Route = createFileRoute('/multi-cookie-redirect/target')({ - component: RouteComponent, -}) - -function RouteComponent() { - const [cookies, setCookies] = Solid.createSignal>({}) - - Solid.onMount(() => { - setCookies({ - session: Cookies.get('session') || '', - csrf: Cookies.get('csrf') || '', - theme: Cookies.get('theme') || '', - }) - }) - - return ( -
-

- Multi Cookie Redirect Target -

-
-

- Session cookie:{' '} - {cookies().session} -

-

- CSRF cookie: {cookies().csrf} -

-

- Theme cookie:{' '} - {cookies().theme} -

-
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/not-found/index.tsx b/e2e/solid-start/basic/src/routes/not-found/index.tsx deleted file mode 100644 index 34c8ef6146..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/index.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/not-found/')({ - component: () => { - const preload = Route.useSearch({ select: (s) => s.preload }) - return ( -
-
- - via-beforeLoad - -
-
- - via-loader - -
-
- ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/not-found/parent-boundary/route.tsx b/e2e/solid-start/basic/src/routes/not-found/parent-boundary/route.tsx deleted file mode 100644 index feef2a328c..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/parent-boundary/route.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/not-found/parent-boundary')({ - loader: () => ({ - parentLoaderData: 'ready', - }), - component: RouteComponent, - notFoundComponent: ParentBoundaryNotFoundComponent, -}) - -function RouteComponent() { - return ( -
- -
- ) -} - -function ParentBoundaryNotFoundComponent() { - const loaderData = Route.useLoaderData() - - return ( -
-
- {loaderData().parentLoaderData} -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/not-found/parent-boundary/via-beforeLoad.tsx b/e2e/solid-start/basic/src/routes/not-found/parent-boundary/via-beforeLoad.tsx deleted file mode 100644 index 0b4b6b689e..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/parent-boundary/via-beforeLoad.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { createFileRoute, notFound } from '@tanstack/solid-router' -import { Route as ParentBoundaryRoute } from './route' - -export const Route = createFileRoute( - '/not-found/parent-boundary/via-beforeLoad', -)({ - beforeLoad: () => { - throw notFound({ routeId: ParentBoundaryRoute.id }) - }, - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/not-found/parent-boundary/via-beforeLoad"! -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/not-found/route.tsx b/e2e/solid-start/basic/src/routes/not-found/route.tsx deleted file mode 100644 index 84f5ef81a5..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/route.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import z from 'zod' - -export const Route = createFileRoute('/not-found')({ - validateSearch: z.object({ - preload: z.literal(false).optional(), - }), -}) diff --git a/e2e/solid-start/basic/src/routes/not-found/via-beforeLoad-target-root.tsx b/e2e/solid-start/basic/src/routes/not-found/via-beforeLoad-target-root.tsx deleted file mode 100644 index 3d833ddc78..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/via-beforeLoad-target-root.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createFileRoute, notFound, rootRouteId } from '@tanstack/solid-router' - -export const Route = createFileRoute('/not-found/via-beforeLoad-target-root')({ - beforeLoad: () => { - throw notFound({ routeId: rootRouteId }) - }, - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/not-found/via-beforeLoad-target-root"! -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/not-found/via-beforeLoad.tsx b/e2e/solid-start/basic/src/routes/not-found/via-beforeLoad.tsx deleted file mode 100644 index 496af91755..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/via-beforeLoad.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { notFound, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/not-found/via-beforeLoad')({ - beforeLoad: () => { - throw notFound() - }, - component: RouteComponent, - notFoundComponent: () => { - return ( -
- Not Found "/not-found/via-beforeLoad"! -
- ) - }, -}) - -function RouteComponent() { - return ( -
- Hello "/not-found/via-beforeLoad"! -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/not-found/via-loader.tsx b/e2e/solid-start/basic/src/routes/not-found/via-loader.tsx deleted file mode 100644 index 96599dfc6f..0000000000 --- a/e2e/solid-start/basic/src/routes/not-found/via-loader.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { notFound, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/not-found/via-loader')({ - loader: () => { - throw notFound() - }, - component: RouteComponent, - notFoundComponent: () => { - return ( -
- Not Found "/not-found/via-loader"! -
- ) - }, -}) - -function RouteComponent() { - return ( -
- Hello "/not-found/via-loader"! -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/posts.$postId.tsx b/e2e/solid-start/basic/src/routes/posts.$postId.tsx deleted file mode 100644 index c6b2fcf5f9..0000000000 --- a/e2e/solid-start/basic/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { ErrorComponent, Link, createFileRoute } from '@tanstack/solid-router' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -import { fetchPost } from '~/utils/posts' -import { NotFound } from '~/components/NotFound' -import { PostErrorComponent } from '~/components/PostErrorComponent' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost({ data: postId }), - errorComponent: PostErrorComponent, - component: PostComponent, - notFoundComponent: () => { - return Post not found - }, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
- - Deep View - -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/posts.index.tsx b/e2e/solid-start/basic/src/routes/posts.index.tsx deleted file mode 100644 index c7d8cfe19c..0000000000 --- a/e2e/solid-start/basic/src/routes/posts.index.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-start/basic/src/routes/posts.tsx b/e2e/solid-start/basic/src/routes/posts.tsx deleted file mode 100644 index 0e94cd4d2c..0000000000 --- a/e2e/solid-start/basic/src/routes/posts.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { For } from 'solid-js' - -import { fetchPosts } from '~/utils/posts' - -export const Route = createFileRoute('/posts')({ - head: () => ({ - meta: [ - { - title: 'Posts page', - }, - ], - }), - loader: async () => fetchPosts(), - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - - {(post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }} -
    -
-
- -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/posts_.$postId.deep.tsx b/e2e/solid-start/basic/src/routes/posts_.$postId.deep.tsx deleted file mode 100644 index f8d4627914..0000000000 --- a/e2e/solid-start/basic/src/routes/posts_.$postId.deep.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { PostErrorComponent } from '~/components/PostErrorComponent' - -import { fetchPost } from '~/utils/posts' - -export const Route = createFileRoute('/posts_/$postId/deep')({ - loader: async ({ params: { postId } }) => fetchPost({ data: postId }), - errorComponent: PostErrorComponent, - component: PostDeepComponent, -}) - -function PostDeepComponent() { - const post = Route.useLoaderData() - - return ( -
- - ← All Posts - -

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/raw-stream.tsx b/e2e/solid-start/basic/src/routes/raw-stream.tsx deleted file mode 100644 index 7aa8f167e7..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream.tsx +++ /dev/null @@ -1,70 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/raw-stream')({ - component: RawStreamLayout, -}) - -function RawStreamLayout() { - return ( -
-

Raw Stream Tests

- - - -
- - -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/raw-stream/client-call.tsx b/e2e/solid-start/basic/src/routes/raw-stream/client-call.tsx deleted file mode 100644 index a0c9d8adac..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/client-call.tsx +++ /dev/null @@ -1,488 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createSignal } from 'solid-js' -import { - TEST10_EXPECTED, - TEST11_EXPECTED, - TEST12_STREAM_A_EXPECTED, - TEST12_STREAM_B_EXPECTED, - TEST13_EXPECTED, - TEST14_STREAM_A_EXPECTED, - TEST14_STREAM_B_EXPECTED, - TEST14_STREAM_C_EXPECTED, - TEST7_EXPECTED, - TEST8_EXPECTED, - TEST9_EXPECTED, - binaryHintBinaryFn, - binaryHintTextFn, - burstPauseBurstFn, - collectBytes, - compareBytes, - consumeBinaryStream, - createStreamConsumer, - emptyStreamFn, - errorStreamFn, - interleavedStreamsFn, - jsonEndsFirstFn, - largeBinaryFn, - mixedStreamingFn, - multipleRawStreamsFn, - rawEndsFirstFn, - singleRawStreamFn, - textHintMixedFn, - textHintPureBinaryFn, - textHintPureTextFn, - threeStreamsFn, -} from '../../raw-stream-fns' - -function ClientCallTests() { - const [results, setResults] = createSignal>({}) - const [loading, setLoading] = createSignal>({}) - - const consumeStream = createStreamConsumer() - - const runTest = async ( - testName: string, - fn: () => Promise, - processor: (result: any) => Promise, - ) => { - setLoading((prev) => ({ ...prev, [testName]: true })) - try { - const result = await fn() - const processed = await processor(result) - setResults((prev) => ({ ...prev, [testName]: processed })) - } catch (error) { - setResults((prev) => ({ - ...prev, - [testName]: { error: String(error) }, - })) - } finally { - setLoading((prev) => ({ ...prev, [testName]: false })) - } - } - - return ( -
-

Client-Side Server Function Calls (RPC)

-

- These tests invoke server functions directly from the client, using the - binary framing protocol for RawStream data. -

- - {/* Test 1: Single Raw Stream */} -
-

Test 1: Single Raw Stream

- -
{JSON.stringify(results().test1)}
-
- - {/* Test 2: Multiple Raw Streams */} -
-

Test 2: Multiple Raw Streams

- -
{JSON.stringify(results().test2)}
-
- - {/* Test 3: JSON Ends First */} -
-

Test 3: JSON Ends Before Raw Stream

- -
{JSON.stringify(results().test3)}
-
- - {/* Test 4: Raw Ends First */} -
-

Test 4: Raw Stream Ends Before JSON

- -
{JSON.stringify(results().test4)}
-
- - {/* Test 5: Large Binary */} -
-

Test 5: Large Binary Data

- -
{JSON.stringify(results().test5)}
-
- - {/* Test 6: Mixed Streaming */} -
-

Test 6: Mixed Streaming

- -
{JSON.stringify(results().test6)}
-
- - {/* Hint Tests Section */} -

Hint Parameter Tests (RPC)

-

- These tests verify that hint parameter works correctly for RPC calls. - Note: RPC always uses binary framing regardless of hint. -

- - {/* Test 7: Text Hint with Pure Text */} -
-

Test 7: Text Hint - Pure Text

- -
{JSON.stringify(results().test7)}
-
- - {/* Test 8: Text Hint with Pure Binary */} -
-

Test 8: Text Hint - Pure Binary

- -
{JSON.stringify(results().test8)}
-
- - {/* Test 9: Text Hint with Mixed Content */} -
-

Test 9: Text Hint - Mixed Content

- -
{JSON.stringify(results().test9)}
-
- - {/* Test 10: Binary Hint with Text Data */} -
-

Test 10: Binary Hint - Text Data

- -
-          {JSON.stringify(results().test10)}
-        
-
- - {/* Test 11: Binary Hint with Binary Data */} -
-

Test 11: Binary Hint - Binary Data

- -
-          {JSON.stringify(results().test11)}
-        
-
- - {/* Multiplexing Tests Section */} -

Multiplexing Tests (RPC)

-

- These tests verify correct interleaving of multiple concurrent streams. -

- - {/* Test 12: Interleaved Streams */} -
-

Test 12: Interleaved Streams

- -
-          {JSON.stringify(results().test12)}
-        
-
- - {/* Test 13: Burst-Pause-Burst */} -
-

Test 13: Burst-Pause-Burst

- -
-          {JSON.stringify(results().test13)}
-        
-
- - {/* Test 14: Three Concurrent Streams */} -
-

Test 14: Three Concurrent Streams

- -
-          {JSON.stringify(results().test14)}
-        
-
- - {/* Edge Case Tests Section */} -

Edge Case Tests (RPC)

-

- These tests verify edge cases like empty streams and error handling. -

- - {/* Test 15: Empty Stream */} -
-

Test 15: Empty Stream

- -
-          {JSON.stringify(results().test15)}
-        
-
- - {/* Test 16: Stream Error */} -
-

Test 16: Stream Error

- -
-          {JSON.stringify(results().test16)}
-        
-
-
- ) -} - -export const Route = createFileRoute('/raw-stream/client-call')({ - component: ClientCallTests, -}) diff --git a/e2e/solid-start/basic/src/routes/raw-stream/index.tsx b/e2e/solid-start/basic/src/routes/raw-stream/index.tsx deleted file mode 100644 index 8fe5133ede..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/index.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/raw-stream/')({ - component: RawStreamIndex, -}) - -function RawStreamIndex() { - return ( -
-

Select a test category above to begin testing.

-
    -
  • - - Client Calls - - - Test RawStream via direct server function calls (RPC) -
  • -
  • - - SSR Single - - - Test single RawStream from route loader (SSR) -
  • -
  • - - SSR Multiple - - - Test multiple RawStreams from route loader (SSR) -
  • -
  • - - SSR Mixed - - - {' '} - - Test RawStream mixed with deferred data from loader (SSR) - -
  • -
  • - - SSR Text Hint - - - Test RawStream with hint: 'text' from loader (SSR) -
  • -
  • - - SSR Binary Hint - - - Test RawStream with hint: 'binary' from loader (SSR) -
  • -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/raw-stream/ssr-binary-hint.tsx b/e2e/solid-start/basic/src/routes/raw-stream/ssr-binary-hint.tsx deleted file mode 100644 index 2c41daff7f..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/ssr-binary-hint.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { RawStream } from '@tanstack/solid-start' -import { createEffect, createSignal } from 'solid-js' -import { - collectBytes, - compareBytes, - concatBytes, - createDelayedStream, - encode, -} from '../../raw-stream-fns' - -// Expected data - defined at module level for client-side verification -const TEXT_CHUNKS = [encode('Binary '), encode('hint '), encode('with text')] -const TEXT_EXPECTED = concatBytes(TEXT_CHUNKS) - -const BINARY_CHUNKS = [ - new Uint8Array([0x00, 0x01, 0x02, 0x03]), - new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]), -] -const BINARY_EXPECTED = concatBytes(BINARY_CHUNKS) - -type TextMatch = { - match: boolean - mismatchIndex: number | null - actualLength: number - expectedLength: number - asText: string -} - -type BinaryMatch = { - match: boolean - mismatchIndex: number | null - actualLength: number - expectedLength: number -} - -function SSRBinaryHintTest() { - const loaderData = Route.useLoaderData() - const [textMatch, setTextMatch] = createSignal(null) - const [binaryMatch, setBinaryMatch] = createSignal(null) - const [isLoading, setIsLoading] = createSignal(true) - const [error, setError] = createSignal(null) - - createEffect(() => { - const { textData, binaryData } = loaderData() - if (!textData || !binaryData) { - return - } - setIsLoading(true) - setError(null) - Promise.all([collectBytes(textData), collectBytes(binaryData)]) - .then(([textBytes, binaryBytes]) => { - const textComp = compareBytes(textBytes, TEXT_EXPECTED) - const decoder = new TextDecoder() - setTextMatch({ - ...textComp, - actualLength: textBytes.length, - expectedLength: TEXT_EXPECTED.length, - asText: decoder.decode(textBytes), - }) - const binaryComp = compareBytes(binaryBytes, BINARY_EXPECTED) - setBinaryMatch({ - ...binaryComp, - actualLength: binaryBytes.length, - expectedLength: BINARY_EXPECTED.length, - }) - setIsLoading(false) - }) - .catch((err) => { - setError(String(err)) - setIsLoading(false) - }) - }) - - return ( -
-

SSR Binary Hint Test

-

- This route tests RawStream with hint: 'binary' from loader. Binary hint - always uses base64 encoding (default behavior). -

- -
-
- Message: {loaderData().message} -
-
- Text Data: - {error() - ? `Error: ${error()}` - : isLoading() - ? 'Loading...' - : textMatch()?.asText} -
-
- Text Bytes Match: - {isLoading() ? 'Loading...' : textMatch()?.match ? 'true' : 'false'} -
-
- Binary Bytes Match: - {isLoading() ? 'Loading...' : binaryMatch()?.match ? 'true' : 'false'} -
-
-          {JSON.stringify({
-            message: loaderData().message,
-            textMatch: textMatch(),
-            binaryMatch: binaryMatch(),
-            isLoading: isLoading(),
-            error: error(),
-          })}
-        
-
-
- ) -} - -export const Route = createFileRoute('/raw-stream/ssr-binary-hint')({ - loader: async () => { - // Text data with binary hint - should still use base64 (default behavior) - const textStream = createDelayedStream( - [encode('Binary '), encode('hint '), encode('with text')], - 30, - ) - - // Pure binary stream with binary hint - const binaryStream = createDelayedStream( - [ - new Uint8Array([0x00, 0x01, 0x02, 0x03]), - new Uint8Array([0xff, 0xfe, 0xfd, 0xfc]), - ], - 30, - ) - - return { - message: 'SSR Binary Hint Test', - textData: new RawStream(textStream, { hint: 'binary' }), - binaryData: new RawStream(binaryStream, { hint: 'binary' }), - } - }, - component: SSRBinaryHintTest, -}) diff --git a/e2e/solid-start/basic/src/routes/raw-stream/ssr-mixed.tsx b/e2e/solid-start/basic/src/routes/raw-stream/ssr-mixed.tsx deleted file mode 100644 index 5ccd05cc1f..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/ssr-mixed.tsx +++ /dev/null @@ -1,96 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { RawStream } from '@tanstack/solid-start' -import { Suspense, createEffect, createSignal } from 'solid-js' -import { - createDelayedStream, - createStreamConsumer, - encode, -} from '../../raw-stream-fns' - -function SSRMixedTest() { - const loaderData = Route.useLoaderData() - const [streamContent, setStreamContent] = createSignal('') - const [isConsuming, setIsConsuming] = createSignal(true) - const [error, setError] = createSignal(null) - - createEffect(() => { - const rawData = loaderData().rawData - if (!rawData) { - return - } - const consumeStream = createStreamConsumer() - setIsConsuming(true) - setError(null) - consumeStream(rawData) - .then((content) => { - setStreamContent(content) - setIsConsuming(false) - }) - .catch((err) => { - setError(String(err)) - setIsConsuming(false) - }) - }) - - return ( -
-

SSR Mixed Streaming Test

-

- This route returns a mix of immediate data, deferred promises, and - RawStream from its loader. -

- -
-
- Immediate: {loaderData().immediate} -
-
- Deferred: - Loading deferred...}> - {value}} - /> - -
-
- Stream Content: - {error() - ? `Error: ${error()}` - : isConsuming() - ? 'Loading...' - : streamContent()} -
-
-          {JSON.stringify({
-            immediate: loaderData().immediate,
-            streamContent: streamContent(),
-            isConsuming: isConsuming(),
-            error: error(),
-          })}
-        
-
-
- ) -} - -export const Route = createFileRoute('/raw-stream/ssr-mixed')({ - loader: () => { - const rawStream = createDelayedStream( - [encode('mixed-ssr-1'), encode('mixed-ssr-2')], - 50, - ) - - // Deferred promise that resolves after a delay - const deferredData = new Promise((resolve) => - setTimeout(() => resolve('deferred-ssr-value'), 100), - ) - - return { - immediate: 'immediate-ssr-value', - deferred: deferredData, - rawData: new RawStream(rawStream), - } - }, - component: SSRMixedTest, -}) diff --git a/e2e/solid-start/basic/src/routes/raw-stream/ssr-multiple.tsx b/e2e/solid-start/basic/src/routes/raw-stream/ssr-multiple.tsx deleted file mode 100644 index adb389e754..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/ssr-multiple.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { RawStream } from '@tanstack/solid-start' -import { createEffect, createSignal } from 'solid-js' -import { - createDelayedStream, - createStreamConsumer, - encode, -} from '../../raw-stream-fns' - -function SSRMultipleTest() { - const loaderData = Route.useLoaderData() - const [firstContent, setFirstContent] = createSignal('') - const [secondContent, setSecondContent] = createSignal('') - const [isConsuming, setIsConsuming] = createSignal(true) - const [error, setError] = createSignal(null) - - createEffect(() => { - const first = loaderData().first - const second = loaderData().second - if (!first || !second) { - return - } - const consumeStream = createStreamConsumer() - setIsConsuming(true) - setError(null) - Promise.all([consumeStream(first), consumeStream(second)]) - .then(([content1, content2]) => { - setFirstContent(content1) - setSecondContent(content2) - setIsConsuming(false) - }) - .catch((err) => { - setError(String(err)) - setIsConsuming(false) - }) - }) - - return ( -
-

SSR Multiple RawStreams Test

-

- This route returns multiple RawStreams from its loader. Each stream is - independently serialized during SSR. -

- -
-
- Message: {loaderData().message} -
-
- First Stream: - {error() - ? `Error: ${error()}` - : isConsuming() - ? 'Loading...' - : firstContent()} -
-
- Second Stream: - {error() - ? `Error: ${error()}` - : isConsuming() - ? 'Loading...' - : secondContent()} -
-
-          {JSON.stringify({
-            message: loaderData().message,
-            firstContent: firstContent(),
-            secondContent: secondContent(),
-            isConsuming: isConsuming(),
-            error: error(),
-          })}
-        
-
-
- ) -} - -export const Route = createFileRoute('/raw-stream/ssr-multiple')({ - loader: async () => { - const stream1 = createDelayedStream( - [encode('multi-1a'), encode('multi-1b')], - 30, - ) - const stream2 = createDelayedStream( - [encode('multi-2a'), encode('multi-2b')], - 50, - ) - return { - message: 'SSR Multiple Streams Test', - first: new RawStream(stream1), - second: new RawStream(stream2), - } - }, - component: SSRMultipleTest, -}) diff --git a/e2e/solid-start/basic/src/routes/raw-stream/ssr-single.tsx b/e2e/solid-start/basic/src/routes/raw-stream/ssr-single.tsx deleted file mode 100644 index c59e2a0341..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/ssr-single.tsx +++ /dev/null @@ -1,91 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { RawStream } from '@tanstack/solid-start' -import { createEffect, createSignal } from 'solid-js' -import { - createDelayedStream, - createStreamConsumer, - encode, -} from '../../raw-stream-fns' - -function SSRSingleTest() { - const loaderData = Route.useLoaderData() - const [streamContent, setStreamContent] = createSignal('') - const [isConsuming, setIsConsuming] = createSignal(true) - const [error, setError] = createSignal(null) - - createEffect(() => { - const rawData = loaderData().rawData - if (!rawData) { - return - } - const consumeStream = createStreamConsumer() - setIsConsuming(true) - setError(null) - consumeStream(rawData) - .then((content) => { - setStreamContent(content) - setIsConsuming(false) - }) - .catch((err) => { - setError(String(err)) - setIsConsuming(false) - }) - }) - - return ( -
-

SSR Single RawStream Test

-

- This route returns a single RawStream from its loader. The stream is - serialized during SSR using base64 encoding. -

- -
-
- Message: {loaderData().message} -
-
- Has Timestamp:{' '} - {typeof loaderData().timestamp === 'number' ? 'true' : 'false'} -
-
- Stream Content: - {error() - ? `Error: ${error()}` - : isConsuming() - ? 'Loading...' - : streamContent()} -
-
- RawData Type: {typeof loaderData().rawData} | hasStream: - {loaderData().rawData && 'getReader' in loaderData().rawData - ? 'true' - : 'false'} -
-
-          {JSON.stringify({
-            message: loaderData().message,
-            streamContent: streamContent(),
-            isConsuming: isConsuming(),
-            error: error(),
-          })}
-        
-
-
- ) -} - -export const Route = createFileRoute('/raw-stream/ssr-single')({ - loader: async () => { - const stream = createDelayedStream( - [encode('ssr-chunk1'), encode('ssr-chunk2'), encode('ssr-chunk3')], - 50, - ) - return { - message: 'SSR Single Stream Test', - timestamp: Date.now(), - rawData: new RawStream(stream), - } - }, - component: SSRSingleTest, -}) diff --git a/e2e/solid-start/basic/src/routes/raw-stream/ssr-text-hint.tsx b/e2e/solid-start/basic/src/routes/raw-stream/ssr-text-hint.tsx deleted file mode 100644 index f776474bfd..0000000000 --- a/e2e/solid-start/basic/src/routes/raw-stream/ssr-text-hint.tsx +++ /dev/null @@ -1,192 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { RawStream } from '@tanstack/solid-start' -import { createEffect, createSignal } from 'solid-js' -import { - collectBytes, - compareBytes, - concatBytes, - createDelayedStream, - encode, -} from '../../raw-stream-fns' - -// Expected data - defined at module level for client-side verification -const PURE_TEXT_CHUNKS = [ - encode('Hello '), - encode('World '), - encode('from SSR!'), -] -const PURE_TEXT_EXPECTED = concatBytes(PURE_TEXT_CHUNKS) - -const MIXED_CHUNKS = [ - encode('Valid text'), - new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8 - encode(' more text'), -] -const MIXED_EXPECTED = concatBytes(MIXED_CHUNKS) - -// Pure binary data (invalid UTF-8) - must use base64 fallback -const PURE_BINARY_CHUNKS = [ - new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]), - new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]), -] -const PURE_BINARY_EXPECTED = concatBytes(PURE_BINARY_CHUNKS) - -type TextMatch = { - match: boolean - mismatchIndex: number | null - actualLength: number - expectedLength: number - asText: string -} - -type BinaryMatch = { - match: boolean - mismatchIndex: number | null - actualLength: number - expectedLength: number -} - -function SSRTextHintTest() { - const loaderData = Route.useLoaderData() - const [pureTextMatch, setPureTextMatch] = createSignal(null) - const [mixedMatch, setMixedMatch] = createSignal(null) - const [pureBinaryMatch, setPureBinaryMatch] = - createSignal(null) - const [isLoading, setIsLoading] = createSignal(true) - const [error, setError] = createSignal(null) - - createEffect(() => { - const { pureText, mixedContent, pureBinary } = loaderData() - if (!pureText || !mixedContent || !pureBinary) { - return - } - setIsLoading(true) - setError(null) - Promise.all([ - collectBytes(pureText), - collectBytes(mixedContent), - collectBytes(pureBinary), - ]) - .then(([pureBytes, mixedBytes, pureBinaryBytes]) => { - const pureComp = compareBytes(pureBytes, PURE_TEXT_EXPECTED) - const decoder = new TextDecoder() - setPureTextMatch({ - ...pureComp, - actualLength: pureBytes.length, - expectedLength: PURE_TEXT_EXPECTED.length, - asText: decoder.decode(pureBytes), - }) - const mixedComp = compareBytes(mixedBytes, MIXED_EXPECTED) - setMixedMatch({ - ...mixedComp, - actualLength: mixedBytes.length, - expectedLength: MIXED_EXPECTED.length, - }) - const pureBinaryComp = compareBytes( - pureBinaryBytes, - PURE_BINARY_EXPECTED, - ) - setPureBinaryMatch({ - ...pureBinaryComp, - actualLength: pureBinaryBytes.length, - expectedLength: PURE_BINARY_EXPECTED.length, - }) - setIsLoading(false) - }) - .catch((err) => { - setError(String(err)) - setIsLoading(false) - }) - }) - - return ( -
-

SSR Text Hint Test

-

- This route tests RawStream with hint: 'text' from loader. Text hint - optimizes for UTF-8 content but falls back to base64 for invalid UTF-8. -

- -
-
- Message: {loaderData().message} -
-
- Pure Text: - {error() - ? `Error: ${error()}` - : isLoading() - ? 'Loading...' - : pureTextMatch()?.asText} -
-
- Pure Text Bytes Match: - {isLoading() - ? 'Loading...' - : pureTextMatch()?.match - ? 'true' - : 'false'} -
-
- Mixed Content Bytes Match: - {isLoading() ? 'Loading...' : mixedMatch()?.match ? 'true' : 'false'} -
-
- Pure Binary Bytes Match: - {isLoading() - ? 'Loading...' - : pureBinaryMatch()?.match - ? 'true' - : 'false'} -
-
-          {JSON.stringify({
-            message: loaderData().message,
-            pureTextMatch: pureTextMatch(),
-            mixedMatch: mixedMatch(),
-            pureBinaryMatch: pureBinaryMatch(),
-            isLoading: isLoading(),
-            error: error(),
-          })}
-        
-
-
- ) -} - -export const Route = createFileRoute('/raw-stream/ssr-text-hint')({ - loader: async () => { - // Pure text stream - should use UTF-8 encoding with text hint - const textStream = createDelayedStream( - [encode('Hello '), encode('World '), encode('from SSR!')], - 30, - ) - - // Mixed content stream - text hint should use UTF-8 for valid text, base64 for binary - const mixedStream = createDelayedStream( - [ - encode('Valid text'), - new Uint8Array([0xff, 0xfe, 0x80, 0x90]), // Invalid UTF-8 - encode(' more text'), - ], - 30, - ) - - // Pure binary stream - text hint must fallback to base64 for all chunks - const pureBinaryStream = createDelayedStream( - [ - new Uint8Array([0xff, 0xfe, 0x00, 0x01, 0x80, 0x90]), - new Uint8Array([0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0]), - ], - 30, - ) - - return { - message: 'SSR Text Hint Test', - pureText: new RawStream(textStream, { hint: 'text' }), - mixedContent: new RawStream(mixedStream, { hint: 'text' }), - pureBinary: new RawStream(pureBinaryStream, { hint: 'text' }), - } - }, - component: SSRTextHintTest, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target.tsx b/e2e/solid-start/basic/src/routes/redirect/$target.tsx deleted file mode 100644 index f6e62744bd..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { retainSearchParams, createFileRoute } from '@tanstack/solid-router' -import z from 'zod' - -export const Route = createFileRoute('/redirect/$target')({ - params: { - parse: (p) => - z - .object({ - target: z.union([z.literal('internal'), z.literal('external')]), - }) - .parse(p), - }, - validateSearch: z.object({ - reloadDocument: z.boolean().optional(), - preload: z.literal(false).optional(), - externalHost: z.string().optional(), - }), - search: { - middlewares: [retainSearchParams(['externalHost'])], - }, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/index.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/index.tsx deleted file mode 100644 index 916afd450b..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/index.tsx +++ /dev/null @@ -1,76 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/')({ - component: () => { - const preload = Route.useSearch({ select: (s) => s.preload }) - return ( -
-
- - via-beforeLoad - -
-
- - via-beforeLoad (reloadDocument=true) - -
-
- - via-loader - -
-
- - via-loader (reloadDocument=true) - -
-
- - serverFn - -
-
- ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/index.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/index.tsx deleted file mode 100644 index d404672372..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/index.tsx +++ /dev/null @@ -1,87 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/serverFn/')({ - component: () => ( -
-

- redirect test with server functions (target {Route.useParams()().target} - ) -

-
- - via-beforeLoad - -
-
- - via-beforeLoad (reloadDocument=true) - -
-
- - via-loader - -
-
- - via-loader (reloadDocument=true) - -
-
- - via-useServerFn - -
-
- - via-useServerFn (reloadDocument=true) - -
-
- ), -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx deleted file mode 100644 index 81f9dd2d36..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-beforeLoad.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { throwRedirect } from '~/components/throwRedirect' - -export const Route = createFileRoute( - '/redirect/$target/serverFn/via-beforeLoad', -)({ - beforeLoad: ({ - params: { target }, - search: { reloadDocument, externalHost }, - }) => throwRedirect({ data: { target, reloadDocument, externalHost } }), - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx deleted file mode 100644 index 0b6ac91c15..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-loader.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { throwRedirect } from '~/components/throwRedirect' - -export const Route = createFileRoute('/redirect/$target/serverFn/via-loader')({ - loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({ - reloadDocument, - externalHost, - }), - loader: ({ params: { target }, deps: { reloadDocument, externalHost } }) => - throwRedirect({ data: { target, reloadDocument, externalHost } }), - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx deleted file mode 100644 index 5b0c246474..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/serverFn/via-useServerFn.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { RedirectOnClick } from '~/components/RedirectOnClick' - -export const Route = createFileRoute( - '/redirect/$target/serverFn/via-useServerFn', -)({ - component: () => { - const params = Route.useParams() - const search = Route.useSearch() - return ( - - ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx deleted file mode 100644 index 828769edb6..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/via-beforeLoad.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { redirect, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/via-beforeLoad')({ - beforeLoad: ({ - params: { target }, - search: { reloadDocument, externalHost }, - }) => { - switch (target) { - case 'internal': - throw redirect({ to: '/posts', reloadDocument }) - case 'external': - throw redirect({ href: externalHost }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/$target/via-loader.tsx b/e2e/solid-start/basic/src/routes/redirect/$target/via-loader.tsx deleted file mode 100644 index 11430e84db..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/$target/via-loader.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { redirect, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/$target/via-loader')({ - loaderDeps: ({ search: { reloadDocument, externalHost } }) => ({ - reloadDocument, - externalHost, - }), - loader: ({ params: { target }, deps: { externalHost, reloadDocument } }) => { - switch (target) { - case 'internal': - throw redirect({ to: '/posts', reloadDocument }) - case 'external': - throw redirect({ href: externalHost }) - } - }, - component: () =>
{Route.fullPath}
, -}) diff --git a/e2e/solid-start/basic/src/routes/redirect/index.tsx b/e2e/solid-start/basic/src/routes/redirect/index.tsx deleted file mode 100644 index 043f305e57..0000000000 --- a/e2e/solid-start/basic/src/routes/redirect/index.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/')({ - component: () => ( -
- - internal - {' '} - - external - -
- ), -}) diff --git a/e2e/solid-start/basic/src/routes/scripts.tsx b/e2e/solid-start/basic/src/routes/scripts.tsx deleted file mode 100644 index 1c7bea295b..0000000000 --- a/e2e/solid-start/basic/src/routes/scripts.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -const isProd = import.meta.env.PROD - -export const Route = createFileRoute('/scripts')({ - head: () => ({ - scripts: [ - { - src: 'script.js', - }, - isProd - ? undefined - : { - src: 'script2.js', - }, - ], - }), - component: ScriptsComponent, -}) - -function ScriptsComponent() { - return ( -
-

Scripts Test

-

- Both `script.js` and `script2.js` are included in development, but only - `script.js` is included in production. -

-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/search-params/default.tsx b/e2e/solid-start/basic/src/routes/search-params/default.tsx deleted file mode 100644 index 3687946620..0000000000 --- a/e2e/solid-start/basic/src/routes/search-params/default.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/search-params/default')({ - validateSearch: z.object({ - default: z.string().default('d1'), - }), - beforeLoad: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - loader: ({ context }) => { - if (context.hello !== 'world') { - throw new Error('Context hello is not "world"') - } - }, - component: () => { - const search = Route.useSearch() - const context = Route.useRouteContext() - return ( - <> -
{search().default}
-
{context().hello}
- - ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/search-params/index.tsx b/e2e/solid-start/basic/src/routes/search-params/index.tsx deleted file mode 100644 index a99d64cbf4..0000000000 --- a/e2e/solid-start/basic/src/routes/search-params/index.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/search-params/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- - go to /search-params/default - -
- - go to /search-params/default?default=d2 - -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/search-params/loader-throws-redirect.tsx b/e2e/solid-start/basic/src/routes/search-params/loader-throws-redirect.tsx deleted file mode 100644 index 80c5ea9ad7..0000000000 --- a/e2e/solid-start/basic/src/routes/search-params/loader-throws-redirect.tsx +++ /dev/null @@ -1,26 +0,0 @@ -import { redirect, createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' - -export const Route = createFileRoute('/search-params/loader-throws-redirect')({ - validateSearch: z.object({ - step: z.enum(['a', 'b', 'c']).optional(), - }), - loaderDeps: ({ search: { step } }) => ({ step }), - loader: ({ deps: { step } }) => { - if (step === undefined) { - throw redirect({ - to: '/search-params/loader-throws-redirect', - search: { step: 'a' }, - }) - } - }, - component: () => { - const search = Route.useSearch() - return ( -
-

SearchParams

-
{search().step}
-
- ) - }, -}) diff --git a/e2e/solid-start/basic/src/routes/search-params/route.tsx b/e2e/solid-start/basic/src/routes/search-params/route.tsx deleted file mode 100644 index 5d9fc67515..0000000000 --- a/e2e/solid-start/basic/src/routes/search-params/route.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/search-params')({ - beforeLoad: async () => { - await new Promise((resolve) => setTimeout(resolve, 1000)) - return { hello: 'world' as string } - }, -}) diff --git a/e2e/solid-start/basic/src/routes/specialChars/$param.tsx b/e2e/solid-start/basic/src/routes/specialChars/$param.tsx deleted file mode 100644 index 179965e2c0..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/$param.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/specialChars/$param')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
- Hello "/specialChars/$param":{' '} - {params().param} -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/hash.tsx b/e2e/solid-start/basic/src/routes/specialChars/hash.tsx deleted file mode 100644 index 391ec1a72d..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/hash.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createFileRoute, useLocation } from '@tanstack/solid-router' -import { createSignal } from 'solid-js' - -export const Route = createFileRoute('/specialChars/hash')({ - component: RouteComponent, -}) - -function RouteComponent() { - const location = useLocation() - const [toggleHashValue, setToggleHashValue] = createSignal(false) - - return ( -
-
Hello "/specialChars/hash"!
- -
- {toggleHashValue() && ( -
- Hash Value{location().hash} -
- )} -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/malformed/$param.tsx b/e2e/solid-start/basic/src/routes/specialChars/malformed/$param.tsx deleted file mode 100644 index 132d7f72bf..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/malformed/$param.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/specialChars/malformed/$param')({ - component: RouteComponent, -}) - -function RouteComponent() { - const params = Route.useParams() - return ( -
- Hello "/specialChars/malformed/$param":{' '} - {params().param} -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/malformed/route.tsx b/e2e/solid-start/basic/src/routes/specialChars/malformed/route.tsx deleted file mode 100644 index 1b32e5ff71..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/malformed/route.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/specialChars/malformed')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
Hello "/specialChars/malformed"!
- - malformed path param - {' '} - - malformed search param - {' '} -
- -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/malformed/search.tsx b/e2e/solid-start/basic/src/routes/specialChars/malformed/search.tsx deleted file mode 100644 index a9aea49137..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/malformed/search.tsx +++ /dev/null @@ -1,22 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import z from 'zod' - -export const Route = createFileRoute('/specialChars/malformed/search')({ - validateSearch: z.object({ - searchParam: z.string(), - }), - component: RouteComponent, -}) - -function RouteComponent() { - const search = Route.useSearch() - - return ( -
- Hello "/specialChars/malformed/search"! - - {search().searchParam} - -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/route.tsx b/e2e/solid-start/basic/src/routes/specialChars/route.tsx deleted file mode 100644 index e69155da67..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/route.tsx +++ /dev/null @@ -1,79 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/specialChars')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
-
Hello "/specialChars"!
- - Unicode - {' '} - - Unicode param - {' '} - - Unicode search param - {' '} - - Unicode Hash - {' '} - - Unicode Hash abc - {' '} - - Malformed paths - {' '} -
- -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/search.tsx b/e2e/solid-start/basic/src/routes/specialChars/search.tsx deleted file mode 100644 index 9ffc8f026f..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/search.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import z from 'zod' - -export const Route = createFileRoute('/specialChars/search')({ - validateSearch: z.object({ - searchParam: z.string(), - }), - component: RouteComponent, -}) - -function RouteComponent() { - const search = Route.useSearch() - - return ( -
- Hello "/specialChars/search"! - {search().searchParam} -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/specialChars/대한민국.tsx b/e2e/solid-start/basic/src/routes/specialChars/대한민국.tsx deleted file mode 100644 index 13257e1fa8..0000000000 --- a/e2e/solid-start/basic/src/routes/specialChars/대한민국.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/specialChars/대한민국')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- Hello "/specialChars/대한민국"! -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/stream.tsx b/e2e/solid-start/basic/src/routes/stream.tsx deleted file mode 100644 index 550e55cc89..0000000000 --- a/e2e/solid-start/basic/src/routes/stream.tsx +++ /dev/null @@ -1,64 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { createEffect, createSignal, Suspense } from 'solid-js' - -export const Route = createFileRoute('/stream')({ - component: Home, - loader() { - return { - promise: new Promise((resolve) => - setTimeout(() => resolve('promise-data'), 150), - ), - stream: new ReadableStream({ - async start(controller) { - for (let i = 0; i < 5; i++) { - await new Promise((resolve) => setTimeout(resolve, 200)) - controller.enqueue(`stream-data-${i} `) - } - controller.close() - }, - }), - } - }, -}) - -const decoder = new TextDecoder('utf-8') - -function Home() { - const loaderData = Route.useLoaderData() - const [streamData, setStreamData] = createSignal>([]) - - createEffect(() => { - async function fetchStream() { - const reader = loaderData().stream.getReader() - let chunk - - while (!(chunk = await reader.read()).done) { - let value = chunk.value - if (typeof value !== 'string') { - value = decoder.decode(value, { stream: !chunk.done }) - } - setStreamData((prev) => [...prev, value]) - } - } - - fetchStream() - }) - - return ( - - ( -
- {promiseData} -
- {streamData().map((d) => ( -
{d}
- ))} -
-
- )} - /> -
- ) -} diff --git a/e2e/solid-start/basic/src/routes/transition/count/create-resource.tsx b/e2e/solid-start/basic/src/routes/transition/count/create-resource.tsx deleted file mode 100644 index 182a03fd1a..0000000000 --- a/e2e/solid-start/basic/src/routes/transition/count/create-resource.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { Suspense, createResource } from 'solid-js' -import { z } from 'zod' - -export const Route = createFileRoute('/transition/count/create-resource')({ - validateSearch: z.object({ - n: z.number().default(1), - }), - component: Home, -}) - -function Home() { - return ( -
- ({ n: s.n + 1 })} - > - Increase - - - -
- ) -} - -function Result() { - const searchQuery = Route.useSearch() - - const [doubleQuery] = createResource( - () => searchQuery().n, - async (n) => { - await new Promise((r) => setTimeout(r, 1000)) - return n * 2 - }, - ) - - return ( -
- -
n: {searchQuery().n}
-
double: {doubleQuery()}
-
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/transition/typing/create-resource.tsx b/e2e/solid-start/basic/src/routes/transition/typing/create-resource.tsx deleted file mode 100644 index 33b1fed17a..0000000000 --- a/e2e/solid-start/basic/src/routes/transition/typing/create-resource.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Suspense, createResource } from 'solid-js' - -export const Route = createFileRoute('/transition/typing/create-resource')({ - validateSearch: (search: { query?: string }) => ({ - query: search.query ?? '', - }), - component: Home, - ssr: true, -}) - -function Home() { - const searchQuery = Route.useSearch() - const navigate = Route.useNavigate() - - const [asyncResult] = createResource( - () => searchQuery().query, - async (query) => { - await new Promise((r) => setTimeout(r, 1000)) - return query - }, - ) - - return ( -
-
- { - navigate({ search: { query: e.currentTarget.value } }) - }} - /> -
- - Query: {searchQuery().query} -
- Result: {asyncResult()} -
{' '} -
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/users.$userId.tsx b/e2e/solid-start/basic/src/routes/users.$userId.tsx deleted file mode 100644 index ccc37e78f5..0000000000 --- a/e2e/solid-start/basic/src/routes/users.$userId.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import axios from 'redaxios' - -import { getRouterInstance } from '@tanstack/solid-start' -import type { User } from '~/utils/users' -import { NotFound } from '~/components/NotFound' -import { UserErrorComponent } from '~/components/UserErrorComponent' - -export const Route = createFileRoute('/users/$userId')({ - loader: async ({ params: { userId } }) => { - const router = await getRouterInstance() - return await axios - .get('/api/users/' + userId, { baseURL: router.options.origin }) - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch user') - }) - }, - errorComponent: UserErrorComponent, - component: UserComponent, - notFoundComponent: () => { - return User not found - }, -}) - -function UserComponent() { - const user = Route.useLoaderData() - - return ( -
-

{user().name}

-
{user().email}
-
- ) -} diff --git a/e2e/solid-start/basic/src/routes/users.index.tsx b/e2e/solid-start/basic/src/routes/users.index.tsx deleted file mode 100644 index 34d25e1428..0000000000 --- a/e2e/solid-start/basic/src/routes/users.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/users/')({ - component: UsersIndexComponent, -}) - -function UsersIndexComponent() { - return
Select a user.
-} diff --git a/e2e/solid-start/basic/src/routes/users.tsx b/e2e/solid-start/basic/src/routes/users.tsx deleted file mode 100644 index 65878a704a..0000000000 --- a/e2e/solid-start/basic/src/routes/users.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { getRouterInstance } from '@tanstack/solid-start' -import axios from 'redaxios' - -import type { User } from '~/utils/users' - -export const Route = createFileRoute('/users')({ - loader: async () => { - const router = await getRouterInstance() - return await axios - .get>('/api/users', { baseURL: router.options.origin }) - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch users') - }) - }, - component: UsersComponent, -}) - -function UsersComponent() { - const users = Route.useLoaderData() - - return ( -
-
    - {[ - ...users(), - { id: 'i-do-not-exist', name: 'Non-existent User', email: '' }, - ].map((user) => { - return ( -
  • - -
    {user.name}
    - -
  • - ) - })} -
-
- -
- ) -} diff --git a/e2e/solid-start/basic/src/server.ts b/e2e/solid-start/basic/src/server.ts deleted file mode 100644 index d48e6df349..0000000000 --- a/e2e/solid-start/basic/src/server.ts +++ /dev/null @@ -1,11 +0,0 @@ -// DO NOT DELETE THIS FILE!!! -// This file is a good smoke test to make sure the custom server entry is working -import handler from '@tanstack/solid-start/server-entry' - -console.log("[server-entry]: using custom server entry in 'src/server.ts'") - -export default { - fetch(request: Request) { - return handler.fetch(request) - }, -} diff --git a/e2e/solid-start/basic/src/styles/app.css b/e2e/solid-start/basic/src/styles/app.css deleted file mode 100644 index 37c1f5a6e2..0000000000 --- a/e2e/solid-start/basic/src/styles/app.css +++ /dev/null @@ -1,30 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -@layer base { - html { - color-scheme: light dark; - } - - * { - @apply border-gray-200 dark:border-gray-800; - } - - html, - body { - @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200; - } - - .using-mouse * { - outline: none !important; - } -} diff --git a/e2e/solid-start/basic/src/utils/posts.tsx b/e2e/solid-start/basic/src/utils/posts.tsx deleted file mode 100644 index 6c12105ab8..0000000000 --- a/e2e/solid-start/basic/src/utils/posts.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -export const fetchPost = createServerFn({ method: 'GET' }) - .validator((postId: string) => postId) - .handler(async ({ data: postId }) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`https://jsonplaceholder.typicode.com/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - console.error(err) - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post - }) - -export const fetchPosts = createServerFn({ method: 'GET' }).handler( - async () => { - console.info('Fetching posts...') - return axios - .get>('https://jsonplaceholder.typicode.com/posts') - .then((r) => r.data.slice(0, 10)) - }, -) diff --git a/e2e/solid-start/basic/src/utils/seo.ts b/e2e/solid-start/basic/src/utils/seo.ts deleted file mode 100644 index d18ad84b74..0000000000 --- a/e2e/solid-start/basic/src/utils/seo.ts +++ /dev/null @@ -1,33 +0,0 @@ -export const seo = ({ - title, - description, - keywords, - image, -}: { - title: string - description?: string - image?: string - keywords?: string -}) => { - const tags = [ - { title }, - { name: 'description', content: description }, - { name: 'keywords', content: keywords }, - { name: 'twitter:title', content: title }, - { name: 'twitter:description', content: description }, - { name: 'twitter:creator', content: '@tannerlinsley' }, - { name: 'twitter:site', content: '@tannerlinsley' }, - { name: 'og:type', content: 'website' }, - { name: 'og:title', content: title }, - { name: 'og:description', content: description }, - ...(image - ? [ - { name: 'twitter:image', content: image }, - { name: 'twitter:card', content: 'summary_large_image' }, - { name: 'og:image', content: image }, - ] - : []), - ] - - return tags -} diff --git a/e2e/solid-start/basic/src/utils/users.tsx b/e2e/solid-start/basic/src/utils/users.tsx deleted file mode 100644 index 7ba645b383..0000000000 --- a/e2e/solid-start/basic/src/utils/users.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export type User = { - id: number - name: string - email: string -} diff --git a/e2e/solid-start/basic/src/vite-env.d.ts b/e2e/solid-start/basic/src/vite-env.d.ts deleted file mode 100644 index 0b2af560d6..0000000000 --- a/e2e/solid-start/basic/src/vite-env.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module '*?url' { - const url: string - export default url -} diff --git a/e2e/solid-start/basic/tests/error-normalization.spec.ts b/e2e/solid-start/basic/tests/error-normalization.spec.ts deleted file mode 100644 index e5e7e18a29..0000000000 --- a/e2e/solid-start/basic/tests/error-normalization.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import { isSpaMode } from './utils/isSpaMode' -import { isPrerender } from './utils/isPrerender' - -test.skip(isSpaMode || isPrerender, 'Requires dynamic SSR') - -test.use({ - whitelistErrors: [ - 'Failed to load resource: the server responded with a status of 500', - ], -}) - -test('normalizes errors during SSR, hydration, and client navigation', async ({ - page, -}) => { - const response = await page.goto('/error-normalization?kind=string') - expect(response?.status()).toBe(500) - const html = await response!.text() - expect(html).toContain('data-name="Error"') - expect(html).toContain('data-message="loader failure"') - expect(html).toContain('data-cause="loader failure"') - - const details = page.getByTestId('error-details') - await expect(details).toHaveAttribute('data-hydrated', 'true') - await expect(details).toHaveAttribute('data-name', 'Error') - await expect(details).toHaveAttribute('data-message', 'loader failure') - await expect(details).toHaveAttribute('data-cause', 'loader failure') - - await page.getByRole('link', { name: 'Throw null' }).click() - await expect(details).toHaveAttribute('data-hydrated', 'true') - await expect(details).toHaveAttribute('data-name', 'Error') - await expect(details).toHaveAttribute('data-message', 'Unknown error') - await expect(details).toHaveAttribute('data-cause', 'null') -}) diff --git a/e2e/solid-start/basic/tests/fixture-api.spec.ts b/e2e/solid-start/basic/tests/fixture-api.spec.ts deleted file mode 100644 index 6c9b26dc4c..0000000000 --- a/e2e/solid-start/basic/tests/fixture-api.spec.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('server API receives canned users without a fixture listener', async ({ - request, -}) => { - const response = await request.get('/api/users') - expect(response.ok()).toBe(true) - const users = await response.json() - expect(users).toHaveLength(10) - expect(users[0]).toMatchObject({ id: 1, name: 'Leanne Graham' }) -}) diff --git a/e2e/solid-start/basic/tests/navigation.spec.ts b/e2e/solid-start/basic/tests/navigation.spec.ts deleted file mode 100644 index 058eb0cd03..0000000000 --- a/e2e/solid-start/basic/tests/navigation.spec.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' - -test.use({ - whitelistErrors: [ - 'Failed to load resource: the server responded with a status of 404', - ], -}) -test('Navigating to post', async ({ page }) => { - await page.goto('/') - - await page.waitForURL('/') - - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await page.getByRole('link', { name: 'Deep View' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating to user', async ({ page }) => { - await page.goto('/') - - await page.waitForURL('/') - - await page.getByRole('link', { name: 'Users' }).click() - await page.getByRole('link', { name: 'Leanne Graham' }).click() - await expect(page.getByRole('heading')).toContainText('Leanne Graham') -}) - -test('Navigating nested layouts', async ({ page }) => { - await page.goto('/') - - await page.waitForURL('/') - - await page.getByRole('link', { name: 'Layout', exact: true }).click() - - await expect(page.locator('body')).toContainText("I'm a layout") - await expect(page.locator('body')).toContainText("I'm a nested layout") - - await page.getByRole('link', { name: 'Layout A' }).click() - await expect(page.locator('body')).toContainText("I'm layout A!") - - await page.getByRole('link', { name: 'Layout B' }).click() - await expect(page.locator('body')).toContainText("I'm layout B!") -}) - -test('client side navigating to a route with scripts', async ({ page }) => { - await page.goto('/') - - await page.waitForURL('/') - await page.getByRole('link', { name: 'Scripts', exact: true }).click() - await expect(page.getByTestId('scripts-test-heading')).toBeInViewport() - await page.waitForFunction(() => (window as any).SCRIPT_1 === true) - expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined) -}) - -test('directly going to a route with scripts', async ({ page }) => { - await page.goto('/scripts') - - await page.waitForURL('/scripts') - await page.waitForLoadState('networkidle') - expect(await page.evaluate('window.SCRIPT_1')).toBe(true) - expect(await page.evaluate('window.SCRIPT_2')).toBe(undefined) -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.goto('/') - - await page.waitForURL('/') - - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Should change title on client side navigation', async ({ page }) => { - await page.goto('/') - - await page.waitForURL('/') - - await page.getByRole('link', { name: 'Posts' }).click() - - await expect(page).toHaveTitle('Posts page') -}) diff --git a/e2e/solid-start/basic/tests/not-found.spec.ts b/e2e/solid-start/basic/tests/not-found.spec.ts deleted file mode 100644 index cfc60fe5e4..0000000000 --- a/e2e/solid-start/basic/tests/not-found.spec.ts +++ /dev/null @@ -1,101 +0,0 @@ -import { expect } from '@playwright/test' -import combinateImport from 'combinate' -import { test } from '@tanstack/router-e2e-utils' -import { isSpaMode } from './utils/isSpaMode' - -// somehow playwright does not correctly import default exports -const combinate = (combinateImport as any).default as typeof combinateImport - -test.use({ - whitelistErrors: [ - 'Failed to load resource: the server responded with a status of 404', - ], -}) -test.describe('not-found', () => { - test(`global not found`, async ({ page }) => { - const response = await page.goto(`/this-page-does-not-exist/foo/bar`) - - expect(response?.status()).toBe(isSpaMode ? 200 : 404) - - await expect( - page.getByTestId('default-not-found-component'), - ).toBeInViewport() - }) - - test.describe('throw notFound()', () => { - const navigationTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - preload: [false, true] as const, - }) - - navigationTestMatrix.forEach(({ thrower, preload }) => { - test(`navigation: thrower: ${thrower}, preload: ${preload}`, async ({ - page, - }) => { - await page.goto( - `/not-found/${preload === false ? '?preload=false' : ''}`, - ) - const link = page.getByTestId(`via-${thrower}`) - - if (preload) { - await link.focus() - await new Promise((r) => setTimeout(r, 250)) - } - - await link.click() - - await expect( - page.getByTestId(`via-${thrower}-notFound-component`), - ).toBeInViewport() - await expect( - page.getByTestId(`via-${thrower}-route-component`), - ).not.toBeInViewport() - }) - }) - const directVisitTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - }) - - directVisitTestMatrix.forEach(({ thrower }) => { - test(`direct visit: thrower: ${thrower}`, async ({ page }) => { - await page.goto(`/not-found/via-${thrower}`) - await page.waitForLoadState('networkidle') - await expect( - page.getByTestId(`via-${thrower}-notFound-component`), - ).toBeInViewport() - await expect( - page.getByTestId(`via-${thrower}-route-component`), - ).not.toBeInViewport() - }) - }) - - test('direct visit: child beforeLoad notFound renders parent boundary with parent loader data', async ({ - page, - }) => { - await page.goto('/not-found/parent-boundary/via-beforeLoad') - await page.waitForLoadState('networkidle') - - await expect( - page.getByTestId('parent-boundary-notFound-component'), - ).toBeInViewport() - await expect(page.getByTestId('parent-loader-data')).toHaveText('ready') - await expect( - page.getByTestId('parent-boundary-child-route-component'), - ).not.toBeInViewport() - }) - - test('direct visit: beforeLoad notFound with routeId targets root boundary', async ({ - page, - }) => { - await page.goto('/not-found/via-beforeLoad-target-root') - await page.waitForLoadState('networkidle') - - await expect( - page.getByTestId('default-not-found-component'), - ).toBeInViewport() - await expect( - page.getByTestId('via-beforeLoad-target-root-route-component'), - ).not.toBeInViewport() - }) - }) -}) diff --git a/e2e/solid-start/basic/tests/prerendering.spec.ts b/e2e/solid-start/basic/tests/prerendering.spec.ts deleted file mode 100644 index ddcf720a4c..0000000000 --- a/e2e/solid-start/basic/tests/prerendering.spec.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { existsSync, readFileSync } from 'node:fs' -import { join } from 'node:path' -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import { isPrerender } from './utils/isPrerender' - -const distDir = join( - process.cwd(), - process.env.E2E_DIST_DIR ?? 'dist', - 'client', -) - -test.describe('Prerender Static Path Discovery', () => { - test.skip(!isPrerender, 'Skipping since not in prerender mode') - test.describe('Build Output Verification', () => { - test('should automatically discover and prerender static routes', () => { - // Check that static routes were automatically discovered and prerendered - // These static routes should be automatically discovered and prerendered - expect(existsSync(join(distDir, 'index.html'))).toBe(true) - expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true) - expect(existsSync(join(distDir, 'deferred/index.html'))).toBe(true) - expect(existsSync(join(distDir, 'scripts/index.html'))).toBe(true) - expect(existsSync(join(distDir, 'inline-scripts/index.html'))).toBe(true) - expect( - existsSync(join(distDir, 'specialChars/대한민국/index.html')), - ).toBe(true) - - // Pathless layouts should NOT be prerendered (they start with _) - expect(existsSync(join(distDir, '_layout', 'index.html'))).toBe(false) // /_layout - - // API routes should NOT be prerendered - - expect(existsSync(join(distDir, 'api', 'users', 'index.html'))).toBe( - false, - ) // /api/users - }) - }) - - test.describe('Static Files Verification', () => { - test('should contain prerendered content in posts.html', () => { - expect(existsSync(join(distDir, 'posts/index.html'))).toBe(true) - - // "Select a post." should be in the prerendered HTML - const html = readFileSync(join(distDir, 'posts/index.html'), 'utf-8') - expect(html).toContain('Select a post.') - }) - }) -}) diff --git a/e2e/solid-start/basic/tests/redirect.spec.ts b/e2e/solid-start/basic/tests/redirect.spec.ts deleted file mode 100644 index 8e6ceba5b9..0000000000 --- a/e2e/solid-start/basic/tests/redirect.spec.ts +++ /dev/null @@ -1,225 +0,0 @@ -import queryString from 'node:querystring' -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import combinateImport from 'combinate' -import type { Page } from '@playwright/test' - -// somehow playwright does not correctly import default exports -const combinate = (combinateImport as any).default as typeof combinateImport - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const EXTERNAL_ORIGIN = `http://127.0.0.1:${PORT}` -const POSTS_URL = `http://localhost:${PORT}/posts` - -async function waitForRouterIdle(page: Page) { - await expect(page.getByTestId('router-isLoading')).toHaveText('false') - await expect(page.getByTestId('router-status')).toHaveText('idle') -} - -async function waitForPostsIndex(page: Page) { - await page.waitForURL(POSTS_URL) - expect(page.url()).toBe(POSTS_URL) - await waitForRouterIdle(page) - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() -} - -test.describe('redirects', () => { - const internalNavigationTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - preload: [false, true] as const, - }) - - internalNavigationTestMatrix.forEach( - ({ thrower, reloadDocument, preload }) => { - test(`internal target, navigation: thrower: ${thrower}, reloadDocument: ${reloadDocument}, preload: ${preload}`, async ({ - page, - }) => { - await page.goto( - `/redirect/internal${preload === false ? '?preload=false' : ''}`, - ) - const link = page.getByTestId( - `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`, - ) - - await waitForRouterIdle(page) - let requestHappened = false - - const requestPromise = new Promise((resolve) => { - page.on('request', (request) => { - if ( - request.url().startsWith(`http://localhost:${PORT}/_serverFn/`) - ) { - requestHappened = true - resolve() - } - }) - }) - await link.focus() - - const expectRequestHappened = preload && !reloadDocument - const timeoutPromise = new Promise((resolve) => - setTimeout(resolve, expectRequestHappened ? 5000 : 500), - ) - await Promise.race([requestPromise, timeoutPromise]) - expect(requestHappened).toBe(expectRequestHappened) - let fullPageLoad = false - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - - await link.click() - - await waitForPostsIndex(page) - expect(fullPageLoad).toBe(reloadDocument) - }) - }, - ) - - const internalDirectVisitTestMatrix = combinate({ - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - }) - - internalDirectVisitTestMatrix.forEach(({ thrower, reloadDocument }) => { - test(`internal target, direct visit: thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({ - page, - }) => { - await page.goto(`/redirect/internal/via-${thrower}`) - - await waitForPostsIndex(page) - }) - }) - - const externalTestMatrix = combinate({ - scenario: ['navigate', 'direct_visit'] as const, - thrower: ['beforeLoad', 'loader'] as const, - }) - - externalTestMatrix.forEach(({ scenario, thrower }) => { - test(`external target: scenario: ${scenario}, thrower: ${thrower}`, async ({ - page, - }) => { - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - }) - - if (scenario === 'navigate') { - await page.goto(`/redirect/external?${q}`) - await waitForRouterIdle(page) - const link = page.getByTestId(`via-${thrower}`) - await link.focus() - await link.click() - } else { - await page.goto(`/redirect/external/via-${thrower}?${q}`) - } - - const url = `${EXTERNAL_ORIGIN}/` - - await page.waitForURL(url) - expect(page.url()).toBe(url) - }) - }) - - const serverFnTestMatrix = combinate({ - target: ['internal', 'external'] as const, - scenario: ['navigate', 'direct_visit'] as const, - thrower: ['beforeLoad', 'loader'] as const, - reloadDocument: [false, true] as const, - }) - - serverFnTestMatrix.forEach( - ({ target, thrower, scenario, reloadDocument }) => { - test(`serverFn redirects to target: ${target}, scenario: ${scenario}, thrower: ${thrower}, reloadDocument: ${reloadDocument}`, async ({ - page, - }) => { - let fullPageLoad = false - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - reloadDocument, - }) - - if (scenario === 'navigate') { - await page.goto(`/redirect/${target}/serverFn?${q}`) - await waitForRouterIdle(page) - const link = page.getByTestId( - `via-${thrower}${reloadDocument ? '-reloadDocument' : ''}`, - ) - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - await link.focus() - await link.click() - } else { - await page.goto(`/redirect/${target}/serverFn/via-${thrower}?${q}`) - } - - const url = target === 'internal' ? POSTS_URL : `${EXTERNAL_ORIGIN}/` - await page.waitForURL(url) - expect(page.url()).toBe(url) - if (target === 'internal' && scenario === 'navigate') { - await waitForRouterIdle(page) - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - expect(fullPageLoad).toBe(reloadDocument) - } - }) - }, - ) - - const useServerFnTestMatrix = combinate({ - target: ['internal', 'external'] as const, - reloadDocument: [false, true] as const, - }) - - useServerFnTestMatrix.forEach(({ target, reloadDocument }) => { - test(`useServerFn redirects to target: ${target}, reloadDocument: ${reloadDocument}`, async ({ - page, - }) => { - const q = queryString.stringify({ - externalHost: `${EXTERNAL_ORIGIN}/`, - reloadDocument, - }) - - await page.goto(`/redirect/${target}/serverFn/via-useServerFn?${q}`) - - await waitForRouterIdle(page) - - const button = page.getByTestId('redirect-on-click') - - let fullPageLoad = false - page.on('domcontentloaded', () => { - fullPageLoad = true - }) - - await button.click() - - const url = target === 'internal' ? POSTS_URL : `${EXTERNAL_ORIGIN}/` - await page.waitForURL(url) - expect(page.url()).toBe(url) - if (target === 'internal') { - await waitForRouterIdle(page) - await expect(page.getByTestId('PostsIndexComponent')).toBeInViewport() - expect(fullPageLoad).toBe(reloadDocument) - } - }) - }) - - test('multiple Set-Cookie headers are preserved on redirect', async ({ - page, - }) => { - // This test verifies that multiple Set-Cookie headers are not lost during redirect - await page.goto('/multi-cookie-redirect') - - // Wait for redirect to complete - await page.waitForURL(/\/multi-cookie-redirect\/target/) - - // Should redirect to target page - await expect(page.getByTestId('multi-cookie-redirect-target')).toBeVisible() - expect(page.url()).toContain('/multi-cookie-redirect/target') - - // Verify all three cookies were preserved during the redirect - await expect(page.getByTestId('cookie-session')).toHaveText('session-value') - await expect(page.getByTestId('cookie-csrf')).toHaveText('csrf-token-value') - await expect(page.getByTestId('cookie-theme')).toHaveText('dark') - }) -}) diff --git a/e2e/solid-start/basic/tests/script-duplication.spec.ts b/e2e/solid-start/basic/tests/script-duplication.spec.ts deleted file mode 100644 index b6c9e9e2fd..0000000000 --- a/e2e/solid-start/basic/tests/script-duplication.spec.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { expect, test } from '@playwright/test' - -test.describe('Script Duplication Prevention', () => { - test('should not create duplicate scripts on SSR route', async ({ page }) => { - await page.goto('/scripts') - - await expect(page.getByTestId('scripts-test-heading')).toBeInViewport() - - const scriptCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - - expect(scriptCount).toBe(1) - expect(await page.evaluate('window.SCRIPT_1')).toBe(true) - }) - - test('should not create duplicate scripts during client-side navigation', async ({ - page, - }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Scripts', exact: true }).click() - await expect(page.getByTestId('scripts-test-heading')).toBeInViewport() - - const firstNavCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - expect(firstNavCount).toBe(1) - - await page.getByRole('link', { name: 'Home' }).click() - await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible() - - await page.getByRole('link', { name: 'Scripts', exact: true }).click() - await expect(page.getByTestId('scripts-test-heading')).toBeInViewport() - - const secondNavCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - expect(secondNavCount).toBe(1) - expect(await page.evaluate('window.SCRIPT_1')).toBe(true) - }) - - test('should not create duplicate scripts with multiple navigation cycles', async ({ - page, - }) => { - await page.goto('/') - - for (let i = 0; i < 3; i++) { - await page.getByRole('link', { name: 'Scripts', exact: true }).click() - await expect(page.getByTestId('scripts-test-heading')).toBeInViewport() - - await page.getByRole('link', { name: 'Home' }).click() - await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible() - } - - await page.getByRole('link', { name: 'Scripts', exact: true }).click() - await expect(page.getByTestId('scripts-test-heading')).toBeInViewport() - - const finalCount = await page.evaluate(() => { - return document.querySelectorAll('script[src="script.js"]').length - }) - expect(finalCount).toBe(1) - expect(await page.evaluate('window.SCRIPT_1')).toBe(true) - }) - - test('should not create duplicate inline scripts', async ({ page }) => { - await page.goto('/inline-scripts') - - await expect( - page.getByTestId('inline-scripts-test-heading'), - ).toBeInViewport() - - const script1Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_1 = true'), - ).length - }) - - const script2Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_2 = "test"'), - ).length - }) - - expect(script1Count).toBe(1) - expect(script2Count).toBe(1) - expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true) - expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test') - }) - - test('should not create duplicate inline scripts during client-side navigation', async ({ - page, - }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Inline Scripts' }).click() - await expect( - page.getByTestId('inline-scripts-test-heading'), - ).toBeInViewport() - - const firstNavScript1Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_1 = true'), - ).length - }) - expect(firstNavScript1Count).toBe(1) - - await page.getByRole('link', { name: 'Home' }).click() - await expect(page.getByRole('link', { name: 'Posts' })).toBeVisible() - - await page.getByRole('link', { name: 'Inline Scripts' }).click() - await expect( - page.getByTestId('inline-scripts-test-heading'), - ).toBeInViewport() - - const secondNavScript1Count = await page.evaluate(() => { - const scripts = Array.from(document.querySelectorAll('script:not([src])')) - return scripts.filter( - (script) => - script.textContent && - script.textContent.includes('window.INLINE_SCRIPT_1 = true'), - ).length - }) - expect(secondNavScript1Count).toBe(1) - - expect(await page.evaluate('window.INLINE_SCRIPT_1')).toBe(true) - expect(await page.evaluate('window.INLINE_SCRIPT_2')).toBe('test') - }) -}) diff --git a/e2e/solid-start/basic/tests/search-params.spec.ts b/e2e/solid-start/basic/tests/search-params.spec.ts deleted file mode 100644 index cdf5a21b4a..0000000000 --- a/e2e/solid-start/basic/tests/search-params.spec.ts +++ /dev/null @@ -1,100 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import { isSpaMode } from './utils/isSpaMode' -import { isPrerender } from './utils/isPrerender' -import type { Response } from '@playwright/test' - -function expectRedirect(response: Response | null, endsWith: string) { - expect(response).not.toBeNull() - expect(response!.request().redirectedFrom()).not.toBeNull() - const redirectUrl = response! - .request() - .redirectedFrom()! - .redirectedTo() - ?.url() - expect(redirectUrl).toBeDefined() - expect(redirectUrl!.endsWith(endsWith)) -} - -function expectNoRedirect(response: Response | null) { - expect(response).not.toBeNull() - const request = response!.request() - expect(request.redirectedFrom()).toBeNull() -} - -test.describe('/search-params/loader-throws-redirect', () => { - test('Directly visiting the route without search param set', async ({ - page, - }) => { - const response = await page.goto('/search-params/loader-throws-redirect') - - if (!isSpaMode && !isPrerender) { - expectRedirect(response, '/search-params/loader-throws-redirect?step=a') - } - - await expect(page.getByTestId('search-param')).toContainText('a') - expect(page.url().endsWith('/search-params/loader-throws-redirect?step=a')) - }) - - test('Directly visiting the route with search param set', async ({ - page, - }) => { - const response = await page.goto( - '/search-params/loader-throws-redirect?step=b', - ) - expectNoRedirect(response) - await expect(page.getByTestId('search-param')).toContainText('b') - expect(page.url().endsWith('/search-params/loader-throws-redirect?step=b')) - }) -}) - -test.describe('/search-params/default', () => { - test('Directly visiting the route without search param set', async ({ - page, - }) => { - const response = await page.goto('/search-params/default') - if (!isSpaMode && !isPrerender) { - expectRedirect(response, '/search-params/default?default=d1') - } - await expect(page.getByTestId('search-default')).toContainText('d1') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d1'), - ).toBeTruthy() - }) - - test('Directly visiting the route with search param set', async ({ - page, - }) => { - const response = await page.goto('/search-params/default?default=d2') - expectNoRedirect(response) - - await expect(page.getByTestId('search-default')).toContainText('d2') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d2'), - ).toBeTruthy() - }) - - test('navigating to the route without search param set', async ({ page }) => { - await page.goto('/search-params/') - await page.getByTestId('link-to-default-without-search').click() - - await expect(page.getByTestId('search-default')).toContainText('d1') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d1'), - ).toBeTruthy() - }) - - test('navigating to the route with search param set', async ({ page }) => { - await page.goto('/search-params/') - await page.getByTestId('link-to-default-with-search').click() - - await expect(page.getByTestId('search-default')).toContainText('d2') - await expect(page.getByTestId('context-hello')).toContainText('world') - expect( - page.url().endsWith('/search-params/default?default=d2'), - ).toBeTruthy() - }) -}) diff --git a/e2e/solid-start/basic/tests/special-characters.spec.ts b/e2e/solid-start/basic/tests/special-characters.spec.ts deleted file mode 100644 index 284097d72b..0000000000 --- a/e2e/solid-start/basic/tests/special-characters.spec.ts +++ /dev/null @@ -1,246 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import { isSpaMode } from './utils/isSpaMode' - -test.use({ - whitelistErrors: [ - /Failed to load resource: the server responded with a status of 404/, - ], -}) -test.describe('Unicode route rendering', () => { - test.beforeEach(async ({ page }) => { - await page.goto('/specialChars') - }) - - test('should render non-latin route correctly with direct navigation', async ({ - page, - baseURL, - }) => { - await page.goto('/specialChars/대한민국') - await page.waitForURL( - `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`, - ) - - await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport() - }) - - test('should render non-latin route correctly during router navigation', async ({ - page, - baseURL, - }) => { - const nonLatinLink = page.getByTestId('special-non-latin-link') - - await nonLatinLink.click() - await page.waitForURL( - `${baseURL}/specialChars/%EB%8C%80%ED%95%9C%EB%AF%BC%EA%B5%AD`, - ) - - await expect(page.getByTestId('special-non-latin-heading')).toBeInViewport() - }) - - test.describe('Special characters in path params', () => { - test('should render route correctly on direct navigation', async ({ - page, - baseURL, - }) => { - await page.goto('/specialChars/대|') - await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`) - - const param = await page.getByTestId('special-param').textContent() - - expect(param).toBe('대|') - }) - - test('should render route correctly on router navigation', async ({ - page, - baseURL, - }) => { - const link = page.getByTestId('special-param-link') - - await link.click() - await page.waitForURL(`${baseURL}/specialChars/%EB%8C%80%7C`) - - const param = await page.getByTestId('special-param').textContent() - - expect(param).toBe('대|') - }) - }) - - test.describe('Special characters in search params', () => { - test('should render route correctly on direct navigation', async ({ - page, - baseURL, - }) => { - await page.goto('/specialChars/search?searchParam=대|') - - await page.waitForURL( - `${baseURL}/specialChars/search?searchParam=%EB%8C%80|`, - ) - - const searchParam = await page - .getByTestId('special-search-param') - .textContent() - - expect(searchParam).toBe('대|') - }) - - test('should render route correctly on router navigation', async ({ - page, - baseURL, - }) => { - const link = page.getByTestId('special-searchParam-link') - - await link.click() - await page.waitForURL( - `${baseURL}/specialChars/search?searchParam=%EB%8C%80%7C`, - ) - - const searchParam = await page - .getByTestId('special-search-param') - .textContent() - - expect(searchParam).toBe('대|') - }) - }) - - test.describe('Special characters in url hash', () => { - test('should render route correctly on direct navigation', async ({ - page, - baseURL, - }) => { - await expect(page.getByTestId('special-hash-link-1')).not.toContainClass( - 'font-bold', - ) - await expect(page.getByTestId('special-hash-link-2')).not.toContainClass( - 'font-bold', - ) - - await page.goto('/specialChars/hash#대|') - - await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`) - await page.waitForLoadState('load') - - await expect(page.getByTestId('special-hash-heading')).toBeInViewport() - - await expect(page.getByTestId('special-hash-link-1')).toContainClass( - 'font-bold', - ) - - await expect(page.getByTestId('special-hash-link-2')).not.toContainClass( - 'font-bold', - ) - - await page.getByTestId('toggle-hash-button').click() - - const hashValue = await page.getByTestId('special-hash').textContent() - - expect(hashValue).toBe('대|') - }) - - test('should render route correctly on router navigation', async ({ - page, - baseURL, - }) => { - await expect(page.getByTestId('special-hash-link-1')).not.toContainClass( - 'font-bold', - ) - - await expect(page.getByTestId('special-hash-link-2')).not.toContainClass( - 'font-bold', - ) - - const link = page.getByTestId('special-hash-link-1') - - await link.click() - - await page.waitForURL(`${baseURL}/specialChars/hash#%EB%8C%80|`) - await page.waitForLoadState('load') - - await expect(page.getByTestId('special-hash-heading')).toBeInViewport() - - await expect(page.getByTestId('special-hash-link-1')).toContainClass( - 'font-bold', - ) - - await expect(page.getByTestId('special-hash-link-2')).not.toContainClass( - 'font-bold', - ) - - await page.getByTestId('toggle-hash-button').click() - - const hashValue = await page.getByTestId('special-hash').textContent() - - expect(hashValue).toBe('대|') - }) - }) - - test.describe('malformed paths', () => { - const malformedPathnames = [ - '/specialChars/malformed/%E0%A4', - '/specialChars/malformed/%80', - '/specialChars/malformed/%FF', - ] - - test.use({ - whitelistErrors: [ - 'Failed to load resource: the server responded with a status of 404', - 'Failed to load resource: the server responded with a status of 400 (Bad Request)', - ], - }) - - for (const pathname of malformedPathnames) { - test(`un-matched malformed path "${pathname}" should return bad request on direct navigation`, async ({ - page, - }) => { - const res = await page.goto(pathname) - - await page.waitForLoadState(`load`) - - // in spa mode this is caught and handled at server level - if (!isSpaMode) { - expect(res!.status()).toBe(400) - } else { - expect(res!.status()).toBe(400) - } - }) - } - - test('malformed path params should return not found on router link', async ({ - page, - baseURL, - }) => { - await page.goto('/specialChars/malformed') - await page.waitForURL(`${baseURL}/specialChars/malformed`) - - const link = page.getByTestId('special-malformed-path-link') - - await link.click() - await page.waitForLoadState('load') - - await expect( - page.getByTestId('default-not-found-component'), - ).toBeInViewport() - }) - - test('un-matched malformed paths should return not found on direct navigation in search params', async ({ - page, - baseURL, - }) => { - await page.goto('/specialChars/malformed/search?searchParam=%E0%A4') - - await page.waitForURL( - `${baseURL}/specialChars/malformed/search?searchParam=%E0%A4`, - ) - - await expect( - page.getByTestId('special-malformed-search-param'), - ).toBeInViewport() - - const searchParam = await page - .getByTestId('special-malformed-search-param') - .textContent() - - expect(searchParam).toBe('�') - }) - }) -}) diff --git a/e2e/solid-start/basic/tests/streaming.spec.ts b/e2e/solid-start/basic/tests/streaming.spec.ts deleted file mode 100644 index 5fc81f1fed..0000000000 --- a/e2e/solid-start/basic/tests/streaming.spec.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import { isSpaMode } from './utils/isSpaMode' - -test('Navigating to deferred route', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Deferred' }).click() - - await expect(page.getByTestId('regular-person')).toContainText('John Doe') - await expect(page.getByTestId('deferred-person')).toContainText( - 'Tanner Linsley', - ) - await expect(page.getByTestId('deferred-stuff')).toContainText( - 'Hello deferred!', - ) -}) - -test('Directly visiting the deferred route', async ({ page }) => { - await page.goto('/deferred') - - await expect(page.getByTestId('regular-person')).toContainText('John Doe') - await expect(page.getByTestId('deferred-person')).toContainText( - 'Tanner Linsley', - ) - await expect(page.getByTestId('deferred-stuff')).toContainText( - 'Hello deferred!', - ) -}) - -test('streaming loader data', async ({ page }) => { - await page.goto('/stream') - - await expect(page.getByTestId('promise-data')).toContainText('promise-data') - await expect(page.getByTestId('stream-data')).toContainText('stream-data') -}) - -test('streams Await fallback for server function loader promises', async ({ - page, -}) => { - test.skip(isSpaMode, 'SPA mode does not render streamed SSR HTML') - - const response = await page.request.get('/deferred-without-suspense') - const html = await response.text() - - expect(html).toContain('data-testid="deferred-without-suspense-loading"') - - await page.goto('/deferred-without-suspense') - await expect( - page.getByTestId('deferred-without-suspense-data'), - ).not.toBeEmpty() -}) diff --git a/e2e/solid-start/basic/tests/transition.spec.ts b/e2e/solid-start/basic/tests/transition.spec.ts deleted file mode 100644 index 0f145fdf40..0000000000 --- a/e2e/solid-start/basic/tests/transition.spec.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('transitions/count/create-resource should keep old values visible during navigation', async ({ - page, -}) => { - const burstClicks = async (count: number) => { - await page - .getByTestId('increase-button') - .evaluate((element, clickCount) => { - for (let index = 0; index < clickCount; index++) { - ;(element as HTMLAnchorElement).click() - } - }, count) - } - - await page.goto('/transition/count/create-resource') - - await expect(page.getByTestId('n-value')).toContainText('n: 1') - await expect(page.getByTestId('double-value')).toContainText('double: 2') - - const bodyTexts: Array = [] - - const pollInterval = setInterval(async () => { - const text = await page - .locator('body') - .textContent() - .catch(() => '') - if (text) bodyTexts.push(text) - }, 50) - - // 1 click - - await burstClicks(1) - - await expect(page.getByTestId('n-value')).toContainText('n: 1', { - timeout: 2_000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 2', { - timeout: 2_000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 2', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 4', { - timeout: 2000, - }) - - // 2 clicks - - await burstClicks(2) - - await expect(page.getByTestId('n-value')).toContainText('n: 2', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 4', { - timeout: 2000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 4', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 8', { - timeout: 2000, - }) - - // 3 clicks - - await burstClicks(3) - - await expect(page.getByTestId('n-value')).toContainText('n: 4', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 8', { - timeout: 2000, - }) - - await page.waitForTimeout(200) - - await expect(page.getByTestId('n-value')).toContainText('n: 7', { - timeout: 2000, - }) - await expect(page.getByTestId('double-value')).toContainText('double: 14', { - timeout: 2000, - }) - - clearInterval(pollInterval) - - // With proper transitions, old values should remain visible until new ones arrive - const hasLoadingText = bodyTexts.some((text) => text.includes('Loading...')) - - if (hasLoadingText) { - throw new Error( - 'FAILED: "Loading..." appeared during navigation. ' + - 'Solid Router should use transitions to keep old values visible.', - ) - } -}) diff --git a/e2e/solid-start/basic/tests/utils/getPackageName.ts b/e2e/solid-start/basic/tests/utils/getPackageName.ts deleted file mode 100644 index 6bd2e0499e..0000000000 --- a/e2e/solid-start/basic/tests/utils/getPackageName.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { readFileSync } from 'node:fs' -import { join } from 'node:path' - -let packageName: string | undefined - -export function getPackageName() { - if (!packageName) { - const packageJson = JSON.parse( - readFileSync(join(process.cwd(), 'package.json'), 'utf-8'), - ) as { name: string } - - packageName = packageJson.name - } - - return packageName -} diff --git a/e2e/solid-start/basic/tests/utils/isPrerender.ts b/e2e/solid-start/basic/tests/utils/isPrerender.ts deleted file mode 100644 index d5d991d454..0000000000 --- a/e2e/solid-start/basic/tests/utils/isPrerender.ts +++ /dev/null @@ -1 +0,0 @@ -export const isPrerender: boolean = process.env.MODE === 'prerender' diff --git a/e2e/solid-start/basic/tests/utils/isPreview.ts b/e2e/solid-start/basic/tests/utils/isPreview.ts deleted file mode 100644 index 7ea362a83e..0000000000 --- a/e2e/solid-start/basic/tests/utils/isPreview.ts +++ /dev/null @@ -1 +0,0 @@ -export const isPreview: boolean = process.env.MODE === 'preview' diff --git a/e2e/solid-start/basic/tests/utils/isSpaMode.ts b/e2e/solid-start/basic/tests/utils/isSpaMode.ts deleted file mode 100644 index b4edb829a8..0000000000 --- a/e2e/solid-start/basic/tests/utils/isSpaMode.ts +++ /dev/null @@ -1 +0,0 @@ -export const isSpaMode: boolean = process.env.MODE === 'spa' diff --git a/e2e/solid-start/basic/tsconfig.json b/e2e/solid-start/basic/tsconfig.json deleted file mode 100644 index 0543683c33..0000000000 --- a/e2e/solid-start/basic/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx", "public/script*.js"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "allowImportingTsExtensions": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/basic/vite.config.ts b/e2e/solid-start/basic/vite.config.ts deleted file mode 100644 index faca5763c8..0000000000 --- a/e2e/solid-start/basic/vite.config.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' -import { isSpaMode } from './tests/utils/isSpaMode' -import { isPrerender } from './tests/utils/isPrerender' -import tailwindcss from '@tailwindcss/vite' - -const spaModeConfiguration = { - enabled: true, - prerender: { - outputPath: 'index.html', - }, -} - -const prerenderConfiguration = { - enabled: true, - filter: (page: { path: string }) => - ![ - '/this-route-does-not-exist', - '/error-normalization', - '/redirect', - '/i-do-not-exist', - '/not-found', - '/specialChars/search', - '/specialChars/hash', - '/specialChars/malformed', - '/search-params/default', - '/transition', - '/users', - ].some((p) => page.path.includes(p)), - maxRedirects: 100, -} - -const outDir = process.env.E2E_DIST_DIR ?? 'dist' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - build: { - outDir, - }, - server: { - port: 3000, - }, - plugins: [ - tailwindcss(), - tanstackStart({ - spa: isSpaMode ? spaModeConfiguration : undefined, - prerender: isPrerender ? prerenderConfiguration : undefined, - }), - viteSolid({ ssr: true }), - ], -}) diff --git a/e2e/solid-start/csp/.devcontainer/devcontainer.json b/e2e/solid-start/csp/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/csp/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/csp/.gitignore b/e2e/solid-start/csp/.gitignore deleted file mode 100644 index a86a144649..0000000000 --- a/e2e/solid-start/csp/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -dist -.output -test-results -playwright-report diff --git a/e2e/solid-start/csp/package.json b/e2e/solid-start/csp/package.json deleted file mode 100644 index f233a87d67..0000000000 --- a/e2e/solid-start/csp/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-csp", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev", - "build": "vite build && tsc --noEmit", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/node": "^22.10.2", - "srvx": "^1.0.0", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-start/csp/playwright.config.ts b/e2e/solid-start/csp/playwright.config.ts deleted file mode 100644 index 87b32e1f50..0000000000 --- a/e2e/solid-start/csp/playwright.config.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `VITE_SERVER_PORT=${PORT} pnpm build && PORT=${PORT} VITE_SERVER_PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/csp/public/external.css b/e2e/solid-start/csp/public/external.css deleted file mode 100644 index 4085d14afd..0000000000 --- a/e2e/solid-start/csp/public/external.css +++ /dev/null @@ -1,4 +0,0 @@ -.external-styled { - color: blue; - font-weight: bold; -} diff --git a/e2e/solid-start/csp/public/external.js b/e2e/solid-start/csp/public/external.js deleted file mode 100644 index 35cb817064..0000000000 --- a/e2e/solid-start/csp/public/external.js +++ /dev/null @@ -1,3 +0,0 @@ -// This script sets a window global when loaded -// Using a global avoids race conditions with Solid and DOM ownership issues -window.__EXTERNAL_SCRIPT_LOADED__ = true diff --git a/e2e/solid-start/csp/src/routeTree.gen.ts b/e2e/solid-start/csp/src/routeTree.gen.ts deleted file mode 100644 index 4776246e1f..0000000000 --- a/e2e/solid-start/csp/src/routeTree.gen.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* 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' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' - fileRoutesByTo: FileRoutesByTo - to: '/' - id: '__root__' | '/' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/csp/src/router.tsx b/e2e/solid-start/csp/src/router.tsx deleted file mode 100644 index bf0b283bb6..0000000000 --- a/e2e/solid-start/csp/src/router.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { createIsomorphicFn } from '@tanstack/solid-start' -import { routeTree } from './routeTree.gen' - -const getSSROptions = createIsomorphicFn().server(() => { - const array = new Uint8Array(16) - crypto.getRandomValues(array) - const nonce = Array.from(array, (b) => b.toString(16).padStart(2, '0')).join( - '', - ) - return { nonce } -}) - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - ssr: getSSROptions(), - }) -} diff --git a/e2e/solid-start/csp/src/routes/__root.tsx b/e2e/solid-start/csp/src/routes/__root.tsx deleted file mode 100644 index 82faa1929d..0000000000 --- a/e2e/solid-start/csp/src/routes/__root.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import { - createRootRoute, - HeadContent, - Outlet, - Scripts, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - headers: ({ ssr }) => { - const nonce = ssr?.nonce - if (!nonce) return - return { - 'Content-Security-Policy': [ - "default-src 'self'", - `script-src 'self' 'nonce-${nonce}'`, - `style-src 'self' 'nonce-${nonce}'`, - ].join('; '), - } - }, - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { title: 'CSP Nonce Test' }, - ], - links: [{ rel: 'stylesheet', href: '/external.css' }], - scripts: [{ src: '/external.js' }], - styles: [ - { children: '.inline-styled { color: green; font-weight: bold; }' }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/e2e/solid-start/csp/src/routes/index.tsx b/e2e/solid-start/csp/src/routes/index.tsx deleted file mode 100644 index d737e5d477..0000000000 --- a/e2e/solid-start/csp/src/routes/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createSignal } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - const [count, setCount] = createSignal(0) - - return ( -
-

CSP Nonce Test

-

- This should be green if inline styles work -

-

- This should be blue if external styles work -

- -
- ) -} diff --git a/e2e/solid-start/csp/src/vite-env.d.ts b/e2e/solid-start/csp/src/vite-env.d.ts deleted file mode 100644 index 11f02fe2a0..0000000000 --- a/e2e/solid-start/csp/src/vite-env.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/e2e/solid-start/csp/tests/csp.spec.ts b/e2e/solid-start/csp/tests/csp.spec.ts deleted file mode 100644 index f299e73399..0000000000 --- a/e2e/solid-start/csp/tests/csp.spec.ts +++ /dev/null @@ -1,178 +0,0 @@ -import { expect, type Page } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' - -async function getRawHtml(page: Page) { - let rawHtml = '' - - await page.route('/', async (route) => { - const response = await route.fetch() - rawHtml = await response.text() - await route.fulfill({ response, body: rawHtml }) - }) - - const response = await page.goto('/') - await page.unrouteAll({ behavior: 'ignoreErrors' }) - - return { rawHtml, response } -} - -test('CSP header is set with nonce', async ({ page }) => { - const response = await page.goto('/') - const csp = response?.headers()['content-security-policy'] - expect(csp).toContain("script-src 'self' 'nonce-") - expect(csp).toContain("style-src 'self' 'nonce-") -}) - -test('Inline scripts have nonce attribute', async ({ page }) => { - await page.goto('/') - const scripts = await page.locator('script[nonce]').all() - expect(scripts.length).toBeGreaterThan(0) -}) - -test('Inline styles have nonce attribute', async ({ page }) => { - await page.goto('/') - const styles = await page.locator('style[nonce]').all() - expect(styles.length).toBeGreaterThan(0) -}) - -test('External script has nonce attribute', async ({ page }) => { - const { rawHtml } = await getRawHtml(page) - expect(rawHtml).toMatch( - /]*\bsrc="\/external\.js")(?=[^>]*\bnonce="[^"]+")[^>]*>/, - ) -}) - -test('External stylesheet has nonce attribute', async ({ page }) => { - await page.goto('/') - const externalStylesheet = page.locator('link[href="/external.css"]') - await expect(externalStylesheet).toHaveAttribute('nonce') -}) - -test('Nonces match between header and elements', async ({ page }) => { - // Intercept the HTML response to get raw content before browser strips nonces - const { rawHtml, response } = await getRawHtml(page) - - const csp = response?.headers()['content-security-policy'] || '' - - // Extract nonce from CSP header - const nonceMatch = csp.match(/nonce-([a-f0-9]+)/) - expect(nonceMatch).toBeTruthy() - const headerNonce = nonceMatch![1] - - // Check script nonces match - look for nonce attribute anywhere in the script tag - const scriptNonces = [ - ...rawHtml.matchAll(/]*\bnonce="([^"]+)"[^>]*>/g), - ].map((m) => m[1]) - expect(scriptNonces.length).toBeGreaterThan(0) - for (const nonce of scriptNonces) { - expect(nonce).toBe(headerNonce) - } - - // Check style nonces match - const styleNonces = [ - ...rawHtml.matchAll(/]*\bnonce="([^"]+)"[^>]*>/g), - ].map((m) => m[1]) - expect(styleNonces.length).toBeGreaterThan(0) - for (const nonce of styleNonces) { - expect(nonce).toBe(headerNonce) - } - - // Check external script nonce matches (nonce can be before or after src) - const externalScriptMatch = rawHtml.match( - /]*\bsrc="\/external\.js"[^>]*\bnonce="([^"]+)"[^>]*>|]*\bnonce="([^"]+)"[^>]*\bsrc="\/external\.js"[^>]*>/, - ) - expect(externalScriptMatch).toBeTruthy() - expect(externalScriptMatch![1] || externalScriptMatch![2]).toBe(headerNonce) - - // Check external stylesheet nonce matches (nonce can be before or after href) - const externalStyleMatch = rawHtml.match( - /]*\bhref="\/external\.css"[^>]*\bnonce="([^"]+)"[^>]*>|]*\bnonce="([^"]+)"[^>]*\bhref="\/external\.css"[^>]*>/, - ) - expect(externalStyleMatch).toBeTruthy() - expect(externalStyleMatch![1] || externalStyleMatch![2]).toBe(headerNonce) -}) - -test('Hydration works - counter increments', async ({ page }) => { - await page.goto('/') - await expect(page.getByTestId('counter-value')).toContainText('0') - - // Keep clicking until Solid hydrates and the counter increments - // This handles the race between test execution and hydration - await expect - .poll( - async () => { - await page.getByTestId('counter-btn').click() - return page.getByTestId('counter-value').textContent() - }, - { timeout: 10000, intervals: [100, 200, 500, 1000] }, - ) - .not.toBe('0') - - // Now that hydration is confirmed, verify further increments work - const currentValue = parseInt( - (await page.getByTestId('counter-value').textContent()) || '0', - ) - await page.getByTestId('counter-btn').click() - await expect(page.getByTestId('counter-value')).toContainText( - String(currentValue + 1), - ) -}) - -test('Inline styles work with CSP', async ({ page }) => { - await page.goto('/') - const el = page.getByTestId('inline-styled') - await expect(el).toBeVisible() - // Verify the style was applied (green color) - const color = await el.evaluate((e) => getComputedStyle(e).color) - expect(color).toBe('rgb(0, 128, 0)') // green -}) - -test('External styles work with CSP', async ({ page }) => { - await page.goto('/') - const el = page.getByTestId('external-styled') - await expect(el).toBeVisible() - // Verify the style was applied (blue color) - const color = await el.evaluate((e) => getComputedStyle(e).color) - expect(color).toBe('rgb(0, 0, 255)') // blue -}) - -test('External script executes with CSP', async ({ page }) => { - await page.goto('/') - // Check that the external script set its window global - await expect - .poll(() => page.evaluate(() => (window as any).__EXTERNAL_SCRIPT_LOADED__)) - .toBe(true) -}) - -test('No CSP violations in console', async ({ page }) => { - const violations: string[] = [] - page.on('console', (msg) => { - if (msg.text().toLowerCase().includes('content security policy')) { - violations.push(msg.text()) - } - }) - page.on('pageerror', (err) => { - if (err.message.toLowerCase().includes('content security policy')) { - violations.push(err.message) - } - }) - await page.goto('/') - await page.getByTestId('counter-btn').click() - // Small wait to ensure any async violations are caught - await page.waitForTimeout(100) - expect(violations).toEqual([]) -}) - -test('Each request gets a unique nonce', async ({ page }) => { - const response1 = await page.goto('/') - const csp1 = response1?.headers()['content-security-policy'] || '' - const nonce1 = csp1.match(/nonce-([a-f0-9]+)/)?.[1] - - const response2 = await page.goto('/') - const csp2 = response2?.headers()['content-security-policy'] || '' - const nonce2 = csp2.match(/nonce-([a-f0-9]+)/)?.[1] - - expect(nonce1).toBeTruthy() - expect(nonce2).toBeTruthy() - expect(nonce1).not.toBe(nonce2) -}) diff --git a/e2e/solid-start/csp/tsconfig.json b/e2e/solid-start/csp/tsconfig.json deleted file mode 100644 index ff0556e7a8..0000000000 --- a/e2e/solid-start/csp/tsconfig.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true - } -} diff --git a/e2e/solid-start/csp/vite.config.ts b/e2e/solid-start/csp/vite.config.ts deleted file mode 100644 index a9913da087..0000000000 --- a/e2e/solid-start/csp/vite.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' - -export default defineConfig({ - server: { - port: 3000, - }, - plugins: [tanstackStart(), viteSolid({ ssr: true })], -}) diff --git a/e2e/solid-start/css-modules/.devcontainer/devcontainer.json b/e2e/solid-start/css-modules/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/css-modules/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/css-modules/.gitignore b/e2e/solid-start/css-modules/.gitignore deleted file mode 100644 index 950326609c..0000000000 --- a/e2e/solid-start/css-modules/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -dist -.routeTree.gen.ts -src/routeTree.gen.ts -test-results -playwright-report -port*.txt diff --git a/e2e/solid-start/css-modules/.prettierignore b/e2e/solid-start/css-modules/.prettierignore deleted file mode 100644 index 083bdb7c4c..0000000000 --- a/e2e/solid-start/css-modules/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -src/routeTree.gen.ts diff --git a/e2e/solid-start/css-modules/package.json b/e2e/solid-start/css-modules/package.json deleted file mode 100644 index 107659f43c..0000000000 --- a/e2e/solid-start/css-modules/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-css-modules", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev --port $PORT", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e:dev": "MODE=dev playwright test --project=chromium", - "test:e2e:prod": "playwright test --project=chromium", - "test:e2e": "pnpm run test:e2e:dev" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:*", - "@tanstack/solid-start": "workspace:*", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-e2e-utils": "workspace:*", - "@types/node": "^22.10.2", - "sass": "^1.97.2", - "srvx": "^1.0.0", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-start/css-modules/playwright.config.ts b/e2e/solid-start/css-modules/playwright.config.ts deleted file mode 100644 index a50ac5ae63..0000000000 --- a/e2e/solid-start/css-modules/playwright.config.ts +++ /dev/null @@ -1,41 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const mode = process.env.MODE ?? 'prod' -const isDev = mode === 'dev' -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -export default defineConfig({ - testDir: './tests', - workers: 1, - reporter: [['line']], - - globalSetup: './tests/setup/global.setup.ts', - - use: { - baseURL, - }, - - webServer: { - command: isDev - ? `pnpm dev:e2e --port 0` - : `pnpm build && PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - VITE_NODE_ENV: 'test', - PORT: String(PORT), - }, - }, - - projects: [ - { - name: 'chromium', - use: { - ...devices['Desktop Chrome'], - }, - }, - ], -}) diff --git a/e2e/solid-start/css-modules/src/router.tsx b/e2e/solid-start/css-modules/src/router.tsx deleted file mode 100644 index aa5762b4f7..0000000000 --- a/e2e/solid-start/css-modules/src/router.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - const router = createRouter({ - routeTree, - scrollRestoration: true, - defaultPreload: false, - }) - - return router -} diff --git a/e2e/solid-start/css-modules/src/routes/__root.tsx b/e2e/solid-start/css-modules/src/routes/__root.tsx deleted file mode 100644 index 9ee18b1a5a..0000000000 --- a/e2e/solid-start/css-modules/src/routes/__root.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - ], - }), - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - -
- -
- - - - ) -} diff --git a/e2e/solid-start/css-modules/src/routes/index.tsx b/e2e/solid-start/css-modules/src/routes/index.tsx deleted file mode 100644 index 3c7caf6a97..0000000000 --- a/e2e/solid-start/css-modules/src/routes/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import '~/styles/global.css' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

CSS Collection Test - Global CSS

-

This page tests that global CSS is collected and served during SSR.

- -
-
- Global CSS Applied -
-
- This container should have a blue background, white text, and rounded - corners even with JavaScript disabled. -
-
-
- ) -} diff --git a/e2e/solid-start/css-modules/src/routes/modules.tsx b/e2e/solid-start/css-modules/src/routes/modules.tsx deleted file mode 100644 index 34cd8d36ea..0000000000 --- a/e2e/solid-start/css-modules/src/routes/modules.tsx +++ /dev/null @@ -1,28 +0,0 @@ -/// -import { createFileRoute } from '@tanstack/solid-router' -import styles from '~/styles/card.module.css' - -export const Route = createFileRoute('/modules')({ - component: Modules, -}) - -function Modules() { - return ( -
-

CSS Collection Test - CSS Modules

-

- This page tests that CSS modules are collected and served during SSR. -

- -
-
- CSS Module Applied -
-
- This card should have a green theme with scoped class names even with - JavaScript disabled. -
-
-
- ) -} diff --git a/e2e/solid-start/css-modules/src/routes/sass-mixin.tsx b/e2e/solid-start/css-modules/src/routes/sass-mixin.tsx deleted file mode 100644 index 659790c5cd..0000000000 --- a/e2e/solid-start/css-modules/src/routes/sass-mixin.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import '~/styles/app.scss' - -export const Route = createFileRoute('/sass-mixin')({ - component: SassMixin, -}) - -function SassMixin() { - return ( -
-

CSS Collection Test - Sass Mixin

-

- This page tests that Sass mixins imported in a parent file are available - to subsequent imports during dev mode SSR. -

- -
- - Sass Mixin Applied - Should be centered with purple background - -
-
- ) -} diff --git a/e2e/solid-start/css-modules/src/styles/app.scss b/e2e/solid-start/css-modules/src/styles/app.scss deleted file mode 100644 index 2c2fde6cb2..0000000000 --- a/e2e/solid-start/css-modules/src/styles/app.scss +++ /dev/null @@ -1,4 +0,0 @@ -// Import the mixin, which should make them available to future imports -@import './center-mixin.scss'; - -@import './mixin-consumer.scss'; diff --git a/e2e/solid-start/css-modules/src/styles/card.module.css b/e2e/solid-start/css-modules/src/styles/card.module.css deleted file mode 100644 index fcbcb419aa..0000000000 --- a/e2e/solid-start/css-modules/src/styles/card.module.css +++ /dev/null @@ -1,20 +0,0 @@ -/* CSS Module for testing scoped styles in dev mode */ - -.card { - background-color: #f0fdf4; /* green-50 */ - padding: 16px; - border-radius: 8px; - border: 1px solid #22c55e; /* green-500 */ -} - -.title { - font-size: 18px; - font-weight: 600; - color: #166534; /* green-800 */ - margin-bottom: 8px; -} - -.content { - font-size: 14px; - color: #15803d; /* green-700 */ -} diff --git a/e2e/solid-start/css-modules/src/styles/center-mixin.scss b/e2e/solid-start/css-modules/src/styles/center-mixin.scss deleted file mode 100644 index 7eeb174b6e..0000000000 --- a/e2e/solid-start/css-modules/src/styles/center-mixin.scss +++ /dev/null @@ -1,5 +0,0 @@ -@mixin center-mixin { - display: flex; - justify-content: center; - align-items: center; -} diff --git a/e2e/solid-start/css-modules/src/styles/global.css b/e2e/solid-start/css-modules/src/styles/global.css deleted file mode 100644 index 5bef746780..0000000000 --- a/e2e/solid-start/css-modules/src/styles/global.css +++ /dev/null @@ -1,19 +0,0 @@ -/* Global styles for testing CSS collection in dev mode */ - -.global-container { - background-color: #3b82f6; /* blue-500 */ - padding: 24px; - border-radius: 12px; - color: white; -} - -.global-title { - font-size: 24px; - font-weight: bold; - margin-bottom: 16px; -} - -.global-description { - font-size: 16px; - opacity: 0.9; -} diff --git a/e2e/solid-start/css-modules/src/styles/mixin-consumer.scss b/e2e/solid-start/css-modules/src/styles/mixin-consumer.scss deleted file mode 100644 index 52715c90b0..0000000000 --- a/e2e/solid-start/css-modules/src/styles/mixin-consumer.scss +++ /dev/null @@ -1,10 +0,0 @@ -.mixin-container { - // Use the center mixin, which is included in app.scss - // This works for the client build, but not for the dev server styles.css build - @include center-mixin; - background-color: #a855f7; /* purple-500 */ - padding: 24px; - border-radius: 12px; - color: white; - min-height: 100px; -} diff --git a/e2e/solid-start/css-modules/tests/css.spec.ts b/e2e/solid-start/css-modules/tests/css.spec.ts deleted file mode 100644 index 0b34d9e651..0000000000 --- a/e2e/solid-start/css-modules/tests/css.spec.ts +++ /dev/null @@ -1,207 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' - -// Whitelist errors that can occur in CI: -// - net::ERR_NAME_NOT_RESOLVED: transient network issues -// - 504 (Outdated Optimize Dep): Vite dependency optimization reload -const whitelistErrors = [ - 'Failed to load resource: net::ERR_NAME_NOT_RESOLVED', - 'Failed to load resource: the server responded with a status of 504', -] - -test.describe('CSS styles in SSR (dev mode)', () => { - test.use({ whitelistErrors }) - - // Helper to build full URL from baseURL and path - // Playwright's goto with absolute paths (like '/modules') ignores baseURL's path portion - // So we need to manually construct the full URL - const buildUrl = (baseURL: string, path: string) => { - return baseURL.replace(/\/$/, '') + path - } - - test.describe('with JavaScript disabled', () => { - test.use({ javaScriptEnabled: false, whitelistErrors }) - - test('global CSS is applied on initial page load', async ({ - page, - baseURL, - }) => { - await page.goto(buildUrl(baseURL!, '/')) - - const element = page.getByTestId('global-styled') - await expect(element).toBeVisible() - - // Verify the CSS is applied by checking computed styles - // #3b82f6 (blue-500) in RGB is rgb(59, 130, 246) - const backgroundColor = await element.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(59, 130, 246)') - - const padding = await element.evaluate( - (el) => getComputedStyle(el).padding, - ) - expect(padding).toBe('24px') - - const borderRadius = await element.evaluate( - (el) => getComputedStyle(el).borderRadius, - ) - expect(borderRadius).toBe('12px') - }) - - test('CSS modules are applied on initial page load', async ({ - page, - baseURL, - }) => { - await page.goto(buildUrl(baseURL!, '/modules')) - - const card = page.getByTestId('module-card') - await expect(card).toBeVisible() - - // Verify class is scoped (hashed) - const className = await card.getAttribute('class') - expect(className).toBeTruthy() - expect(className).not.toBe('card') - // The class should contain some hash characters (CSS modules add a hash) - expect(className!.length).toBeGreaterThan(5) - - // Verify computed styles from card.module.css - // #f0fdf4 (green-50) in RGB is rgb(240, 253, 244) - const backgroundColor = await card.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(240, 253, 244)') - - const padding = await card.evaluate((el) => getComputedStyle(el).padding) - expect(padding).toBe('16px') - - const borderRadius = await card.evaluate( - (el) => getComputedStyle(el).borderRadius, - ) - expect(borderRadius).toBe('8px') - }) - - test('global CSS class names are NOT scoped', async ({ page, baseURL }) => { - await page.goto(buildUrl(baseURL!, '/')) - - const element = page.getByTestId('global-styled') - await expect(element).toBeVisible() - - // Get the class attribute - it should be the plain class name (not hashed) - const className = await element.getAttribute('class') - expect(className).toBe('global-container') - }) - - test('Sass mixin styles are applied on initial page load', async ({ - page, - baseURL, - }) => { - await page.goto(buildUrl(baseURL!, '/sass-mixin')) - - const element = page.getByTestId('mixin-styled') - await expect(element).toBeVisible() - - // Verify the mixin is applied (display: flex from center-mixin) - const display = await element.evaluate( - (el) => getComputedStyle(el).display, - ) - expect(display).toBe('flex') - - const justifyContent = await element.evaluate( - (el) => getComputedStyle(el).justifyContent, - ) - expect(justifyContent).toBe('center') - - const alignItems = await element.evaluate( - (el) => getComputedStyle(el).alignItems, - ) - expect(alignItems).toBe('center') - - // Verify other styles from mixin-consumer.scss - // #a855f7 (purple-500) in RGB is rgb(168, 85, 247) - const backgroundColor = await element.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(168, 85, 247)') - - const padding = await element.evaluate( - (el) => getComputedStyle(el).padding, - ) - expect(padding).toBe('24px') - }) - }) - - test('styles persist after hydration', async ({ page, baseURL }) => { - await page.goto(buildUrl(baseURL!, '/')) - - // Wait for hydration and styles to be applied - const element = page.getByTestId('global-styled') - await expect(element).toBeVisible() - - // Wait for CSS to be applied (background color should not be transparent) - await expect(async () => { - const backgroundColor = await element.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(59, 130, 246)') - }).toPass({ timeout: 5000 }) - }) - - test('CSS modules styles persist after hydration', async ({ - page, - baseURL, - }) => { - await page.goto(buildUrl(baseURL!, '/modules')) - - // Wait for hydration and styles to be applied - const card = page.getByTestId('module-card') - await expect(card).toBeVisible() - - // Wait for CSS to be applied (background color should not be transparent) - await expect(async () => { - const backgroundColor = await card.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(240, 253, 244)') - }).toPass({ timeout: 5000 }) - }) - - test('styles work correctly after client-side navigation', async ({ - page, - baseURL, - }) => { - // Start from home - await page.goto(buildUrl(baseURL!, '/')) - - // Verify initial styles - const globalElement = page.getByTestId('global-styled') - await expect(globalElement).toBeVisible() - let backgroundColor = await globalElement.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(59, 130, 246)') - - // Navigate to modules page - await page.getByTestId('nav-modules').click() - await page.waitForURL('**/modules') - - // Verify CSS modules styles - const card = page.getByTestId('module-card') - await expect(card).toBeVisible() - backgroundColor = await card.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(240, 253, 244)') - - // Navigate back to home - await page.getByTestId('nav-home').click() - await page.waitForURL(/\/([^/]*)(\/)?($|\?)/) - - // Verify global styles still work - await expect(globalElement).toBeVisible() - backgroundColor = await globalElement.evaluate( - (el) => getComputedStyle(el).backgroundColor, - ) - expect(backgroundColor).toBe('rgb(59, 130, 246)') - }) -}) diff --git a/e2e/solid-start/css-modules/tests/setup/global.setup.ts b/e2e/solid-start/css-modules/tests/setup/global.setup.ts deleted file mode 100644 index 17be637f77..0000000000 --- a/e2e/solid-start/css-modules/tests/setup/global.setup.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { preOptimizeDevServer, waitForServer } from '@tanstack/router-e2e-utils' - -export default async function setup() { - if (process.env.MODE !== 'dev') return - - const port = Number(process.env.E2E_APP_PORT ?? 0) - const baseURL = `http://localhost:${port}` - - await waitForServer(baseURL) - await preOptimizeDevServer({ - baseURL, - readyTestId: 'global-styled', - warmup: async (page) => { - await page.goto(`${baseURL}/modules`, { waitUntil: 'domcontentloaded' }) - await page.getByTestId('module-card').waitFor({ state: 'visible' }) - await page.waitForLoadState('networkidle') - - await page.goto(`${baseURL}/sass-mixin`, { - waitUntil: 'domcontentloaded', - }) - await page.getByTestId('mixin-styled').waitFor({ state: 'visible' }) - await page.waitForLoadState('networkidle') - - await page.goto(`${baseURL}/`, { waitUntil: 'domcontentloaded' }) - await page.getByTestId('global-styled').waitFor({ state: 'visible' }) - await page.waitForLoadState('networkidle') - - await page.getByTestId('nav-modules').click() - await page.waitForURL('**/modules') - await page.getByTestId('module-card').waitFor({ state: 'visible' }) - await page.waitForLoadState('networkidle') - - await page.getByTestId('nav-home').click() - await page.waitForURL(/\/([^/]*)(\/)?($|\?)/) - await page.getByTestId('global-styled').waitFor({ state: 'visible' }) - await page.waitForLoadState('networkidle') - }, - }) -} diff --git a/e2e/solid-start/css-modules/tsconfig.json b/e2e/solid-start/css-modules/tsconfig.json deleted file mode 100644 index c34f9d7c36..0000000000 --- a/e2e/solid-start/css-modules/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/css-modules/vite.config.ts b/e2e/solid-start/css-modules/vite.config.ts deleted file mode 100644 index 48a1788a13..0000000000 --- a/e2e/solid-start/css-modules/vite.config.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - server: { - port: 3000, - }, - plugins: [tanstackStart(), viteSolid({ ssr: true })], -}) diff --git a/e2e/solid-start/custom-basepath/.devcontainer/devcontainer.json b/e2e/solid-start/custom-basepath/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/custom-basepath/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/custom-basepath/.gitignore b/e2e/solid-start/custom-basepath/.gitignore deleted file mode 100644 index a79d5cf129..0000000000 --- a/e2e/solid-start/custom-basepath/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -node_modules -package-lock.json -yarn.lock - -.DS_Store -.cache -.env -.vercel -.output - -/build/ -/api/ -/server/build -/public/build -# Sentry Config File -.env.sentry-build-plugin -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-start/custom-basepath/.prettierignore b/e2e/solid-start/custom-basepath/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/solid-start/custom-basepath/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/solid-start/custom-basepath/express-server.ts b/e2e/solid-start/custom-basepath/express-server.ts deleted file mode 100644 index b9bf393466..0000000000 --- a/e2e/solid-start/custom-basepath/express-server.ts +++ /dev/null @@ -1,51 +0,0 @@ -import express from 'express' -import { toNodeHandler } from 'srvx/node' -import type { AddressInfo } from 'node:net' -import type { NodeHttp1Handler } from 'srvx' - -const DEVELOPMENT = process.env.NODE_ENV === 'development' -const PORT = Number.parseInt(process.env.PORT || '3000') - -const app = express() - -if (DEVELOPMENT) { - const viteDevServer = await import('vite').then((vite) => - vite.createServer({ - server: { middlewareMode: true }, - }), - ) - app.use(viteDevServer.middlewares) - app.use(async (req, res, next) => { - try { - const { default: serverEntry } = - await viteDevServer.ssrLoadModule('./src/server.ts') - const handler = toNodeHandler(serverEntry.fetch) as NodeHttp1Handler - await handler(req, res) - } catch (error) { - if (typeof error === 'object' && error instanceof Error) { - viteDevServer.ssrFixStacktrace(error) - } - next(error) - } - }) -} else { - const { default: handler } = await import('./dist/server/server.js') - const nodeHandler = toNodeHandler(handler.fetch) as NodeHttp1Handler - app.use('/custom/basepath', express.static('dist/client')) - app.use(async (req, res, next) => { - try { - await nodeHandler(req, res) - } catch (error) { - next(error) - } - }) -} - -const httpServer = app.listen(PORT, (error) => { - if (error) { - throw error - } - console.log( - `E2E app: http://localhost:${(httpServer.address() as AddressInfo).port}`, - ) -}) diff --git a/e2e/solid-start/custom-basepath/package.json b/e2e/solid-start/custom-basepath/package.json deleted file mode 100644 index 9113db133b..0000000000 --- a/e2e/solid-start/custom-basepath/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-custom-basepath", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "cross-env NODE_ENV=development tsx express-server.ts", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "tsx express-server.ts", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "express": "^5.2.1", - "redaxios": "catalog:", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/express": "^5.0.6", - "@types/node": "^22.10.2", - "cross-env": "^10.0.0", - "srvx": "^1.0.0", - "tailwindcss": "^4.2.2", - "tsx": "^4.20.3", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-start/custom-basepath/playwright.config.ts b/e2e/solid-start/custom-basepath/playwright.config.ts deleted file mode 100644 index e113ce64ad..0000000000 --- a/e2e/solid-start/custom-basepath/playwright.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}/custom/basepath` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ''} --import=@tanstack/router-e2e-utils/mock-api`, - }, - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/custom-basepath/public/android-chrome-192x192.png b/e2e/solid-start/custom-basepath/public/android-chrome-192x192.png deleted file mode 100644 index 09c8324f8c..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/android-chrome-192x192.png and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/android-chrome-512x512.png b/e2e/solid-start/custom-basepath/public/android-chrome-512x512.png deleted file mode 100644 index 11d626ea3d..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/android-chrome-512x512.png and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/apple-touch-icon.png b/e2e/solid-start/custom-basepath/public/apple-touch-icon.png deleted file mode 100644 index 5a9423cc02..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/apple-touch-icon.png and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/favicon-16x16.png b/e2e/solid-start/custom-basepath/public/favicon-16x16.png deleted file mode 100644 index e3389b0044..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/favicon-16x16.png and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/favicon-32x32.png b/e2e/solid-start/custom-basepath/public/favicon-32x32.png deleted file mode 100644 index 900c77d444..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/favicon-32x32.png and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/favicon.ico b/e2e/solid-start/custom-basepath/public/favicon.ico deleted file mode 100644 index 1a1751676f..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/favicon.ico and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/favicon.png b/e2e/solid-start/custom-basepath/public/favicon.png deleted file mode 100644 index 1e77bc0609..0000000000 Binary files a/e2e/solid-start/custom-basepath/public/favicon.png and /dev/null differ diff --git a/e2e/solid-start/custom-basepath/public/script.js b/e2e/solid-start/custom-basepath/public/script.js deleted file mode 100644 index 897477e7d0..0000000000 --- a/e2e/solid-start/custom-basepath/public/script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_1 loaded') -window.SCRIPT_1 = true diff --git a/e2e/solid-start/custom-basepath/public/script2.js b/e2e/solid-start/custom-basepath/public/script2.js deleted file mode 100644 index 819af30daf..0000000000 --- a/e2e/solid-start/custom-basepath/public/script2.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_2 loaded') -window.SCRIPT_2 = true diff --git a/e2e/solid-start/custom-basepath/public/site.webmanifest b/e2e/solid-start/custom-basepath/public/site.webmanifest deleted file mode 100644 index fa99de77db..0000000000 --- a/e2e/solid-start/custom-basepath/public/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/e2e/solid-start/custom-basepath/src/components/CustomMessage.tsx b/e2e/solid-start/custom-basepath/src/components/CustomMessage.tsx deleted file mode 100644 index c038b66d2f..0000000000 --- a/e2e/solid-start/custom-basepath/src/components/CustomMessage.tsx +++ /dev/null @@ -1,8 +0,0 @@ -export function CustomMessage({ message }: { message: string }) { - return ( -
-
This is a custom message:
-

{message}

-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/components/DefaultCatchBoundary.tsx b/e2e/solid-start/custom-basepath/src/components/DefaultCatchBoundary.tsx deleted file mode 100644 index f44db955a0..0000000000 --- a/e2e/solid-start/custom-basepath/src/components/DefaultCatchBoundary.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - ErrorComponent, - Link, - useLocation, - useRouter, -} from '@tanstack/solid-router' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function DefaultCatchBoundary({ error }: ErrorComponentProps) { - const router = useRouter() - const isRoot = useLocation({ - select: (location) => location.pathname === '/', - }) - - console.error(error) - - return ( -
- -
- - {isRoot() ? ( - - Home - - ) : ( - { - e.preventDefault() - window.history.back() - }} - > - Go Back - - )} -
-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/components/NotFound.tsx b/e2e/solid-start/custom-basepath/src/components/NotFound.tsx deleted file mode 100644 index c48444862b..0000000000 --- a/e2e/solid-start/custom-basepath/src/components/NotFound.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Link } from '@tanstack/solid-router' - -export function NotFound({ children }: { children?: any }) { - return ( -
-
- {children ||

The page you are looking for does not exist.

} -
-

- - - Start Over - -

-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/components/PostErrorComponent.tsx b/e2e/solid-start/custom-basepath/src/components/PostErrorComponent.tsx deleted file mode 100644 index 3e5d62c79b..0000000000 --- a/e2e/solid-start/custom-basepath/src/components/PostErrorComponent.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import { ErrorComponent, ErrorComponentProps } from '@tanstack/solid-router' - -export function PostErrorComponent({ error }: ErrorComponentProps) { - return -} diff --git a/e2e/solid-start/custom-basepath/src/components/UserErrorComponent.tsx b/e2e/solid-start/custom-basepath/src/components/UserErrorComponent.tsx deleted file mode 100644 index 529c544ce5..0000000000 --- a/e2e/solid-start/custom-basepath/src/components/UserErrorComponent.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { ErrorComponent } from '@tanstack/solid-router' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function UserErrorComponent({ error }: ErrorComponentProps) { - return -} diff --git a/e2e/solid-start/custom-basepath/src/routeTree.gen.ts b/e2e/solid-start/custom-basepath/src/routeTree.gen.ts deleted file mode 100644 index ddc9f81ab0..0000000000 --- a/e2e/solid-start/custom-basepath/src/routeTree.gen.ts +++ /dev/null @@ -1,388 +0,0 @@ -/* 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 DeferredRouteImport } from './routes/deferred' -import { Route as LogoutRouteImport } from './routes/logout' -import { Route as NavigateTestRouteImport } from './routes/navigate-test' -import { Route as PostsRouteImport } from './routes/posts' -import { Route as UsersRouteImport } from './routes/users' -import { Route as ApiUsersRouteImport } from './routes/api/users' -import { Route as PostsIndexRouteImport } from './routes/posts.index' -import { Route as PostsPostIdRouteImport } from './routes/posts.$postId' -import { Route as RedirectIndexRouteImport } from './routes/redirect.index' -import { Route as RedirectThrowItRouteImport } from './routes/redirect.throw-it' -import { Route as UsersIndexRouteImport } from './routes/users.index' -import { Route as UsersUserIdRouteImport } from './routes/users.$userId' -import { Route as ApiUsersUserIdRouteImport } from './routes/api/users.$userId' -import { Route as PostsPostIdDeepRouteImport } from './routes/posts_.$postId.deep' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const DeferredRoute = DeferredRouteImport.update({ - id: '/deferred', - path: '/deferred', - getParentRoute: () => rootRouteImport, -} as any) -const LogoutRoute = LogoutRouteImport.update({ - id: '/logout', - path: '/logout', - getParentRoute: () => rootRouteImport, -} as any) -const NavigateTestRoute = NavigateTestRouteImport.update({ - id: '/navigate-test', - path: '/navigate-test', - getParentRoute: () => rootRouteImport, -} as any) -const PostsRoute = PostsRouteImport.update({ - id: '/posts', - path: '/posts', - getParentRoute: () => rootRouteImport, -} as any) -const UsersRoute = UsersRouteImport.update({ - id: '/users', - path: '/users', - getParentRoute: () => rootRouteImport, -} as any) -const ApiUsersRoute = ApiUsersRouteImport.update({ - id: '/api/users', - path: '/api/users', - getParentRoute: () => rootRouteImport, -} as any) -const PostsIndexRoute = PostsIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => PostsRoute, -} as any) -const PostsPostIdRoute = PostsPostIdRouteImport.update({ - id: '/$postId', - path: '/$postId', - getParentRoute: () => PostsRoute, -} as any) -const RedirectIndexRoute = RedirectIndexRouteImport.update({ - id: '/redirect/', - path: '/redirect/', - getParentRoute: () => rootRouteImport, -} as any) -const RedirectThrowItRoute = RedirectThrowItRouteImport.update({ - id: '/redirect/throw-it', - path: '/redirect/throw-it', - getParentRoute: () => rootRouteImport, -} as any) -const UsersIndexRoute = UsersIndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => UsersRoute, -} as any) -const UsersUserIdRoute = UsersUserIdRouteImport.update({ - id: '/$userId', - path: '/$userId', - getParentRoute: () => UsersRoute, -} as any) -const ApiUsersUserIdRoute = ApiUsersUserIdRouteImport.update({ - id: '/$userId', - path: '/$userId', - getParentRoute: () => ApiUsersRoute, -} as any) -const PostsPostIdDeepRoute = PostsPostIdDeepRouteImport.update({ - id: '/posts_/$postId/deep', - path: '/posts/$postId/deep', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/deferred': typeof DeferredRoute - '/logout': typeof LogoutRoute - '/navigate-test': typeof NavigateTestRoute - '/posts': typeof PostsRouteWithChildren - '/users': typeof UsersRouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/throw-it': typeof RedirectThrowItRoute - '/users/$userId': typeof UsersUserIdRoute - '/posts/': typeof PostsIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/users/': typeof UsersIndexRoute - '/api/users/$userId': typeof ApiUsersUserIdRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/deferred': typeof DeferredRoute - '/logout': typeof LogoutRoute - '/navigate-test': typeof NavigateTestRoute - '/api/users': typeof ApiUsersRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/throw-it': typeof RedirectThrowItRoute - '/users/$userId': typeof UsersUserIdRoute - '/posts': typeof PostsIndexRoute - '/redirect': typeof RedirectIndexRoute - '/users': typeof UsersIndexRoute - '/api/users/$userId': typeof ApiUsersUserIdRoute - '/posts/$postId/deep': typeof PostsPostIdDeepRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/deferred': typeof DeferredRoute - '/logout': typeof LogoutRoute - '/navigate-test': typeof NavigateTestRoute - '/posts': typeof PostsRouteWithChildren - '/users': typeof UsersRouteWithChildren - '/api/users': typeof ApiUsersRouteWithChildren - '/posts/$postId': typeof PostsPostIdRoute - '/redirect/throw-it': typeof RedirectThrowItRoute - '/users/$userId': typeof UsersUserIdRoute - '/posts/': typeof PostsIndexRoute - '/redirect/': typeof RedirectIndexRoute - '/users/': typeof UsersIndexRoute - '/api/users/$userId': typeof ApiUsersUserIdRoute - '/posts_/$postId/deep': typeof PostsPostIdDeepRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: - | '/' - | '/deferred' - | '/logout' - | '/navigate-test' - | '/posts' - | '/users' - | '/api/users' - | '/posts/$postId' - | '/redirect/throw-it' - | '/users/$userId' - | '/posts/' - | '/redirect/' - | '/users/' - | '/api/users/$userId' - | '/posts/$postId/deep' - fileRoutesByTo: FileRoutesByTo - to: - | '/' - | '/deferred' - | '/logout' - | '/navigate-test' - | '/api/users' - | '/posts/$postId' - | '/redirect/throw-it' - | '/users/$userId' - | '/posts' - | '/redirect' - | '/users' - | '/api/users/$userId' - | '/posts/$postId/deep' - id: - | '__root__' - | '/' - | '/deferred' - | '/logout' - | '/navigate-test' - | '/posts' - | '/users' - | '/api/users' - | '/posts/$postId' - | '/redirect/throw-it' - | '/users/$userId' - | '/posts/' - | '/redirect/' - | '/users/' - | '/api/users/$userId' - | '/posts_/$postId/deep' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - DeferredRoute: typeof DeferredRoute - LogoutRoute: typeof LogoutRoute - NavigateTestRoute: typeof NavigateTestRoute - PostsRoute: typeof PostsRouteWithChildren - UsersRoute: typeof UsersRouteWithChildren - ApiUsersRoute: typeof ApiUsersRouteWithChildren - RedirectThrowItRoute: typeof RedirectThrowItRoute - RedirectIndexRoute: typeof RedirectIndexRoute - PostsPostIdDeepRoute: typeof PostsPostIdDeepRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/deferred': { - id: '/deferred' - path: '/deferred' - fullPath: '/deferred' - preLoaderRoute: typeof DeferredRouteImport - parentRoute: typeof rootRouteImport - } - '/logout': { - id: '/logout' - path: '/logout' - fullPath: '/logout' - preLoaderRoute: typeof LogoutRouteImport - parentRoute: typeof rootRouteImport - } - '/navigate-test': { - id: '/navigate-test' - path: '/navigate-test' - fullPath: '/navigate-test' - preLoaderRoute: typeof NavigateTestRouteImport - parentRoute: typeof rootRouteImport - } - '/posts': { - id: '/posts' - path: '/posts' - fullPath: '/posts' - preLoaderRoute: typeof PostsRouteImport - parentRoute: typeof rootRouteImport - } - '/users': { - id: '/users' - path: '/users' - fullPath: '/users' - preLoaderRoute: typeof UsersRouteImport - parentRoute: typeof rootRouteImport - } - '/api/users': { - id: '/api/users' - path: '/api/users' - fullPath: '/api/users' - preLoaderRoute: typeof ApiUsersRouteImport - parentRoute: typeof rootRouteImport - } - '/posts/': { - id: '/posts/' - path: '/' - fullPath: '/posts/' - preLoaderRoute: typeof PostsIndexRouteImport - parentRoute: typeof PostsRoute - } - '/posts/$postId': { - id: '/posts/$postId' - path: '/$postId' - fullPath: '/posts/$postId' - preLoaderRoute: typeof PostsPostIdRouteImport - parentRoute: typeof PostsRoute - } - '/redirect/': { - id: '/redirect/' - path: '/redirect' - fullPath: '/redirect/' - preLoaderRoute: typeof RedirectIndexRouteImport - parentRoute: typeof rootRouteImport - } - '/redirect/throw-it': { - id: '/redirect/throw-it' - path: '/redirect/throw-it' - fullPath: '/redirect/throw-it' - preLoaderRoute: typeof RedirectThrowItRouteImport - parentRoute: typeof rootRouteImport - } - '/users/': { - id: '/users/' - path: '/' - fullPath: '/users/' - preLoaderRoute: typeof UsersIndexRouteImport - parentRoute: typeof UsersRoute - } - '/users/$userId': { - id: '/users/$userId' - path: '/$userId' - fullPath: '/users/$userId' - preLoaderRoute: typeof UsersUserIdRouteImport - parentRoute: typeof UsersRoute - } - '/api/users/$userId': { - id: '/api/users/$userId' - path: '/$userId' - fullPath: '/api/users/$userId' - preLoaderRoute: typeof ApiUsersUserIdRouteImport - parentRoute: typeof ApiUsersRoute - } - '/posts_/$postId/deep': { - id: '/posts_/$postId/deep' - path: '/posts/$postId/deep' - fullPath: '/posts/$postId/deep' - preLoaderRoute: typeof PostsPostIdDeepRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -interface PostsRouteChildren { - PostsPostIdRoute: typeof PostsPostIdRoute - PostsIndexRoute: typeof PostsIndexRoute -} - -const PostsRouteChildren: PostsRouteChildren = { - PostsPostIdRoute: PostsPostIdRoute, - PostsIndexRoute: PostsIndexRoute, -} - -const PostsRouteWithChildren = PostsRoute._addFileChildren(PostsRouteChildren) - -interface UsersRouteChildren { - UsersUserIdRoute: typeof UsersUserIdRoute - UsersIndexRoute: typeof UsersIndexRoute -} - -const UsersRouteChildren: UsersRouteChildren = { - UsersUserIdRoute: UsersUserIdRoute, - UsersIndexRoute: UsersIndexRoute, -} - -const UsersRouteWithChildren = UsersRoute._addFileChildren(UsersRouteChildren) - -interface ApiUsersRouteChildren { - ApiUsersUserIdRoute: typeof ApiUsersUserIdRoute -} - -const ApiUsersRouteChildren: ApiUsersRouteChildren = { - ApiUsersUserIdRoute: ApiUsersUserIdRoute, -} - -const ApiUsersRouteWithChildren = ApiUsersRoute._addFileChildren( - ApiUsersRouteChildren, -) - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - DeferredRoute: DeferredRoute, - LogoutRoute: LogoutRoute, - NavigateTestRoute: NavigateTestRoute, - PostsRoute: PostsRouteWithChildren, - UsersRoute: UsersRouteWithChildren, - ApiUsersRoute: ApiUsersRouteWithChildren, - RedirectThrowItRoute: RedirectThrowItRoute, - RedirectIndexRoute: RedirectIndexRoute, - PostsPostIdDeepRoute: PostsPostIdDeepRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/custom-basepath/src/router.tsx b/e2e/solid-start/custom-basepath/src/router.tsx deleted file mode 100644 index b940fffea8..0000000000 --- a/e2e/solid-start/custom-basepath/src/router.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import { DefaultCatchBoundary } from './components/DefaultCatchBoundary' -import { NotFound } from './components/NotFound' -import { basepath } from './utils/basepath' - -export function getRouter() { - const router = createRouter({ - routeTree, - defaultPreload: 'intent', - defaultErrorComponent: DefaultCatchBoundary, - defaultNotFoundComponent: () => , - scrollRestoration: true, - basepath: basepath, - }) - - return router -} diff --git a/e2e/solid-start/custom-basepath/src/routes/__root.tsx b/e2e/solid-start/custom-basepath/src/routes/__root.tsx deleted file mode 100644 index bd7fa92f5e..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/__root.tsx +++ /dev/null @@ -1,114 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' - -import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools' -import { HydrationScript } from 'solid-js/web' -import { NotFound } from '~/components/NotFound' -import appCss from '~/styles/app.css?url' -import { seo } from '~/utils/seo' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - ...seo({ - title: - 'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework', - description: `TanStack Start is a type-safe, client-first, full-stack React framework. `, - }), - ], - links: [ - { rel: 'stylesheet', href: appCss }, - { - rel: 'apple-touch-icon', - sizes: '180x180', - href: '/apple-touch-icon.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '32x32', - href: '/favicon-32x32.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '16x16', - href: '/favicon-16x16.png', - }, - { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' }, - { rel: 'icon', href: '/favicon.ico' }, - ], - }), - errorComponent: (props) =>

{props.error.stack}

, - notFoundComponent: () => , - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - -
- - Home - {' '} - - Posts - {' '} - - Users - {' '} - - Deferred - {' '} - - This Route Does Not Exist - -
- - - - - - ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/api/users.$userId.ts b/e2e/solid-start/custom-basepath/src/routes/api/users.$userId.ts deleted file mode 100644 index 2c1978b370..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/api/users.$userId.ts +++ /dev/null @@ -1,29 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import type { User } from '~/utils/users' - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const Route = createFileRoute('/api/users/$userId')({ - server: { - handlers: { - GET: async ({ params, request }) => { - console.info(`Fetching users by id=${params.userId}... @`, request.url) - try { - const res = await fetch(`${queryURL}/users/${params.userId}`) - if (!res.ok) { - throw new Error('Failed to fetch user') - } - const user = (await res.json()) as User - return Response.json({ - id: user.id, - name: user.name, - email: user.email, - }) - } catch (e) { - console.error(e) - return Response.json({ error: 'User not found' }, { status: 404 }) - } - }, - }, - }, -}) diff --git a/e2e/solid-start/custom-basepath/src/routes/api/users.ts b/e2e/solid-start/custom-basepath/src/routes/api/users.ts deleted file mode 100644 index d9fe7817d6..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/api/users.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { createMiddleware } from '@tanstack/solid-start' -import type { User } from '~/utils/users' - -const userLoggerMiddleware = createMiddleware().server( - async ({ next, request }) => { - console.info('In: /users') - const result = await next() - result.response.headers.set('x-users', 'true') - console.info('Out: /users') - return result - }, -) - -const testParentMiddleware = createMiddleware().server( - async ({ next, request }) => { - console.info('In: testParentMiddleware') - const result = await next() - result.response.headers.set('x-test-parent', 'true') - console.info('Out: testParentMiddleware') - return result - }, -) - -const testMiddleware = createMiddleware() - .middleware([testParentMiddleware]) - .server(async ({ next, request }) => { - console.info('In: testMiddleware') - const result = await next() - result.response.headers.set('x-test', 'true') - // if (Math.random() > 0.5) { - // throw new Response(null, { - // status: 302, - // headers: { Location: 'https://www.google.com' }, - // }) - // } - console.info('Out: testMiddleware') - return result - }) - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const Route = createFileRoute('/api/users')({ - server: { - middleware: [testMiddleware, userLoggerMiddleware, testParentMiddleware], - handlers: { - GET: async ({ request }) => { - console.info('Fetching users... @', request.url) - const res = await fetch(`${queryURL}/users`) - if (!res.ok) { - throw new Error('Failed to fetch users') - } - const data = (await res.json()) as Array - const list = data.slice(0, 10) - return Response.json( - list.map((u) => ({ id: u.id, name: u.name, email: u.email })), - ) - }, - }, - }, -}) diff --git a/e2e/solid-start/custom-basepath/src/routes/deferred.tsx b/e2e/solid-start/custom-basepath/src/routes/deferred.tsx deleted file mode 100644 index 2a53643453..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/deferred.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { Await, createFileRoute } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' -import { Suspense, createSignal } from 'solid-js' - -const personServerFn = createServerFn({ method: 'GET' }) - .validator((data: { name: string }) => data) - .handler(({ data }) => { - return { name: data.name, randomNumber: Math.floor(Math.random() * 100) } - }) - -const slowServerFn = createServerFn({ method: 'GET' }) - .validator((data: { name: string }) => data) - .handler(async ({ data }) => { - await new Promise((r) => setTimeout(r, 1000)) - return { name: data.name, randomNumber: Math.floor(Math.random() * 100) } - }) - -export const Route = createFileRoute('/deferred')({ - loader: async () => { - return { - deferredStuff: new Promise((r) => - setTimeout(() => r('Hello deferred!'), 2000), - ), - deferredPerson: slowServerFn({ data: { name: 'Tanner Linsley' } }), - person: await personServerFn({ data: { name: 'John Doe' } }), - } - }, - component: Deferred, -}) - -function Deferred() { - const [count, setCount] = createSignal(0) - // const { deferredStuff, deferredPerson, person } = Route.useLoaderData() - const loaderData = Route.useLoaderData() - - return ( -
-
- {loaderData().person.name} - {loaderData().person.randomNumber} -
- Loading person...
}> - ( -
- {data.name} - {data.randomNumber} -
- )} - /> - - Loading stuff...
}> -

{data}

} - /> - -
Count: {count()}
-
- -
-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/index.tsx b/e2e/solid-start/custom-basepath/src/routes/index.tsx deleted file mode 100644 index 6b23caf87b..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { CustomMessage } from '~/components/CustomMessage' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Welcome Home!!!

- -
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/logout.tsx b/e2e/solid-start/custom-basepath/src/routes/logout.tsx deleted file mode 100644 index 7e13279bee..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/logout.tsx +++ /dev/null @@ -1,32 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' - -const logoutFn = createServerFn({ - method: 'POST', -}).handler(async () => { - // do logout stuff here - throw redirect({ - to: '/', - }) -}) - -export const Route = createFileRoute('/logout')({ - component: Home, -}) - -function Home() { - return ( -
-

Logout Page

-

- This form tests that server function URLs correctly include the app's - basepath. The form action should be '/custom/basepath/_serverFn/...' not - just '/_serverFn/...' -

-
- - -
-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/navigate-test.tsx b/e2e/solid-start/custom-basepath/src/routes/navigate-test.tsx deleted file mode 100644 index cd1cd1e174..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/navigate-test.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/navigate-test')({ - component: NavigateTest, -}) - -function NavigateTest() { - const navigate = Route.useNavigate() - - return ( -
-

Navigate Test

- {' '} - -
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx b/e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx deleted file mode 100644 index 0a1daf6e13..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/posts.$postId.tsx +++ /dev/null @@ -1,35 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -import { fetchPost } from '~/utils/posts' -import { NotFound } from '~/components/NotFound' -import { PostErrorComponent } from '~/components/PostErrorComponent' - -export const Route = createFileRoute('/posts/$postId')({ - loader: async ({ params: { postId } }) => fetchPost({ data: postId }), - errorComponent: PostErrorComponent, - component: PostComponent, - notFoundComponent: () => { - return Post not found - }, -}) - -function PostComponent() { - const post = Route.useLoaderData() - - return ( -
-

{post().title}

-
{post().body}
- - Deep View - -
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/posts.index.tsx b/e2e/solid-start/custom-basepath/src/routes/posts.index.tsx deleted file mode 100644 index ac7c378e60..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/posts.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/posts/')({ - component: PostsIndexComponent, -}) - -function PostsIndexComponent() { - return
Select a post.
-} diff --git a/e2e/solid-start/custom-basepath/src/routes/posts.tsx b/e2e/solid-start/custom-basepath/src/routes/posts.tsx deleted file mode 100644 index 22187bf863..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/posts.tsx +++ /dev/null @@ -1,47 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import { For } from 'solid-js' - -import { fetchPosts } from '~/utils/posts' - -export const Route = createFileRoute('/posts')({ - head: () => ({ - meta: [ - { - title: 'Posts page', - }, - ], - }), - loader: async () => fetchPosts(), - component: PostsComponent, -}) - -function PostsComponent() { - const posts = Route.useLoaderData() - - return ( -
-
    - - {(post) => { - return ( -
  • - -
    {post.title.substring(0, 20)}
    - -
  • - ) - }} -
    -
-
- -
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/posts_.$postId.deep.tsx b/e2e/solid-start/custom-basepath/src/routes/posts_.$postId.deep.tsx deleted file mode 100644 index f8d4627914..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/posts_.$postId.deep.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' -import { PostErrorComponent } from '~/components/PostErrorComponent' - -import { fetchPost } from '~/utils/posts' - -export const Route = createFileRoute('/posts_/$postId/deep')({ - loader: async ({ params: { postId } }) => fetchPost({ data: postId }), - errorComponent: PostErrorComponent, - component: PostDeepComponent, -}) - -function PostDeepComponent() { - const post = Route.useLoaderData() - - return ( -
- - ← All Posts - -

{post().title}

-
{post().body}
-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx b/e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx deleted file mode 100644 index aec49f7597..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/redirect.index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/')({ - component: RouteComponent, -}) - -function RouteComponent() { - return ( -
- -
Throw It
- -
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx b/e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx deleted file mode 100644 index d1164f1c58..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/redirect.throw-it.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createFileRoute, redirect } from '@tanstack/solid-router' - -export const Route = createFileRoute('/redirect/throw-it')({ - beforeLoad: () => { - throw redirect({ - to: '/posts/$postId', - params: { postId: '1' }, - }) - }, -}) diff --git a/e2e/solid-start/custom-basepath/src/routes/users.$userId.tsx b/e2e/solid-start/custom-basepath/src/routes/users.$userId.tsx deleted file mode 100644 index db5614394a..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/users.$userId.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import axios from 'redaxios' - -import type { User } from '~/utils/users' -import { NotFound } from '~/components/NotFound' -import { UserErrorComponent } from '~/components/UserErrorComponent' -import { basepath } from '~/utils/basepath' - -export const Route = createFileRoute('/users/$userId')({ - loader: async ({ params: { userId } }) => { - return await axios - .get(basepath + '/api/users/' + userId) - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch user') - }) - }, - errorComponent: UserErrorComponent, - component: UserComponent, - notFoundComponent: () => { - return User not found - }, -}) - -function UserComponent() { - const user = Route.useLoaderData() - - return ( -
-

{user().name}

-
{user().email}
-
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/routes/users.index.tsx b/e2e/solid-start/custom-basepath/src/routes/users.index.tsx deleted file mode 100644 index 34d25e1428..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/users.index.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -export const Route = createFileRoute('/users/')({ - component: UsersIndexComponent, -}) - -function UsersIndexComponent() { - return
Select a user.
-} diff --git a/e2e/solid-start/custom-basepath/src/routes/users.tsx b/e2e/solid-start/custom-basepath/src/routes/users.tsx deleted file mode 100644 index b686fa91cd..0000000000 --- a/e2e/solid-start/custom-basepath/src/routes/users.tsx +++ /dev/null @@ -1,48 +0,0 @@ -import { Link, Outlet, createFileRoute } from '@tanstack/solid-router' -import axios from 'redaxios' -import type { User } from '~/utils/users' -import { basepath } from '~/utils/basepath' - -export const Route = createFileRoute('/users')({ - loader: async () => { - return await axios - .get>(basepath + '/api/users') - .then((r) => r.data) - .catch(() => { - throw new Error('Failed to fetch users') - }) - }, - component: UsersComponent, -}) - -function UsersComponent() { - const users = Route.useLoaderData() - - return ( -
-
    - {[ - ...users(), - { id: 'i-do-not-exist', name: 'Non-existent User', email: '' }, - ].map((user) => { - return ( -
  • - -
    {user.name}
    - -
  • - ) - })} -
-
- -
- ) -} diff --git a/e2e/solid-start/custom-basepath/src/server.ts b/e2e/solid-start/custom-basepath/src/server.ts deleted file mode 100644 index 3682c04c20..0000000000 --- a/e2e/solid-start/custom-basepath/src/server.ts +++ /dev/null @@ -1,7 +0,0 @@ -import handler from '@tanstack/solid-start/server-entry' - -export default { - fetch(request: Request) { - return handler.fetch(request) - }, -} diff --git a/e2e/solid-start/custom-basepath/src/styles/app.css b/e2e/solid-start/custom-basepath/src/styles/app.css deleted file mode 100644 index 37c1f5a6e2..0000000000 --- a/e2e/solid-start/custom-basepath/src/styles/app.css +++ /dev/null @@ -1,30 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -@layer base { - html { - color-scheme: light dark; - } - - * { - @apply border-gray-200 dark:border-gray-800; - } - - html, - body { - @apply text-gray-900 bg-gray-50 dark:bg-gray-950 dark:text-gray-200; - } - - .using-mouse * { - outline: none !important; - } -} diff --git a/e2e/solid-start/custom-basepath/src/utils/basepath.ts b/e2e/solid-start/custom-basepath/src/utils/basepath.ts deleted file mode 100644 index 6e719f196c..0000000000 --- a/e2e/solid-start/custom-basepath/src/utils/basepath.ts +++ /dev/null @@ -1 +0,0 @@ -export const basepath = '/custom/basepath' diff --git a/e2e/solid-start/custom-basepath/src/utils/posts.tsx b/e2e/solid-start/custom-basepath/src/utils/posts.tsx deleted file mode 100644 index d0889bd725..0000000000 --- a/e2e/solid-start/custom-basepath/src/utils/posts.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { notFound } from '@tanstack/solid-router' -import { createServerFn } from '@tanstack/solid-start' -import axios from 'redaxios' - -export type PostType = { - id: string - title: string - body: string -} - -const queryURL = 'https://jsonplaceholder.typicode.com' - -export const fetchPost = createServerFn({ method: 'GET' }) - .validator((postId: string) => postId) - .handler(async ({ data: postId }) => { - console.info(`Fetching post with id ${postId}...`) - const post = await axios - .get(`${queryURL}/posts/${postId}`) - .then((r) => r.data) - .catch((err) => { - console.error(err) - if (err.status === 404) { - throw notFound() - } - throw err - }) - - return post - }) - -export const fetchPosts = createServerFn({ method: 'GET' }).handler( - async () => { - console.info('Fetching posts...') - return axios - .get>(`${queryURL}/posts`) - .then((r) => r.data.slice(0, 10)) - }, -) diff --git a/e2e/solid-start/custom-basepath/src/utils/seo.ts b/e2e/solid-start/custom-basepath/src/utils/seo.ts deleted file mode 100644 index d18ad84b74..0000000000 --- a/e2e/solid-start/custom-basepath/src/utils/seo.ts +++ /dev/null @@ -1,33 +0,0 @@ -export const seo = ({ - title, - description, - keywords, - image, -}: { - title: string - description?: string - image?: string - keywords?: string -}) => { - const tags = [ - { title }, - { name: 'description', content: description }, - { name: 'keywords', content: keywords }, - { name: 'twitter:title', content: title }, - { name: 'twitter:description', content: description }, - { name: 'twitter:creator', content: '@tannerlinsley' }, - { name: 'twitter:site', content: '@tannerlinsley' }, - { name: 'og:type', content: 'website' }, - { name: 'og:title', content: title }, - { name: 'og:description', content: description }, - ...(image - ? [ - { name: 'twitter:image', content: image }, - { name: 'twitter:card', content: 'summary_large_image' }, - { name: 'og:image', content: image }, - ] - : []), - ] - - return tags -} diff --git a/e2e/solid-start/custom-basepath/src/utils/users.tsx b/e2e/solid-start/custom-basepath/src/utils/users.tsx deleted file mode 100644 index 7ba645b383..0000000000 --- a/e2e/solid-start/custom-basepath/src/utils/users.tsx +++ /dev/null @@ -1,5 +0,0 @@ -export type User = { - id: number - name: string - email: string -} diff --git a/e2e/solid-start/custom-basepath/src/vite-env.d.ts b/e2e/solid-start/custom-basepath/src/vite-env.d.ts deleted file mode 100644 index d0b512cd80..0000000000 --- a/e2e/solid-start/custom-basepath/src/vite-env.d.ts +++ /dev/null @@ -1,6 +0,0 @@ -/// - -declare module '*?url' { - const url: string - export default url -} diff --git a/e2e/solid-start/custom-basepath/tests/navigation.spec.ts b/e2e/solid-start/custom-basepath/tests/navigation.spec.ts deleted file mode 100644 index 49454e1b8e..0000000000 --- a/e2e/solid-start/custom-basepath/tests/navigation.spec.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { expect, test } from '@playwright/test' - -test('Navigating to post', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Posts' }).click() - await page.getByRole('link', { name: 'sunt aut facere repe' }).click() - await page.getByRole('link', { name: 'Deep View' }).click() - await expect(page.getByRole('heading')).toContainText('sunt aut facere') -}) - -test('Navigating to user', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Users' }).click() - await page.getByRole('link', { name: 'Leanne Graham' }).click() - await expect(page.getByRole('heading')).toContainText('Leanne Graham') -}) - -test('Navigating to a not-found route', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'This Route Does Not Exist' }).click() - await page.getByRole('link', { name: 'Start Over' }).click() - await expect(page.getByRole('heading')).toContainText('Welcome Home!') -}) - -test('Should change title on client side navigation', async ({ page }) => { - await page.goto('/') - - await page.getByRole('link', { name: 'Posts' }).click() - - await expect(page).toHaveTitle('Posts page') -}) - -test('Server function URLs correctly include app basepath', async ({ - page, -}) => { - await page.goto('/logout') - - const form = page.locator('form') - const actionUrl = await form.getAttribute('action') - - expect(actionUrl).toMatch(/^\/custom\/basepath\/_serverFn\//) -}) - -test('client-side redirect', async ({ page, baseURL }) => { - await page.goto('/redirect') - await page.getByTestId('link-to-throw-it').click() - await page.waitForLoadState('networkidle') - - expect(await page.getByTestId('post-view').isVisible()).toBe(true) - expect(page.url()).toBe(`${baseURL}/posts/1`) -}) - -test('server-side redirect', async ({ page, baseURL }) => { - await page.goto('/redirect/throw-it') - await page.waitForLoadState('networkidle') - - expect(await page.getByTestId('post-view').isVisible()).toBe(true) - expect(page.url()).toBe(`${baseURL}/posts/1`) - - // do not follow redirects since we want to test the Location header - // first go to the route WITHOUT the base path, this will just add the base path - await page.request - .get('/redirect/throw-it', { maxRedirects: 0 }) - .then((res) => { - const headers = new Headers(res.headers()) - expect(headers.get('location')).toBe('/custom/basepath/redirect/throw-it') - }) - await page.request - .get('/custom/basepath/redirect/throw-it', { maxRedirects: 0 }) - .then((res) => { - const headers = new Headers(res.headers()) - expect(headers.get('location')).toBe('/custom/basepath/posts/1') - }) -}) - -test('navigate() with href containing basepath', async ({ page, baseURL }) => { - await page.goto('/navigate-test') - await expect(page.getByTestId('navigate-test-component')).toBeVisible() - - const btn = page.getByTestId('to-posts-href-with-basepath-btn') - await btn.click() - // Should navigate to /custom/basepath/posts, NOT /custom/basepath/custom/basepath/posts - await page.waitForURL(`${baseURL}/posts`) - await expect(page.getByTestId('posts-component')).toBeVisible() -}) - -test('navigate() with href containing basepath and reloadDocument=true', async ({ - page, - baseURL, -}) => { - await page.goto('/navigate-test') - await expect(page.getByTestId('navigate-test-component')).toBeVisible() - - const btn = page.getByTestId('to-posts-href-with-basepath-reload-btn') - await btn.click() - // Should navigate to /custom/basepath/posts, NOT stay on current page - await page.waitForURL(`${baseURL}/posts`) - await expect(page.getByTestId('posts-component')).toBeVisible() -}) diff --git a/e2e/solid-start/custom-basepath/tsconfig.json b/e2e/solid-start/custom-basepath/tsconfig.json deleted file mode 100644 index cb1a0b80dd..0000000000 --- a/e2e/solid-start/custom-basepath/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx", "public/script*.js"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/custom-basepath/vite.config.ts b/e2e/solid-start/custom-basepath/vite.config.ts deleted file mode 100644 index 7f0ece5c8e..0000000000 --- a/e2e/solid-start/custom-basepath/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - base: '/custom/basepath', - server: { - port: 3000, - }, - plugins: [tailwindcss(), tanstackStart(), viteSolid({ ssr: true })], -}) diff --git a/e2e/solid-start/deferred-hydration/.gitignore b/e2e/solid-start/deferred-hydration/.gitignore deleted file mode 100644 index 1b3a07ede1..0000000000 --- a/e2e/solid-start/deferred-hydration/.gitignore +++ /dev/null @@ -1,15 +0,0 @@ -node_modules -package-lock.json -yarn.lock -.DS_Store -.cache -.env -.vercel -.output -/build/ -/api/ -/server/build -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-start/deferred-hydration/package.json b/e2e/solid-start/deferred-hydration/package.json deleted file mode 100644 index 4e2a3a1665..0000000000 --- a/e2e/solid-start/deferred-hydration/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-deferred-hydration", - "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": "pnpm start:vite", - "start:vite": "srvx --prod --dir=. -s dist-vite-ssr/client --entry dist-vite-ssr/server/server.js", - "start:rsbuild": "srvx --prod --dir=. -s dist-rsbuild-ssr/client --entry dist-rsbuild-ssr/server/index.js", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@rsbuild/core": "^2.3.1", - "@rsbuild/plugin-babel": "^1.1.2", - "@rsbuild/plugin-solid": "^1.1.1", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/node": "^22.10.2", - "srvx": "^1.0.0", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - }, - "nx": { - "targets": { - "test:e2e": { - "parallelism": false - }, - "build": { - "outputs": [ - "...", - "{projectRoot}/dist-vite-ssr" - ] - } - }, - "metadata": { - "playwrightModes": [ - { - "toolchain": "vite", - "mode": "ssr" - }, - { - "toolchain": "rsbuild", - "mode": "ssr" - } - ] - } - } -} diff --git a/e2e/solid-start/deferred-hydration/playwright.config.ts b/e2e/solid-start/deferred-hydration/playwright.config.ts deleted file mode 100644 index 4b7fbc6a9c..0000000000 --- a/e2e/solid-start/deferred-hydration/playwright.config.ts +++ /dev/null @@ -1,36 +0,0 @@ -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-${toolchain}-ssr` - -const serverEntryFile = toolchain === 'rsbuild' ? 'index.js' : 'server.js' -const startCommand = `pnpm exec srvx --prod --dir=. -s ${distDir}/client --entry ${distDir}/server/${serverEntryFile}` - -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: startCommand, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - E2E_DIST_DIR: distDir, - NODE_ENV: 'production', - PORT: String(PORT), - VITE_SERVER_PORT: String(PORT), - }, - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/deferred-hydration/rsbuild.config.ts b/e2e/solid-start/deferred-hydration/rsbuild.config.ts deleted file mode 100644 index 7ab152bb58..0000000000 --- a/e2e/solid-start/deferred-hydration/rsbuild.config.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { defineConfig } from '@rsbuild/core' -import { pluginBabel } from '@rsbuild/plugin-babel' -import { pluginSolid } from '@rsbuild/plugin-solid' -import { tanstackStart } from '@tanstack/solid-start/plugin/rsbuild' - -const outDir = process.env.E2E_DIST_DIR ?? 'dist-rsbuild-ssr' - -export default defineConfig({ - plugins: [ - pluginBabel({ - include: /\.(?:jsx|tsx)$/, - }), - pluginSolid(), - tanstackStart(), - ], - output: { - distPath: { - root: outDir, - }, - }, -}) diff --git a/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts b/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts deleted file mode 100644 index e689dd19b8..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routeTree.gen.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* 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 ComponentsRouteImport } from './routes/components' -import { Route as CssRouteImport } from './routes/css' -import { Route as EnhancedRouteImport } from './routes/enhanced' -import { Route as ImportedRouteImport } from './routes/imported' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const ComponentsRoute = ComponentsRouteImport.update({ - id: '/components', - path: '/components', - getParentRoute: () => rootRouteImport, -} as any) -const CssRoute = CssRouteImport.update({ - id: '/css', - path: '/css', - getParentRoute: () => rootRouteImport, -} as any) -const EnhancedRoute = EnhancedRouteImport.update({ - id: '/enhanced', - path: '/enhanced', - getParentRoute: () => rootRouteImport, -} as any) -const ImportedRoute = ImportedRouteImport.update({ - id: '/imported', - path: '/imported', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/components': typeof ComponentsRoute - '/css': typeof CssRoute - '/enhanced': typeof EnhancedRoute - '/imported': typeof ImportedRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/components': typeof ComponentsRoute - '/css': typeof CssRoute - '/enhanced': typeof EnhancedRoute - '/imported': typeof ImportedRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/components': typeof ComponentsRoute - '/css': typeof CssRoute - '/enhanced': typeof EnhancedRoute - '/imported': typeof ImportedRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/components' | '/css' | '/enhanced' | '/imported' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/components' | '/css' | '/enhanced' | '/imported' - id: '__root__' | '/' | '/components' | '/css' | '/enhanced' | '/imported' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - ComponentsRoute: typeof ComponentsRoute - CssRoute: typeof CssRoute - EnhancedRoute: typeof EnhancedRoute - ImportedRoute: typeof ImportedRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/components': { - id: '/components' - path: '/components' - fullPath: '/components' - preLoaderRoute: typeof ComponentsRouteImport - parentRoute: typeof rootRouteImport - } - '/css': { - id: '/css' - path: '/css' - fullPath: '/css' - preLoaderRoute: typeof CssRouteImport - parentRoute: typeof rootRouteImport - } - '/enhanced': { - id: '/enhanced' - path: '/enhanced' - fullPath: '/enhanced' - preLoaderRoute: typeof EnhancedRouteImport - parentRoute: typeof rootRouteImport - } - '/imported': { - id: '/imported' - path: '/imported' - fullPath: '/imported' - preLoaderRoute: typeof ImportedRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - ComponentsRoute: ComponentsRoute, - CssRoute: CssRoute, - EnhancedRoute: EnhancedRoute, - ImportedRoute: ImportedRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/deferred-hydration/src/router.tsx b/e2e/solid-start/deferred-hydration/src/router.tsx deleted file mode 100644 index aa7ead6752..0000000000 --- a/e2e/solid-start/deferred-hydration/src/router.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - }) -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/__root.tsx b/e2e/solid-start/deferred-hydration/src/routes/__root.tsx deleted file mode 100644 index b8c8189c6b..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/__root.tsx +++ /dev/null @@ -1,98 +0,0 @@ -/// -import { - HeadContent, - Link, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { charSet: 'utf-8' }, - { name: 'viewport', content: 'width=device-width, initial-scale=1' }, - { title: 'Deferred Hydration E2E' }, - ], - }), - component: RootDocument, -}) - -function RootDocument() { - return ( - - - - - - - - -
- -
- - - - ) -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/components.tsx b/e2e/solid-start/deferred-hydration/src/routes/components.tsx deleted file mode 100644 index 9dd6387f09..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/components.tsx +++ /dev/null @@ -1,171 +0,0 @@ -import * as Solid from 'solid-js' - -import { createFileRoute } from '@tanstack/solid-router' -import { Hydrate } from '@tanstack/solid-start' -import { - condition, - idle, - interaction, - load, - media, - never, - visible, -} from '@tanstack/solid-start/hydration' - -export const Route = createFileRoute('/components')({ - component: ComponentHydrationPage, -}) - -function InteractiveBox(props: { id: string; label: string }) { - const [count, setCount] = Solid.createSignal(0) - const [hydrated, setHydrated] = Solid.createSignal(false) - - Solid.onMount(() => { - setHydrated(true) - }) - - return ( - - ) -} - -function DelayedFallbackBox() { - if (typeof window !== 'undefined') { - const [ready] = Solid.createResource(async () => { - await new Promise((resolve) => window.setTimeout(resolve, 1000)) - return true - }) - - return ( - -
fallback child
-
- ) - } - - return
fallback child
-} - -function ComponentHydrationPage() { - const [hydratedCallbacks, setHydratedCallbacks] = Solid.createSignal(0) - const [conditionReady, setConditionReady] = Solid.createSignal(false) - const [showClientFallbackBoundary, setShowClientFallbackBoundary] = - Solid.createSignal(false) - - return ( -
-

Component Deferred Hydration

-
- Manual test guide - - Pink buttons are server HTML that has not hydrated yet. Green buttons - have hydrated and should increment when clicked. Follow the notes - below to trigger each strategy intentionally. - -
-

{hydratedCallbacks()}

-

- load and idle should become green - without interaction shortly after the page loads. -

- - - - - - -
Scroll down to reveal the visible boundary
-

- visible hydrates only after this button enters the - viewport. -

- - - -

- media hydrates when (min-width: 1px) - matches. interaction hydrates on hover, focus, pointer - down, or click intent. -

- - - - - - -

- Custom interaction boundaries below hydrate only for their configured - events: double-click for the single-event example, and right-click or - double-click for the multi-event example. The prefetch example should - download code on hover but hydrate on click. -

- setHydratedCallbacks((count) => count + 1)} - > - - - - - - - - - - - - - - - - - - - - - - - -

- never stays as server HTML forever on the initial page, - so clicking should not increment it. -

- - - client fallback
- } - > - - - - - ) -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/css.tsx b/e2e/solid-start/deferred-hydration/src/routes/css.tsx deleted file mode 100644 index c1a80d492b..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/css.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { Hydrate } from '@tanstack/solid-start' -import { media, never, visible } from '@tanstack/solid-start/hydration' -import outerStyles from './css/outer.module.css' -import deferredStyles from './css/deferred-only.module.css' -import sharedStyles from './css/shared.module.css' - -export const Route = createFileRoute('/css')({ - component: CssHydrationPage, -}) - -function CssHydrationPage() { - return ( -
-
-

- CSS Deferred Hydration -

-

- CSS from deferred, never, shared, and nested Hydrate boundaries should - be available even before the client JavaScript hydrates those islands. -

-
-
-
- Outer CSS -
-
- Shared outer CSS -
-
- -
- Deferred CSS -
-
- -
- Never CSS -
-
- - -
- Nested CSS -
-
-
-
- ) -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/css/deferred-only.module.css b/e2e/solid-start/deferred-hydration/src/routes/css/deferred-only.module.css deleted file mode 100644 index 05eafda03c..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/css/deferred-only.module.css +++ /dev/null @@ -1,15 +0,0 @@ -.deferredBox { - background-color: rgb(23, 45, 67); - color: rgb(255, 255, 255); - padding: 12px; -} - -.neverBox { - color: rgb(45, 67, 89); - padding: 12px; -} - -.nestedBox { - border-left: 5px solid rgb(67, 89, 123); - padding-left: 12px; -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/css/outer.module.css b/e2e/solid-start/deferred-hydration/src/routes/css/outer.module.css deleted file mode 100644 index 98ca5e0934..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/css/outer.module.css +++ /dev/null @@ -1,9 +0,0 @@ -.heading { - color: rgb(11, 31, 53); -} - -.outerBox { - background-color: rgb(242, 250, 255); - color: rgb(12, 34, 56); - padding: 12px; -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/css/shared.module.css b/e2e/solid-start/deferred-hydration/src/routes/css/shared.module.css deleted file mode 100644 index 020da5d7ad..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/css/shared.module.css +++ /dev/null @@ -1,4 +0,0 @@ -.sharedBox { - border-top: 4px solid rgb(98, 76, 54); - margin-top: 8px; -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/enhanced.tsx b/e2e/solid-start/deferred-hydration/src/routes/enhanced.tsx deleted file mode 100644 index d699a644f1..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/enhanced.tsx +++ /dev/null @@ -1,316 +0,0 @@ -import { Show, createSignal, onMount, type JSX } from 'solid-js' -import { createFileRoute } from '@tanstack/solid-router' -import { Hydrate } from '@tanstack/solid-start' -import { interaction, media } from '@tanstack/solid-start/hydration' -import { EnhancedNestedWidget } from '../shared/EnhancedNestedWidget' - -type EnhancedSearch = { - dynamic?: 'interaction' -} - -export const Route = createFileRoute('/enhanced')({ - validateSearch: (search: Record): EnhancedSearch => ({ - dynamic: search.dynamic === 'interaction' ? 'interaction' : undefined, - }), - component: EnhancedHydrationPage, -}) - -type DeferredGate = { - promise: Promise - resolve: () => void -} - -const clickIntent = interaction({ events: 'click' }) -const pointerOverIntent = interaction({ events: 'pointerover' }) -const doubleClickIntent = interaction({ events: 'dblclick' }) - -function createDeferredGate(): DeferredGate { - let resolve!: () => void - const promise = new Promise((next) => { - resolve = next - }) - return { promise, resolve } -} - -function InteractiveBox(props: { id: string; label: string }): JSX.Element { - const [count, setCount] = createSignal(0) - const [hydrated, setHydrated] = createSignal(false) - - onMount(() => { - setHydrated(true) - }) - - return ( - - ) -} - -function DynamicWhenExamples(): JSX.Element { - const search = Route.useSearch() - const searchDrivenHydration = () => - search().dynamic === 'interaction' ? clickIntent : doubleClickIntent - - return ( - <> -

- Dynamic callbacks are client-only. The first boundary always hydrates on - click; the second reads typed router search state before choosing its - interaction event. -

- clickIntent}> - - - - - - - ) -} - -function SplitPrefetchExample(): JSX.Element { - const gate = createDeferredGate() - const [waitReason, setWaitReason] = createSignal('idle') - const [preloadStatus, setPreloadStatus] = createSignal('idle') - const [queryStatus, setQueryStatus] = createSignal('idle') - - return ( - <> -

{waitReason()}

-

{preloadStatus()}

-

{queryStatus()}

- - { - setQueryStatus(element ? 'element' : 'missing-element') - setWaitReason('waiting') - - const reason = await waitFor(pointerOverIntent) - setWaitReason(reason) - if (reason === 'abort' || signal.aborted) return - - await preload() - setPreloadStatus('done') - await gate.promise - setQueryStatus('done') - }} - > - - - - ) -} - -function FireAndForgetPrefetchExample(): JSX.Element { - const gate = createDeferredGate() - const [waitReason, setWaitReason] = createSignal('idle') - const [workStatus, setWorkStatus] = createSignal('idle') - const [queryStatus, setQueryStatus] = createSignal('idle') - - return ( - <> -

{workStatus()}

-

{waitReason()}

-

{queryStatus()}

- - { - setWaitReason('waiting') - void waitFor(pointerOverIntent).then((reason) => { - setWaitReason(reason) - if (reason === 'abort') return - - setWorkStatus('started') - void gate.promise.then(() => { - setQueryStatus('done') - }) - }) - }} - > - - - - ) -} - -function HydrateFirstPrefetchExample(): JSX.Element { - const [reason, setReason] = createSignal('idle') - - return ( - <> -

{reason()}

- { - setReason(await waitFor(doubleClickIntent)) - }} - > - - - - ) -} - -function RuntimeOnlyPrefetchExample(): JSX.Element { - const gate = createDeferredGate() - const [waitReason, setWaitReason] = createSignal('idle') - const [runtimeStatus, setRuntimeStatus] = createSignal('idle') - - return ( - <> -

{waitReason()}

-

{runtimeStatus()}

- - { - setWaitReason('waiting') - const reason = await waitFor(pointerOverIntent) - setWaitReason(reason) - if (reason === 'abort') return - - await gate.promise - await preload() - setRuntimeStatus('ready') - }} - > - - - - ) -} - -function WaitForAbortExample(): JSX.Element { - const [showBoundary, setShowBoundary] = createSignal(true) - const [reason, setReason] = createSignal('idle') - - return ( - <> -

{reason()}

- - - { - setReason('waiting') - setReason(await waitFor(pointerOverIntent)) - }} - > - - - - - ) -} - -function SignalAbortExample(): JSX.Element { - const [showBoundary, setShowBoundary] = createSignal(true) - const [status, setStatus] = createSignal('idle') - - return ( - <> -

{status()}

- - - { - setStatus('listening') - await new Promise((resolve) => { - const onAbort = () => { - setStatus('aborted') - resolve() - } - - if (signal.aborted) { - onAbort() - return - } - - signal.addEventListener('abort', onAbort, { once: true }) - }) - }} - > - - - - - ) -} - -function NestedDynamicExamples(): JSX.Element { - return ( - <> - - clickIntent}> - - - - - - ) -} - -function EnhancedHydrationPage(): JSX.Element { - return ( -
-

Enhanced Hydrate APIs

- - - - - - - - -
- ) -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/imported.tsx b/e2e/solid-start/deferred-hydration/src/routes/imported.tsx deleted file mode 100644 index abfb827c91..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/imported.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { ImportedHydrateWidget } from '../shared/ImportedHydrateWidget' - -export const Route = createFileRoute('/imported')({ - component: ImportedHydrationPage, -}) - -function ImportedHydrationPage() { - return ( -
-

Imported Hydrate

- -
- ) -} diff --git a/e2e/solid-start/deferred-hydration/src/routes/index.tsx b/e2e/solid-start/deferred-hydration/src/routes/index.tsx deleted file mode 100644 index 61fbf7f6dc..0000000000 --- a/e2e/solid-start/deferred-hydration/src/routes/index.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { Link, createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Deferred Hydration

-

Component strategies

- component strategies -

CSS

- CSS deferred hydration -

Imported component

- - imported Hydrate - -

Enhanced APIs

- enhanced Hydrate APIs -
- ) -} diff --git a/e2e/solid-start/deferred-hydration/src/shared/EnhancedNestedWidget.tsx b/e2e/solid-start/deferred-hydration/src/shared/EnhancedNestedWidget.tsx deleted file mode 100644 index e595e38da8..0000000000 --- a/e2e/solid-start/deferred-hydration/src/shared/EnhancedNestedWidget.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import { createSignal, onMount } from 'solid-js' -import { Hydrate } from '@tanstack/solid-start' -import { interaction, media } from '@tanstack/solid-start/hydration' - -function CrossFileNestedButton() { - const [count, setCount] = createSignal(0) - const [hydrated, setHydrated] = createSignal(false) - - onMount(() => { - setHydrated(true) - }) - - return ( - - ) -} - -export function EnhancedNestedWidget() { - return ( - - - - - - ) -} diff --git a/e2e/solid-start/deferred-hydration/src/shared/ImportedHydrateWidget.tsx b/e2e/solid-start/deferred-hydration/src/shared/ImportedHydrateWidget.tsx deleted file mode 100644 index 859b741755..0000000000 --- a/e2e/solid-start/deferred-hydration/src/shared/ImportedHydrateWidget.tsx +++ /dev/null @@ -1,34 +0,0 @@ -import { createSignal } from 'solid-js' - -import { Hydrate } from '@tanstack/solid-start' -import { media } from '@tanstack/solid-start/hydration' - -function ImportedHydrateChild() { - const [count, setCount] = createSignal(0) - - return ( - - ) -} - -export function ImportedHydrateWidget() { - return ( - - imported hydrate fallback - - } - > - - - ) -} diff --git a/e2e/solid-start/deferred-hydration/tests/hydration.spec.ts b/e2e/solid-start/deferred-hydration/tests/hydration.spec.ts deleted file mode 100644 index 892dddf0dd..0000000000 --- a/e2e/solid-start/deferred-hydration/tests/hydration.spec.ts +++ /dev/null @@ -1,911 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' -import type { APIRequestContext, Page } from '@playwright/test' - -async function clickAndExpectCount( - page: Page, - buttonTestId: string, - countTestId: string, - count: string, -) { - await expect(page.getByTestId(buttonTestId)).toHaveAttribute( - 'data-hydrated', - 'true', - ) - await page.getByTestId(buttonTestId).click() - await expect(page.getByTestId(countTestId)).toHaveText(count) -} - -async function clickIntentAndExpectReplayedCount( - page: Page, - buttonTestId: string, - countTestId: string, - count: string, -) { - await expectRouteToStayUnhydrated(page, buttonTestId) - await page.getByTestId(buttonTestId).click() - await expect(page.getByTestId(buttonTestId)).toHaveAttribute( - 'data-hydrated', - 'true', - ) - await expect(page.getByTestId(countTestId)).toHaveText(count) -} - -async function clickToHydrateThenClickAndExpectIncrement( - page: Page, - buttonTestId: string, - countTestId: string, -) { - await expectRouteToStayUnhydrated(page, buttonTestId) - await page.getByTestId(buttonTestId).click() - await expect(page.getByTestId(buttonTestId)).toHaveAttribute( - 'data-hydrated', - 'true', - ) - const previousCount = Number( - await page.getByTestId(countTestId).textContent(), - ) - await page.getByTestId(buttonTestId).click() - await expect - .poll(async () => Number(await page.getByTestId(countTestId).textContent())) - .toBe(previousCount + 1) -} - -async function hoverIntentAndExpectCount( - page: Page, - buttonTestId: string, - countTestId: string, - count: string, -) { - await expectRouteToStayUnhydrated(page, buttonTestId) - await page.mouse.move(0, 0) - await page.getByTestId(buttonTestId).hover() - await clickAndExpectCount(page, buttonTestId, countTestId, count) -} - -async function dispatchHydrationIntent( - page: Page, - buttonTestId: string, - eventName: string, -) { - await page.getByTestId(buttonTestId).evaluate((element, eventName) => { - const marker = element.closest('[data-ts-hydrate-id]') - - if (!marker) { - throw new Error('Expected Hydrate marker to exist') - } - - marker.dispatchEvent( - new Event(eventName, { bubbles: true, cancelable: true }), - ) - }, eventName) -} - -async function trackBoundaryStability(page: Page, buttonTestId: string) { - await page.getByTestId(buttonTestId).evaluate((element, testId) => { - const marker = element.closest('[data-ts-hydrate-id]') - - if (!(marker instanceof HTMLElement)) { - throw new Error('Expected Hydrate marker to exist') - } - - const win = window as typeof window & { - __hydrateBoundaryVisualGapCount?: number - __hydrateBoundaryMaxScrollDelta?: number - __hydrateBoundaryStabilityDone?: boolean - } - const hasBoundaryButton = () => - Array.from(marker.querySelectorAll('[data-testid]')).some( - (child) => child.getAttribute('data-testid') === testId, - ) - const hasHydratedBoundaryButton = () => - Array.from(marker.querySelectorAll('[data-testid]')).some( - (child) => - child.getAttribute('data-testid') === testId && - child.getAttribute('data-hydrated') === 'true', - ) - const initialScrollY = window.scrollY - - win.__hydrateBoundaryVisualGapCount = 0 - win.__hydrateBoundaryMaxScrollDelta = 0 - win.__hydrateBoundaryStabilityDone = false - - let frameCount = 0 - let hydratedFrameCount = 0 - let observer: MutationObserver | undefined - const recordScroll = () => { - win.__hydrateBoundaryMaxScrollDelta = Math.max( - win.__hydrateBoundaryMaxScrollDelta ?? 0, - Math.abs(window.scrollY - initialScrollY), - ) - - if (hasHydratedBoundaryButton()) hydratedFrameCount++ - - frameCount++ - if (hydratedFrameCount >= 10 || frameCount >= 300) { - observer?.disconnect() - win.__hydrateBoundaryStabilityDone = true - return - } - - requestAnimationFrame(recordScroll) - } - - observer = new MutationObserver(() => { - if (!hasBoundaryButton()) { - win.__hydrateBoundaryVisualGapCount!++ - } - }) - observer.observe(marker, { childList: true }) - - requestAnimationFrame(recordScroll) - }, buttonTestId) -} - -async function expectBoundaryStable(page: Page) { - await expect - .poll(() => - page.evaluate( - () => - ( - window as typeof window & { - __hydrateBoundaryStabilityDone?: boolean - } - ).__hydrateBoundaryStabilityDone ?? false, - ), - ) - .toBe(true) - await expect - .poll(() => - page.evaluate( - () => - ( - window as typeof window & { - __hydrateBoundaryVisualGapCount?: number - } - ).__hydrateBoundaryVisualGapCount ?? 0, - ), - ) - .toBe(0) - await expect - .poll(() => - page.evaluate( - () => - ( - window as typeof window & { - __hydrateBoundaryMaxScrollDelta?: number - } - ).__hydrateBoundaryMaxScrollDelta ?? 0, - ), - ) - .toBeLessThanOrEqual(1) -} - -async function expectRouteToStayUnhydrated( - page: Page, - buttonTestId: string, - duration = 250, -) { - await expect(page.getByTestId(buttonTestId)).toHaveAttribute( - 'data-hydrated', - 'false', - ) - await page.waitForTimeout(duration) - await expect(page.getByTestId(buttonTestId)).toHaveAttribute( - 'data-hydrated', - 'false', - ) -} - -async function scrollToBoundary(page: Page, buttonTestId: string) { - const button = page.getByTestId(buttonTestId) - for (let attempt = 0; attempt < 3; attempt++) { - await button.evaluate((element) => { - element.scrollIntoView({ block: 'center', inline: 'nearest' }) - }) - - await page.waitForTimeout(100) - const isVisible = await button.evaluate((element) => { - const rect = element.getBoundingClientRect() - return rect.bottom > 0 && rect.top < window.innerHeight - }) - - if (isVisible) return - } - - await expect(button).toBeInViewport() -} - -async function expectCssProperty( - page: Page, - testId: string, - property: string, - value: string, -) { - await expect - .poll(() => - page.getByTestId(testId).evaluate((element, propertyName) => { - return getComputedStyle(element).getPropertyValue(propertyName) - }, property), - ) - .toBe(value) -} - -function htmlContainsText(html: string, text: string) { - const pattern = text.split(' ').join('(?:\\s|)+') - expect(html).toMatch(new RegExp(pattern)) -} - -function getModulePreloadHrefs(html: string) { - return Array.from(html.matchAll(/]*>/g), (match) => match[0]) - .filter((tag) => /\brel="modulepreload"/.test(tag)) - .map((tag) => tag.match(/\bhref="([^"]+)"/)?.[1]) - .filter((href): href is string => !!href) -} - -async function modulePreloadContentsContain( - request: APIRequestContext, - hrefs: Array, - marker: string, -) { - for (const href of hrefs) { - const response = await request.get(href) - if (!response.ok()) continue - - const text = await response.text() - if (text.includes(marker)) return true - } - - return false -} - -async function resourceContentsContain( - page: Page, - request: APIRequestContext, - marker: string, - filter: (url: string) => boolean, -) { - const resourceUrls = await page.evaluate(() => - performance.getEntriesByType('resource').map((entry) => entry.name), - ) - - return modulePreloadContentsContain( - request, - resourceUrls.filter(filter), - marker, - ) -} - -async function documentModulePreloadHrefs(page: Page) { - return page.evaluate(() => - Array.from( - document.querySelectorAll('link[rel~="modulepreload"]'), - (link) => link.href, - ), - ) -} - -function isHydrateBoundaryResource(url: string) { - return ( - url.includes('/assets/components-') || - url.includes('/assets/js/async/') || - url.includes('/static/js/async/') - ) -} - -function isClientJavaScriptResource(url: string) { - return ( - url.includes('/assets/') || - url.includes('/static/js/') || - url.includes('/static/js/async/') - ) -} - -async function expectClientRouterReady(page: Page) { - await expect - .poll(() => - page.evaluate(() => - Boolean( - ( - globalThis as typeof globalThis & { - __TSR_ROUTER__?: unknown - } - ).__TSR_ROUTER__, - ), - ), - ) - .toBe(true) -} - -async function gotoEnhanced(page: Page, search = '') { - await page.goto(`/enhanced${search}`) - await expectClientRouterReady(page) -} - -test.describe('component-level Hydrate runtime strategies', () => { - test('renders SSR HTML and hydrates each runtime when appropriately', async ({ - page, - request, - }) => { - await page.goto('/components') - - await expect(page.getByTestId('component-heading')).toHaveText( - 'Component Deferred Hydration', - ) - - await clickAndExpectCount( - page, - 'component-load-button', - 'component-load-count', - '1', - ) - await clickAndExpectCount( - page, - 'component-idle-button', - 'component-idle-count', - '1', - ) - await expect( - resourceContentsContain(page, request, 'component-visible', (url) => - isHydrateBoundaryResource(url), - ), - ).resolves.toBe(false) - await expectRouteToStayUnhydrated(page, 'component-visible-button') - await scrollToBoundary(page, 'component-visible-button') - await clickAndExpectCount( - page, - 'component-visible-button', - 'component-visible-count', - '1', - ) - await expect - .poll(() => - resourceContentsContain(page, request, 'component-visible', (url) => - isHydrateBoundaryResource(url), - ), - ) - .toBe(true) - await clickAndExpectCount( - page, - 'component-media-button', - 'component-media-count', - '1', - ) - await hoverIntentAndExpectCount( - page, - 'component-interaction-button', - 'component-interaction-count', - '1', - ) - await expect(page.getByTestId('component-on-hydrated-count')).toHaveText( - '0', - ) - await expectRouteToStayUnhydrated(page, 'component-custom-single-button') - await page.getByTestId('component-custom-single-button').hover() - await expectRouteToStayUnhydrated(page, 'component-custom-single-button') - await page.getByTestId('component-custom-single-button').click() - await expectRouteToStayUnhydrated(page, 'component-custom-single-button') - await dispatchHydrationIntent( - page, - 'component-custom-single-button', - 'dblclick', - ) - await expect( - page.getByTestId('component-custom-single-button'), - ).toHaveAttribute('data-hydrated', 'true') - await expect(page.getByTestId('component-on-hydrated-count')).toHaveText( - '1', - ) - await clickAndExpectCount( - page, - 'component-custom-single-button', - 'component-custom-single-count', - '1', - ) - await expect(page.getByTestId('component-on-hydrated-count')).toHaveText( - '1', - ) - await expectRouteToStayUnhydrated(page, 'component-custom-multi-button') - await dispatchHydrationIntent( - page, - 'component-custom-multi-button', - 'contextmenu', - ) - await clickAndExpectCount( - page, - 'component-custom-multi-button', - 'component-custom-multi-count', - '1', - ) - await expectRouteToStayUnhydrated(page, 'component-condition-button') - await page.getByTestId('component-enable-condition').click() - await clickAndExpectCount( - page, - 'component-condition-button', - 'component-condition-count', - '1', - ) - await scrollToBoundary(page, 'component-click-replay-button') - await expectRouteToStayUnhydrated(page, 'component-click-replay-button') - await trackBoundaryStability(page, 'component-click-replay-button') - await page.getByTestId('component-click-replay-button').click() - await expect( - page.getByTestId('component-click-replay-button'), - ).toHaveAttribute('data-hydrated', 'true') - await expectBoundaryStable(page) - await expect(page.getByTestId('component-click-replay-count')).toHaveText( - '1', - ) - await expectRouteToStayUnhydrated(page, 'component-prefetch-button') - await expect( - resourceContentsContain(page, request, 'component-prefetch', (url) => - isHydrateBoundaryResource(url), - ), - ).resolves.toBe(false) - await page.mouse.move(0, 0) - await page.getByTestId('component-prefetch-button').hover() - await expect(page.getByTestId('component-prefetch-button')).toHaveAttribute( - 'data-hydrated', - 'false', - ) - await expect - .poll(() => - resourceContentsContain(page, request, 'component-prefetch', (url) => - isHydrateBoundaryResource(url), - ), - ) - .toBe(true) - await expect(page.getByTestId('component-prefetch-button')).toHaveAttribute( - 'data-hydrated', - 'false', - ) - await page.getByTestId('component-prefetch-button').click() - await expect(page.getByTestId('component-prefetch-button')).toHaveAttribute( - 'data-hydrated', - 'true', - ) - await expect(page.getByTestId('component-prefetch-count')).toHaveText('1') - await hoverIntentAndExpectCount( - page, - 'component-nested-child-button', - 'component-nested-child-count', - '1', - ) - - await page.getByTestId('component-never-button').click() - await expect(page.getByTestId('component-never-count')).toHaveText('0') - }) - - test('replays click after another interaction boundary hydrates first', async ({ - page, - }) => { - await page.goto('/components') - await expectClientRouterReady(page) - - await scrollToBoundary(page, 'component-custom-multi-button') - await expectRouteToStayUnhydrated(page, 'component-custom-multi-button') - await page.getByTestId('component-custom-multi-button').click({ - button: 'right', - }) - await expect( - page.getByTestId('component-custom-multi-button'), - ).toHaveAttribute('data-hydrated', 'true') - - await scrollToBoundary(page, 'component-click-replay-button') - await expectRouteToStayUnhydrated(page, 'component-click-replay-button') - await trackBoundaryStability(page, 'component-click-replay-button') - await page.getByTestId('component-click-replay-button').click() - await expect( - page.getByTestId('component-click-replay-button'), - ).toHaveAttribute('data-hydrated', 'true') - await expectBoundaryStable(page) - await expect(page.getByTestId('component-click-replay-count')).toHaveText( - '1', - ) - }) - - test('keeps bottom scroll stable when a condition boundary hydrates', async ({ - page, - }) => { - await page.goto('/components') - await expectClientRouterReady(page) - await expectRouteToStayUnhydrated(page, 'component-condition-button') - - await page.evaluate(() => { - window.scrollTo(0, document.documentElement.scrollHeight) - }) - await page.waitForTimeout(100) - await expect( - page.getByTestId('component-enable-condition'), - ).toBeInViewport() - - await trackBoundaryStability(page, 'component-condition-button') - await page.getByTestId('component-enable-condition').click() - await expect( - page.getByTestId('component-condition-button'), - ).toHaveAttribute('data-hydrated', 'true') - await expectBoundaryStable(page) - await clickAndExpectCount( - page, - 'component-condition-button', - 'component-condition-count', - '1', - ) - }) - - test('shows fallback during a client-only mount while the child suspends', async ({ - page, - }) => { - await page.goto('/components') - await expect(page.getByTestId('component-load-button')).toHaveAttribute( - 'data-hydrated', - 'true', - ) - await page.getByTestId('component-show-client-fallback').click() - - await expect(page.getByTestId('component-client-fallback')).toHaveText( - 'client fallback', - ) - await expect(page.getByTestId('component-fallback-child')).toHaveText( - 'fallback child', - ) - await expect(page.getByTestId('component-client-fallback')).toHaveCount(0) - }) -}) - -test.describe('enhanced Hydrate API combinations', () => { - test('server renders dynamic markers without evaluating client-only callbacks or prefetch functions', async ({ - request, - }) => { - const response = await request.get('/enhanced?dynamic=interaction') - const html = await response.text() - - expect(response.ok()).toBe(true) - htmlContainsText(html, 'Enhanced Hydrate APIs') - htmlContainsText(html, 'conditional dynamic') - expect(html).toContain('data-ts-hydrate-when="dynamic"') - expect(html).not.toContain('missing-element') - }) - - test('dynamic when functions hydrate and replay interaction events', async ({ - page, - }) => { - await gotoEnhanced(page, '?dynamic=interaction') - await expect(page.getByTestId('enhanced-heading')).toHaveText( - 'Enhanced Hydrate APIs', - ) - await clickIntentAndExpectReplayedCount( - page, - 'enhanced-dynamic-interaction-button', - 'enhanced-dynamic-interaction-count', - '1', - ) - - await expectRouteToStayUnhydrated( - page, - 'enhanced-dynamic-conditional-button', - ) - await page.getByTestId('enhanced-dynamic-conditional-button').hover() - await expectRouteToStayUnhydrated( - page, - 'enhanced-dynamic-conditional-button', - ) - await clickIntentAndExpectReplayedCount( - page, - 'enhanced-dynamic-conditional-button', - 'enhanced-dynamic-conditional-count', - '1', - ) - }) - - test('procedural prefetch can block hydration, preload the split chunk, and prepare query-like work', async ({ - page, - request, - }) => { - await gotoEnhanced(page) - await expect( - resourceContentsContain( - page, - request, - 'enhanced-procedural-split-child', - isClientJavaScriptResource, - ), - ).resolves.toBe(false) - - await expectRouteToStayUnhydrated(page, 'enhanced-procedural-split-button') - await expect(page.getByTestId('enhanced-split-wait-reason')).toHaveText( - 'waiting', - ) - await dispatchHydrationIntent( - page, - 'enhanced-procedural-split-button', - 'pointerover', - ) - await expect(page.getByTestId('enhanced-split-query')).toHaveText('element') - await expect(page.getByTestId('enhanced-split-wait-reason')).toHaveText( - 'prefetch', - ) - await expect(page.getByTestId('enhanced-split-preload')).toHaveText('done') - await expect - .poll(() => - resourceContentsContain( - page, - request, - 'enhanced-procedural-split-child', - isClientJavaScriptResource, - ), - ) - .toBe(true) - - await page.getByTestId('enhanced-procedural-split-button').click() - await expect( - page.getByTestId('enhanced-procedural-split-button'), - ).toHaveAttribute('data-hydrated', 'false') - await expect( - page.getByTestId('enhanced-procedural-split-count'), - ).toHaveText('0') - await page.getByTestId('enhanced-release-split-prefetch').click() - await expect( - page.getByTestId('enhanced-procedural-split-button'), - ).toHaveAttribute('data-hydrated', 'true') - await expect( - page.getByTestId('enhanced-procedural-split-count'), - ).toHaveText('1') - await expect(page.getByTestId('enhanced-split-query')).toHaveText('done') - }) - - test('function prefetch supports fire-and-forget work and waitFor hydrate-first resolution', async ({ - page, - }) => { - await gotoEnhanced(page) - - await expect(page.getByTestId('enhanced-fire-wait-reason')).toHaveText( - 'waiting', - ) - await dispatchHydrationIntent( - page, - 'enhanced-fire-and-forget-button', - 'pointerover', - ) - await expect(page.getByTestId('enhanced-fire-wait-reason')).toHaveText( - 'prefetch', - ) - await expect(page.getByTestId('enhanced-fire-status')).toHaveText('started') - await clickIntentAndExpectReplayedCount( - page, - 'enhanced-fire-and-forget-button', - 'enhanced-fire-and-forget-count', - '1', - ) - await expect(page.getByTestId('enhanced-fire-query')).toHaveText('idle') - await page.getByTestId('enhanced-release-fire-prefetch').click() - await expect(page.getByTestId('enhanced-fire-query')).toHaveText('done') - - await clickIntentAndExpectReplayedCount( - page, - 'enhanced-hydrate-first-button', - 'enhanced-hydrate-first-count', - '1', - ) - await expect(page.getByTestId('enhanced-hydrate-first-reason')).toHaveText( - 'hydrate', - ) - }) - - test('split=false procedural prefetch blocks hydration without requiring a child preload chunk', async ({ - page, - }) => { - await gotoEnhanced(page) - - await expectRouteToStayUnhydrated(page, 'enhanced-runtime-only-button') - await expect(page.getByTestId('enhanced-runtime-wait-reason')).toHaveText( - 'waiting', - ) - await dispatchHydrationIntent( - page, - 'enhanced-runtime-only-button', - 'pointerover', - ) - await expect(page.getByTestId('enhanced-runtime-wait-reason')).toHaveText( - 'prefetch', - ) - await page.getByTestId('enhanced-runtime-only-button').click() - await expect( - page.getByTestId('enhanced-runtime-only-button'), - ).toHaveAttribute('data-hydrated', 'false') - await expect(page.getByTestId('enhanced-runtime-only-count')).toHaveText( - '0', - ) - await page.getByTestId('enhanced-release-runtime-prefetch').click() - await expect(page.getByTestId('enhanced-runtime-status')).toHaveText( - 'ready', - ) - await expect( - page.getByTestId('enhanced-runtime-only-button'), - ).toHaveAttribute('data-hydrated', 'true') - await expect(page.getByTestId('enhanced-runtime-only-count')).toHaveText( - '1', - ) - }) - - test('procedural prefetch aborts waiters and signals when boundaries unmount', async ({ - page, - }) => { - await gotoEnhanced(page) - - await expectRouteToStayUnhydrated(page, 'enhanced-wait-abort-button') - await expect(page.getByTestId('enhanced-wait-abort-reason')).toHaveText( - 'waiting', - ) - await page.getByTestId('enhanced-hide-wait-abort').click() - await expect(page.getByTestId('enhanced-wait-abort-reason')).toHaveText( - 'abort', - ) - - await expect(page.getByTestId('enhanced-abort-status')).toHaveText( - 'listening', - ) - await page.getByTestId('enhanced-hide-abort').click() - await expect(page.getByTestId('enhanced-abort-status')).toHaveText( - 'aborted', - ) - }) - - test('nested dynamic interaction boundaries delegate through outer boundaries', async ({ - page, - }) => { - await gotoEnhanced(page) - - await clickToHydrateThenClickAndExpectIncrement( - page, - 'enhanced-dynamic-nested-button', - 'enhanced-dynamic-nested-count', - ) - await clickToHydrateThenClickAndExpectIncrement( - page, - 'enhanced-cross-file-nested-button', - 'enhanced-cross-file-nested-count', - ) - }) -}) - -test.describe('Hydrate CSS delivery', () => { - test('ships CSS for deferred, never, shared, and nested boundaries without JavaScript', async ({ - browser, - request, - }) => { - const response = await request.get('/css') - const html = await response.text() - - htmlContainsText(html, 'CSS Deferred Hydration') - htmlContainsText(html, 'Outer CSS') - htmlContainsText(html, 'Deferred CSS') - htmlContainsText(html, 'Never CSS') - htmlContainsText(html, 'Nested CSS') - - const context = await browser.newContext({ javaScriptEnabled: false }) - const page = await context.newPage() - - try { - await page.goto('/css') - - await expect(page.getByTestId('css-heading')).toHaveText( - 'CSS Deferred Hydration', - ) - await expect(page.getByTestId('css-deferred')).toHaveText('Deferred CSS') - await expect(page.getByTestId('css-never')).toHaveText('Never CSS') - await expect(page.getByTestId('css-nested')).toHaveText('Nested CSS') - - await expectCssProperty(page, 'css-outer', 'color', 'rgb(12, 34, 56)') - await expectCssProperty( - page, - 'css-deferred', - 'background-color', - 'rgb(23, 45, 67)', - ) - await expectCssProperty(page, 'css-never', 'color', 'rgb(45, 67, 89)') - await expectCssProperty( - page, - 'css-shared-outer', - 'border-top-color', - 'rgb(98, 76, 54)', - ) - await expectCssProperty( - page, - 'css-deferred', - 'border-top-color', - 'rgb(98, 76, 54)', - ) - await expectCssProperty( - page, - 'css-nested', - 'border-left-color', - 'rgb(67, 89, 123)', - ) - await expectCssProperty(page, 'css-nested', 'border-left-width', '5px') - } finally { - await context.close() - } - }) - - test('renders deferred content and omits never content after client-side navigation', async ({ - page, - }) => { - await page.goto('/') - await expectClientRouterReady(page) - await page.getByRole('link', { name: 'CSS', exact: true }).click() - await expect(page).toHaveURL(/\/css$/) - - await expect(page.getByTestId('css-heading')).toHaveText( - 'CSS Deferred Hydration', - ) - await expect(page.getByTestId('css-deferred')).toHaveText('Deferred CSS') - await expect(page.getByTestId('css-never')).toHaveCount(0) - await expect(page.getByTestId('css-nested')).toHaveCount(0) - - await expectCssProperty( - page, - 'css-deferred', - 'background-color', - 'rgb(23, 45, 67)', - ) - }) -}) - -test.describe('imported Hydrate boundaries', () => { - test('does not emit filtered shared Hydrate child JS on the initial document', async ({ - request, - }) => { - const response = await request.get('/imported') - const html = await response.text() - - htmlContainsText(html, 'Imported Hydrate') - htmlContainsText(html, 'Imported Hydrate Child') - - await expect( - modulePreloadContentsContain( - request, - getModulePreloadHrefs(html), - 'imported-hydrate-child', - ), - ).resolves.toBe(false) - }) - - test('does not preload Hydrate child chunks before client navigation', async ({ - page, - request, - }) => { - await page.goto('/') - await expect(page.getByTestId('home-heading')).toHaveText( - 'Deferred Hydration', - ) - await expectClientRouterReady(page) - - const link = page.getByRole('link', { name: 'imported Hydrate' }) - await page.mouse.move(0, 0) - await link.hover() - await link.focus() - - await expect( - modulePreloadContentsContain( - request, - await documentModulePreloadHrefs(page), - 'imported-hydrate-child', - ), - ).resolves.toBe(false) - await expect( - resourceContentsContain(page, request, 'imported-hydrate-child', (url) => - isClientJavaScriptResource(url), - ), - ).resolves.toBe(false) - - await page.getByRole('link', { name: 'imported Hydrate' }).click() - await expect(page).toHaveURL(/\/imported$/) - await expect(page.getByTestId('imported-hydrate-fallback')).toHaveCount(0) - await expect(page.getByTestId('imported-hydrate-child')).toContainText( - 'Imported Hydrate Child', - ) - await page.getByTestId('imported-hydrate-child').click() - await expect(page.getByTestId('imported-hydrate-count')).toHaveText('1') - }) -}) diff --git a/e2e/solid-start/deferred-hydration/tsconfig.json b/e2e/solid-start/deferred-hydration/tsconfig.json deleted file mode 100644 index 76cf3401fa..0000000000 --- a/e2e/solid-start/deferred-hydration/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2024", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/deferred-hydration/vite.config.ts b/e2e/solid-start/deferred-hydration/vite.config.ts deleted file mode 100644 index 70f388638a..0000000000 --- a/e2e/solid-start/deferred-hydration/vite.config.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' - -const outDir = process.env.E2E_DIST_DIR ?? 'dist-vite-ssr' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - build: { - outDir, - }, - server: { port: 3000 }, - plugins: [tanstackStart(), viteSolid({ ssr: true })], -}) diff --git a/e2e/solid-start/dev-ssr-styles/.gitignore b/e2e/solid-start/dev-ssr-styles/.gitignore deleted file mode 100644 index 950326609c..0000000000 --- a/e2e/solid-start/dev-ssr-styles/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -dist -.routeTree.gen.ts -src/routeTree.gen.ts -test-results -playwright-report -port*.txt diff --git a/e2e/solid-start/dev-ssr-styles/package.json b/e2e/solid-start/dev-ssr-styles/package.json deleted file mode 100644 index 6ca79c15c6..0000000000 --- a/e2e/solid-start/dev-ssr-styles/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-dev-ssr-styles", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev --port 0", - "build": "vite build && tsc --noEmit", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e:dev": "MODE=dev playwright test --project=chromium", - "test:e2e": "pnpm run test:e2e:dev && pnpm run test:e2e:dev:bundled-dev", - "test:e2e:dev:bundled-dev": "MODE=dev E2E_VITE_BUNDLED_DEV=true playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:*", - "@tanstack/solid-start": "workspace:*", - "solid-js": "^1.9.10" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tanstack/router-core": "workspace:*", - "@tanstack/router-e2e-utils": "workspace:*", - "@types/node": "^22.10.2", - "srvx": "^1.0.0", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11", - "@typescript/native": "npm:typescript@^7.0.2" - } -} diff --git a/e2e/solid-start/dev-ssr-styles/playwright.config.ts b/e2e/solid-start/dev-ssr-styles/playwright.config.ts deleted file mode 100644 index 723cd32789..0000000000 --- a/e2e/solid-start/dev-ssr-styles/playwright.config.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -export default defineConfig({ - testDir: './tests', - workers: 1, - reporter: [['line']], - globalSetup: './tests/setup/global.setup.ts', - use: { baseURL }, - webServer: { - command: 'pnpm dev:e2e', - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - VITE_NODE_ENV: 'test', - }, - }, - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/dev-ssr-styles/src/components/CodeSplitStyledBox.tsx b/e2e/solid-start/dev-ssr-styles/src/components/CodeSplitStyledBox.tsx deleted file mode 100644 index 02d924dd10..0000000000 --- a/e2e/solid-start/dev-ssr-styles/src/components/CodeSplitStyledBox.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import styles from '../styles/code-split-route.module.css' - -export function CodeSplitStyledBox() { - return ( -
- This box is styled by a code-split route component. -
- ) -} diff --git a/e2e/solid-start/dev-ssr-styles/src/router.tsx b/e2e/solid-start/dev-ssr-styles/src/router.tsx deleted file mode 100644 index 73b487af4d..0000000000 --- a/e2e/solid-start/dev-ssr-styles/src/router.tsx +++ /dev/null @@ -1,10 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - return createRouter({ - routeTree, - scrollRestoration: true, - defaultPreload: false, - }) -} diff --git a/e2e/solid-start/dev-ssr-styles/src/routes/__root.tsx b/e2e/solid-start/dev-ssr-styles/src/routes/__root.tsx deleted file mode 100644 index 47a50b5716..0000000000 --- a/e2e/solid-start/dev-ssr-styles/src/routes/__root.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { - HeadContent, - Outlet, - Scripts, - createRootRoute, -} from '@tanstack/solid-router' -import { HydrationScript } from 'solid-js/web' -import '~/styles/app.css' - -export const Route = createRootRoute({ - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - - - - - - ) -} diff --git a/e2e/solid-start/dev-ssr-styles/src/routes/index.tsx b/e2e/solid-start/dev-ssr-styles/src/routes/index.tsx deleted file mode 100644 index 73e6f1e89d..0000000000 --- a/e2e/solid-start/dev-ssr-styles/src/routes/index.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { CodeSplitStyledBox } from '../components/CodeSplitStyledBox' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Solid Dev SSR Styles Test

- -
- ) -} diff --git a/e2e/solid-start/dev-ssr-styles/src/styles/app.css b/e2e/solid-start/dev-ssr-styles/src/styles/app.css deleted file mode 100644 index 9a67f9b153..0000000000 --- a/e2e/solid-start/dev-ssr-styles/src/styles/app.css +++ /dev/null @@ -1,5 +0,0 @@ -body { - font-family: sans-serif; - margin: 0; - padding: 20px; -} diff --git a/e2e/solid-start/dev-ssr-styles/src/styles/code-split-route.module.css b/e2e/solid-start/dev-ssr-styles/src/styles/code-split-route.module.css deleted file mode 100644 index 75a73ca7c3..0000000000 --- a/e2e/solid-start/dev-ssr-styles/src/styles/code-split-route.module.css +++ /dev/null @@ -1,6 +0,0 @@ -.styledBox { - --solid-code-split-style-marker: present; - background-color: #3b82f6; - color: white; - padding: 24px; -} diff --git a/e2e/solid-start/dev-ssr-styles/tests/app.spec.ts b/e2e/solid-start/dev-ssr-styles/tests/app.spec.ts deleted file mode 100644 index 25bd317a72..0000000000 --- a/e2e/solid-start/dev-ssr-styles/tests/app.spec.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { expect } from '@playwright/test' -import { DEV_STYLES_ATTR } from '@tanstack/router-core' -import { test } from '@tanstack/router-e2e-utils' - -const whitelistErrors = [ - 'Failed to load resource: net::ERR_NAME_NOT_RESOLVED', - 'Failed to load resource: the server responded with a status of 504', -] - -test.describe('dev SSR styles', () => { - test.use({ whitelistErrors }) - - test.describe('with JavaScript disabled', () => { - test.use({ javaScriptEnabled: false, whitelistErrors }) - - test('includes CSS from a code-split route component during SSR', async ({ - page, - }) => { - await page.goto('/') - - const element = page.getByTestId('styled-box') - await expect(element).toBeVisible() - await expect(element).toHaveCSS('background-color', 'rgb(59, 130, 246)') - - const href = await page - .locator(`link[${DEV_STYLES_ATTR}]`) - .getAttribute('href') - expect(href).toBeTruthy() - - const response = await page.request.get(new URL(href!, page.url()).href) - expect(response.ok()).toBeTruthy() - expect(await response.text()).toContain( - '/* /src/styles/code-split-route.module.css */', - ) - }) - }) - - test('keeps CSS output stable after client modules load', async ({ - page, - }) => { - const initialResponsePromise = page.waitForResponse((response) => - new URL(response.url()).pathname.endsWith('/@tanstack-start/styles.css'), - ) - await page.goto('/') - await expect(page.getByTestId('styled-box')).toBeVisible() - const initialResponse = await initialResponsePromise - expect(initialResponse.ok()).toBeTruthy() - const initialCss = await initialResponse.text() - - const reloadedResponsePromise = page.waitForResponse((response) => - new URL(response.url()).pathname.endsWith('/@tanstack-start/styles.css'), - ) - await page.reload() - await expect(page.getByTestId('styled-box')).toBeVisible() - const reloadedResponse = await reloadedResponsePromise - expect(reloadedResponse.ok()).toBeTruthy() - const reloadedCss = await reloadedResponse.text() - - expect(reloadedCss).toBe(initialCss) - }) -}) diff --git a/e2e/solid-start/dev-ssr-styles/tests/setup/global.setup.ts b/e2e/solid-start/dev-ssr-styles/tests/setup/global.setup.ts deleted file mode 100644 index b03b6485c8..0000000000 --- a/e2e/solid-start/dev-ssr-styles/tests/setup/global.setup.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { preOptimizeDevServer, waitForServer } from '@tanstack/router-e2e-utils' - -export default async function setup() { - if (process.env.MODE !== 'dev') { - return - } - - const port = Number(process.env.E2E_APP_PORT ?? 0) - const baseURL = `http://localhost:${port}` - await waitForServer(baseURL) - await preOptimizeDevServer({ - baseURL, - readyTestId: 'home-heading', - }) -} diff --git a/e2e/solid-start/dev-ssr-styles/tsconfig.json b/e2e/solid-start/dev-ssr-styles/tsconfig.json deleted file mode 100644 index c34f9d7c36..0000000000 --- a/e2e/solid-start/dev-ssr-styles/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/dev-ssr-styles/vite.config.ts b/e2e/solid-start/dev-ssr-styles/vite.config.ts deleted file mode 100644 index fa59f4af6d..0000000000 --- a/e2e/solid-start/dev-ssr-styles/vite.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import viteSolid from 'vite-plugin-solid' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - experimental: - process.env.E2E_VITE_BUNDLED_DEV === 'true' - ? { bundledDev: true } - : undefined, - server: { port: 3000 }, - plugins: [tanstackStart(), viteSolid({ ssr: true })], -}) diff --git a/e2e/solid-start/query-integration/.devcontainer/devcontainer.json b/e2e/solid-start/query-integration/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/query-integration/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/query-integration/.prettierignore b/e2e/solid-start/query-integration/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/solid-start/query-integration/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/solid-start/query-integration/package.json b/e2e/solid-start/query-integration/package.json deleted file mode 100644 index 336804c46e..0000000000 --- a/e2e/solid-start/query-integration/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-query-integration", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-query": "^5.90.9", - "@tanstack/solid-query-devtools": "^5.90.0", - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/solid-router-ssr-query": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "solid-js": "^1.9.10", - "tailwind-merge": "^3.6.0", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/node": "^22.10.2", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-start/query-integration/playwright.config.ts b/e2e/solid-start/query-integration/playwright.config.ts deleted file mode 100644 index 1381ce6cde..0000000000 --- a/e2e/solid-start/query-integration/playwright.config.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -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 build && PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/query-integration/src/queryOptions.ts b/e2e/solid-start/query-integration/src/queryOptions.ts deleted file mode 100644 index 10a5073f5e..0000000000 --- a/e2e/solid-start/query-integration/src/queryOptions.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { queryOptions } from '@tanstack/solid-query' - -export const makeQueryOptions = (key: string) => - queryOptions({ - queryKey: ['e2e-test-query-integration', key], - queryFn: async () => { - console.log('fetching query data') - await new Promise((resolve) => { - setTimeout(resolve, 500) - }) - const result = typeof window !== 'undefined' ? 'client' : 'server' - console.log('query data result', result) - return result - }, - staleTime: Infinity, - }) diff --git a/e2e/solid-start/query-integration/src/routeTree.gen.ts b/e2e/solid-start/query-integration/src/routeTree.gen.ts deleted file mode 100644 index 3d6686f67c..0000000000 --- a/e2e/solid-start/query-integration/src/routeTree.gen.ts +++ /dev/null @@ -1,104 +0,0 @@ -/* 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 UseQueryRouteImport } from './routes/useQuery' -import { Route as LoaderFetchQueryTypeRouteImport } from './routes/loader-fetchQuery/$type' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const UseQueryRoute = UseQueryRouteImport.update({ - id: '/useQuery', - path: '/useQuery', - getParentRoute: () => rootRouteImport, -} as any) -const LoaderFetchQueryTypeRoute = LoaderFetchQueryTypeRouteImport.update({ - id: '/loader-fetchQuery/$type', - path: '/loader-fetchQuery/$type', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/useQuery': typeof UseQueryRoute - '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/useQuery': typeof UseQueryRoute - '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/useQuery': typeof UseQueryRoute - '/loader-fetchQuery/$type': typeof LoaderFetchQueryTypeRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/useQuery' | '/loader-fetchQuery/$type' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/useQuery' | '/loader-fetchQuery/$type' - id: '__root__' | '/' | '/useQuery' | '/loader-fetchQuery/$type' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - UseQueryRoute: typeof UseQueryRoute - LoaderFetchQueryTypeRoute: typeof LoaderFetchQueryTypeRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/useQuery': { - id: '/useQuery' - path: '/useQuery' - fullPath: '/useQuery' - preLoaderRoute: typeof UseQueryRouteImport - parentRoute: typeof rootRouteImport - } - '/loader-fetchQuery/$type': { - id: '/loader-fetchQuery/$type' - path: '/loader-fetchQuery/$type' - fullPath: '/loader-fetchQuery/$type' - preLoaderRoute: typeof LoaderFetchQueryTypeRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - UseQueryRoute: UseQueryRoute, - LoaderFetchQueryTypeRoute: LoaderFetchQueryTypeRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/query-integration/src/router.tsx b/e2e/solid-start/query-integration/src/router.tsx deleted file mode 100644 index 59ce312b7e..0000000000 --- a/e2e/solid-start/query-integration/src/router.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import { QueryClient } from '@tanstack/solid-query' -import { createRouter } from '@tanstack/solid-router' -import { setupRouterSsrQueryIntegration } from '@tanstack/solid-router-ssr-query' -import { routeTree } from './routeTree.gen' - -export function getRouter() { - const queryClient = new QueryClient() - const router = createRouter({ - routeTree, - context: { queryClient }, - scrollRestoration: true, - defaultPreload: 'intent', - }) - setupRouterSsrQueryIntegration({ - router, - queryClient, - }) - return router -} diff --git a/e2e/solid-start/query-integration/src/routes/__root.tsx b/e2e/solid-start/query-integration/src/routes/__root.tsx deleted file mode 100644 index faa842e58e..0000000000 --- a/e2e/solid-start/query-integration/src/routes/__root.tsx +++ /dev/null @@ -1,86 +0,0 @@ -/// -import { - HeadContent, - Link, - Scripts, - createRootRouteWithContext, -} from '@tanstack/solid-router' -import { TanStackRouterDevtoolsInProd } from '@tanstack/solid-router-devtools' -import { HydrationScript } from 'solid-js/web' -import type { QueryClient } from '@tanstack/solid-query' -import appCss from '~/styles/app.css?url' - -export const Route = createRootRouteWithContext<{ - queryClient: QueryClient -}>()({ - head: () => ({ - meta: [ - { - charset: 'utf-8', - }, - ], - links: [{ rel: 'stylesheet', href: appCss }], - }), - shellComponent: RootDocument, -}) - -function RootDocument(props: { children?: any }) { - return ( - - - - - - -
- - Home - {' '} - - fetchQuery (sync) - {' '} - - fetchQuery (async) - {' '} - - useQuery - {' '} - {/* - useSuspenseQuery - {' '} */} -
-
- {props.children} - - - - - ) -} diff --git a/e2e/solid-start/query-integration/src/routes/index.tsx b/e2e/solid-start/query-integration/src/routes/index.tsx deleted file mode 100644 index 144674be76..0000000000 --- a/e2e/solid-start/query-integration/src/routes/index.tsx +++ /dev/null @@ -1,13 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' - -export const Route = createFileRoute('/')({ - component: Home, -}) - -function Home() { - return ( -
-

Query Integration E2E tests

-
- ) -} diff --git a/e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx b/e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx deleted file mode 100644 index 2a4db2f560..0000000000 --- a/e2e/solid-start/query-integration/src/routes/loader-fetchQuery/$type.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { useQuery } from '@tanstack/solid-query' -import { createFileRoute } from '@tanstack/solid-router' -import z from 'zod' -import { makeQueryOptions } from '~/queryOptions' - -export const Route = createFileRoute('/loader-fetchQuery/$type')({ - component: RouteComponent, - params: { - parse: ({ type }) => - z - .object({ - type: z.union([z.literal('sync'), z.literal('async')]), - }) - .parse({ type }), - }, - context: ({ params }) => ({ - queryOptions: makeQueryOptions(`loader-fetchQuery-${params.type}`), - }), - loader: ({ context, params }) => { - const queryPromise = context.queryClient.fetchQuery(context.queryOptions) - if (params.type === 'sync') { - return queryPromise - } - }, - ssr: 'data-only', -}) - -function RouteComponent() { - const loaderData = Route.useLoaderData() - const context = Route.useRouteContext() - const query = useQuery(() => context().queryOptions) - return ( -
-
- loader data:{' '} -
{loaderData() ?? 'undefined'}
-
-
- query data:{' '} -
{query.data ?? 'loading...'}
-
-
- ) -} diff --git a/e2e/solid-start/query-integration/src/routes/useQuery.tsx b/e2e/solid-start/query-integration/src/routes/useQuery.tsx deleted file mode 100644 index 335e97753d..0000000000 --- a/e2e/solid-start/query-integration/src/routes/useQuery.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { useQuery } from '@tanstack/solid-query' -import { makeQueryOptions } from '~/queryOptions' - -const qOptions = makeQueryOptions('useQuery') - -export const Route = createFileRoute('/useQuery')({ - loader: ({ context }) => context.queryClient.ensureQueryData(qOptions), - component: RouteComponent, - ssr: true, -}) - -function RouteComponent() { - const query = useQuery(() => qOptions) - - return ( -
-
- query data:{' '} -
{query.data ?? 'loading...'}
-
-
- ) -} diff --git a/e2e/solid-start/query-integration/src/styles/app.css b/e2e/solid-start/query-integration/src/styles/app.css deleted file mode 100644 index 7ff6765215..0000000000 --- a/e2e/solid-start/query-integration/src/styles/app.css +++ /dev/null @@ -1,16 +0,0 @@ -@import 'tailwindcss' source('../'); - -@layer base { - *, - ::after, - ::before, - ::backdrop, - ::file-selector-button { - border-color: var(--color-gray-200, currentcolor); - } -} - -body { - @apply text-base; - font-family: system-ui, sans-serif; -} diff --git a/e2e/solid-start/query-integration/test-results/.last-run.json b/e2e/solid-start/query-integration/test-results/.last-run.json deleted file mode 100644 index cbcc1fbac1..0000000000 --- a/e2e/solid-start/query-integration/test-results/.last-run.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "status": "passed", - "failedTests": [] -} \ No newline at end of file diff --git a/e2e/solid-start/query-integration/tests/app.spec.ts b/e2e/solid-start/query-integration/tests/app.spec.ts deleted file mode 100644 index 90b7f8deb2..0000000000 --- a/e2e/solid-start/query-integration/tests/app.spec.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { expect } from '@playwright/test' -import { test } from '@tanstack/router-e2e-utils' - -test.describe('queries are streamed from the server', () => { - test('direct visit - loader on server runs fetchQuery and awaits it', async ({ - page, - }) => { - await page.goto('/loader-fetchQuery/sync') - - const queryData = page.getByTestId('query-data') - await expect(queryData).toHaveText('server') - - const loaderData = page.getByTestId('loader-data') - await expect(loaderData).toHaveText('server') - }) - test('direct visit - loader on server runs fetchQuery and does not await it', async ({ - page, - }) => { - await page.goto('/loader-fetchQuery/async') - - const queryData = page.getByTestId('query-data') - await expect(queryData).toHaveText('server') - - const loaderData = page.getByTestId('loader-data') - await expect(loaderData).toHaveText('undefined') - }) - - test('useQuery', async ({ page }) => { - await page.goto('/useQuery') - - const queryData = page.getByTestId('query-data') - await expect(queryData).toHaveText('server') - }) -}) diff --git a/e2e/solid-start/query-integration/tsconfig.json b/e2e/solid-start/query-integration/tsconfig.json deleted file mode 100644 index c34f9d7c36..0000000000 --- a/e2e/solid-start/query-integration/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "include": ["**/*.ts", "**/*.tsx"], - "compilerOptions": { - "strict": true, - "esModuleInterop": true, - "jsx": "preserve", - "jsxImportSource": "solid-js", - "module": "ESNext", - "moduleResolution": "Bundler", - "lib": ["DOM", "DOM.Iterable", "ES2022"], - "isolatedModules": true, - "resolveJsonModule": true, - "skipLibCheck": true, - "target": "ES2022", - "allowJs": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "~/*": ["./src/*"] - }, - "noEmit": true, - "types": ["vite/client"] - } -} diff --git a/e2e/solid-start/query-integration/vite.config.ts b/e2e/solid-start/query-integration/vite.config.ts deleted file mode 100644 index c0ae2c4cca..0000000000 --- a/e2e/solid-start/query-integration/vite.config.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { defineConfig } from 'vite' -import { tanstackStart } from '@tanstack/solid-start/plugin/vite' -import solid from 'vite-plugin-solid' -import tailwindcss from '@tailwindcss/vite' - -export default defineConfig({ - resolve: { tsconfigPaths: true }, - plugins: [tailwindcss(), tanstackStart(), solid({ ssr: true })], -}) diff --git a/e2e/solid-start/scroll-restoration/.devcontainer/devcontainer.json b/e2e/solid-start/scroll-restoration/.devcontainer/devcontainer.json deleted file mode 100644 index e5dafce188..0000000000 --- a/e2e/solid-start/scroll-restoration/.devcontainer/devcontainer.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "image": "mcr.microsoft.com/devcontainers/typescript-node:24" -} diff --git a/e2e/solid-start/scroll-restoration/.gitignore b/e2e/solid-start/scroll-restoration/.gitignore deleted file mode 100644 index a79d5cf129..0000000000 --- a/e2e/solid-start/scroll-restoration/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -node_modules -package-lock.json -yarn.lock - -.DS_Store -.cache -.env -.vercel -.output - -/build/ -/api/ -/server/build -/public/build -# Sentry Config File -.env.sentry-build-plugin -/test-results/ -/playwright-report/ -/blob-report/ -/playwright/.cache/ diff --git a/e2e/solid-start/scroll-restoration/.prettierignore b/e2e/solid-start/scroll-restoration/.prettierignore deleted file mode 100644 index 2be5eaa6ec..0000000000 --- a/e2e/solid-start/scroll-restoration/.prettierignore +++ /dev/null @@ -1,4 +0,0 @@ -**/build -**/public -pnpm-lock.yaml -routeTree.gen.ts \ No newline at end of file diff --git a/e2e/solid-start/scroll-restoration/package.json b/e2e/solid-start/scroll-restoration/package.json deleted file mode 100644 index 8cb355490d..0000000000 --- a/e2e/solid-start/scroll-restoration/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "tanstack-solid-start-e2e-basic-scroll-restoration", - "private": true, - "sideEffects": false, - "type": "module", - "scripts": { - "dev": "vite dev --port 3000", - "dev:e2e": "vite dev", - "build": "vite build && tsc --noEmit", - "preview": "vite preview", - "start": "pnpx srvx --prod -s ../client dist/server/server.js", - "test:e2e": "playwright test --project=chromium" - }, - "dependencies": { - "@tanstack/solid-router": "workspace:^", - "@tanstack/solid-router-devtools": "workspace:^", - "@tanstack/solid-start": "workspace:^", - "redaxios": "catalog:", - "solid-js": "^1.9.10", - "tailwind-merge": "^3.6.0", - "zod": "^4.4.3" - }, - "devDependencies": { - "@playwright/test": "^1.61.0", - "@tailwindcss/vite": "^4.2.2", - "@tanstack/router-e2e-utils": "workspace:^", - "@types/node": "^22.10.2", - "combinate": "^1.1.11", - "srvx": "^1.0.0", - "tailwindcss": "^4.2.2", - "@typescript/native": "npm:typescript@^7.0.2", - "typescript": "npm:@typescript/typescript6@^6.0.2", - "vite": "^8.0.14", - "vite-plugin-solid": "^2.11.11" - } -} diff --git a/e2e/solid-start/scroll-restoration/playwright.config.ts b/e2e/solid-start/scroll-restoration/playwright.config.ts deleted file mode 100644 index 1862174905..0000000000 --- a/e2e/solid-start/scroll-restoration/playwright.config.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { defineConfig, devices } from '@playwright/test' -import { appServerReady } from '@tanstack/router-e2e-utils' - -const PORT = Number(process.env.E2E_APP_PORT ?? 0) -const baseURL = `http://localhost:${PORT}` - -/** - * See https://playwright.dev/docs/test-configuration. - */ -export default defineConfig({ - testDir: './tests', - workers: 1, - - reporter: [['line']], - - use: { - /* Base URL to use in actions like `await page.goto('/')`. */ - baseURL, - }, - - webServer: { - command: `pnpm build && PORT=${PORT} pnpm start`, - wait: appServerReady, - reuseExistingServer: false, - stdout: 'pipe', - env: { - NODE_OPTIONS: `${process.env.NODE_OPTIONS ?? ''} --import=@tanstack/router-e2e-utils/mock-api`, - }, - }, - - projects: [ - { - name: 'chromium', - use: { ...devices['Desktop Chrome'] }, - }, - ], -}) diff --git a/e2e/solid-start/scroll-restoration/public/android-chrome-192x192.png b/e2e/solid-start/scroll-restoration/public/android-chrome-192x192.png deleted file mode 100644 index 09c8324f8c..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/android-chrome-192x192.png and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/android-chrome-512x512.png b/e2e/solid-start/scroll-restoration/public/android-chrome-512x512.png deleted file mode 100644 index 11d626ea3d..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/android-chrome-512x512.png and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/apple-touch-icon.png b/e2e/solid-start/scroll-restoration/public/apple-touch-icon.png deleted file mode 100644 index 5a9423cc02..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/apple-touch-icon.png and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/favicon-16x16.png b/e2e/solid-start/scroll-restoration/public/favicon-16x16.png deleted file mode 100644 index e3389b0044..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/favicon-16x16.png and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/favicon-32x32.png b/e2e/solid-start/scroll-restoration/public/favicon-32x32.png deleted file mode 100644 index 900c77d444..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/favicon-32x32.png and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/favicon.ico b/e2e/solid-start/scroll-restoration/public/favicon.ico deleted file mode 100644 index 1a1751676f..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/favicon.ico and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/favicon.png b/e2e/solid-start/scroll-restoration/public/favicon.png deleted file mode 100644 index 1e77bc0609..0000000000 Binary files a/e2e/solid-start/scroll-restoration/public/favicon.png and /dev/null differ diff --git a/e2e/solid-start/scroll-restoration/public/script.js b/e2e/solid-start/scroll-restoration/public/script.js deleted file mode 100644 index 897477e7d0..0000000000 --- a/e2e/solid-start/scroll-restoration/public/script.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_1 loaded') -window.SCRIPT_1 = true diff --git a/e2e/solid-start/scroll-restoration/public/script2.js b/e2e/solid-start/scroll-restoration/public/script2.js deleted file mode 100644 index 819af30daf..0000000000 --- a/e2e/solid-start/scroll-restoration/public/script2.js +++ /dev/null @@ -1,2 +0,0 @@ -console.log('SCRIPT_2 loaded') -window.SCRIPT_2 = true diff --git a/e2e/solid-start/scroll-restoration/public/site.webmanifest b/e2e/solid-start/scroll-restoration/public/site.webmanifest deleted file mode 100644 index fa99de77db..0000000000 --- a/e2e/solid-start/scroll-restoration/public/site.webmanifest +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "", - "short_name": "", - "icons": [ - { - "src": "/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - } - ], - "theme_color": "#ffffff", - "background_color": "#ffffff", - "display": "standalone" -} diff --git a/e2e/solid-start/scroll-restoration/src/components/DefaultCatchBoundary.tsx b/e2e/solid-start/scroll-restoration/src/components/DefaultCatchBoundary.tsx deleted file mode 100644 index f44db955a0..0000000000 --- a/e2e/solid-start/scroll-restoration/src/components/DefaultCatchBoundary.tsx +++ /dev/null @@ -1,51 +0,0 @@ -import { - ErrorComponent, - Link, - useLocation, - useRouter, -} from '@tanstack/solid-router' -import type { ErrorComponentProps } from '@tanstack/solid-router' - -export function DefaultCatchBoundary({ error }: ErrorComponentProps) { - const router = useRouter() - const isRoot = useLocation({ - select: (location) => location.pathname === '/', - }) - - console.error(error) - - return ( -
- -
- - {isRoot() ? ( - - Home - - ) : ( - { - e.preventDefault() - window.history.back() - }} - > - Go Back - - )} -
-
- ) -} diff --git a/e2e/solid-start/scroll-restoration/src/components/NotFound.tsx b/e2e/solid-start/scroll-restoration/src/components/NotFound.tsx deleted file mode 100644 index af5ad273c5..0000000000 --- a/e2e/solid-start/scroll-restoration/src/components/NotFound.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { Link } from '@tanstack/solid-router' - -export function NotFound({ children }: { children?: any }) { - return ( -
-
- {children ||

The page you are looking for does not exist.

} -
-

- - - Start Over - -

-
- ) -} diff --git a/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts b/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts deleted file mode 100644 index 7668df5930..0000000000 --- a/e2e/solid-start/scroll-restoration/src/routeTree.gen.ts +++ /dev/null @@ -1,127 +0,0 @@ -/* 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 testsNormalPageRouteImport } from './routes/(tests)/normal-page' -import { Route as testsWithLoaderRouteImport } from './routes/(tests)/with-loader' -import { Route as testsWithSearchRouteImport } from './routes/(tests)/with-search' - -const IndexRoute = IndexRouteImport.update({ - id: '/', - path: '/', - getParentRoute: () => rootRouteImport, -} as any) -const testsNormalPageRoute = testsNormalPageRouteImport.update({ - id: '/(tests)/normal-page', - path: '/normal-page', - getParentRoute: () => rootRouteImport, -} as any) -const testsWithLoaderRoute = testsWithLoaderRouteImport.update({ - id: '/(tests)/with-loader', - path: '/with-loader', - getParentRoute: () => rootRouteImport, -} as any) -const testsWithSearchRoute = testsWithSearchRouteImport.update({ - id: '/(tests)/with-search', - path: '/with-search', - getParentRoute: () => rootRouteImport, -} as any) - -export interface FileRoutesByFullPath { - '/': typeof IndexRoute - '/normal-page': typeof testsNormalPageRoute - '/with-loader': typeof testsWithLoaderRoute - '/with-search': typeof testsWithSearchRoute -} -export interface FileRoutesByTo { - '/': typeof IndexRoute - '/normal-page': typeof testsNormalPageRoute - '/with-loader': typeof testsWithLoaderRoute - '/with-search': typeof testsWithSearchRoute -} -export interface FileRoutesById { - __root__: typeof rootRouteImport - '/': typeof IndexRoute - '/(tests)/normal-page': typeof testsNormalPageRoute - '/(tests)/with-loader': typeof testsWithLoaderRoute - '/(tests)/with-search': typeof testsWithSearchRoute -} -export interface FileRouteTypes { - fileRoutesByFullPath: FileRoutesByFullPath - fullPaths: '/' | '/normal-page' | '/with-loader' | '/with-search' - fileRoutesByTo: FileRoutesByTo - to: '/' | '/normal-page' | '/with-loader' | '/with-search' - id: - | '__root__' - | '/' - | '/(tests)/normal-page' - | '/(tests)/with-loader' - | '/(tests)/with-search' - fileRoutesById: FileRoutesById -} -export interface RootRouteChildren { - IndexRoute: typeof IndexRoute - testsNormalPageRoute: typeof testsNormalPageRoute - testsWithLoaderRoute: typeof testsWithLoaderRoute - testsWithSearchRoute: typeof testsWithSearchRoute -} - -declare module '@tanstack/solid-router' { - interface FileRoutesByPath { - '/': { - id: '/' - path: '/' - fullPath: '/' - preLoaderRoute: typeof IndexRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/normal-page': { - id: '/(tests)/normal-page' - path: '/normal-page' - fullPath: '/normal-page' - preLoaderRoute: typeof testsNormalPageRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/with-loader': { - id: '/(tests)/with-loader' - path: '/with-loader' - fullPath: '/with-loader' - preLoaderRoute: typeof testsWithLoaderRouteImport - parentRoute: typeof rootRouteImport - } - '/(tests)/with-search': { - id: '/(tests)/with-search' - path: '/with-search' - fullPath: '/with-search' - preLoaderRoute: typeof testsWithSearchRouteImport - parentRoute: typeof rootRouteImport - } - } -} - -const rootRouteChildren: RootRouteChildren = { - IndexRoute: IndexRoute, - testsNormalPageRoute: testsNormalPageRoute, - testsWithLoaderRoute: testsWithLoaderRoute, - testsWithSearchRoute: testsWithSearchRoute, -} -export const routeTree = rootRouteImport - ._addFileChildren(rootRouteChildren) - ._addFileTypes() - -import type { getRouter } from './router.tsx' -import type { createStart } from '@tanstack/solid-start' -declare module '@tanstack/solid-start' { - interface Register { - ssr: true - router: Awaited> - } -} diff --git a/e2e/solid-start/scroll-restoration/src/router.tsx b/e2e/solid-start/scroll-restoration/src/router.tsx deleted file mode 100644 index 6b397aa78d..0000000000 --- a/e2e/solid-start/scroll-restoration/src/router.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { createRouter } from '@tanstack/solid-router' -import { routeTree } from './routeTree.gen' -import { DefaultCatchBoundary } from './components/DefaultCatchBoundary' -import { NotFound } from './components/NotFound' - -export function getRouter() { - const router = createRouter({ - routeTree, - scrollRestoration: true, - defaultPreload: 'intent', - defaultErrorComponent: DefaultCatchBoundary, - defaultNotFoundComponent: () => , - }) - - return router -} diff --git a/e2e/solid-start/scroll-restoration/src/routes/(tests)/normal-page.tsx b/e2e/solid-start/scroll-restoration/src/routes/(tests)/normal-page.tsx deleted file mode 100644 index 95dcecdbe4..0000000000 --- a/e2e/solid-start/scroll-restoration/src/routes/(tests)/normal-page.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import * as Solid from 'solid-js' - -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/normal-page')({ - component: Component, -}) - -function Component() { - return ( -
-

normal-page

-
- -
- ) -} diff --git a/e2e/solid-start/scroll-restoration/src/routes/(tests)/with-loader.tsx b/e2e/solid-start/scroll-restoration/src/routes/(tests)/with-loader.tsx deleted file mode 100644 index 53ee8adbe0..0000000000 --- a/e2e/solid-start/scroll-restoration/src/routes/(tests)/with-loader.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { sleep } from '../../utils/posts' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/with-loader')({ - loader: async () => { - await sleep(1000) - return { foo: 'bar' } - }, - component: Component, -}) - -function Component() { - return ( -
-

lazy-with-loader-page

-
- -
- ) -} diff --git a/e2e/solid-start/scroll-restoration/src/routes/(tests)/with-search.tsx b/e2e/solid-start/scroll-restoration/src/routes/(tests)/with-search.tsx deleted file mode 100644 index 61ac78a439..0000000000 --- a/e2e/solid-start/scroll-restoration/src/routes/(tests)/with-search.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { createFileRoute } from '@tanstack/solid-router' -import { z } from 'zod' -import { ScrollBlock } from '../-components/scroll-block' - -export const Route = createFileRoute('/(tests)/with-search')({ - validateSearch: z.object({ where: z.string() }), - component: Component, -}) - -function Component() { - return ( -
-

page-with-search

-
- -
- ) -} diff --git a/e2e/solid-start/scroll-restoration/src/routes/-components/scroll-block.tsx b/e2e/solid-start/scroll-restoration/src/routes/-components/scroll-block.tsx deleted file mode 100644 index 0539293f92..0000000000 --- a/e2e/solid-start/scroll-restoration/src/routes/-components/scroll-block.tsx +++ /dev/null @@ -1,16 +0,0 @@ -export const atTheTopId = 'at-the-top' -export const atTheBottomId = 'at-the-bottom' - -export function ScrollBlock({ number = 100 }: { number?: number }) { - return ( - <> -
- {Array.from({ length: number }).map((_, i) => ( -
{i}
- ))} -
- At the bottom -
- - ) -} diff --git a/e2e/solid-start/scroll-restoration/src/routes/__root.tsx b/e2e/solid-start/scroll-restoration/src/routes/__root.tsx deleted file mode 100644 index edd079c0a8..0000000000 --- a/e2e/solid-start/scroll-restoration/src/routes/__root.tsx +++ /dev/null @@ -1,113 +0,0 @@ -import { - HeadContent, - Link, - Outlet, - Scripts, - createRootRoute, - linkOptions, -} from '@tanstack/solid-router' -import { Dynamic, HydrationScript } from 'solid-js/web' -import { TanStackRouterDevtools } from '@tanstack/solid-router-devtools' -import { NotFound } from '~/components/NotFound' -import appCss from '~/styles/app.css?url' -import { seo } from '~/utils/seo' - -export const Route = createRootRoute({ - head: () => ({ - meta: [ - { - charset: 'utf-8', - }, - { - name: 'viewport', - content: 'width=device-width, initial-scale=1', - }, - ...seo({ - title: - 'TanStack Start | Type-Safe, Client-First, Full-Stack React Framework', - description: `TanStack Start is a type-safe, client-first, full-stack React framework. `, - }), - ], - links: [ - { rel: 'stylesheet', href: appCss }, - { - rel: 'apple-touch-icon', - sizes: '180x180', - href: '/apple-touch-icon.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '32x32', - href: '/favicon-32x32.png', - }, - { - rel: 'icon', - type: 'image/png', - sizes: '16x16', - href: '/favicon-16x16.png', - }, - { rel: 'manifest', href: '/site.webmanifest', color: '#fffff' }, - { rel: 'icon', href: '/favicon.ico' }, - ], - }), - errorComponent: (props) => { - return

{props.error.stack}

- }, - notFoundComponent: () => , - component: RootComponent, -}) - -function RootComponent() { - return ( - - - - - - -